diff --git a/README b/README index fc7eb80..3db8d54 100644 --- a/README +++ b/README @@ -41,6 +41,7 @@ Dependencied: -- libsdl-image1.2 -- libgl1-mesa-dri -- libopenal0a + -- libalut0 -- libvorbis0a -- libvorbisfile3 -- libxml2 @@ -51,6 +52,7 @@ Dependencied: -- libsdl-image1.2-dev -- libgl1-mesa-dev -- libopenal-dev + -- libalut-dev -- libvorbis-dev -- libxml2-dev -- libfreetype6-dev diff --git a/bin/Makefile b/bin/Makefile index 8319b12..b807117 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -21,7 +21,7 @@ CLUA = -I../lib/lua CSDL = $(shell sdl-config --cflags) CXML = $(shell xml2-config --cflags) CTTF = $(shell freetype-config --cflags) -CAL = -lopenal +CAL = -lopenal $(shell freealut-config --cflags) CVORBIS = CGL = CFLAGS = $(CLUA) $(CPLUTO) $(CSDL) $(CXML) $(CTTF) $(CGL) $(CAL) $(CVORBIS) $(VERSION) -D$(OS) -fgnu89-inline @@ -37,7 +37,7 @@ LDSDL = $(shell sdl-config --libs) -lSDL_image LDXML = $(shell xml2-config --libs) LDTTF = $(shell freetype-config --libs) LDGL = -lGL -LDAL = -lopenal +LDAL = -lopenal $(shell freealut-config --libs) LDVORBIS = -lvorbisfile LDPNG = -lpng LDFLAGS = -lm $(LDLUA) $(LDPLUTO) $(LDSDL) $(LDXML) $(LDTTF) $(LDGL) $(LDPNG) $(LDAL) $(LDVORBIS) diff --git a/src/player.c b/src/player.c index e8f543e..e0656b5 100644 --- a/src/player.c +++ b/src/player.c @@ -1391,12 +1391,12 @@ void player_afterburnOver(void) { // Start accelerating. void player_accel(double acc) { player_acc = acc; - //player_playSound(player->ship->sound, 0); + player_playSound(player->ship->sound, 0); } void player_accelOver(void) { player_acc = 0; - //player_stopSound(); + player_stopSound(); } // Take a screenshot. diff --git a/src/sound.c b/src/sound.c index b670639..08f97ae 100644 --- a/src/sound.c +++ b/src/sound.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -127,6 +128,9 @@ int sound_init(void) { sound_lock = SDL_CreateMutex(); soundLock(); + // Initialize alut - I think it's worth it. + alutInitWithoutContext(NULL, NULL); + const ALchar* device = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); // Open the default device. al_device = alcOpenDevice(NULL); @@ -330,8 +334,10 @@ static int sound_load(ALuint* buffer, char* filename) { soundLock(); // Bind to OpenAL buffer. - alGenBuffers(1, buffer); - alBufferData(*buffer, AL_FORMAT_MONO16, wavdata, size, 22050); + (*buffer) = alutCreateBufferFromFileImage(wavdata, size); + if((*buffer) == AL_NONE) WARN("FAILURE: %s", alutGetErrorString(alutGetError())); + //alGenBuffers(1, buffer); + //alBufferData(*buffer, AL_FORMAT_MONO16, wavdata, size, 22050); // Errors? if((err = alGetError()) != AL_NO_ERROR) {