diff options
| author | Sven Hesse | 2011-01-20 17:07:17 +0000 |
|---|---|---|
| committer | Sven Hesse | 2011-01-20 17:07:17 +0000 |
| commit | 33ed3fa8a072c5260c1dd5c6662fc2162470bd04 (patch) | |
| tree | 7a095054a0192c4555c92dfa47b43d43ddf29723 /graphics | |
| parent | 715560edb9e369fe5e55567d3725e853b11e3e91 (diff) | |
| download | scummvm-rg350-33ed3fa8a072c5260c1dd5c6662fc2162470bd04.tar.gz scummvm-rg350-33ed3fa8a072c5260c1dd5c6662fc2162470bd04.tar.bz2 scummvm-rg350-33ed3fa8a072c5260c1dd5c6662fc2162470bd04.zip | |
VIDEO: Don't delete, just finish the audiostream on video end
svn-id: r55356
Diffstat (limited to 'graphics')
| -rw-r--r-- | graphics/video/coktel_decoder.cpp | 33 | ||||
| -rw-r--r-- | graphics/video/coktel_decoder.h | 7 |
2 files changed, 22 insertions, 18 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index cb1d968d16..d95f4a89c0 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -200,19 +200,18 @@ void CoktelDecoder::enableSound() { void CoktelDecoder::disableSound() { if (_audioStream) { - - if (_soundStage == kSoundPlaying) { + if ((_soundStage == kSoundPlaying) || (_soundStage == kSoundFinished)) { _audioStream->finish(); _mixer->stopHandle(_audioHandle); - } else - delete _audioStream; + } + delete _audioStream; } _soundEnabled = false; _soundStage = kSoundNone; - _audioStream = 0; + _audioStream = 0; } void CoktelDecoder::colorModeChanged() { @@ -1275,16 +1274,15 @@ void IMDDecoder::processFrame() { // Start the audio stream if necessary if (startSound && _soundEnabled) { - _mixer->playStream(_soundType, &_audioHandle, _audioStream); + _mixer->playStream(_soundType, &_audioHandle, _audioStream, + -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); _soundStage = kSoundPlaying; } // End the audio stream if necessary if ((_curFrame >= (int32)(_frameCount - 1)) && (_soundStage == kSoundPlaying)) { _audioStream->finish(); - _mixer->stopHandle(_audioHandle); - _audioStream = 0; - _soundStage = kSoundNone; + _soundStage = kSoundFinished; } } @@ -1419,7 +1417,9 @@ bool IMDDecoder::initialSoundSlice(bool hasNextCmd) { return false; } - if (!_audioStream) { + if (!_audioStream || (_soundStage == kSoundFinished)) { + delete _audioStream; + _audioStream = Audio::makeQueuingAudioStream(_soundFreq, false); _soundStage = kSoundLoaded; } @@ -1550,7 +1550,11 @@ bool VMDDecoder::seek(int32 frame, int whence, bool restart) { return true; // Restart sound - if (_hasSound && (frame == -1) && (_soundStage == kSoundNone) && !_audioStream) { + if (_hasSound && (frame == -1) && + ((_soundStage == kSoundNone) || (_soundStage == kSoundFinished))) { + + delete _audioStream; + _soundStage = kSoundLoaded; _audioStream = Audio::makeQueuingAudioStream(_soundFreq, _soundStereo != 0); } @@ -2150,7 +2154,8 @@ void VMDDecoder::processFrame() { if (startSound && _soundEnabled) { if (_hasSound && _audioStream) { - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream); + _mixer->playStream(_soundType, &_audioHandle, _audioStream, + -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); _soundStage = kSoundPlaying; } else _soundStage = kSoundNone; @@ -2158,9 +2163,7 @@ void VMDDecoder::processFrame() { if (((uint32)_curFrame == (_frameCount - 1)) && (_soundStage == 2)) { _audioStream->finish(); - _mixer->stopHandle(_audioHandle); - _audioStream = 0; - _soundStage = kSoundNone; + _soundStage = kSoundFinished; } } diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h index 441bdc8184..9d99215ab5 100644 --- a/graphics/video/coktel_decoder.h +++ b/graphics/video/coktel_decoder.h @@ -136,9 +136,10 @@ public: protected: enum SoundStage { - kSoundNone = 0, ///< No sound. - kSoundLoaded = 1, ///< Sound loaded. - kSoundPlaying = 2 ///< Sound is playing. + kSoundNone = 0, ///< No sound. + kSoundLoaded = 1, ///< Sound loaded. + kSoundPlaying = 2, ///< Sound is playing. + kSoundFinished = 3 ///< No more new sound data. }; enum Features { |
