Skip to content

Conversation

@ACrazyTown
Copy link
Contributor

Fixes #1986

There are certain OpenAL parameters, meant to be passed into ALC.getString(), that return a list of strings. For example, ALC_ALL_DEVICES_SPECIFIER to get the names of available playback audio devices or ALC_CAPTURE_DEVICE_SPECIFIERto get the names of available capture devices.

ALC.getString() assumes that the result will always be a standard C string with a single NULL character at the end, but this is not the case when passing the params mentioned above:

An alcGetString query of ALC_DEVICE_SPECIFIER or
ALC_CAPTURE_DEVICE_SPECIFIER with a NULL device passed in will return a list
of available devices. Each device name will be separated by a single NULL character and
the list will be terminated with two NULL characters.
(https://www.openal.org/documentation/openal-1.1-specification.pdf)

This PR introduces the ALC.getStringList(device, param) method which handles these lists properly and returns them as an Array<String>. If list handling is unnecessary for the param provided, the result will simply be [ALC.getString(device, param)]

@KarimAkra
Copy link

This looks good but a little hardcoded..?

I personally went with this:
image

And we just split the string at the comma on haxe
image

@ACrazyTown
Copy link
Contributor Author

This looks good but a little hardcoded..?

Yeah, it's a bit ugly but I had to do that since lime_alc_get_string_list assumes it's dealing with a list and not a standard C-string. I figured it'd be fine since it's a private API meant to be called by Lime internally.

Maybe the check could be done on the C++ side but ngl my C(++) is a bit rusty.

And we just split the string at the comma on haxe

This could've be done as well but I opted in for a seperate method because I wanted to do as much as possible on the C++ side and other OpenAL bindings seem to do something similar.

@ACrazyTown ACrazyTown changed the base branch from develop to 8.4.0-dev November 4, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAL strings not handled properly

2 participants