Support -no-mb and -m

This commit is contained in:
tomcw 2023-01-21 21:08:04 +00:00
parent 8a7e224383
commit 2f4f8ae780
4 changed files with 25 additions and 26 deletions

View File

@ -93,32 +93,24 @@ MockingboardCard::MockingboardCard(UINT slot, SS_CARDTYPE type) : Card(type, slo
g_syncEvent[id] = new SyncEvent(syncId, 0, MB_SyncEventCallback);
}
LogFileOutput("MockingboardCard::ctor: g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
for (UINT i = 0; i < NUM_VOICES; i++)
ppAYVoiceBuffer[i] = new short[MAX_SAMPLES]; // Buffer can hold a max of 0.37 seconds worth of samples (16384/44100)
for (UINT i = 0; i < NUM_SY6522; i++)
{
// MockingboardVoice.bMute = true; // TODO-TC: move to class MockingboardCardManager
g_MB[i] = SY6522_AY8910(m_slot);
g_MB[i].nAY8910Number = i;
const UINT id0 = i * SY6522::kNumTimersPer6522 + 0; // TIMER1
const UINT id1 = i * SY6522::kNumTimersPer6522 + 1; // TIMER2
g_MB[i].sy6522.InitSyncEvents(g_syncEvent[id0], g_syncEvent[id1]);
g_MB[i].ssi263.SetDevice(i);
}
else
{
for (UINT i = 0; i < NUM_VOICES; i++)
ppAYVoiceBuffer[i] = new short[MAX_SAMPLES]; // Buffer can hold a max of 0.37 seconds worth of samples (16384/44100)
for (UINT i = 0; i < NUM_SY6522; i++)
{
g_MB[i] = SY6522_AY8910(m_slot);
g_MB[i].nAY8910Number = i;
const UINT id0 = i * SY6522::kNumTimersPer6522 + 0; // TIMER1
const UINT id1 = i * SY6522::kNumTimersPer6522 + 1; // TIMER2
g_MB[i].sy6522.InitSyncEvents(g_syncEvent[id0], g_syncEvent[id1]);
g_MB[i].ssi263.SetDevice(i);
}
AY8910_InitAll((int)g_fCurrentCLK6502, SAMPLE_RATE);
LogFileOutput("MockingboardCard::ctor: AY8910_InitAll()\n");
AY8910_InitAll((int)g_fCurrentCLK6502, SAMPLE_RATE);
LogFileOutput("MockingboardCard::ctor: AY8910_InitAll()\n");
Reset(true);
LogFileOutput("MockingboardCard::ctor: Reset()\n");
}
Reset(true);
LogFileOutput("MockingboardCard::ctor: Reset()\n");
}
MockingboardCard::~MockingboardCard(void)
@ -430,15 +422,15 @@ UINT MockingboardCard::MB_Update(void)
//-----------------------------------------------------------------------------
//
// TODO-TC: check this - but shouldn't happen now, since MockingboardCard's are now properly destructed
//
// NB. Mockingboard voice is *already* muted because showing 'Select Load State file' dialog
// . and voice will be unmuted when dialog is closed
void MockingboardCard::InitializeForLoadingSnapshot(void) // GH#609
{
Reset(true);
//
// TODO-TC: move to class MockingboardCardManager
//
// if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
// return;
//

View File

@ -209,6 +209,9 @@ void MockingboardCardManager::UpdateSoundBuffer(void)
if (!MockingboardVoice.lpDSBvoice)
{
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
return;
if (!Init())
return;
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "Core.h"
#include "SoundCore.h"
class MockingboardCardManager
@ -11,6 +12,9 @@ public:
dwByteOffset = (DWORD)-1;
g_cyclesThisAudioFrame = 0;
m_userVolume = 0;
// NB. Cmd line has already been processed
LogFileOutput("MockingboardCardManager::ctor() g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
}
~MockingboardCardManager(void)
{}

View File

@ -61,7 +61,7 @@ bool g_bDSAvailable = false;
//-----------------------------------------------------------------------------
// NB. Also similar is done by: MockingboardCardManager::Destroy()
// - which is called from WM_DESTROY when !g_bRestart (ie. when exiting the app)
// - which is called from WM_DESTROY (when both restarting VM & exiting the app)
VOICE::~VOICE(void)
{