X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=tests%2Fplaysaw.cpp;h=41c4e26488431688451a660e7b3f932d8d58b0c0;hb=0e95564f14bea955bcbca94b224dc5fdd99458a8;hp=1f7bd52c5fe389528796cf609a37893db220da9e;hpb=221bbd009b11c21424c21bed98a65639c8a21d3d;p=rtaudio.git diff --git a/tests/playsaw.cpp b/tests/playsaw.cpp index 1f7bd52..41c4e26 100644 --- a/tests/playsaw.cpp +++ b/tests/playsaw.cpp @@ -64,15 +64,15 @@ void usage( void ) { exit( 0 ); } -void errorCallback( RtAudioError::Type type, const std::string &errorText ) +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 ) + //if ( type == RtAudioError::WARNING ) std::cerr << '\n' << errorText << "\n\n"; - else if ( type != RtAudioError::WARNING ) - throw( RtAudioError( errorText, type ) ); + //else if ( type != RtAudioError::WARNING ) + //throw( RtAudioError( errorText, type ) ); } unsigned int channels; @@ -80,7 +80,9 @@ RtAudio::StreamOptions options; unsigned int frameCounter = 0; bool checkCount = false; unsigned int nFrames = 0; -const unsigned int callbackReturnValue = 1; +const unsigned int callbackReturnValue = 2; +double streamTimePrintIncrement = 1.0; // seconds +double streamTimePrintTime = 1.0; // seconds //#define USE_INTERLEAVED #if defined( USE_INTERLEAVED ) @@ -97,6 +99,11 @@ int saw( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, if ( status ) std::cout << "Stream underflow detected!" << std::endl; + if ( streamTime >= streamTimePrintTime ) { + std::cout << "streamTime = " << streamTime << std::endl; + streamTimePrintTime += streamTimePrintIncrement; + } + for ( i=0; i= streamTimePrintTime ) { + std::cout << "streamTime = " << streamTime << std::endl; + streamTimePrintTime += streamTimePrintIncrement; + } + double increment; for ( j=0; j to quit (buffer size = " << bufferFrames << ").\n"; std::cin.get( input ); - try { + //try { // Stop the stream dac.stopStream(); - } + //dac.abortStream(); + } + /* catch ( RtAudioError& e ) { e.printMessage(); } } + */ cleanup: if ( dac.isStreamOpen() ) dac.closeStream();