From a2e355d6715ffd6aa121c7dfdc357e56906c9ae8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 6 Apr 2008 13:57:28 +0000 Subject: Implemented fadeout waiting in KyraEngine_v2::enterNewScene for AdLib. svn-id: r31424 --- engines/kyra/scene_v2.cpp | 2 +- engines/kyra/sound.h | 1 + engines/kyra/sound_adlib.cpp | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index 4b3242b724..ef9fde2eea 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -115,7 +115,7 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk if (newSoundFile) { if (_sound->getMusicType() == Sound::kAdlib) { - while (0/*snd_isPlaying()*/) + while (((SoundAdlibPC*)_sound)->isPlaying()) _system->delayMillis(10); } else { while (waitTime > _system->getMillis()) diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 29308f5b04..70936b0191 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -240,6 +240,7 @@ public: void playTrack(uint8 track); void haltTrack(); + bool isPlaying(); void playSoundEffect(uint8 track); diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index dea54e37a0..a0445006c2 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -112,7 +112,7 @@ private: int snd_setSoundData(va_list &list); int snd_unkOpcode1(va_list &list); int snd_startSong(va_list &list); - int snd_unkOpcode2(va_list &list); + int snd_isChannelPlaying(va_list &list); int snd_unkOpcode3(va_list &list); int snd_readByte(va_list &list); int snd_writeByte(va_list &list); @@ -543,8 +543,10 @@ int AdlibDriver::snd_startSong(va_list &list) { return 0; } -int AdlibDriver::snd_unkOpcode2(va_list &list) { - warning("unimplemented snd_unkOpcode2"); +int AdlibDriver::snd_isChannelPlaying(va_list &list) { + int channel = va_arg(list, int); + if (_channels[channel].dataptr) + return 1; return 0; } @@ -1888,7 +1890,7 @@ void AdlibDriver::setupOpcodeList() { COMMAND(snd_setSoundData), COMMAND(snd_unkOpcode1), COMMAND(snd_startSong), - COMMAND(snd_unkOpcode2), + COMMAND(snd_isChannelPlaying), COMMAND(snd_unkOpcode3), COMMAND(snd_readByte), COMMAND(snd_writeByte), @@ -2274,6 +2276,10 @@ void SoundAdlibPC::haltTrack() { //_vm->_system->delayMillis(3 * 60); } +bool SoundAdlibPC::isPlaying() { + return _driver->callback(7, int(0)); +} + void SoundAdlibPC::playSoundEffect(uint8 track) { if (_sfxEnabled) play(track); -- cgit v1.2.3