diff options
| author | Stephen Sinclair <radarsat1@gmail.com> | 2020-06-05 10:12:21 +0200 |
|---|---|---|
| committer | Stephen Sinclair <radarsat1@gmail.com> | 2020-06-05 10:21:10 +0200 |
| commit | 7b534671b90286f0557bb8851d1454c0fd60b760 (patch) | |
| tree | 92c3acae274d12927d922dfde0c05ec27e1d2c60 /tests/testall.cpp | |
| parent | f65e492350127c2b7019bacd5cd642105f7bafd7 (diff) | |
Update C API and several backend APIs for no-exceptions branch.
Diffstat (limited to 'tests/testall.cpp')
| -rw-r--r-- | tests/testall.cpp | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/tests/testall.cpp b/tests/testall.cpp index cd6db44..47d02c2 100644 --- a/tests/testall.cpp +++ b/tests/testall.cpp @@ -175,23 +175,19 @@ int main( int argc, char *argv[] ) // Test non-interleaved functionality options.flags = RTAUDIO_NONINTERLEAVED; - try { - dac.openStream( &oParams, NULL, RTAUDIO_FLOAT64, fs, &bufferFrames, &sawni, (void *)data, &options ); + if ( dac.openStream( &oParams, NULL, RTAUDIO_FLOAT64, fs, &bufferFrames, &sawni, (void *)data, &options ) ) + goto cleanup; - if ( !dac.isStreamOpen() ) goto cleanup; + if ( !dac.isStreamOpen() ) goto cleanup; - std::cout << "Press <enter> to start non-interleaved playback.\n"; - std::cin.get( input ); + std::cout << "Press <enter> to start non-interleaved playback.\n"; + std::cin.get( input ); - // Start the stream - dac.startStream(); - std::cout << "\nPlaying ... press <enter> to stop.\n"; - std::cin.get( input ); - } - catch ( RtAudioError& e ) { - e.printMessage(); - goto cleanup; - } + // Start the stream + if (dac.startStream() ) goto cleanup; + + std::cout << "\nPlaying ... press <enter> to stop.\n"; + std::cin.get( input ); if ( dac.isStreamOpen() ) dac.closeStream(); @@ -203,34 +199,41 @@ int main( int argc, char *argv[] ) if ( iDevice == 0 ) iParams.deviceId = dac.getDefaultInputDevice(); options.flags = RTAUDIO_NONINTERLEAVED; - try { - dac.openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options ); - if ( !dac.isStreamOpen() ) goto cleanup; - - bufferBytes = bufferFrames * channels * 4; - std::cout << "Press <enter> to start duplex operation.\n"; - std::cin.get( input ); + if ( dac.openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options ) ) + goto cleanup; - // Start the stream - dac.startStream(); - std::cout << "\nRunning ... press <enter> to stop.\n"; - std::cin.get( input ); + if ( !dac.isStreamOpen() ) goto cleanup; - // Stop the stream - dac.stopStream(); - std::cout << "\nStopped ... press <enter> to restart.\n"; - std::cin.get( input ); + bufferBytes = bufferFrames * channels * 4; - // Restart the stream - dac.startStream(); - std::cout << "\nRunning ... press <enter> to stop.\n"; - std::cin.get( input ); + std::cout << "Press <enter> to start duplex operation.\n"; + std::cin.get( input ); + + // Start the stream + if ( dac.startStream() ) { + std::cout << "\nError starting stream for the first time!\n"; + goto cleanup; } - catch ( RtAudioError& e ) { - e.printMessage(); + + std::cout << "\nRunning ... press <enter> to stop.\n"; + std::cin.get( input ); + + // Stop the stream + dac.stopStream(); + + std::cout << "\nStopped ... press <enter> to restart.\n"; + std::cin.get( input ); + + // Restart the stream + if ( dac.startStream() ) { + std::cout << "\nError restarting stream!\n"; + goto cleanup; } + std::cout << "\nRunning ... press <enter> to stop.\n"; + std::cin.get( input ); + cleanup: if ( dac.isStreamOpen() ) dac.closeStream(); free( data ); |
