diff --git a/AppleWinExpress2013.vcxproj b/AppleWinExpress2013.vcxproj index 87520852..24be103a 100644 --- a/AppleWinExpress2013.vcxproj +++ b/AppleWinExpress2013.vcxproj @@ -125,6 +125,7 @@ + diff --git a/source/Memory.cpp b/source/Memory.cpp index 3868e0b2..d7f1641e 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" #include "Debugger\DebugDefs.h" +#include "DAC.h" // Memory Flag #define MF_80STORE 0x00000001 @@ -1294,6 +1295,8 @@ void MemInitialize() { ConfigureSoftcard(pCxRomPeripheral, 5); // $C500 : Z80 card } + else + ConfigureDAC(pCxRomPeripheral, 5); // $C500 : Z80 card DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w diff --git a/source/Speaker.cpp b/source/Speaker.cpp index 3608ecd6..45f9d0c0 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -51,11 +51,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // their buffers are running low. // -#define SOUND_NONE 0 -#define SOUND_DIRECT 1 -#define SOUND_SMART 2 -#define SOUND_WAVE 3 - static const unsigned short g_nSPKR_NumChannels = 1; static const DWORD g_dwDSSpkrBufferSize = MAX_SAMPLES * sizeof(short) * g_nSPKR_NumChannels; @@ -66,18 +61,20 @@ static short* g_pSpeakerBuffer = NULL; // Globals (SOUND_WAVE) const short SPKR_DATA_INIT = (short)0x8000; -static short g_nSpeakerData = SPKR_DATA_INIT; +short g_nSpeakerData = SPKR_DATA_INIT; static UINT g_nBufferIdx = 0; static short* g_pRemainderBuffer = NULL; static UINT g_nRemainderBufferSize; // Setup in SpkrInitialize() static UINT g_nRemainderBufferIdx; // Setup in SpkrInitialize() - // Application-wide globals: DWORD soundtype = SOUND_WAVE; double g_fClksPerSpkrSample; // Setup in SetClksPerSpkrSample() +// Allow temporary quietening of speaker (8 bit DAC) +UINT g_quieterSpeaker = 0; + // Globals static DWORD lastcyclenum = 0; static DWORD toggles = 0; @@ -447,7 +444,19 @@ BYTE __stdcall SpkrToggle (WORD, WORD, BYTE, BYTE, ULONG nCyclesLeft) UpdateSpkr(); - g_nSpeakerData = ~g_nSpeakerData; + // quieten the speaker if 8 bit DAC in use + + // g_nSpeakerData = ~g_nSpeakerData; + if (g_quieterSpeaker) + if (g_nSpeakerData == (SPKR_DATA_INIT >> 2)) + g_nSpeakerData = ~g_nSpeakerData; + else + g_nSpeakerData = SPKR_DATA_INIT>>2; + else + if (g_nSpeakerData == SPKR_DATA_INIT) + g_nSpeakerData = ~g_nSpeakerData; + else + g_nSpeakerData = SPKR_DATA_INIT; } else if (soundtype != SOUND_NONE) { @@ -993,6 +1002,7 @@ static void Spkr_SetActive(bool bActive) // Called by SpkrUpdate() after 0.2s of speaker inactivity g_bSpkrRecentlyActive = false; SpeakerVoice.bRecentlyActive = false; + g_quieterSpeaker = 0; // undo any muting (for 8 bit DAC) } } diff --git a/source/Speaker.h b/source/Speaker.h index 8e93fbbe..c2ee9c95 100644 --- a/source/Speaker.h +++ b/source/Speaker.h @@ -1,7 +1,14 @@ #pragma once +#define SOUND_NONE 0 +#define SOUND_DIRECT 1 +#define SOUND_SMART 2 +#define SOUND_WAVE 3 + extern DWORD soundtype; extern double g_fClksPerSpkrSample; +extern UINT g_quieterSpeaker; +extern short g_nSpeakerData; void SpkrDestroy (); void SpkrInitialize (); @@ -23,3 +30,5 @@ DWORD SpkrGetSnapshot(SS_IO_Speaker* pSS); DWORD SpkrSetSnapshot(SS_IO_Speaker* pSS); BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); + +