Refactor Mockingboard into a class (#1171)

Mockingboard or Phasor cards can be inserted into any slot.
Change Config->Sound to that slots 4+5 to be individually selected for the 3 soundcard types.
Add MockingboardCardManager class to manage multiple cards and mix the sound buffers.
This commit is contained in:
TomCh
2023-01-28 18:15:28 +00:00
committed by GitHub
parent 4668718fb3
commit 71c67cf132
30 changed files with 1439 additions and 1251 deletions
+20 -3
View File
@@ -48,7 +48,7 @@ static LPDIRECTSOUND g_lpDS = NULL;
// Used for muting & fading:
static const UINT uMAX_VOICES = 6; // 4x SSI263 + spkr + mockingboard
static const UINT uMAX_VOICES = NUM_SLOTS * 2 + 1 + 1; // 8x (2x SSI263) + spkr + MockingboardCardManager
static UINT g_uNumVoices = 0;
static VOICE* g_pVoices[uMAX_VOICES] = {NULL};
@@ -58,6 +58,21 @@ static VOICE* g_pSpeakerVoice = NULL;
bool g_bDSAvailable = false;
//-----------------------------------------------------------------------------
// NB. Also similar is done by: MockingboardCardManager::Destroy()
// - which is called from WM_DESTROY (when both restarting VM & exiting the app)
VOICE::~VOICE(void)
{
if (lpDSBvoice)
{
DSVoiceStop(this);
DSReleaseSoundBuffer(this);
}
}
//-----------------------------------------------------------------------------
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
@@ -540,8 +555,10 @@ bool DSInit()
return false;
}
hr = g_lpDS->SetCooperativeLevel(GetFrame().g_hFrameWindow, DSSCL_NORMAL);
if(FAILED(hr))
HWND hwnd = GetFrame().g_hFrameWindow;
_ASSERT(hwnd);
hr = g_lpDS->SetCooperativeLevel(hwnd, DSSCL_NORMAL);
if (FAILED(hr))
{
if(g_fh) fprintf(g_fh, "SetCooperativeLevel failed (%08X)\n",hr);
return false;