This commit is contained in:
Paul 2001-05-22 19:48:25 +00:00
parent 3a6aad09b2
commit 506a10221d
2 changed files with 113 additions and 136 deletions

View File

@ -588,7 +588,10 @@ void CLevel::shutdown()
} }
CSoundMediator::stopAllSound(); CSoundMediator::stopAllSound();
for(int i=0;i<5;i++)
{
VSync(0);CSoundMediator::think(1); // This is needed to let xmplay kill off the sounds properly (pkg) VSync(0);CSoundMediator::think(1); // This is needed to let xmplay kill off the sounds properly (pkg)
}
if (ActorList) MemFree(ActorList); if (ActorList) MemFree(ActorList);
if (PlatformList) MemFree(PlatformList); if (PlatformList) MemFree(PlatformList);

View File

@ -170,22 +170,23 @@ void CXMPlaySound::think()
case SILENT: case SILENT:
if(!ch->m_locked) if(!ch->m_locked)
{ {
if(XM_GetFeedback(ch->m_internalId,&fb))
{
///PAUL_DBGMSG("freeing channels:");
///int j=i;
do do
{ {
//PAUL_DBGMSG("freed channel %d ( %d )",i,ch->m_playingId); ///PAUL_DBGMSG(" %d (%d)",j++,ch->m_playingId);
ch->m_useType=FREE; ch->m_useType=FREE;
#ifdef __VERSION_DEBUG__
ch->m_internalId=0;
ch->m_playingId=NOT_PLAYING;
ch->m_priority=0;
ch->m_locked=false;
ch->m_vol=MIN_VOLUME;
ch->m_pan=PAN_CENTRE;
#endif
ch++; ch++;
} }
while(ch->m_useType==CONTINUE); while(ch->m_useType==CONTINUE);
} }
/// else
///{
/// PAUL_DBGMSG("channel %d not stopped",i);
///}
}
break; break;
@ -193,14 +194,13 @@ void CXMPlaySound::think()
case SONG: case SONG:
case SFX: case SFX:
if(XM_GetFeedback(ch->m_internalId,&fb)) if(XM_GetFeedback(ch->m_internalId,&fb))
{
do
{ {
// Just mark it as silent, if it's unlocked then it'll die next frame // Just mark it as silent, if it's unlocked then it'll die next frame
ch->m_useType=SILENT; ch->m_useType=SILENT;
ch++;
} // And kill it in the player
while(ch->m_useType==CONTINUE); XM_Quit(ch->m_internalId);
///PAUL_DBGMSG("marked %d (%d) as silent",i,ch->m_internalId);
} }
break; break;
@ -435,13 +435,10 @@ void CXMPlaySound::setStereo(int _stereo)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CXMPlaySound::setVolume(xmPlayingId _playingId,unsigned char _volume) void CXMPlaySound::setVolume(xmPlayingId _playingId,unsigned char _volume)
{ {
// int i;
spuChannelUse *ch; spuChannelUse *ch;
int vol; int vol;
ch=&m_spuChannelUse[_playingId&0xff]; ch=&m_spuChannelUse[_playingId&0xff];
// for(i=0;i<NUM_SPU_CHANNELS;i++,ch++)
{
if(ch->m_playingId==_playingId) if(ch->m_playingId==_playingId)
{ {
ASSERT(ch->m_locked!=false); // Cant alter unlocked channels! ASSERT(ch->m_locked!=false); // Cant alter unlocked channels!
@ -472,7 +469,7 @@ void CXMPlaySound::setVolume(xmPlayingId _playingId,unsigned char _volume)
} }
return; return;
} }
}
ASSERT(0); // Couldn't find the sound to unlock it! ASSERT(0); // Couldn't find the sound to unlock it!
} }
@ -485,12 +482,9 @@ void CXMPlaySound::setVolume(xmPlayingId _playingId,unsigned char _volume)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CXMPlaySound::setPanning(xmPlayingId _playingId,char _pan) void CXMPlaySound::setPanning(xmPlayingId _playingId,char _pan)
{ {
// int i;
spuChannelUse *ch; spuChannelUse *ch;
ch=&m_spuChannelUse[_playingId&0xff]; ch=&m_spuChannelUse[_playingId&0xff];
// for(i=0;i<NUM_SPU_CHANNELS;i++,ch++)
{
if(ch->m_playingId==_playingId) if(ch->m_playingId==_playingId)
{ {
ASSERT(ch->m_locked!=false); // Cant alter unlocked channels! ASSERT(ch->m_locked!=false); // Cant alter unlocked channels!
@ -519,7 +513,7 @@ void CXMPlaySound::setPanning(xmPlayingId _playingId,char _pan)
} }
return; return;
} }
}
ASSERT(0); // Couldn't find the sound to unlock it! ASSERT(0); // Couldn't find the sound to unlock it!
} }
@ -572,7 +566,6 @@ void CXMPlaySound::stopAndUnlockAllSound()
ch->m_useType==LOOPINGSFX) ch->m_useType==LOOPINGSFX)
{ {
ch->m_locked=true; // hmm.. not too ugly I suppose ch->m_locked=true; // hmm.. not too ugly I suppose
// setVolume(ch->m_playingId,0);
stopPlayingId(ch->m_playingId); stopPlayingId(ch->m_playingId);
// Need to unlock too // Need to unlock too
@ -636,12 +629,9 @@ xmPlayingId CXMPlaySound::playSong(xmSampleId _sampleId,xmModId _modId,int _star
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CXMPlaySound::unlockPlayingId(xmPlayingId _playingId) void CXMPlaySound::unlockPlayingId(xmPlayingId _playingId)
{ {
// int i;
spuChannelUse *ch; spuChannelUse *ch;
ch=&m_spuChannelUse[_playingId&0xff]; ch=&m_spuChannelUse[_playingId&0xff];
// for(i=0;i<NUM_SPU_CHANNELS;i++,ch++)
{
if(ch->m_playingId==_playingId) if(ch->m_playingId==_playingId)
{ {
//PAUL_DBGMSG("unlocking %d",_playingId); //PAUL_DBGMSG("unlocking %d",_playingId);
@ -654,7 +644,7 @@ void CXMPlaySound::unlockPlayingId(xmPlayingId _playingId)
while(ch->m_useType==CONTINUE); while(ch->m_useType==CONTINUE);
return; return;
} }
}
ASSERT(0); // Couldn't find the sound to unlock it! ASSERT(0); // Couldn't find the sound to unlock it!
} }
@ -667,12 +657,9 @@ void CXMPlaySound::unlockPlayingId(xmPlayingId _playingId)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CXMPlaySound::stopPlayingId(xmPlayingId _playingId) void CXMPlaySound::stopPlayingId(xmPlayingId _playingId)
{ {
// int i;
spuChannelUse *ch; spuChannelUse *ch;
ch=&m_spuChannelUse[_playingId&0xff]; ch=&m_spuChannelUse[_playingId&0xff];
// for(i=0;i<NUM_SPU_CHANNELS;i++,ch++)
{
if(ch->m_playingId==_playingId) if(ch->m_playingId==_playingId)
{ {
ASSERT(ch->m_locked!=false); // Cant stop unlocked channels! ASSERT(ch->m_locked!=false); // Cant stop unlocked channels!
@ -681,13 +668,13 @@ void CXMPlaySound::stopPlayingId(xmPlayingId _playingId)
case SONG: case SONG:
case SFX: case SFX:
{ {
XM_Feedback fb; // XM_Feedback fb;
do // do
{ // {
XM_PlayStop(ch->m_internalId); XM_PlayStop(ch->m_internalId);
XM_GetFeedback(ch->m_internalId,&fb); // XM_GetFeedback(ch->m_internalId,&fb);
} // }
while(fb.Status!=XM_STOPPED); // while(fb.Status!=XM_STOPPED);
XM_Quit(ch->m_internalId); XM_Quit(ch->m_internalId);
} }
break; break;
@ -705,15 +692,10 @@ void CXMPlaySound::stopPlayingId(xmPlayingId _playingId)
break; break;
} }
do
{
ch->m_useType=SILENT; ch->m_useType=SILENT;
ch++;
}
while(ch->m_useType==CONTINUE);
return; return;
} }
}
ASSERT(0); // Couldn't find the sound to stop it! ASSERT(0); // Couldn't find the sound to stop it!
} }
@ -897,14 +879,6 @@ void CXMPlaySound::markChannelsAsActive(int _baseChannel,int _channelCount,CHANN
for(i=_baseChannel;i<_baseChannel+_channelCount-1;i++,ch++) for(i=_baseChannel;i<_baseChannel+_channelCount-1;i++,ch++)
{ {
ch->m_useType=CONTINUE; ch->m_useType=CONTINUE;
#ifdef __VERSION_DEBUG__
ch->m_internalId=0;
ch->m_playingId=NOT_PLAYING;
ch->m_priority=0;
ch->m_locked=false;
ch->m_vol=MIN_VOLUME;
ch->m_pan=PAN_CENTRE;
#endif
} }
} }