Fix build errors & add MB riff support

This commit is contained in:
tomcw 2023-01-22 19:49:04 +00:00
parent 0bca091b55
commit 5074b0e18a
5 changed files with 16 additions and 13 deletions

View File

@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "SoundCore.h"
#include "SynchronousEventManager.h"
#include "YamlHelper.h"
#include "Riff.h"
#include "AY8910.h"
#include "SSI263.h"
@ -650,19 +649,19 @@ BYTE MockingboardCard::IOWriteInternal(WORD PC, WORD nAddr, BYTE bWrite, BYTE nV
WriteToORB(SY6522_DEVICE_B);
}
bool CS_SSI263_A = (g_phasorMode == PH_Phasor) ? !(nAddr & 0x80) && (nAddr & 0x40) // SSI263 at $Cn4x, $Cn6x
bool CS_SSI263_A = (m_phasorMode == PH_Phasor) ? !(nAddr & 0x80) && (nAddr & 0x40) // SSI263 at $Cn4x, $Cn6x
: nAddr & 0x40; // SSI263 at $Cn4x-Cn7x, $CnCx-CnFx
bool CS_SSI263_B = (g_phasorMode == PH_Phasor) ? !(nAddr & 0x80) && (nAddr & 0x20) // SSI263 at $Cn2x, $Cn6x
bool CS_SSI263_B = (m_phasorMode == PH_Phasor) ? !(nAddr & 0x80) && (nAddr & 0x20) // SSI263 at $Cn2x, $Cn6x
: nAddr & 0x20; // SSI263 at $Cn2x-Cn3x, $Cn6x-Cn7x, $CnAx-CnBx, $CnEx-CnFx
if (g_phasorMode == PH_Mockingboard || g_phasorMode == PH_Phasor) // No SSI263 for Echo+
if (m_phasorMode == PH_Mockingboard || m_phasorMode == PH_Phasor) // No SSI263 for Echo+
{
// NB. Mockingboard mode: writes to $Cn4x/SSI263 also get written to 1st 6522 (have confirmed on real Phasor h/w)
if (CS_SSI263_A) // Primary SSI263
g_MB[1].ssi263.Write(nAddr&0x7, nValue); // 2nd 6522 is used for 1st speech chip
m_MBSubUnit[1].ssi263.Write(nAddr&0x7, nValue); // 2nd 6522 is used for 1st speech chip
if (CS_SSI263_B) // Secondary SSI263
g_MB[0].ssi263.Write(nAddr&0x7, nValue); // 1st 6522 is used for 2nd speech chip
m_MBSubUnit[0].ssi263.Write(nAddr&0x7, nValue); // 1st 6522 is used for 2nd speech chip
}
return 0;
@ -1021,6 +1020,7 @@ UINT MockingboardCard::AY8910_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, BYTE
// Changed at AppleWin 1.30.8
// 9: Phasor AY's are swapped (means that AppleWin 1.30.10 and 1.30.11 are wrong)
// Changed at AppleWin 1.30.12
const UINT kUNIT_VERSION = 9;
#define SS_YAML_KEY_MB_UNIT "Unit"
#define SS_YAML_KEY_AY_CURR_REG "AY Current Register"

View File

@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Core.h"
#include "CardManager.h"
#include "Mockingboard.h"
#include "Riff.h"
//#define DBG_MB_UPDATE
@ -438,7 +439,6 @@ void MockingboardCardManager::MixAllAndCopyToRingBuffer(UINT nNumSamples)
m_byteOffset = (m_byteOffset + (DWORD)nNumSamples * sizeof(short) * NUM_MB_CHANNELS) % SOUNDBUFFER_SIZE;
#ifdef RIFF_MB
RiffPutSamples(&g_nMixBuffer[0], nNumSamples);
#endif
if (m_outputToRiff)
RiffPutSamples(&m_mixBuffer[0], nNumSamples);
}

View File

@ -12,6 +12,7 @@ public:
m_byteOffset = (DWORD)-1;
m_cyclesThisAudioFrame = 0;
m_userVolume = 0;
m_outputToRiff = false;
// NB. Cmd line has already been processed
LogFileOutput("MBCardMgr::ctor() g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
@ -28,6 +29,7 @@ public:
bool IsActive(void);
DWORD GetVolume(void);
void SetVolume(DWORD volume, DWORD volumeMax);
void OutputToRiff(void) { m_outputToRiff = true; }
void Destroy(void);
void Reset(const bool powerCycle)
@ -70,4 +72,5 @@ private:
DWORD m_byteOffset;
UINT m_cyclesThisAudioFrame;
DWORD m_userVolume; // GUI's slide volume
bool m_outputToRiff;
};

View File

@ -382,7 +382,7 @@ void SSI263::Play(unsigned int nPhoneme)
m_currSampleMod4 = 0;
// Set m_lastUpdateCycle, otherwise UpdateAccurateLength() can immediately complete phoneme! (GH#1104)
m_lastUpdateCycle = MB_GetLastCumulativeCycles();
m_lastUpdateCycle = GetLastCumulativeCycles();
}
void SSI263::Stop(void)
@ -510,8 +510,8 @@ void SSI263::Update(void)
const double kMinimumUpdateInterval = 500.0; // Arbitary (500 cycles = 21 samples)
const double kMaximumUpdateInterval = (double)(0xFFFF + 2); // Max 6522 timer interval (1372 samples)
_ASSERT(MB_GetLastCumulativeCycles() >= m_lastUpdateCycle);
updateInterval = (double)(MB_GetLastCumulativeCycles() - m_lastUpdateCycle);
_ASSERT(GetLastCumulativeCycles() >= m_lastUpdateCycle);
updateInterval = (double)(GetLastCumulativeCycles() - m_lastUpdateCycle);
if (updateInterval < kMinimumUpdateInterval)
return;
if (updateInterval > kMaximumUpdateInterval)

View File

@ -633,7 +633,7 @@ static void OneTimeInitialization(HINSTANCE passinstance)
else if (!g_cmdLine.wavFileMockingboard.empty())
{
if (RiffInitWriteFile(g_cmdLine.wavFileMockingboard.c_str(), 44100, 2))
MB_OutputToRiff();
GetCardMgr().GetMockingboardCardMgr().OutputToRiff();
}
// Initialize COM - so we can use CoCreateInstance