Last active
December 20, 2015 01:29
-
-
Save Fahrradkette/6049300 to your computer and use it in GitHub Desktop.
returns a list of available devices if (on windows vista and 7) the ALC_ENUMERATE_ALL_EXT is present. If only ALC_ENUMERATION_EXT is present it returns (on windows vista and 7) the default device. It may returns all the devices on a unix. If no extension is present it returns the default device. We might change it so it returns null instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static readonly string [] OpenAlGetDeviceList | |
{ | |
get | |
{ | |
string[] DeviceList; | |
if (Alc.alcIsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT") == Alc.ALC_TRUE) | |
{ | |
DeviceList = Alc.alcGetStringv(IntPtr.Zero, Alc.ALC_ALL_DEVICES_SPECIFIER); | |
if (Al.alGetError() != Al.AL_NO_ERROR) | |
throw new InvalidOperationException("Can't get OpenAL device list."); | |
// maybe just return null and log the error | |
return DeviceList; | |
} | |
else if (Alc.alcIsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT") == Alc.ALC_TRUE) | |
{ | |
DeviceList = Alc.alcGetStringv(IntPtr.Zero, Alc.ALC_DEVICE_SPECIFIER); | |
if (Al.alGetError() != Al.AL_NO_ERROR) | |
throw new InvalidOperationException("Can't get OpenAL device list."); | |
return DeviceList; | |
} | |
else | |
{ | |
DeviceList = Alc.alcGetStringv(IntPtr.Zero, Alc.ALC_DEFAULT_DEVICE_SPECIFIER); | |
if (Al.alGetError() != Al.AL_NO_ERROR) | |
throw new InvalidOperationException("Can't get OpenAL default device name."); | |
return DeviceList; | |
// or simply return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment