When a "looped" sample has finished playing, we reset iAudioID, so the game adds the sample again into the queue. This is the way most other "looped" samples are currently handled by the game. (oil/power/factory steam, and so on)

see:770
fixes:770


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8031 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-08-22 03:45:28 +00:00 committed by Git SVN Gateway
parent 617ab798f4
commit 61763ee07d
1 changed files with 9 additions and 1 deletions

View File

@ -22,6 +22,7 @@
#include "lib/framework/frame.h"
#include "lib/framework/frameresource.h"
#include "audio_id.h"
#include "src/droid.h"
//*
//
@ -32,7 +33,7 @@
//
// static global variables
// array of pointers to sound effects
static TRACK *g_apTrack[MAX_TRACKS];
static TRACK *g_apTrack[MAX_TRACKS];
// number of tracks loaded
static SDWORD g_iCurTracks = 0;
@ -358,6 +359,13 @@ void sound_FinishedCallback( AUDIO_SAMPLE *psSample )
if ( psSample->pCallback != NULL )
{
psSample->pCallback(psSample->psObj);
// NOTE: we must invalidate the iAudioID (iTrack) so the game knows to add the
// sample back into the queue. This is a bit of a hacky way to handle "looped" samples,
// since currently, the game don't have a decent way to handle this.
if (psSample->psObj)
{
droidAudioTrackStopped((void *)psSample->psObj);
}
}
// set finished flag