diff options
author | Bastien Bouclet | 2017-07-10 21:36:19 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-27 06:40:07 +0200 |
commit | ec49730711399c7705211f76bf583ad73a681e16 (patch) | |
tree | cedf79022d82766108a26a589958cf5a43383ca8 /engines | |
parent | 22ce8dbf385c08a58222049333554ee206bf933d (diff) | |
download | scummvm-rg350-ec49730711399c7705211f76bf583ad73a681e16.tar.gz scummvm-rg350-ec49730711399c7705211f76bf583ad73a681e16.tar.bz2 scummvm-rg350-ec49730711399c7705211f76bf583ad73a681e16.zip |
VIDEO: Allow setting the mixer sound type used to play audio tracks
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/video/movie_decoder.cpp | 7 | ||||
-rw-r--r-- | engines/access/video/movie_decoder.h | 2 | ||||
-rw-r--r-- | engines/kyra/vqa.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/vqa.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/video32.cpp | 12 | ||||
-rw-r--r-- | engines/sherlock/scalpel/3do/movie_decoder.cpp | 5 | ||||
-rw-r--r-- | engines/sherlock/scalpel/3do/movie_decoder.h | 2 | ||||
-rw-r--r-- | engines/titanic/support/avi_surface.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/avi_surface.h | 7 | ||||
-rw-r--r-- | engines/voyeur/animation.cpp | 9 | ||||
-rw-r--r-- | engines/voyeur/animation.h | 5 | ||||
-rw-r--r-- | engines/zvision/video/zork_avi_decoder.cpp | 4 | ||||
-rw-r--r-- | engines/zvision/video/zork_avi_decoder.h | 3 |
13 files changed, 34 insertions, 31 deletions
diff --git a/engines/access/video/movie_decoder.cpp b/engines/access/video/movie_decoder.cpp index 1406e549ad..2b64af6267 100644 --- a/engines/access/video/movie_decoder.cpp +++ b/engines/access/video/movie_decoder.cpp @@ -152,7 +152,7 @@ bool AccessVIDMovieDecoder::loadStream(Common::SeekableReadStream *stream) { soundblasterRate = _stream->readByte(); audioSampleRate = 1000000 / (256 - soundblasterRate); - _audioTrack = new StreamAudioTrack(audioSampleRate); + _audioTrack = new StreamAudioTrack(audioSampleRate, getSoundType()); addTrack(_audioTrack); _stream->seek(chunkStartOffset); // seek back @@ -194,7 +194,7 @@ bool AccessVIDMovieDecoder::loadStream(Common::SeekableReadStream *stream) { // If sample rate was found, create an audio track if (audioSampleRate) { - _audioTrack = new StreamAudioTrack(audioSampleRate); + _audioTrack = new StreamAudioTrack(audioSampleRate, getSoundType()); addTrack(_audioTrack); } @@ -641,7 +641,8 @@ bool AccessVIDMovieDecoder::StreamVideoTrack::hasDirtyPalette() const { return _dirtyPalette; } -AccessVIDMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 sampleRate) { +AccessVIDMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 sampleRate, Audio::Mixer::SoundType soundType) : + AudioTrack(soundType) { _totalAudioQueued = 0; // currently 0 milliseconds queued _sampleRate = sampleRate; diff --git a/engines/access/video/movie_decoder.h b/engines/access/video/movie_decoder.h index 8b5d94836b..54b40e83bb 100644 --- a/engines/access/video/movie_decoder.h +++ b/engines/access/video/movie_decoder.h @@ -119,7 +119,7 @@ private: class StreamAudioTrack : public AudioTrack { public: - StreamAudioTrack(uint32 sampleRate); + StreamAudioTrack(uint32 sampleRate, Audio::Mixer::SoundType soundType); ~StreamAudioTrack(); void queueAudio(Common::SeekableReadStream *stream, byte chunkId); diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index cfd5f6ffc6..0ccf7ebe33 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -105,7 +105,7 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *stream) { case MKTAG('V','Q','H','D'): handleVQHD(_fileStream); if (_header.flags & 1) { - audioTrack = new VQAAudioTrack(&_header); + audioTrack = new VQAAudioTrack(&_header, getSoundType()); addTrack(audioTrack); } foundVQHD = true; @@ -282,7 +282,8 @@ void VQADecoder::readNextPacket() { // ----------------------------------------------------------------------- -VQADecoder::VQAAudioTrack::VQAAudioTrack(const VQAHeader *header) { +VQADecoder::VQAAudioTrack::VQAAudioTrack(const VQAHeader *header, Audio::Mixer::SoundType soundType) : + AudioTrack(soundType) { _audioStream = Audio::makeQueuingAudioStream(header->freq, false); } diff --git a/engines/kyra/vqa.h b/engines/kyra/vqa.h index d23704a9ea..df51a81988 100644 --- a/engines/kyra/vqa.h +++ b/engines/kyra/vqa.h @@ -80,7 +80,7 @@ private: class VQAAudioTrack : public AudioTrack { public: - VQAAudioTrack(const VQAHeader *header); + VQAAudioTrack(const VQAHeader *header, Audio::Mixer::SoundType soundType); ~VQAAudioTrack(); void handleSND0(Common::SeekableReadStream *stream); diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index da34a734e8..2b1f7219fd 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -328,8 +328,10 @@ void SEQPlayer::play(const Common::String &fileName, const int16 numTicks, const #pragma mark AVIPlayer AVIPlayer::AVIPlayer(EventManager *eventMan) : - VideoPlayer(eventMan, new Video::AVIDecoder(Audio::Mixer::kSFXSoundType)), - _status(kAVINotOpen) {} + VideoPlayer(eventMan, new Video::AVIDecoder()), + _status(kAVINotOpen) { + _decoder->setSoundType(Audio::Mixer::kSFXSoundType); +} AVIPlayer::IOStatus AVIPlayer::open(const Common::String &fileName) { if (_status != kAVINotOpen) { @@ -981,11 +983,13 @@ void VMDPlayer::restrictPalette(const uint8 startColor, const int16 endColor) { #pragma mark DuckPlayer DuckPlayer::DuckPlayer(EventManager *eventMan, SegManager *segMan) : - VideoPlayer(eventMan, new Video::AVIDecoder(Audio::Mixer::kSFXSoundType)), + VideoPlayer(eventMan, new Video::AVIDecoder()), _plane(nullptr), _status(kDuckClosed), _volume(Audio::Mixer::kMaxChannelVolume), - _doFrameOut(false) {} + _doFrameOut(false) { + _decoder->setSoundType(Audio::Mixer::kSFXSoundType); +} void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, const int16 x, const int16 y) { if (_status != kDuckClosed) { diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp index bd2f44209f..d14c46e56b 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.cpp +++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp @@ -146,7 +146,7 @@ bool Scalpel3DOMovieDecoder::loadStream(Common::SeekableReadStream *stream) { _stream->readUint32BE(); // Unknown 0x00000004 compression ratio? _stream->readUint32BE(); // Unknown 0x00000A2C - _audioTrack = new StreamAudioTrack(audioCodecTag, audioSampleRate, audioChannels); + _audioTrack = new StreamAudioTrack(audioCodecTag, audioSampleRate, audioChannels, getSoundType()); addTrack(_audioTrack); break; @@ -393,7 +393,8 @@ void Scalpel3DOMovieDecoder::StreamVideoTrack::decodeFrame(Common::SeekableReadS _curFrame++; } -Scalpel3DOMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels) { +Scalpel3DOMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels, Audio::Mixer::SoundType soundType) : + AudioTrack(soundType) { switch (codecTag) { case MKTAG('A','D','P','4'): case MKTAG('S','D','X','2'): diff --git a/engines/sherlock/scalpel/3do/movie_decoder.h b/engines/sherlock/scalpel/3do/movie_decoder.h index 73b125443b..68fed10b78 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.h +++ b/engines/sherlock/scalpel/3do/movie_decoder.h @@ -88,7 +88,7 @@ private: class StreamAudioTrack : public AudioTrack { public: - StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels); + StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels, Audio::Mixer::SoundType soundType); ~StreamAudioTrack(); void queueAudio(Common::SeekableReadStream *stream, uint32 size); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 28b509a297..e52c2a7ea5 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -52,7 +52,7 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) { _priorFrame = -1; // Create a decoder - _decoder = new AVIDecoder(Audio::Mixer::kPlainSoundType); + _decoder = new AVIDecoder(); if (!_decoder->loadFile(_movieName)) error("Could not open video - %s", key.getString().c_str()); diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index b7afac3988..fd21c9ceab 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -43,10 +43,9 @@ enum MovieFlag { class AVIDecoder : public Video::AVIDecoder { public: - AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : - Video::AVIDecoder(soundType) {} - AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : - Video::AVIDecoder(frameRateOverride, soundType) {} + AVIDecoder() {} + AVIDecoder(const Common::Rational &frameRateOverride) : + Video::AVIDecoder(frameRateOverride) {} /** * Returns the number of video tracks the decoder has diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp index d5d58a2fd3..5a5f4c2ad3 100644 --- a/engines/voyeur/animation.cpp +++ b/engines/voyeur/animation.cpp @@ -34,7 +34,7 @@ namespace Voyeur { // Number of audio frames to keep audio track topped up when playing back video #define SOUND_FRAMES_READAHEAD 3 -RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { +RL2Decoder::RL2Decoder() { _paletteStart = 0; _fileStream = nullptr; _soundFrameNumber = -1; @@ -76,7 +76,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) { // Add an audio track if sound is present _audioTrack = nullptr; if (_header._soundRate) { - _audioTrack = new RL2AudioTrack(_header, stream, _soundType); + _audioTrack = new RL2AudioTrack(_header, stream, getSoundType()); addTrack(_audioTrack); } @@ -433,8 +433,9 @@ Graphics::Surface *RL2Decoder::RL2VideoTrack::getBackSurface() { /*------------------------------------------------------------------------*/ -RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType): - _header(header), _soundType(soundType) { +RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType) : + AudioTrack(soundType), + _header(header) { // Create audio straem for the audio track _audStream = Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2); } diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h index c20ccf7284..fbb0cc90d0 100644 --- a/engines/voyeur/animation.h +++ b/engines/voyeur/animation.h @@ -88,7 +88,6 @@ private: class RL2AudioTrack : public AudioTrack { private: - Audio::Mixer::SoundType _soundType; const RL2FileHeader &_header; Audio::QueuingAudioStream *_audStream; protected: @@ -98,7 +97,6 @@ private: Audio::Mixer::SoundType soundType); ~RL2AudioTrack(); - Audio::Mixer::SoundType getSoundType() const { return _soundType; } int numQueuedStreams() const { return _audStream->numQueuedStreams(); } virtual bool isSeekable() const { return true; } virtual bool seek(const Audio::Timestamp &time) { return true; } @@ -156,7 +154,6 @@ private: RL2AudioTrack *_audioTrack; RL2VideoTrack *_videoTrack; Common::SeekableReadStream *_fileStream; - Audio::Mixer::SoundType _soundType; RL2FileHeader _header; int _paletteStart; Common::Array<SoundFrame> _soundFrames; @@ -171,7 +168,7 @@ private: virtual bool seekIntern(const Audio::Timestamp &time); public: - RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + RL2Decoder(); virtual ~RL2Decoder(); virtual void close(); diff --git a/engines/zvision/video/zork_avi_decoder.cpp b/engines/zvision/video/zork_avi_decoder.cpp index 412cd456ef..314f00da0d 100644 --- a/engines/zvision/video/zork_avi_decoder.cpp +++ b/engines/zvision/video/zork_avi_decoder.cpp @@ -35,10 +35,10 @@ namespace ZVision { Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) { if (wvInfo.tag != kWaveFormatZorkPCM) - return new AVIAudioTrack(sHeader, wvInfo, _soundType); + return new AVIAudioTrack(sHeader, wvInfo, getSoundType()); assert(wvInfo.size == 8); - return new ZorkAVIAudioTrack(sHeader, wvInfo, _soundType); + return new ZorkAVIAudioTrack(sHeader, wvInfo, getSoundType()); } ZorkAVIDecoder::ZorkAVIAudioTrack::ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) : diff --git a/engines/zvision/video/zork_avi_decoder.h b/engines/zvision/video/zork_avi_decoder.h index 8befaf5f5f..69a5e0a1fd 100644 --- a/engines/zvision/video/zork_avi_decoder.h +++ b/engines/zvision/video/zork_avi_decoder.h @@ -31,8 +31,7 @@ namespace ZVision { class ZorkAVIDecoder : public Video::AVIDecoder { public: - ZorkAVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) : - Video::AVIDecoder(soundType) {} + ZorkAVIDecoder() {} virtual ~ZorkAVIDecoder() {} |