Fixed sound length and looping. (Setting looping on a source must be done

after setting the buffer)
This commit is contained in:
Steven Fuller 2001-08-14 23:36:15 +00:00 committed by Patryk Obara
parent 48c6088c27
commit 14d3cc45bc
2 changed files with 22 additions and 19 deletions

View file

@ -12,6 +12,7 @@
#include "3dc.h"
#include "platform.h"
#include "inline.h"
#include "psndplat.h"
#include "gamedef.h"
#include "avpview.h"
@ -112,14 +113,14 @@ int PlatPlaySound(int activeIndex)
if (!PlatSoundHasStopped(activeIndex))
PlatStopSound (activeIndex);
// 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,
GameSounds[si].dsBufferP);
if (ActiveSounds[activeIndex].loop)
alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_TRUE);
else
alSourcei (ActiveSounds[activeIndex].ds3DBufferP, AL_LOOPING, AL_FALSE);
if (ActiveSounds[activeIndex].pitch != GameSounds[si].pitch) {
int ok = PlatChangeSoundPitch (activeIndex, ActiveSounds[activeIndex].pitch);
@ -453,13 +454,17 @@ fprintf (stderr, "Loaded %s\n", GameSounds[soundIndex].wavName);
}
if ((rfmt == AUDIO_S16LSB) || (rfmt == AUDIO_S16MSB)) {
int bps;
if (rchan == 2) {
rfmt = AL_FORMAT_STEREO16;
seclen = len / (rfreq * 2 * 2);
bps = rfreq * 2 * 2;
} else if (rchan == 1) {
rfmt = AL_FORMAT_MONO16;
seclen = len / (rfreq * 2);
bps = rfreq * 2 * 1;
}
seclen = DIV_FIXED(len, bps);
} else
return (unsigned char *)0;