Implement ALC.getStringList()
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)]
This looks good but a little hardcoded..?
I personally went with this:
And we just split the string at the comma on haxe
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.