diff options
author | Max Horn | 2010-01-08 22:05:12 +0000 |
---|---|---|
committer | Max Horn | 2010-01-08 22:05:12 +0000 |
commit | 7efba850648777d2d562bfccf2f14868816d6391 (patch) | |
tree | 5feb2d3593335133b72bebee12acbcb426a7d886 /engines | |
parent | 95726dfe50eae85d0e7675f8891339fb0abb43fd (diff) | |
download | scummvm-rg350-7efba850648777d2d562bfccf2f14868816d6391.tar.gz scummvm-rg350-7efba850648777d2d562bfccf2f14868816d6391.tar.bz2 scummvm-rg350-7efba850648777d2d562bfccf2f14868816d6391.zip |
Switch Tinsel, MADE and some of the video players to QueuedAudioStream
svn-id: r47178
Diffstat (limited to 'engines')
-rw-r--r-- | engines/made/pmvplayer.cpp | 4 | ||||
-rw-r--r-- | engines/made/pmvplayer.h | 2 | ||||
-rw-r--r-- | engines/tinsel/bmv.cpp | 30 | ||||
-rw-r--r-- | engines/tinsel/bmv.h | 4 |
4 files changed, 19 insertions, 21 deletions
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index ee41fe3cda..c0dad218c0 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -102,7 +102,7 @@ bool PmvPlayer::play(const char *filename) { // TODO: Sound can still be a little choppy. A bug in the decoder or - // perhaps more likely - do we have to implement double buffering to // get it to work well? - _audioStream = Audio::makeAppendableAudioStream(soundFreq, Audio::Mixer::FLAG_UNSIGNED); + _audioStream = Audio::makeQueuedAudioStream(soundFreq, false); while (!_vm->shouldQuit() && !_aborted && !_fd->eos() && frameNumber < frameCount) { @@ -140,7 +140,7 @@ bool PmvPlayer::play(const char *filename) { soundSize = chunkCount * chunkSize; soundData = new byte[soundSize]; decompressSound(audioData + 8, soundData, chunkSize, chunkCount); - _audioStream->queueBuffer(soundData, soundSize); + _audioStream->queueBuffer(soundData, soundSize, Audio::Mixer::FLAG_UNSIGNED); } // Handle palette diff --git a/engines/made/pmvplayer.h b/engines/made/pmvplayer.h index e20aff12e1..bfdda4fa2e 100644 --- a/engines/made/pmvplayer.h +++ b/engines/made/pmvplayer.h @@ -50,7 +50,7 @@ protected: MadeEngine *_vm; Audio::Mixer *_mixer; Common::File *_fd; - Audio::AppendableAudioStream *_audioStream; + Audio::QueuedAudioStream *_audioStream; Audio::SoundHandle _audioStreamHandle; byte _paletteRGB[768]; Graphics::Surface *_surface; diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index 7d3481bafc..0a6e6536a0 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -311,11 +311,11 @@ void BMVPlayer::InitBMV(byte *memoryBuffer) { memset(memoryBuffer, 0, SCREEN_WIDE); memset(memoryBuffer + SCREEN_WIDE * (SCREEN_HIGH + 1), 0, SCREEN_WIDE); - if (audioStream) { - _vm->_mixer->stopHandle(audioHandle); + if (_audioStream) { + _vm->_mixer->stopHandle(_audioHandle); - delete audioStream; - audioStream = 0; + delete _audioStream; + _audioStream = 0; } // Set the screen beginning to the second line (ie. past the off-screen line) @@ -397,7 +397,7 @@ BMVPlayer::BMVPlayer() { ScreenBeg = 0; screenBuffer = 0; audioStarted = 0; - audioStream = 0; + _audioStream = 0; nextMaintain = 0; } @@ -423,9 +423,7 @@ void BMVPlayer::MoviePalette(int paletteOffset) { } void BMVPlayer::InitialiseMovieSound() { - audioStream = - Audio::makeAppendableAudioStream(22050, - Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_STEREO); + _audioStream = Audio::makeQueuedAudioStream(22050, true); audioStarted = false; } @@ -433,11 +431,11 @@ void BMVPlayer::StartMovieSound() { } void BMVPlayer::FinishMovieSound() { - if (audioStream) { - _vm->_mixer->stopHandle(audioHandle); + if (_audioStream) { + _vm->_mixer->stopHandle(_audioHandle); - delete audioStream; - audioStream = 0; + delete _audioStream; + _audioStream = 0; } } @@ -455,12 +453,12 @@ void BMVPlayer::MovieAudio(int audioOffset, int blobs) { else memset(data, 0, blobs * 128); - audioStream->queueBuffer(data, blobs * 128); + _audioStream->queueBuffer(data, blobs * 128, Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_STEREO); if (currentSoundFrame == ADVANCE_SOUND) { if (!audioStarted) { _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, - &audioHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, false); + &_audioHandle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, false); audioStarted = true; } } @@ -1204,12 +1202,12 @@ bool BMVPlayer::MoviePlaying() { * Returns the audio lag in ms */ int32 BMVPlayer::MovieAudioLag() { - if (!bMovieOn || !audioStream) + if (!bMovieOn || !_audioStream) return 0; // Calculate lag int32 playLength = (movieTick - startTick - 1) * ((((uint32) 1000) << 10) / 24); - return (playLength - (((int32) _vm->_mixer->getSoundElapsedTime(audioHandle)) << 10)) >> 10; + return (playLength - (((int32) _vm->_mixer->getSoundElapsedTime(_audioHandle)) << 10)) >> 10; } uint32 BMVPlayer::NextMovieTime() { diff --git a/engines/tinsel/bmv.h b/engines/tinsel/bmv.h index a4e70a9efc..82aadd5748 100644 --- a/engines/tinsel/bmv.h +++ b/engines/tinsel/bmv.h @@ -113,8 +113,8 @@ class BMVPlayer { bool audioStarted; - Audio::AppendableAudioStream *audioStream; - Audio::SoundHandle audioHandle; + Audio::QueuedAudioStream *_audioStream; + Audio::SoundHandle _audioHandle; int nextMaintain; public: |