openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

ofSoundStream broken with RtAudio 6.0.0

Open EvergreenTheTree opened this issue 8 months ago • 2 comments

I recently tried compiling a project that uses openFrameworks (and also ofSoundStream) on Arch Linux and was running into crashes involving audio device selection. After a lot of time spent debugging I realized that it's because the RtAudio API around device listing and selection has changed in RtAudio 6.0.0 (released around a year ago), which is the version of the library in Arch Linux's repository (well, it's actually 6.0.1 but the result is the same).

The main difference is that you cannot rely on devices being between 0 and RtAudio::getDeviceCount() - 1 and instead must get the list of IDs from RtAudio::getDeviceIds. The only functional change needed to support this is changing the for loop in ofRtAudioSoundStream::getDeviceList to for (unsigned int i: audioTemp.getDeviceIds()) { .... The application I was trying to compile also made the assumption about device IDs being contiguous from 0 to getDeviceCount() - 1, so presumably this would be a breaking change without wrapper functions to hide this new behavior. Maybe the solution is just to stick to a version of RtAudio < 6.0.0 but I at least wanted to document this issue here in case someone else came across it.

EvergreenTheTree avatar Jun 07 '24 06:06 EvergreenTheTree