mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-08 01:29:42 +00:00
Clear MB sound buffer from old save-state to new one
This commit is contained in:
parent
0606716072
commit
775f568a7c
|
@ -758,15 +758,6 @@ void MockingboardCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
|||
break;
|
||||
}
|
||||
#endif // NO_DIRECT_X
|
||||
|
||||
//
|
||||
// TODO-TC: move to class MockingboardCardManager
|
||||
//
|
||||
// Sound buffer may have been stopped by MB_InitializeForLoadingSnapshot().
|
||||
// NB. DSZeroVoiceBuffer() also zeros the sound buffer, so it's better than directly calling IDirectSoundBuffer::Play():
|
||||
// - without zeroing, then the previous sound buffer can be heard for a fraction of a second
|
||||
// - eg. when doing Mockingboard playback, then loading a save-state which is also doing Mockingboard playback
|
||||
// DSZeroVoiceBuffer(&MockingboardVoice, g_dwDSBufferSize);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -56,8 +56,10 @@ void MockingboardCardManager::InitializeForLoadingSnapshot(void)
|
|||
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||
return;
|
||||
|
||||
if (MockingboardVoice.lpDSBvoice);
|
||||
DSVoiceStop(&MockingboardVoice); // Reason: 'MB voice is playing' then loading a save-state where 'no MB present' (GH#609)
|
||||
if (!MockingboardVoice.lpDSBvoice)
|
||||
return;
|
||||
|
||||
DSVoiceStop(&MockingboardVoice); // Reason: 'MB voice is playing' then loading a save-state where 'no MB present' (GH#609)
|
||||
}
|
||||
|
||||
void MockingboardCardManager::MuteControl(bool mute)
|
||||
|
@ -216,6 +218,15 @@ void MockingboardCardManager::UpdateSoundBuffer(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!MockingboardVoice.bActive)
|
||||
{
|
||||
// Sound buffer may have been stopped by MB_InitializeForLoadingSnapshot().
|
||||
// NB. DSZeroVoiceBuffer() also zeros the sound buffer, so it's better than directly calling IDirectSoundBuffer::Play():
|
||||
// - without zeroing, then the previous sound buffer can be heard for a fraction of a second
|
||||
// - eg. when doing Mockingboard playback, then loading a save-state which is also doing Mockingboard playback
|
||||
DSZeroVoiceBuffer(&MockingboardVoice, g_dwDSBufferSize); // ... and Play()
|
||||
}
|
||||
|
||||
UINT numSamples = GenerateAllSoundData();
|
||||
if (numSamples)
|
||||
MixAllAndCopyToRingBuffer(numSamples);
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
m_userVolume = 0;
|
||||
|
||||
// NB. Cmd line has already been processed
|
||||
LogFileOutput("MockingboardCardManager::ctor() g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
|
||||
LogFileOutput("MBCardMgr::ctor() g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
|
||||
}
|
||||
~MockingboardCardManager(void)
|
||||
{}
|
||||
|
|
Loading…
Reference in New Issue
Block a user