From 10f7e805c20c164a7b3a20832237341136165e28 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 27 May 2012 21:18:32 -0400 Subject: VIDEO: Add volume/balance control to VideoDecoder --- engines/sci/video/robot_decoder.cpp | 12 +++++++++++- engines/sci/video/robot_decoder.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'engines/sci') diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp index 77f45e0788..95b3c2abc1 100644 --- a/engines/sci/video/robot_decoder.cpp +++ b/engines/sci/video/robot_decoder.cpp @@ -116,7 +116,7 @@ bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) { if (_header.hasSound) { _audioStream = Audio::makeQueuingAudioStream(11025, false); - _mixer->playStream(Audio::Mixer::kMusicSoundType, &_audioHandle, _audioStream); + _mixer->playStream(Audio::Mixer::kMusicSoundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance()); } readPaletteChunk(_header.paletteDataSize); @@ -361,6 +361,16 @@ void RobotDecoder::close() { reset(); } +void RobotDecoder::updateVolume() { + if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) + g_system->getMixer()->setChannelVolume(_audioHandle, getVolume()); +} + +void RobotDecoder::updateBalance() { + if (g_system->getMixer()->isSoundHandleActive(_audioHandle)) + g_system->getMixer()->setChannelBalance(_audioHandle, getBalance()); +} + #endif } // End of namespace Sci diff --git a/engines/sci/video/robot_decoder.h b/engines/sci/video/robot_decoder.h index 3f93582418..e9cefe7d91 100644 --- a/engines/sci/video/robot_decoder.h +++ b/engines/sci/video/robot_decoder.h @@ -71,6 +71,11 @@ public: Common::Point getPos() const { return _pos; } protected: + // VideoDecoder API + void updateVolume(); + void updateBalance(); + + // FixedRateVideoDecoder API Common::Rational getFrameRate() const { return Common::Rational(60, 10); } private: -- cgit v1.2.3