This commit is contained in:
parent
f3a5b68569
commit
066ab75274
2 changed files with 63 additions and 11 deletions
|
@ -82,7 +82,9 @@ int CSoundMediator::s_targetVolume[CSoundMediator::NUM_VOLUMETYPES];
|
||||||
int CSoundMediator::s_volumeDirty[CSoundMediator::NUM_VOLUMETYPES];
|
int CSoundMediator::s_volumeDirty[CSoundMediator::NUM_VOLUMETYPES];
|
||||||
|
|
||||||
xmSampleId CSoundMediator::s_songSampleId=NO_SAMPLE;
|
xmSampleId CSoundMediator::s_songSampleId=NO_SAMPLE;
|
||||||
|
FileEquate CSoundMediator::s_songVh=(FileEquate)-1;
|
||||||
xmModId CSoundMediator::s_songModId=NO_SONG;
|
xmModId CSoundMediator::s_songModId=NO_SONG;
|
||||||
|
FileEquate CSoundMediator::s_songPxm=(FileEquate)-1;
|
||||||
xmPlayingId CSoundMediator::s_songPlayingId=NOT_PLAYING;
|
xmPlayingId CSoundMediator::s_songPlayingId=NOT_PLAYING;
|
||||||
int CSoundMediator::s_songStartPattern=0;
|
int CSoundMediator::s_songStartPattern=0;
|
||||||
xmSampleId CSoundMediator::s_sfxSampleId=NO_SAMPLE;
|
xmSampleId CSoundMediator::s_sfxSampleId=NO_SAMPLE;
|
||||||
|
@ -419,12 +421,30 @@ void CSoundMediator::setSong(SONGID _songId)
|
||||||
{
|
{
|
||||||
XMSONGDATA *song;
|
XMSONGDATA *song;
|
||||||
|
|
||||||
ASSERT(s_songSampleId==NO_SAMPLE);
|
|
||||||
ASSERT(s_songModId==NO_SONG);
|
|
||||||
|
|
||||||
song=&s_xmSongData[_songId];
|
song=&s_xmSongData[_songId];
|
||||||
s_songModId=s_xmplaySound->loadModData(song->m_pxm);
|
|
||||||
s_songSampleId=s_xmplaySound->loadSampleData(song->m_vh,song->m_vb);
|
if(s_songSampleId!=NO_SAMPLE&&s_songVh!=song->m_vh)
|
||||||
|
{
|
||||||
|
s_xmplaySound->dumpSampleData(s_songSampleId);
|
||||||
|
s_songSampleId=NO_SAMPLE;
|
||||||
|
}
|
||||||
|
if(s_songSampleId==NO_SAMPLE)
|
||||||
|
{
|
||||||
|
s_songSampleId=s_xmplaySound->loadSampleData(song->m_vh,song->m_vb);
|
||||||
|
}
|
||||||
|
s_songVh=song->m_vh;
|
||||||
|
|
||||||
|
if(s_songModId!=NO_SONG&&s_songPxm!=song->m_pxm)
|
||||||
|
{
|
||||||
|
s_xmplaySound->dumpModData(s_songModId);
|
||||||
|
s_songModId=NO_SONG;
|
||||||
|
}
|
||||||
|
if(s_songModId==NO_SONG)
|
||||||
|
{
|
||||||
|
s_songModId=s_xmplaySound->loadModData(song->m_pxm);
|
||||||
|
}
|
||||||
|
s_songPxm=song->m_pxm;
|
||||||
|
|
||||||
s_songStartPattern=song->m_startPattern;
|
s_songStartPattern=song->m_startPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +472,7 @@ void CSoundMediator::playSong()
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CSoundMediator::dumpSong()
|
void CSoundMediator::stopSong()
|
||||||
{
|
{
|
||||||
ASSERT(s_songSampleId!=NO_SAMPLE);
|
ASSERT(s_songSampleId!=NO_SAMPLE);
|
||||||
ASSERT(s_songModId!=NO_SONG);
|
ASSERT(s_songModId!=NO_SONG);
|
||||||
|
@ -462,15 +482,31 @@ void CSoundMediator::dumpSong()
|
||||||
s_xmplaySound->stopPlayingId(s_songPlayingId);
|
s_xmplaySound->stopPlayingId(s_songPlayingId);
|
||||||
s_xmplaySound->unlockPlayingId(s_songPlayingId);
|
s_xmplaySound->unlockPlayingId(s_songPlayingId);
|
||||||
}
|
}
|
||||||
s_xmplaySound->dumpSampleData(s_songSampleId);
|
|
||||||
s_xmplaySound->dumpModData(s_songModId);
|
|
||||||
|
|
||||||
s_songSampleId=NO_SAMPLE;
|
|
||||||
s_songModId=NO_SONG;
|
|
||||||
s_songPlayingId=NOT_PLAYING;
|
s_songPlayingId=NOT_PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CSoundMediator::dumpSong()
|
||||||
|
{
|
||||||
|
ASSERT(s_songSampleId!=NO_SAMPLE);
|
||||||
|
ASSERT(s_songModId!=NO_SONG);
|
||||||
|
|
||||||
|
stopSong();
|
||||||
|
s_xmplaySound->dumpSampleData(s_songSampleId);
|
||||||
|
s_songSampleId=NO_SAMPLE;
|
||||||
|
s_xmplaySound->dumpModData(s_songModId);
|
||||||
|
s_songModId=NO_SONG;
|
||||||
|
s_songVh=(FileEquate)-1;
|
||||||
|
s_songPxm=(FileEquate)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -567,6 +603,18 @@ void CSoundMediator::stopSfx(xmPlayingId _playingId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose: NB: Will invalidate any locked sfx!
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CSoundMediator::stopAllSfx()
|
||||||
|
{
|
||||||
|
s_xmplaySound->stopAndUnlockAllSfx();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
|
@ -180,6 +180,7 @@ public:
|
||||||
// Song interface
|
// Song interface
|
||||||
static void setSong(SONGID _songId);
|
static void setSong(SONGID _songId);
|
||||||
static void playSong();
|
static void playSong();
|
||||||
|
static void stopSong();
|
||||||
static void dumpSong();
|
static void dumpSong();
|
||||||
|
|
||||||
// SFX interface
|
// SFX interface
|
||||||
|
@ -187,6 +188,7 @@ public:
|
||||||
static xmPlayingId playSfx(SFXID _sfxId,int _lock=false);
|
static xmPlayingId playSfx(SFXID _sfxId,int _lock=false);
|
||||||
static void setposition(xmPlayingId _playingId,VECTOR *pos);
|
static void setposition(xmPlayingId _playingId,VECTOR *pos);
|
||||||
static void stopSfx(xmPlayingId _playingId);
|
static void stopSfx(xmPlayingId _playingId);
|
||||||
|
static void stopAllSfx();
|
||||||
|
|
||||||
// Speech interface
|
// Speech interface
|
||||||
static void playSpeech(SpeechEquate _speech);
|
static void playSpeech(SpeechEquate _speech);
|
||||||
|
@ -214,7 +216,9 @@ private:
|
||||||
static int s_volumeDirty[NUM_VOLUMETYPES];
|
static int s_volumeDirty[NUM_VOLUMETYPES];
|
||||||
|
|
||||||
static xmSampleId s_songSampleId;
|
static xmSampleId s_songSampleId;
|
||||||
|
static FileEquate s_songVh;
|
||||||
static xmModId s_songModId;
|
static xmModId s_songModId;
|
||||||
|
static FileEquate s_songPxm;
|
||||||
static xmPlayingId s_songPlayingId;
|
static xmPlayingId s_songPlayingId;
|
||||||
static int s_songStartPattern;
|
static int s_songStartPattern;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue