openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

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

Open EvergreenTheTree opened this issue 1 year ago • 1 comments

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.

EvergreenTheTree avatar Jun 12 '24 04:06 EvergreenTheTree

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

danoli3 avatar Jun 25 '24 07:06 danoli3

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?

EvergreenTheTree avatar Jul 04 '24 04:07 EvergreenTheTree

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: @.***>

danoli3 avatar Jul 04 '24 07:07 danoli3

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

EvergreenTheTree avatar Jul 04 '24 18:07 EvergreenTheTree

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.

EvergreenTheTree avatar Jul 07 '24 14:07 EvergreenTheTree

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 avatar Jul 16 '24 10:07 danoli3

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

danoli3 avatar Jul 16 '24 11:07 danoli3