Skip to content

Commit

Permalink
Use getDeviceIds function to list audio devices (#8017)
Browse files Browse the repository at this point in the history
As of RtAudio 6.0.0 you cannot assume that devices will fall in the
range [0, getDeviceCount() - 1]. Doing so will potentially cause errors
or out of bounds array accesses depending on the platform.

Co-authored-by: 4Evergreen4 <4Evergreen4@users.noreply.github.com>
  • Loading branch information
EvergreenTheTree and 4Evergreen4 committed Jul 7, 2024
1 parent 786bb2e commit 0a44618
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libs/openFrameworks/sound/ofRtAudioSoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ std::vector<ofSoundDevice> ofRtAudioSoundStream::getDeviceList(ofSoundDevice::Ap
if(audioTemp.getCurrentApi()!=rtAudioApi && rtAudioApi!=RtAudio::Api::UNSPECIFIED){
return deviceList;
}
auto deviceCount = audioTemp.getDeviceCount();
RtAudio::DeviceInfo info;
for (unsigned int i = 0; i < deviceCount; i++) {
for (unsigned int i: audioTemp.getDeviceIds()) {
try {
info = audioTemp.getDeviceInfo(i);
}
Expand Down

0 comments on commit 0a44618

Please sign in to comment.