|
@@ -24,8 +24,6 @@
|
24
|
24
|
#include <OpenAL/al.h>
|
25
|
25
|
#include <OpenAL/alc.h>
|
26
|
26
|
#include <AL/alut.h>
|
27
|
|
-// Another dirty hack to get to use OpenAL and FreeALUT on Mac OS X
|
28
|
|
-#define AL_FORMAT_WAVE_EXT 0x10002
|
29
|
27
|
#else
|
30
|
28
|
# include <AL/al.h>
|
31
|
29
|
# include <AL/alc.h>
|
|
@@ -127,10 +125,10 @@ void Sound::sourceAt(int source, float pos[3])
|
127
|
125
|
int Sound::add(char *filename, int *source, unsigned int flags)
|
128
|
126
|
{
|
129
|
127
|
#ifdef HAVE_OPENAL
|
130
|
|
- ALsizei size, freq;
|
|
128
|
+ ALsizei size;
|
|
129
|
+ ALfloat freq;
|
131
|
130
|
ALenum format;
|
132
|
131
|
ALvoid *data;
|
133
|
|
- ALboolean err;
|
134
|
132
|
#endif
|
135
|
133
|
|
136
|
134
|
|
|
@@ -164,11 +162,10 @@ int Sound::add(char *filename, int *source, unsigned int flags)
|
164
|
162
|
}
|
165
|
163
|
|
166
|
164
|
// err = alutLoadWAV(filename, &data, &format, &size, &bits, &freq);
|
167
|
|
- // DEPRECATED?! Dirty solution:
|
168
|
|
- alutLoadWAVFile(filename, &format, &data, &size, &freq);
|
169
|
|
- err = AL_TRUE;
|
|
165
|
+ // is deprecated!
|
|
166
|
+ data = alutLoadMemoryFromFile(filename, &format, &size, &freq);
|
170
|
167
|
|
171
|
|
- if (err == AL_FALSE)
|
|
168
|
+ if (alGetError() != AL_NO_ERROR)
|
172
|
169
|
{
|
173
|
170
|
fprintf(stderr, "Could not load %s\n", filename);
|
174
|
171
|
return -3;
|
|
@@ -233,8 +230,9 @@ int Sound::add(unsigned char *wav, int *source, unsigned int flags)
|
233
|
230
|
return -2;
|
234
|
231
|
}
|
235
|
232
|
|
236
|
|
- // AL_FORMAT_WAVE_EXT
|
237
|
|
- alBufferData(mBuffer[mNextBuffer], AL_FORMAT_WAVE_EXT, data, size, freq);
|
|
233
|
+#warning "AL_FORMAT_WAVE_EXT does not exist on Mac!"
|
|
234
|
+ // alBufferData(mBuffer[mNextBuffer], AL_FORMAT_WAVE_EXT, data, size, freq);
|
|
235
|
+ alBufferData(mBuffer[mNextBuffer], 0x10002, data, size, freq);
|
238
|
236
|
|
239
|
237
|
alSourcei(mSource[mNextSource], AL_BUFFER, mBuffer[mNextBuffer]);
|
240
|
238
|
|