exit( 0 );
}
+void errorCallback( RtAudioError::Type type, const std::string &errorText )
+{
+ // This example error handling function does exactly the same thing
+ // as the embedded RtAudio::error() function.
+ std::cout << "in errorCallback" << std::endl;
+ if ( type == RtAudioError::WARNING )
+ std::cerr << '\n' << errorText << "\n\n";
+ else if ( type != RtAudioError::WARNING )
+ throw( RtAudioError( errorText, type ) );
+}
+
unsigned int channels;
RtAudio::StreamOptions options;
unsigned int frameCounter = 0;
for ( i=0; i<nBufferFrames; i++ ) {
for ( j=0; j<channels; j++ ) {
- *buffer++ = (MY_TYPE) (lastValues[j] * SCALE);
+ *buffer++ = (MY_TYPE) (lastValues[j] * SCALE * 0.5);
lastValues[j] += BASE_RATE * (j+1+(j*0.1));
if ( lastValues[j] >= 1.0 ) lastValues[j] -= 2.0;
}
for ( j=0; j<channels; j++ ) {
increment = BASE_RATE * (j+1+(j*0.1));
for ( i=0; i<nBufferFrames; i++ ) {
- *buffer++ = (MY_TYPE) (lastValues[j] * SCALE);
+ *buffer++ = (MY_TYPE) (lastValues[j] * SCALE * 0.5);
lastValues[j] += increment;
if ( lastValues[j] >= 1.0 ) lastValues[j] -= 2.0;
}
options.flags |= RTAUDIO_NONINTERLEAVED;
#endif
try {
- dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &saw, (void *)data, &options );
+ dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &saw, (void *)data, &options, &errorCallback );
dac.startStream();
}
- catch ( RtError& e ) {
+ catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
// Stop the stream
dac.stopStream();
}
- catch ( RtError& e ) {
+ catch ( RtAudioError& e ) {
e.printMessage();
}
}