From a588d6e3e219e7fd6119f573b50465653648d021 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 29 Oct 2011 02:50:52 +0200 Subject: KYRA: Add another delay for new tracks in the AdLib driver. This is to play really safe and to avoid messing up of sound data. --- engines/kyra/sound_adlib.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 46d407a640..b04abea080 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -618,6 +618,11 @@ void AdLibDriver::setupPrograms() { channel.volumeModifier = _sfxVolume; unkOutput2(chan); + + // We need to wait two callback calls till we can start another track. + // This is (probably) required to assure that the sfx are started with + // the correct priority and velocity. + _programStartTimeout = 2; } } @@ -1331,6 +1336,9 @@ int AdLibDriver::update_setupProgram(uint8 *&dataptr, Channel &channel, uint8 va Channel &channel2 = _channels[chan]; if (priority >= channel2.priority) { + // We keep new tracks from being started for two further iterations of + // the callback. This assures the correct velocity is used for this + // program. _programStartTimeout = 2; initChannel(channel2); channel2.priority = priority; -- cgit v1.2.3