From bd05d98fa5a60b10831d0356d93a6c22755ddf5e Mon Sep 17 00:00:00 2001 From: Dmitry Iskrich Date: Tue, 14 Jun 2016 19:47:17 +0300 Subject: DIRECTOR: Add support for to/from MCI play options --- engines/director/lingo/lingo-funcs.cpp | 5 +++-- engines/director/sound.cpp | 6 ++++-- engines/director/sound.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp index 059671b04d..6f4b1b22e9 100644 --- a/engines/director/lingo/lingo-funcs.cpp +++ b/engines/director/lingo/lingo-funcs.cpp @@ -142,8 +142,9 @@ int Lingo::func_mci(Common::String *s) { warning("Unknown alias %s", params[0].c_str()); return 0; } - //TODO seek - _vm->getSoundManager()->playMCI(*_audioAliases[params[0]]); + uint32 from = strtol(params[1].c_str(), 0, 10); + uint32 to = strtol(params[2].c_str(), 0, 10); + _vm->getSoundManager()->playMCI(*_audioAliases[params[0]], from, to); } break; default: diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp index ea8b78e1a4..5e32972248 100644 --- a/engines/director/sound.cpp +++ b/engines/director/sound.cpp @@ -67,8 +67,10 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) { _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound); } -void DirectorSound::playMCI(Audio::AudioStream &stream) { - _mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, &stream); +void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to) { + Audio::SeekableAudioStream *seekStream = dynamic_cast(&stream); + Audio::SubSeekableAudioStream *subSeekStream = new Audio::SubSeekableAudioStream(seekStream, Audio::Timestamp(from, seekStream->getRate()), Audio::Timestamp(to, seekStream->getRate())); + _mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, subSeekStream); } bool DirectorSound::isChannelActive(uint8 channelID) { diff --git a/engines/director/sound.h b/engines/director/sound.h index 3a56c989a6..87fd04d1a0 100644 --- a/engines/director/sound.h +++ b/engines/director/sound.h @@ -42,7 +42,7 @@ public: void playWAV(Common::String filename, uint8 channelID); void playAIFF(Common::String filename, uint8 channelID); - void playMCI(Audio::AudioStream &stream); + void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to); bool isChannelActive(uint8 channelID); void stopSound(); }; -- cgit v1.2.3