enhanced KidVid song skipping

removed clicks at end of songs
This commit is contained in:
Thomas Jentzsch 2022-09-05 23:15:21 +02:00
parent 5b2e714d4f
commit 201a2c909a
2 changed files with 11 additions and 5 deletions

View File

@ -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();

View File

@ -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};