Kaynağa Gözat

Replced deprecated alutLoadWAVFile().

Thomas Buck 11 yıl önce
ebeveyn
işleme
a02ade6a6a
2 değiştirilmiş dosya ile 11 ekleme ve 12 silme
  1. 3
    2
      deps.sh
  2. 8
    10
      src/Sound.cpp

+ 3
- 2
deps.sh Dosyayı Görüntüle

@@ -1,12 +1,13 @@
1 1
 # Mongoose - This is a simple dep line generator
2
+# modified by xythobuz
2 3
 #
3 4
 # Call it passing CFLAGS and a source filename
4 5
 # to generate a dep line
5 6
 
6
-cc -MM $@ > /dev/null
7
+cc -MM -w $@
7 8
 OUT=$?
8 9
 if [ $OUT -eq 0 ];then
9 10
     printf "\$(BUILDDIR)/"
10
-    cc -MM $@
11
+    cc -MM -w $@
11 12
     printf "\t \$(DO_CC)\n\n"
12 13
 fi

+ 8
- 10
src/Sound.cpp Dosyayı Görüntüle

@@ -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
 

Loading…
İptal
Kaydet