[Add] Shoot me. But I have added alut as a dep. It loads sounds well. Engine sounds are now playing too.

This commit is contained in:
Allanis 2013-06-09 16:19:54 +01:00
parent 0b402d6c15
commit 12eae87db9
4 changed files with 14 additions and 6 deletions

2
README
View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
#include <sys/stat.h>
#include <AL/alc.h>
#include <AL/alut.h>
#include <SDL.h>
#include <SDL_thread.h>
@ -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) {