summaryrefslogtreecommitdiff
blob: c29999fae25de052b0133bd79a16fa4e5f97cccf (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
--- a/src/SoundCore.cpp
+++ b/src/SoundCore.cpp
@@ -352,32 +352,13 @@
 
 	PHYSFS_close(filehandle);
 
-	ALenum format;
-	ALvoid *data;
-	ALsizei size,freq;
-	ALboolean loop=AL_FALSE;
 	ALenum error;
 
 	alGetError();
 
-	alGenBuffers(1,&newsample.alid);
-	if((error=alGetError())!=AL_NO_ERROR){
-		fprintf(stderr,"SoundCore::LoadSample: Error on alGenBuffers\n");
-		PrintALError(error);
-	}
-	alutLoadWAVMemory((ALbyte*)filedata,&format,&data,&size,&freq,&loop);
-	if((error=alGetError())!=AL_NO_ERROR){
-		fprintf(stderr,"SoundCore::LoadSample: Error on alutLoadWAVMemory\n");
-		PrintALError(error);
-	}
-	alBufferData(newsample.alid,format,data,size,freq);
-	if((error=alGetError())!=AL_NO_ERROR){
-		fprintf(stderr,"SoundCore::LoadSample: Error on alBufferData\n");
-		PrintALError(error);
-	}
-	alutUnloadWAV(format,data,size,freq);
-	if((error=alGetError())!=AL_NO_ERROR){
-		fprintf(stderr,"SoundCore::LoadSample: Error on alutUnloadWAV\n");
+	newsample.alid=alutCreateBufferFromFileImage(filedata, filesize);
+	if(((error=alGetError())!=AL_NO_ERROR)||(newsample.alid==AL_NONE)){
+		fprintf(stderr,"SoundCore::LoadSample: Error on alutCreateBufferFromFileImage\n");
 		PrintALError(error);
 	}