]> git.mxchange.org Git - flightgear.git/blob - tests/al-info.c
Check one potential source of the prime-meridian crash.
[flightgear.git] / tests / al-info.c
1
2 #include <stdio.h>
3
4 #ifdef __APPLE__
5 # include <OpenAL/al.h>
6 # include <OpenAL/alc.h>
7 #else
8 # include <AL/al.h>
9 # include <AL/alc.h>
10 # ifndef __CYGWIN__
11 #  include <AL/alext.h>
12 # endif
13 #endif
14
15 #ifndef AL_VERSION_1_1
16 # ifdef __APPLE__
17 #  include <OpenAL/altypes.h>
18 #  include <OpenAL/alctypes.h>
19 #else
20 #  include <AL/altypes.h>
21 #  include <AL/alctypes.h>
22 # endif
23 #endif
24
25 #define MAX_DATA        16
26
27 int main()
28 {
29    ALCint data[MAX_DATA];
30    ALCdevice *device = NULL;
31    ALCcontext *context = NULL;
32    const ALchar *s;
33    ALCenum error;
34
35    device = alcOpenDevice(NULL);
36    if (device == NULL)
37    {
38       printf("No default audio device available.\n");
39       return -1;
40    }
41    context = alcCreateContext(device, NULL);
42    if (context == NULL)
43    {
44       printf("Could not create a valid context.\n");
45       return -2;
46    }
47    alcMakeContextCurrent(context);
48
49    s = alGetString(AL_VENDOR);
50    printf("AL_VENDOR = \"%s\"\n", s);
51
52    s = alGetString(AL_RENDERER);
53    printf("AL_RENDERER = \"%s\"\n", s);
54
55    s = alGetString(AL_VERSION);
56    printf("AL_VERSION = \"%s\"\n", s);
57
58    s = alGetString(AL_EXTENSIONS);
59    printf("AL_EXTENSIONS = \"%s\"\n", s);
60
61    alcGetError(device);
62
63    printf("\n");
64    if (alcIsExtensionPresent(NULL, (const ALchar *)"ALC_ENUMERATION_EXT") == AL_TRUE)
65    {
66       s = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
67       printf("ALC_DEVICE_SPECIFIER = \"%s\"\n", s);
68    }
69
70    alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, data);
71    printf("ALC_MAJOR_VERSION = %i\n", *data);
72    alcGetIntegerv(device, ALC_MINOR_VERSION, 1, data);
73    printf("ALC_MINOR_VERSION = %i\n", *data);
74
75    s = alcGetString(device, ALC_EXTENSIONS);
76    printf("ALC_EXTENSIONS = \"%s\"\n", s);
77
78    if ((error = alcGetError(device)))
79    {
80       printf("Error #%i occured\n", error);
81       return error;
82    }
83
84    s = alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER);
85    printf("ALC_DEFAULT_DEVICE_SPECIFIER = \"%s\"\n", s);
86
87    if ((error = alcGetError(device)))
88    {
89       printf("Error #%i occured\n", error);
90       return error;
91    }
92
93 #if 0
94    alcGetIntegerv(device, ALC_ATTRIBUTES_SIZE, 1, &i);
95    printf("ALC attributes(%i): ", i);
96
97    alcGetIntegerv(device, ALC_ALL_ATTRIBUTES, i, data);
98    for (j=0; j<i; j++)
99    {
100       printf("%i ", data[j]);
101    }
102    printf("\n");
103
104    if ((error = alcGetError(device)))
105    {
106       printf("Error #%i occured\n", error);
107       return error;
108    }
109 #endif
110
111    alcCloseDevice(device);
112
113    return 0;
114 }