Skip to content

Commit 0a44618

Browse files
EvergreenTheTree4Evergreen4
and
4Evergreen4
authored
Use getDeviceIds function to list audio devices (#8017)
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>
1 parent 786bb2e commit 0a44618

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libs/openFrameworks/sound/ofRtAudioSoundStream.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ std::vector<ofSoundDevice> ofRtAudioSoundStream::getDeviceList(ofSoundDevice::Ap
8181
if(audioTemp.getCurrentApi()!=rtAudioApi && rtAudioApi!=RtAudio::Api::UNSPECIFIED){
8282
return deviceList;
8383
}
84-
auto deviceCount = audioTemp.getDeviceCount();
8584
RtAudio::DeviceInfo info;
86-
for (unsigned int i = 0; i < deviceCount; i++) {
85+
for (unsigned int i: audioTemp.getDeviceIds()) {
8786
try {
8887
info = audioTemp.getDeviceInfo(i);
8988
}

0 commit comments

Comments
 (0)