From 943656ab633f4353e8d09f1cac5ed27732107565 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 14 Apr 2007 17:35:28 +0000 Subject: Replaced the use of DigitalTrackInfo objects (which were being leaked, BTW) with a call to openStreamFile (code completely *untested*, so it might not work properly yet). Note the new FIXME comment regarding the playback duration svn-id: r26473 --- engines/saga/music.cpp | 18 ++++++++++-------- engines/saga/music.h | 2 -- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index fc031c07ce..b8199bd854 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -307,8 +307,6 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver, int enable _songTableLen = 0; _songTable = 0; - _track = NULL; - _midiMusicData = NULL; } @@ -411,13 +409,17 @@ void Music::play(uint32 resourceId, MusicFlags flags) { } // Try to open standalone digital track - for (int i = 0; i < ARRAYSIZE(TRACK_FORMATS) - 1; ++i) - if ((_track = TRACK_FORMATS[i].openTrackFunction(realTrackNumber))) { - break; + char trackName[2][16]; + sprintf(trackName[0], "track%d", realTrackNumber); + sprintf(trackName[1], "track%02d", realTrackNumber); + Audio::AudioStream *stream = 0; + for (int i = 0; i < 2; ++i) { + // FIXME: Do we really want a duration of 10000 frames = 133 seconds, or is that just a random value? + stream = Audio::AudioStream::openStreamFile(trackName[i], 0, 10000, (flags == MUSIC_LOOP) ? 0 : 1); + if (stream) { + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, stream); + return; } - if (_track) { - _track->play(_mixer, &_musicHandle, (flags == MUSIC_LOOP) ? -1 : 1, 0, 10000); - return; } if (_vm->getGameType() == GType_ITE) { diff --git a/engines/saga/music.h b/engines/saga/music.h index b02c8c9eb1..4e14f3fc01 100644 --- a/engines/saga/music.h +++ b/engines/saga/music.h @@ -137,8 +137,6 @@ private: MidiParser *xmidiParser; MidiParser *smfParser; - Audio::DigitalTrackInfo *_track; - byte *_midiMusicData; static void musicVolumeGaugeCallback(void *refCon); -- cgit v1.2.3