From f382321fb3da513f1075cb24998fdf1d5ce8ff39 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Dec 2015 21:20:22 +0200 Subject: LAB: Reorder a function --- engines/lab/music.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index e6ad392029..391200ce09 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -62,6 +62,22 @@ byte Music::getSoundFlags() { return soundFlags; } +void Music::changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos) { + if (storeCurPos) + _storedPos = _musicFile->pos(); + + _musicPaused = false; + stopSoundEffect(); + freeMusic(); + _musicFile = _vm->_resource->openDataFile(filename); + if (seektoStoredPos) + _musicFile->seek(_storedPos); + + Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags()); + Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0); + _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopingAudioStream); +} + void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) { pauseBackMusic(); stopSoundEffect(); @@ -130,22 +146,6 @@ void Music::checkRoomMusic() { _curRoomMusic = _vm->_roomNum; } -void Music::changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos) { - if (storeCurPos) - _storedPos = _musicFile->pos(); - - _musicPaused = false; - stopSoundEffect(); - freeMusic(); - _musicFile = _vm->_resource->openDataFile(filename); - if (seektoStoredPos) - _musicFile->seek(_storedPos); - - Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags()); - Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0); - _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopingAudioStream); -} - bool Music::loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished) { Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F')); stopSoundEffect(); -- cgit v1.2.3