[Scummvm-cvs-logs] scummvm master -> d67f9b89f275ddb092d0b833b7ca9adf6a722c5a
clone2727
clone2727 at gmail.com
Mon May 28 20:10:52 CEST 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
10f7e805c2 VIDEO: Add volume/balance control to VideoDecoder
d67f9b89f2 MOHAWK: Use video volume control in Riven
Commit: 10f7e805c20c164a7b3a20832237341136165e28
https://github.com/scummvm/scummvm/commit/10f7e805c20c164a7b3a20832237341136165e28
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-05-28T11:00:16-07:00
Commit Message:
VIDEO: Add volume/balance control to VideoDecoder
Changed paths:
engines/agos/animation.cpp
engines/agos/animation.h
engines/sci/video/robot_decoder.cpp
engines/sci/video/robot_decoder.h
engines/sword25/fmv/theora_decoder.cpp
engines/sword25/fmv/theora_decoder.h
video/avi_decoder.cpp
video/avi_decoder.h
video/bink_decoder.cpp
video/bink_decoder.h
video/coktel_decoder.cpp
video/coktel_decoder.h
video/psx_decoder.cpp
video/psx_decoder.h
video/qt_decoder.cpp
video/qt_decoder.h
video/smk_decoder.cpp
video/smk_decoder.h
video/video_decoder.cpp
video/video_decoder.h
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 29d1b36..10c0174 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -333,7 +333,7 @@ void MoviePlayerDXA::startSound() {
if (_bgSoundStream != NULL) {
_vm->_mixer->stopHandle(_bgSound);
- _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream, -1, getVolume(), getBalance());
}
}
@@ -399,6 +399,16 @@ bool MoviePlayerDXA::processFrame() {
return false;
}
+void MoviePlayerDXA::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_bgSound))
+ g_system->getMixer()->setChannelVolume(_bgSound, getVolume());
+}
+
+void MoviePlayerDXA::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_bgSound))
+ g_system->getMixer()->setChannelBalance(_bgSound, getBalance());
+}
+
///////////////////////////////////////////////////////////////////////////////
// Movie player for Smacker movies
///////////////////////////////////////////////////////////////////////////////
diff --git a/engines/agos/animation.h b/engines/agos/animation.h
index 11936aa..d1ff074 100644
--- a/engines/agos/animation.h
+++ b/engines/agos/animation.h
@@ -83,6 +83,11 @@ public:
void nextFrame();
virtual void stopVideo();
+protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
private:
void handleNextFrame();
bool processFrame();
diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index 77f45e0..95b3c2a 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 3f93582..e9cefe7 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:
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
index 082c569..d38f5a2 100644
--- a/engines/sword25/fmv/theora_decoder.cpp
+++ b/engines/sword25/fmv/theora_decoder.cpp
@@ -289,7 +289,7 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
}
if (_audStream)
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _audHandle, _audStream);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _audHandle, _audStream, -1, getVolume(), getBalance());
} else {
// tear down the partial vorbis setup
vorbis_info_clear(&_vorbisInfo);
@@ -550,6 +550,16 @@ void TheoraDecoder::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer) {
Graphics::convertYUV420ToRGB(&_surface, YUVBuffer[kBufferY].data, YUVBuffer[kBufferU].data, YUVBuffer[kBufferV].data, YUVBuffer[kBufferY].width, YUVBuffer[kBufferY].height, YUVBuffer[kBufferY].stride, YUVBuffer[kBufferU].stride);
}
+void TheoraDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(*_audHandle))
+ g_system->getMixer()->setChannelVolume(*_audHandle, getVolume());
+}
+
+void TheoraDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(*_audHandle))
+ g_system->getMixer()->setChannelBalance(*_audHandle, getBalance());
+}
+
} // End of namespace Sword25
#endif
diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h
index 4fd7cc0..7390400 100644
--- a/engines/sword25/fmv/theora_decoder.h
+++ b/engines/sword25/fmv/theora_decoder.h
@@ -87,6 +87,9 @@ public:
bool endOfVideo() const;
protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
void pauseVideoIntern(bool pause);
private:
diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp
index 28fa712..2ea7e8d 100644
--- a/video/avi_decoder.cpp
+++ b/video/avi_decoder.cpp
@@ -262,7 +262,7 @@ bool AviDecoder::loadStream(Common::SeekableReadStream *stream) {
// Initialize the video stuff too
_audStream = createAudioStream();
if (_audStream)
- _mixer->playStream(_soundType, _audHandle, _audStream);
+ _mixer->playStream(_soundType, _audHandle, _audStream, -1, getVolume(), getBalance());
debug (0, "Frames = %d, Dimensions = %d x %d", _header.totalFrames, _header.width, _header.height);
debug (0, "Frame Rate = %d", _vidsHeader.rate / _vidsHeader.scale);
@@ -451,4 +451,14 @@ void AviDecoder::queueAudioBuffer(uint32 chunkSize) {
}
}
+void AviDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(*_audHandle))
+ g_system->getMixer()->setChannelVolume(*_audHandle, getVolume());
+}
+
+void AviDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(*_audHandle))
+ g_system->getMixer()->setChannelBalance(*_audHandle, getBalance());
+}
+
} // End of namespace Video
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index edd08c4..fb4dae6 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -202,6 +202,11 @@ public:
bool hasDirtyPalette() const { return _dirtyPalette; }
protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
+ // FixedRateVideoDecoder API
Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); }
private:
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 4738c3c..538487f 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -120,7 +120,7 @@ void BinkDecoder::startAudio() {
const AudioTrack &audio = _audioTracks[_audioTrack];
_audioStream = Audio::makeQueuingAudioStream(audio.outSampleRate, audio.outChannels == 2);
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance());
} // else no audio
}
@@ -1647,4 +1647,14 @@ void BinkDecoder::IDCTPut(DecodeContext &ctx, int16 *block) {
}
}
+void BinkDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelVolume(_audioHandle, getVolume());
+}
+
+void BinkDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelBalance(_audioHandle, getBalance());
+}
+
} // End of namespace Video
diff --git a/video/bink_decoder.h b/video/bink_decoder.h
index f1eadc6..a5e1b10 100644
--- a/video/bink_decoder.h
+++ b/video/bink_decoder.h
@@ -78,7 +78,12 @@ public:
// Bink specific
bool loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format);
+
protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
static const int kAudioChannelsMax = 2;
static const int kAudioBlockSizeMax = (kAudioChannelsMax << 11);
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index ae0c35c..be36874 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -1292,7 +1292,7 @@ void IMDDecoder::processFrame() {
// Start the audio stream if necessary
if (startSound && _soundEnabled) {
_mixer->playStream(_soundType, &_audioHandle, _audioStream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ -1, getVolume(), getBalance(), DisposeAfterUse::NO);
_soundStage = kSoundPlaying;
}
@@ -1474,6 +1474,16 @@ Graphics::PixelFormat IMDDecoder::getPixelFormat() const {
return Graphics::PixelFormat::createFormatCLUT8();
}
+void IMDDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelVolume(_audioHandle, getVolume());
+}
+
+void IMDDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelBalance(_audioHandle, getBalance());
+}
+
VMDDecoder::File::File() {
offset = 0;
@@ -2161,7 +2171,7 @@ void VMDDecoder::processFrame() {
if (startSound && _soundEnabled) {
if (_hasSound && _audioStream) {
_mixer->playStream(_soundType, &_audioHandle, _audioStream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ -1, getVolume(), getBalance(), DisposeAfterUse::NO);
_soundStage = kSoundPlaying;
} else
_soundStage = kSoundNone;
@@ -2687,6 +2697,16 @@ bool VMDDecoder::isPaletted() const {
return _isPaletted;
}
+void VMDDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelVolume(_audioHandle, getVolume());
+}
+
+void VMDDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelBalance(_audioHandle, getBalance());
+}
+
} // End of namespace Video
#endif // VIDEO_COKTELDECODER_H
diff --git a/video/coktel_decoder.h b/video/coktel_decoder.h
index b99a44f..68696d5 100644
--- a/video/coktel_decoder.h
+++ b/video/coktel_decoder.h
@@ -284,6 +284,11 @@ public:
Graphics::PixelFormat getPixelFormat() const;
+protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
private:
enum Command {
kCommandNextSound = 0xFF00,
@@ -388,6 +393,11 @@ public:
Graphics::PixelFormat getPixelFormat() const;
+protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
private:
enum PartType {
kPartTypeSeparator = 0,
diff --git a/video/psx_decoder.cpp b/video/psx_decoder.cpp
index 74f740f..df91a2b 100644
--- a/video/psx_decoder.cpp
+++ b/video/psx_decoder.cpp
@@ -385,7 +385,7 @@ void PSXStreamDecoder::queueAudioFromSector(Common::SeekableReadStream *sector)
uint rate = (format & (1 << 2)) ? 18900 : 37800;
_audStream = Audio::makeQueuingAudioStream(rate, stereo);
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream, -1, getVolume(), getBalance());
}
sector->seek(24);
@@ -694,4 +694,14 @@ void PSXStreamDecoder::decodeBlock(Common::BitStream *bits, byte *block, int pit
}
}
+void PSXStreamDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_audHandle))
+ g_system->getMixer()->setChannelVolume(_audHandle, getVolume());
+}
+
+void PSXStreamDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_audHandle))
+ g_system->getMixer()->setChannelBalance(_audHandle, getBalance());
+}
+
} // End of namespace Video
diff --git a/video/psx_decoder.h b/video/psx_decoder.h
index 3695cb0..4364ec4 100644
--- a/video/psx_decoder.h
+++ b/video/psx_decoder.h
@@ -81,6 +81,11 @@ public:
Graphics::PixelFormat getPixelFormat() const { return _surface->format; }
bool endOfVideo() const { return _stream->pos() >= _stream->size(); }
+protected:
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
private:
void initCommon();
Common::SeekableReadStream *_stream;
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 585f592..aba545a 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -97,7 +97,7 @@ void QuickTimeDecoder::startAudio() {
updateAudioBuffer();
for (uint32 i = 0; i < _audioTracks.size(); i++) {
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandles[i], _audioTracks[i], -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandles[i], _audioTracks[i], -1, getVolume(), getBalance(), DisposeAfterUse::NO);
// Pause the audio again if we're still paused
if (isPaused())
@@ -236,6 +236,18 @@ bool QuickTimeDecoder::loadStream(Common::SeekableReadStream *stream) {
return true;
}
+void QuickTimeDecoder::updateVolume() {
+ for (uint32 i = 0; i < _audioHandles.size(); i++)
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandles[i]))
+ g_system->getMixer()->setChannelVolume(_audioHandles[i], getVolume());
+}
+
+void QuickTimeDecoder::updateBalance() {
+ for (uint32 i = 0; i < _audioHandles.size(); i++)
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandles[i]))
+ g_system->getMixer()->setChannelBalance(_audioHandles[i], getBalance());
+}
+
void QuickTimeDecoder::init() {
Audio::QuickTimeAudioDecoder::init();
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 1f614df..ce32562 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -133,6 +133,10 @@ protected:
Common::QuickTimeParser::SampleDesc *readSampleDesc(Track *track, uint32 format);
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
private:
void init();
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp
index 439fe90..359f4cb 100644
--- a/video/smk_decoder.cpp
+++ b/video/smk_decoder.cpp
@@ -667,7 +667,7 @@ void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpac
}
if (!_audioStarted) {
- _mixer->playStream(_soundType, &_audioHandle, _audioStream, -1, 255);
+ _mixer->playStream(_soundType, &_audioHandle, _audioStream, -1, getVolume(), getBalance());
_audioStarted = true;
}
} else {
@@ -819,4 +819,14 @@ void SmackerDecoder::unpackPalette() {
free(chunk);
}
+void SmackerDecoder::updateVolume() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelVolume(_audioHandle, getVolume());
+}
+
+void SmackerDecoder::updateBalance() {
+ if (g_system->getMixer()->isSoundHandleActive(_audioHandle))
+ g_system->getMixer()->setChannelBalance(_audioHandle, getBalance());
+}
+
} // End of namespace Video
diff --git a/video/smk_decoder.h b/video/smk_decoder.h
index fd5d658..516882e 100644
--- a/video/smk_decoder.h
+++ b/video/smk_decoder.h
@@ -77,9 +77,15 @@ public:
virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);
protected:
- Common::Rational getFrameRate() const { return _frameRate; }
Common::SeekableReadStream *_fileStream;
+ // VideoDecoder API
+ void updateVolume();
+ void updateBalance();
+
+ // FixedRateVideoDecoder API
+ Common::Rational getFrameRate() const { return _frameRate; }
+
protected:
void unpackPalette();
// Possible runs of blocks
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index ae82a33..44d7917 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -22,6 +22,8 @@
#include "video/video_decoder.h"
+#include "audio/mixer.h" // for kMaxChannelVolume
+
#include "common/rational.h"
#include "common/file.h"
#include "common/system.h"
@@ -61,6 +63,8 @@ void VideoDecoder::reset() {
_curFrame = -1;
_startTime = 0;
_pauseLevel = 0;
+ _audioVolume = Audio::Mixer::kMaxChannelVolume;
+ _audioBalance = 0;
}
bool VideoDecoder::endOfVideo() const {
@@ -94,6 +98,16 @@ void VideoDecoder::resetPauseStartTime() {
_pauseStartTime = g_system->getMillis();
}
+void VideoDecoder::setVolume(byte volume) {
+ _audioVolume = volume;
+ updateVolume();
+}
+
+void VideoDecoder::setBalance(int8 balance) {
+ _audioBalance = balance;
+ updateBalance();
+}
+
uint32 FixedRateVideoDecoder::getTimeToNextFrame() const {
if (endOfVideo() || _curFrame < 0)
return 0;
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 2b99a2b..3bb75ad 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -185,6 +185,40 @@ public:
*/
bool isPaused() const { return _pauseLevel != 0; }
+ /**
+ * Get the current volume at which the audio in the video is being played
+ * @return the current volume at which the audio in the video is being played
+ */
+ virtual byte getVolume() const { return _audioVolume; }
+
+ /**
+ * Set the volume at which the audio in the video should be played.
+ * This setting remains until reset() is called (which may be called
+ * from loadStream() or close()). The default volume is the maximum.
+ *
+ * @note This function calls updateVolume() by default.
+ *
+ * @param volume The volume at which to play the audio in the video
+ */
+ virtual void setVolume(byte volume);
+
+ /**
+ * Get the current balance at which the audio in the video is being played
+ * @return the current balance at which the audio in the video is being played
+ */
+ virtual int8 getBalance() const { return _audioBalance; }
+
+ /**
+ * Set the balance at which the audio in the video should be played.
+ * This setting remains until reset() is called (which may be called
+ * from loadStream() or close()). The default balance is 0.
+ *
+ * @note This function calls updateBalance() by default.
+ *
+ * @param balance The balance at which to play the audio in the video
+ */
+ virtual void setBalance(int8 balance);
+
protected:
/**
* Resets _curFrame and _startTime. Should be called from every close() function.
@@ -207,12 +241,24 @@ protected:
*/
void resetPauseStartTime();
+ /**
+ * Update currently playing audio tracks with the new volume setting
+ */
+ virtual void updateVolume() {}
+
+ /**
+ * Update currently playing audio tracks with the new balance setting
+ */
+ virtual void updateBalance() {}
+
int32 _curFrame;
int32 _startTime;
private:
uint32 _pauseLevel;
uint32 _pauseStartTime;
+ byte _audioVolume;
+ int8 _audioBalance;
};
/**
Commit: d67f9b89f275ddb092d0b833b7ca9adf6a722c5a
https://github.com/scummvm/scummvm/commit/d67f9b89f275ddb092d0b833b7ca9adf6a722c5a
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-05-28T11:05:17-07:00
Commit Message:
MOHAWK: Use video volume control in Riven
Changed paths:
engines/mohawk/video.cpp
engines/mohawk/video.h
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 83fca9a..c10b986 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -315,7 +315,7 @@ VideoHandle VideoManager::playMovieRiven(uint16 id) {
for (uint16 i = 0; i < _mlstRecords.size(); i++)
if (_mlstRecords[i].code == id) {
debug(1, "Play tMOV %d (non-blocking) at (%d, %d) %s", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0 ? "looping" : "non-looping");
- return createVideoHandle(_mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0);
+ return createVideoHandle(_mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top, _mlstRecords[i].loop != 0, _mlstRecords[i].volume);
}
return NULL_VID_HANDLE;
@@ -371,7 +371,7 @@ void VideoManager::disableAllMovies() {
_videoStreams[i].enabled = false;
}
-VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop) {
+VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop, byte volume) {
// First, check to see if that video is already playing
for (uint32 i = 0; i < _videoStreams.size(); i++)
if (_videoStreams[i].id == id)
@@ -381,6 +381,7 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
Video::QuickTimeDecoder *decoder = new Video::QuickTimeDecoder();
decoder->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, id));
decoder->loadStream(_vm->getResource(ID_TMOV, id));
+ decoder->setVolume(volume);
VideoEntry entry;
entry.clear();
@@ -403,7 +404,7 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
return _videoStreams.size() - 1;
}
-VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop) {
+VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop, byte volume) {
// First, check to see if that video is already playing
for (uint32 i = 0; i < _videoStreams.size(); i++)
if (_videoStreams[i].filename == filename)
@@ -426,6 +427,7 @@ VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint
}
entry->loadStream(file);
+ entry->setVolume(volume);
// Search for any deleted videos so we can take a formerly used slot
for (uint32 i = 0; i < _videoStreams.size(); i++)
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 8736782..98bcadf 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -120,8 +120,8 @@ private:
// Keep tabs on any videos playing
Common::Array<VideoEntry> _videoStreams;
- VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop);
- VideoHandle createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop);
+ VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop, byte volume = 0xff);
+ VideoHandle createVideoHandle(const Common::String &filename, uint16 x, uint16 y, bool loop, byte volume = 0xff);
};
} // End of namespace Mohawk
More information about the Scummvm-git-logs
mailing list