diff options
author | Dmitry Iskrich | 2016-06-11 19:29:23 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | e4428587b763b0f1da48de9decf251f98ddd3f00 (patch) | |
tree | 1d1e1e34c90848ccc73535b5c526a8f0f57610dc /engines | |
parent | 049500d5ba26854034a04b6cd1a0305f79c8da24 (diff) | |
download | scummvm-rg350-e4428587b763b0f1da48de9decf251f98ddd3f00.tar.gz scummvm-rg350-e4428587b763b0f1da48de9decf251f98ddd3f00.tar.bz2 scummvm-rg350-e4428587b763b0f1da48de9decf251f98ddd3f00.zip |
DIRECTOR: Support 2 tracking sound system
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/director.cpp | 2 | ||||
-rw-r--r-- | engines/director/score.cpp | 5 | ||||
-rw-r--r-- | engines/director/score.h | 4 | ||||
-rw-r--r-- | engines/director/sound.cpp | 33 | ||||
-rw-r--r-- | engines/director/sound.h | 9 |
5 files changed, 38 insertions, 15 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 3a39886b8f..00bf7b960c 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -78,7 +78,7 @@ Common::Error DirectorEngine::run() { _mainArchive = new RIFFArchive(); _mainArchive->openFile("bookshelf_example.mmm"); - Score score(*_mainArchive, *_lingo); + Score score(*_mainArchive, *_lingo, *_soundManager); score.startLoop(); if (getPlatform() == Common::kPlatformWindows) diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 948d83d6f6..a426e2b5cb 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -30,6 +30,7 @@ #include "director/dib.h" #include "director/resource.h" #include "director/lingo/lingo.h" +#include "director/sound.h" #include "graphics/palette.h" #include "common/events.h" @@ -38,12 +39,12 @@ namespace Director { -Score::Score(Archive &movie, Lingo &lingo) { +Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) { _surface = new Graphics::ManagedSurface; _movieArchive = &movie; _lingo = &lingo; - + _soundManager = &soundManager; _lingo->processEvent(kEventPrepareMovie, 0); assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024)); diff --git a/engines/director/score.h b/engines/director/score.h index ac43c1a227..b68cc40d55 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -33,6 +33,7 @@ namespace Director { class Lingo; +class DirectorSound; #define CHANNEL_COUNT 24 @@ -264,7 +265,7 @@ public: class Score { public: - Score(Archive &movie, Lingo &lingo); + Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager); ~Score(); static Common::Rect readRect(Common::SeekableReadStream &stream); void startLoop(); @@ -311,6 +312,7 @@ private: Archive *_movieArchive; Graphics::ManagedSurface *_surface; Lingo *_lingo; + DirectorSound *_soundManager; }; } //End of namespace Director diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp index 35071c8072..8c757e256d 100644 --- a/engines/director/sound.cpp +++ b/engines/director/sound.cpp @@ -30,11 +30,12 @@ namespace Director { DirectorSound::DirectorSound() { - _soundHandle = new Audio::SoundHandle(); + _sound1 = new Audio::SoundHandle(); + _sound2 = new Audio::SoundHandle(); _mixer = g_system->getMixer(); } -void DirectorSound::playWAV(Common::String filename) { +void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) { Common::File *file = new Common::File(); if (!file->open(filename)) { @@ -43,12 +44,14 @@ void DirectorSound::playWAV(Common::String filename) { return; } - Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES); - _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound); + Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES); + if (soundChannel == 1) + _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound); + else + _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound); } -void DirectorSound::playAIFF(Common::String filename) { - +void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) { Common::File *file = new Common::File(); if (!file->open(filename)) { warning("Failed to open %s", filename.c_str()); @@ -57,11 +60,25 @@ void DirectorSound::playAIFF(Common::String filename) { } Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES); - _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound); + if (soundChannel == 1) + _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound); + else + _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound); +} + +bool DirectorSound::isChannelActive(uint8 channelID) { + if (channelID == 1) { + return _mixer->isSoundHandleActive(*_sound1); + } else if (channelID == 2) { + return _mixer->isSoundHandleActive(*_sound2); + } + error("Incorrect sound channel"); + return false; } void DirectorSound::stopSound() { - _mixer->stopHandle(*_soundHandle); + _mixer->stopHandle(*_sound1); + _mixer->stopHandle(*_sound2); } } //End of namespace Director diff --git a/engines/director/sound.h b/engines/director/sound.h index 3d842c8b51..8f36a3e247 100644 --- a/engines/director/sound.h +++ b/engines/director/sound.h @@ -32,14 +32,17 @@ namespace Director { class DirectorSound { private: - Audio::SoundHandle *_soundHandle; + Audio::SoundHandle *_sound1; + Audio::SoundHandle *_sound2; + Audio::Mixer *_mixer; public: DirectorSound(); - void playWAV(Common::String filename); - void playAIFF(Common::String filename); + void playWAV(Common::String filename, uint8 channelID); + void playAIFF(Common::String filename, uint8 channelID); + bool isChannelActive(uint8 channelID); void stopSound(); }; |