diff options
author | Martin Kiewitz | 2016-01-03 00:07:05 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-01-03 00:07:05 +0100 |
commit | 30b554d69407abe82ba92bc956b4b82dd81f8e33 (patch) | |
tree | 61e52d62cea51fc698d597bf24ef227add0b6c75 /engines | |
parent | 4892bd806693693f0d82c4855c57a9745516cab5 (diff) | |
download | scummvm-rg350-30b554d69407abe82ba92bc956b4b82dd81f8e33.tar.gz scummvm-rg350-30b554d69407abe82ba92bc956b4b82dd81f8e33.tar.bz2 scummvm-rg350-30b554d69407abe82ba92bc956b4b82dd81f8e33.zip |
SCI: sciSound: check compression type
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sound/audio.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 7b9a8e0b67..5d65f5e17c 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -105,15 +105,32 @@ void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan else if (fileName.hasPrefix("speech")) soundType = Audio::Mixer::kSpeechSoundType; - Common::File *sciAudio = new Common::File(); + // Determine compression + // TODO: ".wav" and ".aiff" + uint32 audioCompressionType = 0; + if ((fileName.hasSuffix(".mp3")) || (fileName.hasSuffix(".sciAudio")) || (fileName.hasSuffix(".sciaudio"))) { + audioCompressionType = MKTAG('M','P','3',' '); + } else { + error("sciAudio: unsupported file type"); + } + + Common::File *sciAudioFile = new Common::File(); // Replace backwards slashes for (uint i = 0; i < fileName.size(); i++) { if (fileName[i] == '\\') fileName.setChar('/', i); } - sciAudio->open("sciAudio/" + fileName); + sciAudioFile->open("sciAudio/" + fileName); - Audio::SeekableAudioStream *audioStream = Audio::makeMP3Stream(sciAudio, DisposeAfterUse::YES); + Audio::SeekableAudioStream *audioStream = nullptr; + + switch (audioCompressionType) { + case MKTAG('M','P','3',' '): + audioStream = Audio::makeMP3Stream(sciAudioFile, DisposeAfterUse::YES); + break; + default: + break; + } // We only support one audio handle _mixer->playStream(soundType, &_audioHandle, |