This commit is contained in:
parent
3a6aad09b2
commit
506a10221d
@ -588,7 +588,10 @@ void CLevel::shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSoundMediator::stopAllSound();
|
CSoundMediator::stopAllSound();
|
||||||
VSync(0);CSoundMediator::think(1); // This is needed to let xmplay kill off the sounds properly (pkg)
|
for(int i=0;i<5;i++)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
@ -170,21 +170,22 @@ void CXMPlaySound::think()
|
|||||||
case SILENT:
|
case SILENT:
|
||||||
if(!ch->m_locked)
|
if(!ch->m_locked)
|
||||||
{
|
{
|
||||||
do
|
if(XM_GetFeedback(ch->m_internalId,&fb))
|
||||||
{
|
{
|
||||||
//PAUL_DBGMSG("freed channel %d ( %d )",i,ch->m_playingId);
|
///PAUL_DBGMSG("freeing channels:");
|
||||||
ch->m_useType=FREE;
|
///int j=i;
|
||||||
#ifdef __VERSION_DEBUG__
|
do
|
||||||
ch->m_internalId=0;
|
{
|
||||||
ch->m_playingId=NOT_PLAYING;
|
///PAUL_DBGMSG(" %d (%d)",j++,ch->m_playingId);
|
||||||
ch->m_priority=0;
|
ch->m_useType=FREE;
|
||||||
ch->m_locked=false;
|
ch++;
|
||||||
ch->m_vol=MIN_VOLUME;
|
}
|
||||||
ch->m_pan=PAN_CENTRE;
|
while(ch->m_useType==CONTINUE);
|
||||||
#endif
|
|
||||||
ch++;
|
|
||||||
}
|
}
|
||||||
while(ch->m_useType==CONTINUE);
|
/// else
|
||||||
|
///{
|
||||||
|
/// PAUL_DBGMSG("channel %d not stopped",i);
|
||||||
|
///}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -194,13 +195,12 @@ void CXMPlaySound::think()
|
|||||||
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
|
||||||
{
|
ch->m_useType=SILENT;
|
||||||
// Just mark it as silent, if it's unlocked then it'll die next frame
|
|
||||||
ch->m_useType=SILENT;
|
// And kill it in the player
|
||||||
ch++;
|
XM_Quit(ch->m_internalId);
|
||||||
}
|
///PAUL_DBGMSG("marked %d (%d) as silent",i,ch->m_internalId);
|
||||||
while(ch->m_useType==CONTINUE);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -435,44 +435,41 @@ 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!
|
||||||
|
ch->m_vol=_volume; // Update volume
|
||||||
|
switch(ch->m_useType)
|
||||||
{
|
{
|
||||||
ASSERT(ch->m_locked!=false); // Cant alter unlocked channels!
|
case SILENT:
|
||||||
ch->m_vol=_volume; // Update volume
|
break;
|
||||||
switch(ch->m_useType)
|
|
||||||
{
|
|
||||||
case SILENT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SONG:
|
case SONG:
|
||||||
vol=(_volume*m_masterSongVolume)>>8;
|
vol=(_volume*m_masterSongVolume)>>8;
|
||||||
XM_SetMasterVol(ch->m_internalId,vol>>1);
|
XM_SetMasterVol(ch->m_internalId,vol>>1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SFX:
|
case SFX:
|
||||||
vol=(_volume*m_masterSfxVolume)>>8;
|
vol=(_volume*m_masterSfxVolume)>>8;
|
||||||
XM_SetMasterVol(ch->m_internalId,vol>>1);
|
XM_SetMasterVol(ch->m_internalId,vol>>1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOOPINGSFX:
|
case LOOPINGSFX:
|
||||||
updateLoopingSfx(ch);
|
updateLoopingSfx(ch);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREE:
|
case FREE:
|
||||||
case CONTINUE:
|
case CONTINUE:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(0); // Couldn't find the sound to unlock it!
|
ASSERT(0); // Couldn't find the sound to unlock it!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,41 +482,38 @@ 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!
|
||||||
|
ch->m_pan=_pan; // Update pan
|
||||||
|
switch(ch->m_useType)
|
||||||
{
|
{
|
||||||
ASSERT(ch->m_locked!=false); // Cant alter unlocked channels!
|
case SILENT:
|
||||||
ch->m_pan=_pan; // Update pan
|
break;
|
||||||
switch(ch->m_useType)
|
|
||||||
{
|
|
||||||
case SILENT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SONG:
|
case SONG:
|
||||||
XM_SetMasterPan(ch->m_internalId,_pan-128);
|
XM_SetMasterPan(ch->m_internalId,_pan-128);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SFX:
|
case SFX:
|
||||||
XM_SetMasterPan(ch->m_internalId,_pan-128);
|
XM_SetMasterPan(ch->m_internalId,_pan-128);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOOPINGSFX:
|
case LOOPINGSFX:
|
||||||
updateLoopingSfx(ch);
|
updateLoopingSfx(ch);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREE:
|
case FREE:
|
||||||
case CONTINUE:
|
case CONTINUE:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
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,25 +629,22 @@ 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);
|
||||||
|
ASSERT(ch->m_locked!=false);
|
||||||
|
do
|
||||||
{
|
{
|
||||||
//PAUL_DBGMSG("unlocking %d",_playingId);
|
ch->m_locked=false;
|
||||||
ASSERT(ch->m_locked!=false);
|
ch++;
|
||||||
do
|
|
||||||
{
|
|
||||||
ch->m_locked=false;
|
|
||||||
ch++;
|
|
||||||
}
|
|
||||||
while(ch->m_useType==CONTINUE);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
while(ch->m_useType==CONTINUE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(0); // Couldn't find the sound to unlock it!
|
ASSERT(0); // Couldn't find the sound to unlock it!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,53 +657,45 @@ 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!
|
||||||
|
switch(ch->m_useType)
|
||||||
{
|
{
|
||||||
ASSERT(ch->m_locked!=false); // Cant stop unlocked channels!
|
case SONG:
|
||||||
switch(ch->m_useType)
|
case SFX:
|
||||||
{
|
{
|
||||||
case SONG:
|
// XM_Feedback fb;
|
||||||
case SFX:
|
// do
|
||||||
{
|
// {
|
||||||
XM_Feedback fb;
|
XM_PlayStop(ch->m_internalId);
|
||||||
do
|
// XM_GetFeedback(ch->m_internalId,&fb);
|
||||||
{
|
// }
|
||||||
XM_PlayStop(ch->m_internalId);
|
// while(fb.Status!=XM_STOPPED);
|
||||||
XM_GetFeedback(ch->m_internalId,&fb);
|
XM_Quit(ch->m_internalId);
|
||||||
}
|
}
|
||||||
while(fb.Status!=XM_STOPPED);
|
break;
|
||||||
XM_Quit(ch->m_internalId);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LOOPINGSFX:
|
case LOOPINGSFX:
|
||||||
XM_StopSample(ch->m_internalId);
|
XM_StopSample(ch->m_internalId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SILENT:
|
case SILENT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREE:
|
case FREE:
|
||||||
case CONTINUE:
|
case CONTINUE:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
ch->m_useType=SILENT;
|
|
||||||
ch++;
|
|
||||||
}
|
|
||||||
while(ch->m_useType==CONTINUE);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ch->m_useType=SILENT;
|
||||||
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user