[Change] Make sounds play fully.

This commit is contained in:
Allanis 2013-06-09 17:09:35 +01:00
parent 331cc86c98
commit 8976622b73

View File

@ -381,20 +381,31 @@ void sound_update(void) {
voice = voice_start;
do {
next = voice->next;
// Get status.
stat = -1;
if(voice->source != 0)
alGetSourcei(voice->source, AL_SOURCE_STATE, &stat);
if(!voice_is(voice, VOICE_DONE)) { // Still working.
// Voice has a source.
if(voice->source != 0) {
alGetSourcei(voice->source, AL_SOURCE_STATE, &stat);
// Update position.
alSource3f(voice->source, AL_POSITION,
voice->px, voice->py, 0.);
/*alSource3f(voice->source, AL_VELOCITY,
voice->vx, voice->vy, 0.);*/
}
prev = voice; // Only case where voice will stay.
} else // Delete them.
voice_rm(prev, voice);
prev = voice;
}else {
// Delete them.
if(stat != AL_PLAYING)
voice_rm(prev, voice); // Do not set prev to voice.
else
prev = voice;
}
voice = next;
} while(voice != NULL);