diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index 0246b8691..8bc44f28a 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -79,7 +79,11 @@ void KidVid::update() } else if(myEvent.get(Event::RightKeyboard6)) { - mySound.stopWav(); + // Some first songs trigger a sequence of timed actions, they cannot be skipped + if(mySongPointer && + ourSongPositions[mySongPointer - 1] != 0 && // First song of all BBears games + ourSongPositions[mySongPointer - 1] != 11) // First song of Harmony Smurf + mySound.stopWav(); } if(!myTape) { @@ -135,7 +139,7 @@ void KidVid::update() if(mySongPlaying) { mySongLength = mySound.wavSize(); - myTapeBusy = (mySongLength > 262 * 48) || !myBeep; + myTapeBusy = (mySongLength > 262 * ClickFrames) || !myBeep; // Check for end of played sample if(mySongLength == 0) { @@ -151,7 +155,7 @@ void KidVid::update() if(mySongLength) { --mySongLength; - myTapeBusy = (mySongLength > 48); + myTapeBusy = (mySongLength > ClickFrames); } } } @@ -254,7 +258,7 @@ void KidVid::setNextSong() myBeep = (ourSongPositions[mySongPointer] & 0x80) == 0; const uInt8 temp = ourSongPositions[mySongPointer] & 0x7f; - mySongLength = ourSongStart[temp + 1] - ourSongStart[temp]; + mySongLength = ourSongStart[temp + 1] - ourSongStart[temp] - 262 * ClickFrames; // Play the WAV file const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName(); diff --git a/src/emucore/KidVid.hxx b/src/emucore/KidVid.hxx index 5f65711f6..c845f20cd 100644 --- a/src/emucore/KidVid.hxx +++ b/src/emucore/KidVid.hxx @@ -107,7 +107,8 @@ class KidVid : public Controller NumBlocks = 6, // number of bytes / block NumBlockBits = NumBlocks * 8, // number of bits / block SongPosSize = 44 + 38 + 42 + 62 + 80 + 62, - SongStartSize = 104 + SongStartSize = 104, + ClickFrames = 48 // eliminate click noise at song end ; // Whether the KidVid device is enabled (only for games that it @@ -126,6 +127,7 @@ class KidVid : public Controller bool mySongPlaying{false}; // Continue song after loading state? bool myContinueSong{false}; + uInt32 mySongPointer{0}; uInt32 mySongLength{0}; bool myBeep{false};