From 58765aab6b126ac4bfdad0ae0bfb1b845fbf65b0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 19 Nov 2009 19:02:16 -0800 Subject: Print available devices before trying to open one --- examples/openal-info.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'examples') 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) { -- cgit v1.2.3