diff options
author | Chris Robinson <[email protected]> | 2009-11-19 19:02:16 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-19 19:02:16 -0800 |
commit | 58765aab6b126ac4bfdad0ae0bfb1b845fbf65b0 (patch) | |
tree | 959c31180605d36e17a2a47ea2b2c68cbdba2066 | |
parent | 1483af1baab70db6e6998e99c5bc9a73a1f77d8f (diff) |
Print available devices before trying to open one
-rw-r--r-- | examples/openal-info.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/examples/openal-info.c b/examples/openal-info.c index df0bd88a..5af34bbc 100644 --- a/examples/openal-info.c +++ b/examples/openal-info.c @@ -129,9 +129,7 @@ static void checkForErrors(void) static void printDevices(ALCenum which, const char *kind) { const char *s = alcGetString(NULL, which); - checkForErrors(); - - printf("Available %sdevices:\n", kind); + printf("Available %s devices:\n", kind); if(s == NULL || *s == '\0') printf(" (none!)\n"); else do { @@ -146,17 +144,6 @@ static void printALCInfo (void) ALCint major, minor; ALCdevice *device; - if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE) - { - if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATE_ALL_EXT") == AL_TRUE) - printDevices(ALC_ALL_DEVICES_SPECIFIER, "playback "); - else - printDevices(ALC_DEVICE_SPECIFIER, "playback "); - printDevices(ALC_CAPTURE_DEVICE_SPECIFIER, "capture "); - } - else - printf("No device enumeration available\n"); - printf("Default device: %s\n", alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER)); printf("Default capture device: %s\n", @@ -276,6 +263,17 @@ int main() ALCdevice *device; ALCcontext *context; + if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE) + { + if(alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATE_ALL_EXT") == AL_TRUE) + printDevices(ALC_ALL_DEVICES_SPECIFIER, "playback"); + else + printDevices(ALC_DEVICE_SPECIFIER, "playback"); + printDevices(ALC_CAPTURE_DEVICE_SPECIFIER, "capture"); + } + else + printf("No device enumeration available\n"); + device = alcOpenDevice(NULL); if(!device) { |