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
+32 -24
View File
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Disk.h"
#include "FourPlay.h"
#include "Harddisk.h"
#include "Mockingboard.h"
#include "MouseInterface.h"
#include "ParallelPrinter.h"
#include "SAM.h"
@@ -65,7 +66,7 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
m_slot[slot] = m_pSSC = new CSuperSerialCard(slot);
break;
case CT_MockingboardC:
m_slot[slot] = new DummyCard(type, slot);
m_slot[slot] = new MockingboardCard(slot, type);
break;
case CT_GenericPrinter:
_ASSERT(m_pParallelPrinterCard == NULL);
@@ -87,7 +88,7 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_Phasor:
m_slot[slot] = new DummyCard(type, slot);
m_slot[slot] = new MockingboardCard(slot, type);
break;
case CT_Echo:
m_slot[slot] = new DummyCard(type, slot);
@@ -237,6 +238,33 @@ void CardManager::InitializeIO(LPBYTE pCxRomPeripheral)
}
}
void CardManager::Destroy()
{
for (UINT i = SLOT0; i < NUM_SLOTS; ++i)
{
if (m_slot[i])
{
m_slot[i]->Destroy();
}
}
GetCardMgr().GetDisk2CardMgr().Destroy();
GetCardMgr().GetMockingboardCardMgr().Destroy();
}
void CardManager::Reset(const bool powerCycle)
{
for (UINT i = SLOT0; i < NUM_SLOTS; ++i)
{
if (m_slot[i])
{
m_slot[i]->Reset(powerCycle);
}
}
GetCardMgr().GetMockingboardCardMgr().Reset(powerCycle);
}
void CardManager::Update(const ULONG nExecutedCycles)
{
for (UINT i = SLOT0; i < NUM_SLOTS; ++i)
@@ -246,6 +274,8 @@ void CardManager::Update(const ULONG nExecutedCycles)
m_slot[i]->Update(nExecutedCycles);
}
}
GetCardMgr().GetMockingboardCardMgr().Update(nExecutedCycles);
}
void CardManager::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
@@ -258,25 +288,3 @@ void CardManager::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
}
}
}
void CardManager::Reset(const bool powerCycle)
{
for (UINT i = SLOT0; i < NUM_SLOTS; ++i)
{
if (m_slot[i])
{
m_slot[i]->Reset(powerCycle);
}
}
}
void CardManager::Destroy()
{
for (UINT i = SLOT0; i < NUM_SLOTS; ++i)
{
if (m_slot[i])
{
m_slot[i]->Destroy();
}
}
}