-
Notifications
You must be signed in to change notification settings - Fork 8
Audio Device Selection #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I had a similar issue with the audio device selection not functioning correctly. It does seem that PyOpenAL's current implementation doesn't support device listing properly. Normally you'd use In theory, you should be able to do: if alc.alcIsExtensionPresent(None, b'ALC_ENUMERATION_EXT'):
devices = alc.alcGetString(None, 0x1013)
print(devices) But OpenAL's documentation indicates that the strings returned for Here's the hack I came up with for reading these weird string lists: import ctypes
from openal import alc
alc.ALC_ALL_DEVICES_SPECIFIER = 0x1013
def alcGetStringList(*args):
alc.alcGetString.restype = ctypes.POINTER(ctypes.c_char)
str_p = alc.alcGetString(*args)
alc.alcGetString.restype = ctypes.c_char_p
items = []
item = b''
for char in str_p:
if char == b'\0':
if not len(item):
break
items.append(item.decode('utf-8', errors='replace'))
item = b''
else:
item += char
return items
def list_audio_devices():
device_list = []
if alc.alcIsExtensionPresent(None, b'ALC_ENUMERATION_EXT'):
return alcGetStringList(None, alc.ALC_ALL_DEVICES_SPECIFIER)
else:
print('WARNING: OpenAL device enumeration extension is not available.')
return device_list
print(list_audio_devices()) Which gives me: ['OpenAL Soft on Headphones (3- High Definition Audio Device)', 'OpenAL Soft on Headphones (Oculus Virtual Audio Device)', 'OpenAL Soft on Digital Audio (S/PDIF) (3- High Definition Audio Device)'] THIS SOLUTION IS NOT THREAD SAFE! It temporarily overrides the default return type for I may look into making a PR to address the issue at some point, but looking into what the correct implementation would be would take a bit of time since the expected use case for |
Hello.
I'm working on audio 3D renderer with Python and PyOpenAL.
I have problems :
the 7.1 integrated soundboard work when selected by default on windows but I have to select another specific audio device and use PRO Audio USB Board
Many thanks for your answer and help :)
The text was updated successfully, but these errors were encountered: