diff options
author | Andre Heider | 2009-10-03 19:29:14 +0000 |
---|---|---|
committer | Andre Heider | 2009-10-03 19:29:14 +0000 |
commit | bbb3cc808601af2535b888528d9500c224c01ad6 (patch) | |
tree | 45321354f6374773351982b0283a1d275c87b0bc | |
parent | 29bb8a59eeb9ad7f6cd2fa77c58e8cfc10f40ee7 (diff) | |
download | scummvm-rg350-bbb3cc808601af2535b888528d9500c224c01ad6.tar.gz scummvm-rg350-bbb3cc808601af2535b888528d9500c224c01ad6.tar.bz2 scummvm-rg350-bbb3cc808601af2535b888528d9500c224c01ad6.zip |
If make*Stream failed, the file needs to be closed to prevent an assert on a consecutive open().
svn-id: r44557
-rw-r--r-- | engines/sword1/music.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index fb9068dde7..352cc11043 100644 --- a/engines/sword1/music.cpp +++ b/engines/sword1/music.cpp @@ -213,27 +213,40 @@ bool MusicHandle::play(const char *fileBase, bool loop) { #ifdef USE_FLAC if (!_audioSource) { sprintf(fileName, "%s.flac", fileBase); - if (_file.open(fileName)) + if (_file.open(fileName)) { _audioSource = Audio::makeFlacStream(&_file, false, 0, 0, loop ? 0 : 1); + if (!_audioSource) + _file.close(); + } } + if (!_audioSource) { sprintf(fileName, "%s.fla", fileBase); - if (_file.open(fileName)) + if (_file.open(fileName)) { _audioSource = Audio::makeFlacStream(&_file, false, 0, 0, loop ? 0 : 1); + if (!_audioSource) + _file.close(); + } } #endif #ifdef USE_VORBIS if (!_audioSource) { sprintf(fileName, "%s.ogg", fileBase); - if (_file.open(fileName)) + if (_file.open(fileName)) { _audioSource = Audio::makeVorbisStream(&_file, false, 0, 0, loop ? 0 : 1); + if (!_audioSource) + _file.close(); + } } #endif #ifdef USE_MAD if (!_audioSource) { sprintf(fileName, "%s.mp3", fileBase); - if (_file.open(fileName)) + if (_file.open(fileName)) { _audioSource = Audio::makeMP3Stream(&_file, false, 0, 0, loop ? 0 : 1); + if (!_audioSource) + _file.close(); + } } #endif if (!_audioSource) { |