diff --git a/AppleWin/source/DiskImage.cpp b/AppleWin/source/DiskImage.cpp index 1f1b38a3..6478b0d2 100644 --- a/AppleWin/source/DiskImage.cpp +++ b/AppleWin/source/DiskImage.cpp @@ -435,9 +435,9 @@ static bool IsValidImageSize(DWORD uImageSize) bool bValidSize = false; - if (uImageSize >= TRACKS_STANDARD*TRACK_DENIBBLIZED_SIZE) + if (uImageSize >= (TRACKS_STANDARD+1)*TRACK_DENIBBLIZED_SIZE) { - // Is uImageSize == 140KB + n*4K? + // Is uImageSize == 140KB + n*4K? (where n>=1) bValidSize = (((uImageSize - TRACKS_STANDARD*TRACK_DENIBBLIZED_SIZE) % TRACK_DENIBBLIZED_SIZE) == 0); } else diff --git a/AppleWin/source/Frame.cpp b/AppleWin/source/Frame.cpp index 03c3eab6..427012ba 100644 --- a/AppleWin/source/Frame.cpp +++ b/AppleWin/source/Frame.cpp @@ -711,6 +711,8 @@ LRESULT CALLBACK FrameWndProc ( if (!g_bIsFullScreen) DrawButton((HDC)0,BTN_DRIVE1); SetForegroundWindow(window); + Sleep(500); // Wait for SetForegroundWindow() to take affect (400ms seems OK, so use 500ms to be sure) + SoundCore_TweakVolumes(); ProcessButtonClick(BTN_RUN); } else diff --git a/AppleWin/source/SoundCore.cpp b/AppleWin/source/SoundCore.cpp index ba2e3381..99e52bf7 100644 --- a/AppleWin/source/SoundCore.cpp +++ b/AppleWin/source/SoundCore.cpp @@ -421,6 +421,7 @@ void SoundCore_SetFade(eFADE FadeType) { // Note: Kludge for fading speaker if curr/last g_nAppMode is/was MODE_LOGO: // . Bug in DirectSound? SpeakerVoice.lpDSBvoice->SetVolume() doesn't work without this! + // . See SoundCore_TweakVolumes() - could be this? if((g_pVoices[i]->bIsSpeaker) && (g_nAppMode != MODE_LOGO) && (nLastMode != MODE_LOGO)) { g_pVoices[i]->lpDSBvoice->GetVolume(&g_pVoices[i]->nFadeVolume); @@ -454,6 +455,20 @@ void SoundCore_SetFade(eFADE FadeType) //----------------------------------------------------------------------------- +// If AppleWin started by double-clicking a .dsk, the our window won't have focus when volumes are set (so gets ignored). +// Subsequent setting (to the same volume) will get ignores, as DirectSound thinks that volume is already set. + +void SoundCore_TweakVolumes() +{ + for (UINT i=0; ilpDSBvoice->SetVolume(g_pVoices[i]->nVolume-1); + g_pVoices[i]->lpDSBvoice->SetVolume(g_pVoices[i]->nVolume); + } +} + +//----------------------------------------------------------------------------- + static UINT g_uDSInitRefCount = 0; bool DSInit() diff --git a/AppleWin/source/SoundCore.h b/AppleWin/source/SoundCore.h index 8707423f..79b7e606 100644 --- a/AppleWin/source/SoundCore.h +++ b/AppleWin/source/SoundCore.h @@ -33,6 +33,7 @@ bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSiz enum eFADE {FADE_NONE, FADE_IN, FADE_OUT}; void SoundCore_SetFade(eFADE FadeType); bool SoundCore_GetTimerState(); +void SoundCore_TweakVolumes(); bool DSInit(); void DSUninit();