mirror of https://github.com/stella-emu/stella.git
enhanced KidVid song skipping
removed clicks at end of songs
This commit is contained in:
parent
5b2e714d4f
commit
201a2c909a
|
@ -79,7 +79,11 @@ void KidVid::update()
|
||||||
}
|
}
|
||||||
else if(myEvent.get(Event::RightKeyboard6))
|
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)
|
if(!myTape)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +139,7 @@ void KidVid::update()
|
||||||
if(mySongPlaying)
|
if(mySongPlaying)
|
||||||
{
|
{
|
||||||
mySongLength = mySound.wavSize();
|
mySongLength = mySound.wavSize();
|
||||||
myTapeBusy = (mySongLength > 262 * 48) || !myBeep;
|
myTapeBusy = (mySongLength > 262 * ClickFrames) || !myBeep;
|
||||||
// Check for end of played sample
|
// Check for end of played sample
|
||||||
if(mySongLength == 0)
|
if(mySongLength == 0)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +155,7 @@ void KidVid::update()
|
||||||
if(mySongLength)
|
if(mySongLength)
|
||||||
{
|
{
|
||||||
--mySongLength;
|
--mySongLength;
|
||||||
myTapeBusy = (mySongLength > 48);
|
myTapeBusy = (mySongLength > ClickFrames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,7 +258,7 @@ void KidVid::setNextSong()
|
||||||
myBeep = (ourSongPositions[mySongPointer] & 0x80) == 0;
|
myBeep = (ourSongPositions[mySongPointer] & 0x80) == 0;
|
||||||
|
|
||||||
const uInt8 temp = ourSongPositions[mySongPointer] & 0x7f;
|
const uInt8 temp = ourSongPositions[mySongPointer] & 0x7f;
|
||||||
mySongLength = ourSongStart[temp + 1] - ourSongStart[temp];
|
mySongLength = ourSongStart[temp + 1] - ourSongStart[temp] - 262 * ClickFrames;
|
||||||
|
|
||||||
// Play the WAV file
|
// Play the WAV file
|
||||||
const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName();
|
const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName();
|
||||||
|
|
|
@ -107,7 +107,8 @@ class KidVid : public Controller
|
||||||
NumBlocks = 6, // number of bytes / block
|
NumBlocks = 6, // number of bytes / block
|
||||||
NumBlockBits = NumBlocks * 8, // number of bits / block
|
NumBlockBits = NumBlocks * 8, // number of bits / block
|
||||||
SongPosSize = 44 + 38 + 42 + 62 + 80 + 62,
|
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
|
// Whether the KidVid device is enabled (only for games that it
|
||||||
|
@ -126,6 +127,7 @@ class KidVid : public Controller
|
||||||
bool mySongPlaying{false};
|
bool mySongPlaying{false};
|
||||||
// Continue song after loading state?
|
// Continue song after loading state?
|
||||||
bool myContinueSong{false};
|
bool myContinueSong{false};
|
||||||
|
|
||||||
uInt32 mySongPointer{0};
|
uInt32 mySongPointer{0};
|
||||||
uInt32 mySongLength{0};
|
uInt32 mySongLength{0};
|
||||||
bool myBeep{false};
|
bool myBeep{false};
|
||||||
|
|
Loading…
Reference in New Issue