summaryrefslogtreecommitdiff
blob: 8fe0706cac81a97f07a0aef23b4362aa6687263b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--- configure
+++ configure
@@ -3946,7 +3946,7 @@
 	if test x"$use_static_openal" = x"yes"; then
 		LIBS="$LIBS /usr/local/lib/libopenal.a"
 	else
-		LIBS="$LIBS `$OPENAL_CONFIG --libs`"
+		LIBS="$LIBS `$OPENAL_CONFIG --libs` -lalut"
 	fi
 
 	CFLAGS="$CFLAGS `$OPENAL_CONFIG --cflags`"

--- src/sound/SoundBufferStaticWav.cpp
+++ src/sound/SoundBufferStaticWav.cpp
@@ -57,44 +57,7 @@
 	SoundBuffer(fileName),
 	buffer_(0)
 {
-	unsigned int error;
-
-	// Create a buffer
-	alGetError();
-	alGenBuffers(1, &buffer_);
-	if ((error = alGetError()) != AL_NO_ERROR)
-	{
-		return;
-	}
-
-	// Load WAV
-	void *data;
-	ALenum format;
-	ALsizei size;
-	ALsizei freq;
-	ALboolean loop;
-
-#ifdef __DARWIN__
-	alutLoadWAVFile((ALbyte*) fileName,&format,&data,&size,&freq);
-#else
-	alutLoadWAVFile((ALbyte*) fileName,&format,&data,&size,&freq,&loop);
-#endif
-
-	if ((error = alGetError()) != AL_NO_ERROR)
-	{
-		return;
-	}
-
-	// Load WAV into buffer
-	alBufferData(buffer_,format,data,size,freq);
-	if ((error = alGetError()) != AL_NO_ERROR)
-	{
-		return;
-	}
-
-	// Delete WAV memory
-	alutUnloadWAV(format,data,size,freq);
-	if ((error = alGetError()) != AL_NO_ERROR)
+	if ((buffer_ = alutCreateBufferFromFile(fileName)) == AL_NONE)
 	{
 		return;
 	}

--- src/sound/Sound.cpp
+++ src/sound/Sound.cpp
@@ -28,6 +28,7 @@
 #include <sound/PlayingSoundSource.h>
 #include <AL/al.h>
 #include <AL/alc.h>
+#include <AL/alut.h>
 #include <algorithm>
 
 Sound *Sound::instance_ = 0;
@@ -150,6 +151,7 @@
 		totalSources_.push_back(source);
 		availableSources_.push_back(source);
 	}
+	alutInitWithoutContext(NULL, NULL);
 
 	init_ = true;
 	return init_;