Package: stk Version: 4.6.2+dfsg-2 Severity: important Tags: ftbfs patch Dear Maintainer,
stk ftbfs with RtAudio 6 (as currently found in experimental): a small excerpt from the build-logs: ``` RtWvOut.cpp:110:11: error: ‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’? 110 | catch ( RtAudioError &error ) { | ^~~~~~~~~~~~ | RtAudioErrorType RtWvOut.cpp:111:18: error: ‘error’ was not declared in this scope; did you mean ‘perror’? 111 | handleError( error.what(), StkError::AUDIO_SYSTEM ); | ^~~~~ | perror make[3]: *** [Makefile:79: RtWvOut.o] Error 1 make[3]: *** Waiting for unfinished jobs.... RtWvIn.cpp: In constructor ‘stk::RtWvIn::RtWvIn(unsigned int, stk::StkFloat, int, int, int)’: RtWvIn.cpp:89:11: error: ‘RtAudioError’ does not name a type; did you mean ‘RtAudioErrorType’? 89 | catch ( RtAudioError &error ) { | ^~~~~~~~~~~~ | RtAudioErrorType RtWvIn.cpp:90:18: error: ‘error’ was not declared in this scope; did you mean ‘perror’? 90 | handleError( error.what(), StkError::AUDIO_SYSTEM ); | ^~~~~ | perror ``` attached is a patch that fixes the FTBFS (but is otherwise untested). no debdiff this time, sorry. cheers.
Description: Fix FTBFS with RtAudio 6 replace try/catch with checking error-codes Author: IOhannes m zmölnig Origin: Debian Forwarded: no Last-Update: 2023-09-09 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: stk-4.6.2+dfsg/src/RtWvIn.cpp =================================================================== --- stk-4.6.2+dfsg.orig/src/RtWvIn.cpp +++ stk-4.6.2+dfsg/src/RtWvIn.cpp @@ -83,11 +83,8 @@ RtWvIn :: RtWvIn( unsigned int nChannels unsigned int size = bufferFrames; RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; - try { - adc_.openStream( NULL, ¶meters, format, (unsigned int)Stk::sampleRate(), &size, &read, (void *)this ); - } - catch ( RtAudioError &error ) { - handleError( error.what(), StkError::AUDIO_SYSTEM ); + if(adc_.openStream( NULL, ¶meters, format, (unsigned int)Stk::sampleRate(), &size, &read, (void *)this )) { + handleError(adc_.getErrorText(), StkError::AUDIO_SYSTEM ); } data_.resize( size * nBuffers, nChannels ); Index: stk-4.6.2+dfsg/src/RtWvOut.cpp =================================================================== --- stk-4.6.2+dfsg.orig/src/RtWvOut.cpp +++ stk-4.6.2+dfsg/src/RtWvOut.cpp @@ -104,11 +104,8 @@ RtWvOut :: RtWvOut( unsigned int nChanne RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; // Open a stream and set the callback function. - try { - dac_.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &size, &write, (void *)this ); - } - catch ( RtAudioError &error ) { - handleError( error.what(), StkError::AUDIO_SYSTEM ); + if(dac_.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &size, &write, (void *)this )) { + handleError( dac_.getErrorText(), StkError::AUDIO_SYSTEM ); } data_.resize( size * nBuffers, nChannels ); Index: stk-4.6.2+dfsg/projects/demo/demo.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/demo/demo.cpp +++ stk-4.6.2+dfsg/projects/demo/demo.cpp @@ -259,11 +259,8 @@ int main( int argc, char *argv[] ) parameters.deviceId = dac.getDefaultOutputDevice(); parameters.nChannels = data.channels; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError& error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } } @@ -279,11 +276,8 @@ int main( int argc, char *argv[] ) // If realtime output, set our callback function and start the dac. #if defined(__STK_REALTIME__) if ( data.realtime ) { - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } } @@ -304,12 +298,7 @@ int main( int argc, char *argv[] ) // Shut down the output stream. #if defined(__STK_REALTIME__) if ( data.realtime ) { - try { - dac.closeStream(); - } - catch ( RtAudioError& error ) { - error.printMessage(); - } + dac.closeStream(); } #endif Index: stk-4.6.2+dfsg/projects/effects/effects.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/effects/effects.cpp +++ stk-4.6.2+dfsg/projects/effects/effects.cpp @@ -253,11 +253,8 @@ int main( int argc, char *argv[] ) iparameters.deviceId = adac.getDefaultInputDevice(); iparameters.nChannels = 1; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - adac.openStream( &oparameters, &iparameters, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError& error ) { - error.printMessage(); + if(adac.openStream( &oparameters, &iparameters, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << adac.getErrorText() << std::endl; goto cleanup; } @@ -267,11 +264,8 @@ int main( int argc, char *argv[] ) (void) signal( SIGINT, finish ); // If realtime output, set our callback function and start the dac. - try { - adac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(adac.startStream()) { + std::cerr << adac.getErrorText() << std::endl; goto cleanup; } @@ -282,12 +276,7 @@ int main( int argc, char *argv[] ) } // Shut down the output stream. - try { - adac.closeStream(); - } - catch ( RtAudioError& error ) { - error.printMessage(); - } + adac.closeStream(); cleanup: Index: stk-4.6.2+dfsg/projects/eguitar/eguitar.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/eguitar/eguitar.cpp +++ stk-4.6.2+dfsg/projects/eguitar/eguitar.cpp @@ -299,11 +299,8 @@ int main( int argc, char *argv[] ) parameters.deviceId = dac.getDefaultOutputDevice(); parameters.nChannels = data.channels; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError& error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } } @@ -335,11 +332,8 @@ int main( int argc, char *argv[] ) // If realtime output, set our callback function and start the dac. #if defined(__STK_REALTIME__) if ( data.realtime ) { - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } } @@ -360,12 +354,7 @@ int main( int argc, char *argv[] ) // Shut down the output stream. #if defined(__STK_REALTIME__) if ( data.realtime ) { - try { dac.closeStream(); - } - catch ( RtAudioError& error ) { - error.printMessage(); - } } #endif Index: stk-4.6.2+dfsg/projects/examples/bethree.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/bethree.cpp +++ stk-4.6.2+dfsg/projects/examples/bethree.cpp @@ -56,11 +56,8 @@ int main() parameters.nChannels = 1; RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError& error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -75,11 +72,8 @@ int main() data.frequency = 220.0; data.instrument->noteOn( data.frequency, 0.5 ); - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -88,12 +82,7 @@ int main() Stk::sleep( 100 ); // Shut down the callback and output stream. - try { dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } cleanup: delete data.instrument; Index: stk-4.6.2+dfsg/projects/examples/controlbee.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/controlbee.cpp +++ stk-4.6.2+dfsg/projects/examples/controlbee.cpp @@ -130,11 +130,8 @@ int main( int argc, char *argv[] ) parameters.nChannels = 1; RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -149,11 +146,8 @@ int main( int argc, char *argv[] ) if ( data.messager.setScoreFile( argv[1] ) == false ) goto cleanup; - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -162,12 +156,7 @@ int main( int argc, char *argv[] ) Stk::sleep( 100 ); // Shut down the output stream. - try { dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } cleanup: delete data.instrument; Index: stk-4.6.2+dfsg/projects/examples/crtsine.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/crtsine.cpp +++ stk-4.6.2+dfsg/projects/examples/crtsine.cpp @@ -33,21 +33,15 @@ int main() parameters.nChannels = 1; RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&sine ); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&sine )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } sine.setFrequency(440.0); - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -57,12 +51,7 @@ int main() std::cin.get( keyhit ); // Shut down the output stream. - try { - dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } + std::cerr << dac.getErrorText() << std::endl; cleanup: Index: stk-4.6.2+dfsg/projects/examples/duplex.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/duplex.cpp +++ stk-4.6.2+dfsg/projects/examples/duplex.cpp @@ -105,29 +105,26 @@ int main(int argc, char *argv[]) //options.flags |= RTAUDIO_NONINTERLEAVED; bufferBytes = bufferFrames * channels * sizeof( MY_TYPE ); - try { - adac.openStream( &oParams, &iParams, FORMAT, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options ); - } - catch ( RtAudioError& e ) { - std::cout << '\n' << e.getMessage() << '\n' << std::endl; + if(adac.openStream( &oParams, &iParams, FORMAT, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options )) { + std::cout << '\n' << adac.getErrorText() << '\n' << std::endl; exit( 1 ); } // Test RtAudio functionality for reporting latency. std::cout << "\nStream latency = " << adac.getStreamLatency() << " frames" << std::endl; - try { - adac.startStream(); + char input; + if(adac.startStream()) { + std::cout << '\n' << adac.getErrorText() << '\n' << std::endl; + goto cleanup; + } - char input; std::cout << "\nRunning ... press <enter> to quit (buffer frames = " << bufferFrames << ").\n"; std::cin.get(input); // Stop the stream. - adac.stopStream(); - } - catch ( RtAudioError& e ) { - std::cout << '\n' << e.getMessage() << '\n' << std::endl; + if(adac.stopStream()) { + std::cout << '\n' << adac.getErrorText() << '\n' << std::endl; goto cleanup; } Index: stk-4.6.2+dfsg/projects/examples/grains.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/grains.cpp +++ stk-4.6.2+dfsg/projects/examples/grains.cpp @@ -79,19 +79,13 @@ int main( int argc, char *argv[] ) parameters.nChannels = grani.channelsOut(); RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&grani ); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&grani )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -102,12 +96,7 @@ int main( int argc, char *argv[] ) std::cin.get( keyhit ); // Shut down the callback and output stream. - try { - dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } + std::cerr << dac.getErrorText() << std::endl; cleanup: Index: stk-4.6.2+dfsg/projects/examples/play.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/play.cpp +++ stk-4.6.2+dfsg/projects/examples/play.cpp @@ -99,11 +99,8 @@ int main(int argc, char *argv[]) parameters.nChannels = ( channels == 1 ) ? 2 : channels; // Play mono files as stereo. RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&input ); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&input )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -113,11 +110,8 @@ int main(int argc, char *argv[]) // Resize the StkFrames object appropriately. frames.resize( bufferFrames, channels ); - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -127,12 +121,7 @@ int main(int argc, char *argv[]) // By returning a non-zero value in the callback above, the stream // is automatically stopped. But we should still close it. - try { - dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } + dac.closeStream(); cleanup: return 0; Index: stk-4.6.2+dfsg/projects/examples/threebees.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/threebees.cpp +++ stk-4.6.2+dfsg/projects/examples/threebees.cpp @@ -130,11 +130,8 @@ int main() parameters.nChannels = 1; RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -154,11 +151,8 @@ int main() if ( data.messager.startStdInput() == false ) goto cleanup; - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -167,12 +161,7 @@ int main() Stk::sleep( 100 ); // Shut down the callback and output stream. - try { dac.closeStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); - } cleanup: for ( i=0; i<3; i++ ) delete instrument[i]; Index: stk-4.6.2+dfsg/projects/ragamatic/ragamat.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/ragamatic/ragamat.cpp +++ stk-4.6.2+dfsg/projects/ragamatic/ragamat.cpp @@ -291,11 +291,8 @@ int main( int argc, char *argv[] ) parameters.deviceId = dac.getDefaultOutputDevice(); parameters.nChannels = 2; unsigned int bufferFrames = RT_BUFFER_SIZE; - try { - dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data ); - } - catch ( RtAudioError& error ) { - error.printMessage(); + if(dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data )) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -314,11 +311,8 @@ int main( int argc, char *argv[] ) (void) signal( SIGINT, finish ); // If realtime output, set our callback function and start the dac. - try { - dac.startStream(); - } - catch ( RtAudioError &error ) { - error.printMessage(); + if(dac.startStream()) { + std::cerr << dac.getErrorText() << std::endl; goto cleanup; } @@ -329,12 +323,7 @@ int main( int argc, char *argv[] ) } // Shut down the output stream. - try { - dac.closeStream(); - } - catch ( RtAudioError& error ) { - error.printMessage(); - } + dac.closeStream(); cleanup: Index: stk-4.6.2+dfsg/projects/examples/audioprobe.cpp =================================================================== --- stk-4.6.2+dfsg.orig/projects/examples/audioprobe.cpp +++ stk-4.6.2+dfsg/projects/examples/audioprobe.cpp @@ -42,7 +42,7 @@ int main() info = audio.getDeviceInfo(i); std::cout << "\nDevice Name = " << info.name << '\n'; - if ( info.probed == false ) + if ( info.ID == 0 ) std::cout << "Probe Status = UNsuccessful\n"; else { std::cout << "Probe Status = Successful\n";