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