]>
Commit | Line | Data |
---|---|---|
77f7c446 TP |
1 | --- configure |
2 | +++ configure | |
3 | @@ -158,8 +158,8 @@ | |
4 | ## set up other config.mak variables | |
5 | ###################################################################### | |
6 | GL_LIBS="-lglpng -lGL -lGLU -lm -lz" | |
7 | -AL_LIBS="-L../support/openal/lib -lopenal -ldl" | |
8 | -AL_CFLAGS="-I../support/openal/linux/include -I../support/openal/include" | |
9 | +AL_LIBS="-lopenal -lalut" | |
10 | +AL_CFLAGS="" | |
11 | ||
12 | ## write out config.mak | |
13 | ###################################################################### | |
14 | ||
15 | --- scripts/Makefile.all | |
16 | +++ scripts/Makefile.all | |
17 | @@ -1,5 +1,4 @@ | |
18 | SUPPORT_DIRS = \ | |
19 | - ./support/openal/ \ | |
20 | ./support/glpng/src | |
21 | ||
22 | CHROMIUM_DIRS = \ | |
23 | ||
24 | --- scripts/Makefile.no-setup | |
25 | +++ scripts/Makefile.no-setup | |
26 | @@ -1,5 +1,4 @@ | |
27 | SUPPORT_DIRS = \ | |
28 | - ./support/openal/ \ | |
29 | ./support/glpng/src | |
30 | ||
31 | CHROMIUM_DIRS = \ | |
32 | ||
33 | --- src/AudioOpenAL.cpp | |
34 | +++ src/AudioOpenAL.cpp | |
35 | @@ -43,8 +43,7 @@ | |
36 | //try to use OpenAL alc[GS]etAudioChannel extensions in linux... | |
37 | #ifdef __linux__ | |
38 | #define CD_VOLUME 1 | |
39 | -// #include <AL/alext.h> | |
40 | - #include <AL/alkludgetypes.h> | |
41 | + #include <AL/alext.h> | |
42 | #endif //__linux__ | |
43 | #endif //USE_SDL | |
44 | #else | |
45 | @@ -52,8 +51,7 @@ | |
46 | //try to use OpenAL alc[GS]etAudioChannel extensions in linux... | |
47 | #ifdef __linux__ | |
48 | #define CD_VOLUME 1 | |
49 | -// #include <AL/alext.h> | |
50 | - #include <AL/alexttypes.h> | |
51 | + #include <AL/alext.h> | |
52 | #endif //__linux__ | |
53 | #endif //USE_SDL | |
54 | #endif | |
55 | @@ -124,6 +122,7 @@ | |
56 | audioScale[0] = 0.5; | |
57 | audioScale[1] = 0.3; | |
58 | audioScale[2] = 0.3; | |
59 | + alDistanceModel(AL_NONE); | |
60 | } | |
61 | ||
62 | if(config->swapStereo()) | |
63 | @@ -235,6 +234,7 @@ | |
64 | printExtensions(stderr, (const char*)alGetString( AL_EXTENSIONS )); | |
65 | fprintf(stderr, "------------------------------------------------------------\n"); | |
66 | ||
67 | + alutInitWithoutContext(NULL, NULL); | |
68 | checkForExtensions(); | |
69 | ||
70 | alListenerfv(AL_POSITION, pos); | |
71 | @@ -310,7 +310,7 @@ | |
72 | ||
73 | //-- check AttenuationScale extension | |
74 | alAttenuationScale = (void (*)(ALfloat param)) | |
75 | - alGetProcAddress((ALubyte *)"alAttenuationScale_LOKI"); | |
76 | + alGetProcAddress("alAttenuationScale_LOKI"); | |
77 | if(alAttenuationScale == NULL) | |
78 | fprintf(stderr, "ATTENTION!! Could not load alAttenuationScale\n"); | |
79 | else | |
80 | @@ -318,9 +318,9 @@ | |
81 | ||
82 | //-- check Audio Channel extension | |
83 | alcGetAudioChannel = (float (*)(ALuint channel)) | |
84 | - alGetProcAddress((const ALubyte *)"alcGetAudioChannel_LOKI"); | |
85 | + alGetProcAddress("alcGetAudioChannel_LOKI"); | |
86 | alcSetAudioChannel = (void (*)(ALuint channel, ALfloat volume)) | |
87 | - alGetProcAddress((const ALubyte *)"alcSetAudioChannel_LOKI"); | |
88 | + alGetProcAddress("alcSetAudioChannel_LOKI"); | |
89 | #ifdef CD_VOLUME | |
90 | if(alcGetAudioChannel) | |
91 | origCDvolume = alcGetAudioChannel(ALC_CHAN_CD_LOKI); | |
92 | @@ -328,10 +328,10 @@ | |
93 | ||
94 | //-- check MP3 extension | |
95 | alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) | |
96 | - alGetProcAddress((const ALubyte *)"alutLoadMP3_LOKI"); | |
97 | + alGetProcAddress("alutLoadMP3_LOKI"); | |
98 | //-- check Ogg/Vorbis extension | |
99 | alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) | |
100 | - alGetProcAddress((const ALubyte *)"alutLoadVorbis_LOKI"); | |
101 | + alGetProcAddress("alutLoadVorbis_LOKI"); | |
102 | ||
103 | #endif //_WIN32 | |
104 | } | |
105 | @@ -468,9 +468,6 @@ | |
106 | void AudioOpenAL::loadSounds() | |
107 | { | |
108 | int i; | |
109 | - ALsizei size, freq, bits; | |
110 | - ALenum format; | |
111 | - ALvoid *data; | |
112 | ||
113 | for(i = 0; i < NumSoundTypes; i++) | |
114 | { | |
115 | @@ -481,9 +478,7 @@ | |
116 | else | |
117 | { | |
118 | #ifndef _WIN32 | |
119 | - alutLoadWAV(dataLoc(fileNames[i]), &data, &format, &size, &bits, &freq); | |
120 | - alBufferData (buffer[i], format, data, size, freq); | |
121 | - free(data); | |
122 | + buffer[i] = alutCreateBufferFromFile(dataLoc(fileNames[i])); | |
123 | #else //_WIN32 | |
124 | char nameBuffer[256]; | |
125 | sprintf(nameBuffer, "%s", dataLoc(fileNames[i])); | |
126 | @@ -842,17 +837,8 @@ | |
127 | fprintf(stderr, " PlayList support not compiled into Chromium (AudioOpenAL.cpp)\n"); | |
128 | return false; | |
129 | #else //USE_PLAYLIST | |
130 | - bool retVal; | |
131 | - ALsizei size, freq, bits; | |
132 | - ALenum format; | |
133 | - ALvoid *data; | |
134 | - retVal = alutLoadWAV(filename, &data, &format, &size, &bits, &freq); | |
135 | - if(retVal) | |
136 | - { | |
137 | - alBufferData (buffer[MusicGame], format, data, size, freq); | |
138 | - free(data); | |
139 | - } | |
140 | - return retVal; | |
141 | + buffer[MusicGame] = alutCreateBufferFromFile(filename); | |
142 | + return true; | |
143 | #endif//USE_PLAYLIST | |
144 | } | |
145 | ||
146 | --- src/AudioOpenAL.h | |
147 | +++ src/AudioOpenAL.h | |
148 | @@ -16,6 +16,7 @@ | |
149 | #include <openal.h> | |
150 | #else //macintosh | |
151 | #include <AL/al.h> | |
152 | +#include <AL/alc.h> | |
153 | #endif //macintosh | |
154 | ||
155 | /** | |
156 | @@ -89,7 +90,7 @@ | |
157 | ||
158 | float origCDvolume; | |
159 | ||
160 | - void *context_id; | |
161 | + ALCcontext *context_id; | |
162 | bool initialized; | |
163 | float audioScale[3]; | |
164 | ||
165 | --- src-setup/Audio.cpp | |
166 | +++ src-setup/Audio.cpp | |
167 | @@ -56,7 +56,7 @@ | |
168 | { | |
169 | fprintf(stderr, "stopping OpenAL..."); | |
170 | if(initialized) | |
171 | - alcDestroyContext(context_id); | |
172 | + alutExit(); | |
173 | initialized = false; | |
174 | fprintf(stderr, "done.\n"); | |
175 | } | |
176 | @@ -71,8 +71,7 @@ | |
177 | if(!initialized) | |
178 | { | |
179 | fprintf(stderr, "starting OpenAL..."); | |
180 | - context_id = alcCreateContext(NULL); | |
181 | - initialized = (bool)context_id; | |
182 | + initialized = alutInit(NULL, NULL); | |
183 | fprintf(stderr, "done.\n"); | |
184 | ||
185 | if(initialized) | |
186 | @@ -81,21 +80,21 @@ | |
187 | ||
188 | #ifndef _WIN32 | |
189 | alAttenuationScale = (void (*)(ALfloat param)) | |
190 | - alGetProcAddress((const ALubyte *)"alAttenuationScale_LOKI"); | |
191 | + alGetProcAddress("alAttenuationScale_LOKI"); | |
192 | if(alAttenuationScale == NULL) | |
193 | fprintf(stderr, "alAttenuationScale NOT present\n"); | |
194 | else | |
195 | alAttenuationScale(1.0); | |
196 | ||
197 | alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) | |
198 | - alGetProcAddress((const ALubyte *)"alutLoadMP3_LOKI"); | |
199 | + alGetProcAddress("alutLoadMP3_LOKI"); | |
200 | if(alutLoadMP3) | |
201 | fprintf(stderr, "alutLoadMP3_LOKI present\n"); | |
202 | else | |
203 | fprintf(stderr, "alutLoadMP3_LOKI NOT present\n"); | |
204 | ||
205 | alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) | |
206 | - alGetProcAddress((const ALubyte *)"alutLoadVorbis_LOKI"); | |
207 | + alGetProcAddress("alutLoadVorbis_LOKI"); | |
208 | if(alutLoadVorbis) | |
209 | fprintf(stderr, "alutLoadVorbis_LOKI present\n"); | |
210 | else | |
211 | @@ -271,12 +270,8 @@ | |
212 | //---------------------------------------------------------- | |
213 | bool Audio::loadWAV(const char *filename) | |
214 | { | |
215 | - bool retVal = false; | |
216 | if(initialized) | |
217 | { | |
218 | - ALsizei size, freq, bits; | |
219 | - ALenum format; | |
220 | - ALvoid *data; | |
221 | struct stat sbuf; | |
222 | ||
223 | if(stat(filename, &sbuf) == -1) | |
224 | @@ -286,19 +281,16 @@ | |
225 | return false; | |
226 | } | |
227 | ||
228 | - retVal = alutLoadWAV(filename, &data, &format, &size, &bits, &freq); | |
229 | - if(retVal) | |
230 | - { | |
231 | - alBufferData (buffer[MusicGame], format, data, size, freq); | |
232 | - free(data); | |
233 | - } | |
234 | - else | |
235 | + alGetError(); | |
236 | + buffer[MusicGame] = alutCreateBufferFromFile(filename); | |
237 | + if (buffer[MusicGame] == AL_NONE) | |
238 | { | |
239 | - sprintf(errorBuffer, "ERROR: alutLoadWAV failed for\n\"%s\"\nin Audio::loadWAV", filename); | |
240 | + sprintf(errorBuffer, "ERROR: failed to load\n\"%s\"\nin Audio::loadWAV", filename); | |
241 | fprintf(stderr, "%s\n", errorBuffer); | |
242 | + return false; | |
243 | } | |
244 | } | |
245 | - return retVal; | |
246 | + return true; | |
247 | } | |
248 | ||
249 | //---------------------------------------------------------- | |
250 | ||
251 | --- src-setup/Audio.h | |
252 | +++ src-setup/Audio.h | |
253 | @@ -46,7 +46,6 @@ | |
254 | ALuint buffer[NumSoundTypes]; | |
255 | ALuint source[NumSoundTypes]; | |
256 | ||
257 | - void *context_id; | |
258 | bool initialized; | |
259 | ||
260 | char errorBuffer[512]; |