mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
MORTEVIELLE: Fix leak in playSong, refactor it a bit
This commit is contained in:
parent
0d2f812387
commit
80cc1700a7
@ -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())
|
||||
;
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user