Line
Link Here
|
0 |
-- configure |
0 |
++ configure |
Lines 158-165
Link Here
|
158 |
## set up other config.mak variables |
158 |
## set up other config.mak variables |
159 |
###################################################################### |
159 |
###################################################################### |
160 |
GL_LIBS="-lglpng -lGL -lGLU -lm" |
160 |
GL_LIBS="-lglpng -lGL -lGLU -lm" |
161 |
AL_LIBS="-L../support/openal/lib -lopenal -ldl" |
161 |
AL_LIBS="-lopenal -lalut" |
162 |
AL_CFLAGS="-I../support/openal/linux/include -I../support/openal/include" |
162 |
AL_CFLAGS="" |
163 |
|
163 |
|
164 |
## write out config.mak |
164 |
## write out config.mak |
165 |
###################################################################### |
165 |
###################################################################### |
166 |
-- scripts/Makefile.all |
166 |
++ scripts/Makefile.all |
Lines 1-5
Link Here
|
1 |
SUPPORT_DIRS = \ |
1 |
SUPPORT_DIRS = \ |
2 |
./support/openal/ \ |
|
|
3 |
./support/glpng/src |
2 |
./support/glpng/src |
4 |
|
3 |
|
5 |
CHROMIUM_DIRS = \ |
4 |
CHROMIUM_DIRS = \ |
6 |
-- scripts/Makefile.no-setup |
5 |
++ scripts/Makefile.no-setup |
Lines 1-5
Link Here
|
1 |
SUPPORT_DIRS = \ |
1 |
SUPPORT_DIRS = \ |
2 |
./support/openal/ \ |
|
|
3 |
./support/glpng/src |
2 |
./support/glpng/src |
4 |
|
3 |
|
5 |
CHROMIUM_DIRS = \ |
4 |
CHROMIUM_DIRS = \ |
6 |
-- src/AudioOpenAL.cpp |
5 |
++ src/AudioOpenAL.cpp |
Lines 43-50
Link Here
|
43 |
//try to use OpenAL alc[GS]etAudioChannel extensions in linux... |
43 |
//try to use OpenAL alc[GS]etAudioChannel extensions in linux... |
44 |
#ifdef __linux__ |
44 |
#ifdef __linux__ |
45 |
#define CD_VOLUME 1 |
45 |
#define CD_VOLUME 1 |
46 |
// #include <AL/alext.h> |
46 |
#include <AL/alext.h> |
47 |
#include <AL/alkludgetypes.h> |
|
|
48 |
#endif //__linux__ |
47 |
#endif //__linux__ |
49 |
#endif //USE_SDL |
48 |
#endif //USE_SDL |
50 |
#else |
49 |
#else |
Lines 52-59
Link Here
|
52 |
//try to use OpenAL alc[GS]etAudioChannel extensions in linux... |
51 |
//try to use OpenAL alc[GS]etAudioChannel extensions in linux... |
53 |
#ifdef __linux__ |
52 |
#ifdef __linux__ |
54 |
#define CD_VOLUME 1 |
53 |
#define CD_VOLUME 1 |
55 |
// #include <AL/alext.h> |
54 |
#include <AL/alext.h> |
56 |
#include <AL/alexttypes.h> |
|
|
57 |
#endif //__linux__ |
55 |
#endif //__linux__ |
58 |
#endif //USE_SDL |
56 |
#endif //USE_SDL |
59 |
#endif |
57 |
#endif |
Lines 124-129
Link Here
|
124 |
audioScale[0] = 0.5; |
122 |
audioScale[0] = 0.5; |
125 |
audioScale[1] = 0.3; |
123 |
audioScale[1] = 0.3; |
126 |
audioScale[2] = 0.3; |
124 |
audioScale[2] = 0.3; |
|
|
125 |
alDistanceModel(AL_NONE); |
127 |
} |
126 |
} |
128 |
|
127 |
|
129 |
if(config->swapStereo()) |
128 |
if(config->swapStereo()) |
Lines 235-240
Link Here
|
235 |
printExtensions(stderr, (const char*)alGetString( AL_EXTENSIONS )); |
234 |
printExtensions(stderr, (const char*)alGetString( AL_EXTENSIONS )); |
236 |
fprintf(stderr, "------------------------------------------------------------\n"); |
235 |
fprintf(stderr, "------------------------------------------------------------\n"); |
237 |
|
236 |
|
|
|
237 |
alutInitWithoutContext(NULL, NULL); |
238 |
checkForExtensions(); |
238 |
checkForExtensions(); |
239 |
|
239 |
|
240 |
alListenerfv(AL_POSITION, pos); |
240 |
alListenerfv(AL_POSITION, pos); |
Lines 310-316
Link Here
|
310 |
|
310 |
|
311 |
//-- check AttenuationScale extension |
311 |
//-- check AttenuationScale extension |
312 |
alAttenuationScale = (void (*)(ALfloat param)) |
312 |
alAttenuationScale = (void (*)(ALfloat param)) |
313 |
alGetProcAddress((ALubyte *)"alAttenuationScale_LOKI"); |
313 |
alGetProcAddress("alAttenuationScale_LOKI"); |
314 |
if(alAttenuationScale == NULL) |
314 |
if(alAttenuationScale == NULL) |
315 |
fprintf(stderr, "ATTENTION!! Could not load alAttenuationScale\n"); |
315 |
fprintf(stderr, "ATTENTION!! Could not load alAttenuationScale\n"); |
316 |
else |
316 |
else |
Lines 318-326
Link Here
|
318 |
|
318 |
|
319 |
//-- check Audio Channel extension |
319 |
//-- check Audio Channel extension |
320 |
alcGetAudioChannel = (float (*)(ALuint channel)) |
320 |
alcGetAudioChannel = (float (*)(ALuint channel)) |
321 |
alGetProcAddress((const ALubyte *)"alcGetAudioChannel_LOKI"); |
321 |
alGetProcAddress("alcGetAudioChannel_LOKI"); |
322 |
alcSetAudioChannel = (void (*)(ALuint channel, ALfloat volume)) |
322 |
alcSetAudioChannel = (void (*)(ALuint channel, ALfloat volume)) |
323 |
alGetProcAddress((const ALubyte *)"alcSetAudioChannel_LOKI"); |
323 |
alGetProcAddress("alcSetAudioChannel_LOKI"); |
324 |
#ifdef CD_VOLUME |
324 |
#ifdef CD_VOLUME |
325 |
if(alcGetAudioChannel) |
325 |
if(alcGetAudioChannel) |
326 |
origCDvolume = alcGetAudioChannel(ALC_CHAN_CD_LOKI); |
326 |
origCDvolume = alcGetAudioChannel(ALC_CHAN_CD_LOKI); |
Lines 328-337
Link Here
|
328 |
|
328 |
|
329 |
//-- check MP3 extension |
329 |
//-- check MP3 extension |
330 |
alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
330 |
alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
331 |
alGetProcAddress((const ALubyte *)"alutLoadMP3_LOKI"); |
331 |
alGetProcAddress("alutLoadMP3_LOKI"); |
332 |
//-- check Ogg/Vorbis extension |
332 |
//-- check Ogg/Vorbis extension |
333 |
alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
333 |
alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
334 |
alGetProcAddress((const ALubyte *)"alutLoadVorbis_LOKI"); |
334 |
alGetProcAddress("alutLoadVorbis_LOKI"); |
335 |
|
335 |
|
336 |
#endif //_WIN32 |
336 |
#endif //_WIN32 |
337 |
} |
337 |
} |
Lines 468-476
Link Here
|
468 |
void AudioOpenAL::loadSounds() |
468 |
void AudioOpenAL::loadSounds() |
469 |
{ |
469 |
{ |
470 |
int i; |
470 |
int i; |
471 |
ALsizei size, freq, bits; |
|
|
472 |
ALenum format; |
473 |
ALvoid *data; |
474 |
|
471 |
|
475 |
for(i = 0; i < NumSoundTypes; i++) |
472 |
for(i = 0; i < NumSoundTypes; i++) |
476 |
{ |
473 |
{ |
Lines 481-489
Link Here
|
481 |
else |
478 |
else |
482 |
{ |
479 |
{ |
483 |
#ifndef _WIN32 |
480 |
#ifndef _WIN32 |
484 |
alutLoadWAV(dataLoc(fileNames[i]), &data, &format, &size, &bits, &freq); |
481 |
buffer[i] = alutCreateBufferFromFile(dataLoc(fileNames[i])); |
485 |
alBufferData (buffer[i], format, data, size, freq); |
|
|
486 |
free(data); |
487 |
#else //_WIN32 |
482 |
#else //_WIN32 |
488 |
char nameBuffer[256]; |
483 |
char nameBuffer[256]; |
489 |
sprintf(nameBuffer, "%s", dataLoc(fileNames[i])); |
484 |
sprintf(nameBuffer, "%s", dataLoc(fileNames[i])); |
Lines 842-858
Link Here
|
842 |
fprintf(stderr, " PlayList support not compiled into Chromium (AudioOpenAL.cpp)\n"); |
837 |
fprintf(stderr, " PlayList support not compiled into Chromium (AudioOpenAL.cpp)\n"); |
843 |
return false; |
838 |
return false; |
844 |
#else //USE_PLAYLIST |
839 |
#else //USE_PLAYLIST |
845 |
bool retVal; |
840 |
buffer[MusicGame] = alutCreateBufferFromFile(filename); |
846 |
ALsizei size, freq, bits; |
841 |
return true; |
847 |
ALenum format; |
|
|
848 |
ALvoid *data; |
849 |
retVal = alutLoadWAV(filename, &data, &format, &size, &bits, &freq); |
850 |
if(retVal) |
851 |
{ |
852 |
alBufferData (buffer[MusicGame], format, data, size, freq); |
853 |
free(data); |
854 |
} |
855 |
return retVal; |
856 |
#endif//USE_PLAYLIST |
842 |
#endif//USE_PLAYLIST |
857 |
} |
843 |
} |
858 |
|
844 |
|
859 |
-- src/AudioOpenAL.h |
845 |
++ src/AudioOpenAL.h |
Lines 16-21
Link Here
|
16 |
#include <openal.h> |
16 |
#include <openal.h> |
17 |
#else //macintosh |
17 |
#else //macintosh |
18 |
#include <AL/al.h> |
18 |
#include <AL/al.h> |
|
|
19 |
#include <AL/alc.h> |
19 |
#endif //macintosh |
20 |
#endif //macintosh |
20 |
|
21 |
|
21 |
/** |
22 |
/** |
Lines 89-95
Link Here
|
89 |
|
90 |
|
90 |
float origCDvolume; |
91 |
float origCDvolume; |
91 |
|
92 |
|
92 |
void *context_id; |
93 |
ALCcontext *context_id; |
93 |
bool initialized; |
94 |
bool initialized; |
94 |
float audioScale[3]; |
95 |
float audioScale[3]; |
95 |
|
96 |
|
96 |
-- src-setup/Audio.cpp |
97 |
++ src-setup/Audio.cpp |
Lines 56-62
Link Here
|
56 |
{ |
56 |
{ |
57 |
fprintf(stderr, "stopping OpenAL..."); |
57 |
fprintf(stderr, "stopping OpenAL..."); |
58 |
if(initialized) |
58 |
if(initialized) |
59 |
alcDestroyContext(context_id); |
59 |
alutExit(); |
60 |
initialized = false; |
60 |
initialized = false; |
61 |
fprintf(stderr, "done.\n"); |
61 |
fprintf(stderr, "done.\n"); |
62 |
} |
62 |
} |
Lines 71-78
Link Here
|
71 |
if(!initialized) |
71 |
if(!initialized) |
72 |
{ |
72 |
{ |
73 |
fprintf(stderr, "starting OpenAL..."); |
73 |
fprintf(stderr, "starting OpenAL..."); |
74 |
context_id = alcCreateContext(NULL); |
74 |
initialized = alutInit(NULL, NULL); |
75 |
initialized = (bool)context_id; |
|
|
76 |
fprintf(stderr, "done.\n"); |
75 |
fprintf(stderr, "done.\n"); |
77 |
|
76 |
|
78 |
if(initialized) |
77 |
if(initialized) |
Lines 81-101
Link Here
|
81 |
|
80 |
|
82 |
#ifndef _WIN32 |
81 |
#ifndef _WIN32 |
83 |
alAttenuationScale = (void (*)(ALfloat param)) |
82 |
alAttenuationScale = (void (*)(ALfloat param)) |
84 |
alGetProcAddress((const ALubyte *)"alAttenuationScale_LOKI"); |
83 |
alGetProcAddress("alAttenuationScale_LOKI"); |
85 |
if(alAttenuationScale == NULL) |
84 |
if(alAttenuationScale == NULL) |
86 |
fprintf(stderr, "alAttenuationScale NOT present\n"); |
85 |
fprintf(stderr, "alAttenuationScale NOT present\n"); |
87 |
else |
86 |
else |
88 |
alAttenuationScale(1.0); |
87 |
alAttenuationScale(1.0); |
89 |
|
88 |
|
90 |
alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
89 |
alutLoadMP3 = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
91 |
alGetProcAddress((const ALubyte *)"alutLoadMP3_LOKI"); |
90 |
alGetProcAddress("alutLoadMP3_LOKI"); |
92 |
if(alutLoadMP3) |
91 |
if(alutLoadMP3) |
93 |
fprintf(stderr, "alutLoadMP3_LOKI present\n"); |
92 |
fprintf(stderr, "alutLoadMP3_LOKI present\n"); |
94 |
else |
93 |
else |
95 |
fprintf(stderr, "alutLoadMP3_LOKI NOT present\n"); |
94 |
fprintf(stderr, "alutLoadMP3_LOKI NOT present\n"); |
96 |
|
95 |
|
97 |
alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
96 |
alutLoadVorbis = (ALboolean (*)(ALuint, ALvoid *, ALint)) |
98 |
alGetProcAddress((const ALubyte *)"alutLoadVorbis_LOKI"); |
97 |
alGetProcAddress("alutLoadVorbis_LOKI"); |
99 |
if(alutLoadVorbis) |
98 |
if(alutLoadVorbis) |
100 |
fprintf(stderr, "alutLoadVorbis_LOKI present\n"); |
99 |
fprintf(stderr, "alutLoadVorbis_LOKI present\n"); |
101 |
else |
100 |
else |
Lines 271-282
Link Here
|
271 |
//---------------------------------------------------------- |
270 |
//---------------------------------------------------------- |
272 |
bool Audio::loadWAV(const char *filename) |
271 |
bool Audio::loadWAV(const char *filename) |
273 |
{ |
272 |
{ |
274 |
bool retVal = false; |
|
|
275 |
if(initialized) |
273 |
if(initialized) |
276 |
{ |
274 |
{ |
277 |
ALsizei size, freq, bits; |
|
|
278 |
ALenum format; |
279 |
ALvoid *data; |
280 |
struct stat sbuf; |
275 |
struct stat sbuf; |
281 |
|
276 |
|
282 |
if(stat(filename, &sbuf) == -1) |
277 |
if(stat(filename, &sbuf) == -1) |
Lines 286-304
Link Here
|
286 |
return false; |
281 |
return false; |
287 |
} |
282 |
} |
288 |
|
283 |
|
289 |
retVal = alutLoadWAV(filename, &data, &format, &size, &bits, &freq); |
284 |
alGetError(); |
290 |
if(retVal) |
285 |
buffer[MusicGame] = alutCreateBufferFromFile(filename); |
291 |
{ |
286 |
if (buffer[MusicGame] == AL_NONE) |
292 |
alBufferData (buffer[MusicGame], format, data, size, freq); |
|
|
293 |
free(data); |
294 |
} |
295 |
else |
296 |
{ |
287 |
{ |
297 |
sprintf(errorBuffer, "ERROR: alutLoadWAV failed for\n\"%s\"\nin Audio::loadWAV", filename); |
288 |
sprintf(errorBuffer, "ERROR: failed to load\n\"%s\"\nin Audio::loadWAV", filename); |
298 |
fprintf(stderr, "%s\n", errorBuffer); |
289 |
fprintf(stderr, "%s\n", errorBuffer); |
|
|
290 |
return false; |
299 |
} |
291 |
} |
300 |
} |
292 |
} |
301 |
return retVal; |
293 |
return true; |
302 |
} |
294 |
} |
303 |
|
295 |
|
304 |
//---------------------------------------------------------- |
296 |
//---------------------------------------------------------- |
305 |
-- src-setup/Audio.h |
297 |
++ src-setup/Audio.h |
Lines 46-52
Link Here
|
46 |
ALuint buffer[NumSoundTypes]; |
46 |
ALuint buffer[NumSoundTypes]; |
47 |
ALuint source[NumSoundTypes]; |
47 |
ALuint source[NumSoundTypes]; |
48 |
|
48 |
|
49 |
void *context_id; |
|
|
50 |
bool initialized; |
49 |
bool initialized; |
51 |
|
50 |
|
52 |
char errorBuffer[512]; |
51 |
char errorBuffer[512]; |