aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2007-04-14 17:35:28 +0000
committerMax Horn2007-04-14 17:35:28 +0000
commit943656ab633f4353e8d09f1cac5ed27732107565 (patch)
tree1f4e2e82ee6b35c162a6279b0bed4a1071ea22c9
parent8f5abc1924d5d7bdbc9684b870394f93ad80d2ff (diff)
downloadscummvm-rg350-943656ab633f4353e8d09f1cac5ed27732107565.tar.gz
scummvm-rg350-943656ab633f4353e8d09f1cac5ed27732107565.tar.bz2
scummvm-rg350-943656ab633f4353e8d09f1cac5ed27732107565.zip
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
-rw-r--r--engines/saga/music.cpp18
-rw-r--r--engines/saga/music.h2
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);