Skip to content

Commit

Permalink
Use getDeviceIds function to list audio devices
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.
  • Loading branch information
4Evergreen4 authored and 4Evergreen4 committed Jun 12, 2024
1 parent dee2eb7 commit 88226ce
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 @@ -80,9 +80,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 88226ce

Please sign in to comment.