openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.98k stars 2.55k forks source link

Use getDeviceIds function to list audio devices instead of relying on contiguous IDs #8017

Closed EvergreenTheTree closed 4 months ago

EvergreenTheTree commented 5 months ago

Fixes #8013

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.

I am not super familiar with this project, but as far as I can tell I couldn't find any documentation or example projects that would need to be updated as a result of this change. However, I do know of at least two projects (audiostellar and ofxPDSP) that make this assumption, so it is definitely worth noting in the change log.

danoli3 commented 5 months ago

msys2: mingw-w64-ucrt-x86_64-rtaudio using 5.2.0-1 for some reason...

macOS will be fixed for 6.0.1 after merge of https://github.com/openframeworks/openFrameworks/pull/7889

EvergreenTheTree commented 4 months ago

I'll see about contributing an update to RtAudio 6.0.1 on msys2's end; based on the PKGBUILD it seems like it should be relatively straightforward. Also, the Linux build is failing due to what appears to be a missing dependency (curl specifically). Is that something that needs to be fixed too?

danoli3 commented 4 months ago

Please tag your head change, then rebase it ontop of current upstream master.

What we can do is use RT audio defines for the meantime set in code while we await the fix for msys2.

On Thu, 4 Jul 2024 at 2:26 PM, Evergreen @.***> wrote:

I'll see about contributing an update to RtAudio 6.0.1 on msys2's end; based on the PKGBUILD it seems like it should be relatively straightforward. Also, the Linux build is failing due to what appears to be a missing dependency (curl specifically). Is that something that needs to be fixed too?

— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/pull/8017#issuecomment-2208095946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGK2HEEIQHAVJQ5QCHOOU3ZKTFITAVCNFSM6AAAAABJFSCUXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGA4TKOJUGY . You are receiving this because you commented.Message ID: @.***>

EvergreenTheTree commented 4 months ago

Rebased; also made a pull request for updating RtAudio in msys2: https://github.com/msys2/MINGW-packages/pull/21319

EvergreenTheTree commented 4 months ago

The rtaudio 6.0.1 package update has now been merged into msys2 and is in the msy2 repositories. This branch should be okay to merge now.

danoli3 commented 4 months ago

having some issues with linux 22.04 / 24.04

https://github.com/openframeworks/openFrameworks/issues/8035 image

https://packages.ubuntu.com/search?keywords=librtaudio-dev

22.04 still living in 5.0 rtaudio can we update that package manager ?

danoli3 commented 4 months ago

Figured out a dynamic way using the version Define

#if RTAUDIO_VERSION_MAJOR >= 6
        for (unsigned int i: audioTemp.getDeviceIds()) {
#else
        auto deviceCount = audioTemp.getDeviceCount();
        for (unsigned int i = 0; i < deviceCount; i++) {
#endif