TOUCHE: Simplify external digital music support slightly.

Checked with valgrind and no leaks are evident.
Thanks to LordHoto for suggesting these changes.
This commit is contained in:
D G Turner 2012-12-16 16:44:34 +00:00
parent 74cd6a4d26
commit c14f45ee05
2 changed files with 4 additions and 6 deletions

View File

@ -3342,13 +3342,12 @@ void ToucheEngine::startMusic(int num) {
_midiPlayer->play(_fData, size, true);
} else {
Common::String extMusicFilename = Common::String::format("track%02d", num);
_extMusicFileStream = Audio::SeekableAudioStream::openStreamFile(extMusicFilename);
if (!_extMusicFileStream) {
Audio::SeekableAudioStream *extMusicFileStream = Audio::SeekableAudioStream::openStreamFile(extMusicFilename);
if (!extMusicFileStream) {
error("Unable to open %s for reading", extMusicFilename.c_str());
}
Audio::LoopingAudioStream *loopStream = new Audio::LoopingAudioStream(_extMusicFileStream, 0);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopStream);
_mixer->setChannelVolume(_musicHandle, _musicVolume);
Audio::LoopingAudioStream *loopStream = new Audio::LoopingAudioStream(extMusicFileStream, 0);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopStream, -1, _musicVolume);
}
}

View File

@ -649,7 +649,6 @@ protected:
int _musicVolume;
Audio::SoundHandle _musicHandle;
Audio::SeekableAudioStream *_extMusicFileStream;
void initMusic();
public: // To allow access from console