diff options
author | Strangerke | 2013-08-05 00:13:57 +0200 |
---|---|---|
committer | Strangerke | 2013-08-05 00:13:57 +0200 |
commit | 80cc1700a7a3e151f25a45dcad868b4d5b62d334 (patch) | |
tree | 9767ff694c3608b7786fa7e888f113a32cae5019 /engines | |
parent | 0d2f81238720bef663f96942b2036e1e59e1f689 (diff) | |
download | scummvm-rg350-80cc1700a7a3e151f25a45dcad868b4d5b62d334.tar.gz scummvm-rg350-80cc1700a7a3e151f25a45dcad868b4d5b62d334.tar.bz2 scummvm-rg350-80cc1700a7a3e151f25a45dcad868b4d5b62d334.zip |
MORTEVIELLE: Fix leak in playSong, refactor it a bit
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mortevielle/sound.cpp | 7 | ||||
-rw-r--r-- | engines/mortevielle/sound.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 042097f52c..bfdadaa048 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -185,10 +185,11 @@ void SoundManager::playNote(int frequency, int32 length) { } -void SoundManager::playSong(const byte* buf, int size, int loops) { - Audio::AudioStream *stream = Audio::makeLoopingAudioStream(Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS), loops); +void SoundManager::playSong(const byte* buf, uint size, uint loops) { + Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS, DisposeAfterUse::NO); + Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; - _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) ; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index ee6aaff4ad..1f9e0d9c4d 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -106,7 +106,7 @@ public: void playNote(int frequency, int32 length); int decodeMusic(const byte *PSrc, byte *PDest, int size); - void playSong(const byte *buf, int size, int loops = 1); + void playSong(const byte *buf, uint usize, uint loops); void litph(tablint &t, int typ, int tempo); }; |