From 48c6088c27bab6ed892fe52df99ca7d5f1803597 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Tue, 14 Aug 2001 21:48:58 +0000 Subject: Fixed common sound loading. Still debugging OpenAL code. --- src/openal.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/openal.c') diff --git a/src/openal.c b/src/openal.c index 0c7dbdc..5c841c8 100644 --- a/src/openal.c +++ b/src/openal.c @@ -112,9 +112,9 @@ int PlatPlaySound(int activeIndex) if (!PlatSoundHasStopped(activeIndex)) PlatStopSound (activeIndex); - if (ActiveSounds[activeIndex].loop) - alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_TRUE); - else +// if (ActiveSounds[activeIndex].loop) +// alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_TRUE); +// else alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_FALSE); alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_BUFFER, @@ -219,7 +219,7 @@ int PlatChangeSoundPitch(int activeIndex, int pitch) ActiveSounds[activeIndex].pitch = pitch; - alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_PITCH, frequency); +// alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_PITCH, frequency); return 1; } @@ -247,7 +247,8 @@ int PlatDo3dSound(int activeIndex) int distance; VECTORCH relativePosn; int newPan, newVolume; - + +return; fprintf(stderr, "PlatDo3dSound(%d)\n", activeIndex); relativePosn.vx = ActiveSounds[activeIndex].threedeedata.position.vx - @@ -435,12 +436,14 @@ unsigned char *ExtractWavFile(int soundIndex, unsigned char *bufferPtr) fprintf (stderr, "Loaded %s\n", GameSounds[soundIndex].wavName); } - if (acLoadWAV (bufferPtr, (ALuint *) &len, &udata, &rfmt, + if (acLoadWAV (bufferPtr, (ALuint *) &rsize, &udata, &rfmt, &rchan, &rfreq) == NULL) { fprintf (stderr, "Unable to convert data\n"); return (unsigned char *)0; } + len = rsize; + if ((rfmt == AUDIO_U8)) { nb = Force8to16 (udata, &len); rfmt = AUDIO_S16LSB; @@ -460,11 +463,9 @@ fprintf (stderr, "Loaded %s\n", GameSounds[soundIndex].wavName); } else return (unsigned char *)0; - rsize = len; - alGenBuffers (1, &(GameSounds[soundIndex].dsBufferP)); alBufferData (GameSounds[soundIndex].dsBufferP, - rfmt, udata, rsize, rfreq); + rfmt, udata, len, rfreq); GameSounds[soundIndex].loaded = 1; GameSounds[soundIndex].flags = SAMPLE_IN_HW; @@ -474,7 +475,10 @@ fprintf (stderr, "Loaded %s\n", GameSounds[soundIndex].wavName); free (udata); - return (bufferPtr + rsize); + /* read RIFF chunk length and jump past it */ + return bufferPtr + 8 + + ((bufferPtr[4] << 0) | (bufferPtr[5] << 8) | + (bufferPtr[6] << 16) | (bufferPtr[7] << 24)); } int LoadWavFromFastFile(int soundNum, char * wavFileName) @@ -505,6 +509,7 @@ void PlatUpdatePlayer() ALfloat vel[3], or[6], pos[3]; fprintf(stderr, "PlatUpdatePlayer()\n"); +return; if (Global_VDB_Ptr) { extern int NormalFrameTime; extern int DopplerShiftIsOn; -- cgit v1.3