aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-11-19 18:25:29 -0800
committerChris Robinson <[email protected]>2009-11-19 18:25:29 -0800
commit9c228e76251b875b08117957daa670a94cabd163 (patch)
tree0ad26af7f7052b866ea3c302996866513be86cfb /examples
parent6a667b36d1cbaeda96a00ef7d008ce4a19adcb08 (diff)
Be clearer if device opening or context setup fails
Diffstat (limited to 'examples')
-rw-r--r--examples/openal-info.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/examples/openal-info.c b/examples/openal-info.c
index daf083b2..bd3b5060 100644
--- a/examples/openal-info.c
+++ b/examples/openal-info.c
@@ -155,14 +155,13 @@ static void printALCInfo (void)
else
printf("No device enumeration available\n");
- device = alcGetContextsDevice(alcGetCurrentContext());
- checkForErrors();
-
printf("Default device: %s\n",
- alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER));
-
+ alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER));
printf("Default capture device: %s\n",
- alcGetString(device, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
+ alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
+
+ device = alcGetContextsDevice(alcGetCurrentContext());
+ checkForErrors();
alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major);
alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor);
@@ -276,10 +275,21 @@ static void printEFXInfo(void)
int main()
{
- ALCdevice *device = alcOpenDevice(NULL);
- ALCcontext *context = alcCreateContext(device, NULL);
- alcMakeContextCurrent(context);
- checkForErrors();
+ ALCdevice *device;
+ ALCcontext *context;
+
+ device = alcOpenDevice(NULL);
+ if(!device)
+ {
+ printf("Failed to open a device!\n");
+ exit(EXIT_FAILURE);
+ }
+ context = alcCreateContext(device, NULL);
+ if(!context || alcMakeContextCurrent(context) == ALC_FALSE)
+ {
+ printf("Failed to set a context!\n");
+ exit(EXIT_FAILURE);
+ }
printALCInfo();
printALInfo();