aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-03 00:26:56 +0100
committerMartin Kiewitz2016-01-03 00:27:42 +0100
commit4a63352462dc32f52b46e7809acabacc3c2beb5d (patch)
tree502848f46155ea584cdc7a6149f9cdd7b231c096
parent35f08ca0fbcead4f18b65baba35f83c3e9f2a914 (diff)
downloadscummvm-rg350-4a63352462dc32f52b46e7809acabacc3c2beb5d.tar.gz
scummvm-rg350-4a63352462dc32f52b46e7809acabacc3c2beb5d.tar.bz2
scummvm-rg350-4a63352462dc32f52b46e7809acabacc3c2beb5d.zip
SCI: sciAudio support for .wav + .aiff files
-rw-r--r--engines/sci/sound/audio.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 5d65f5e17c..57f0415285 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -79,7 +79,6 @@ void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan
Common::String command = segMan->getString(commandReg);
if (command == "play" || command == "playx") {
-#ifdef USE_MAD
reg_t fileNameReg = readSelector(segMan, sciAudioObject, kernel->findSelector("fileName"));
Common::String fileName = segMan->getString(fileNameReg);
@@ -106,10 +105,13 @@ void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan
soundType = Audio::Mixer::kSpeechSoundType;
// 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 if (fileName.hasSuffix(".wav")) {
+ audioCompressionType = MKTAG('W','A','V',' ');
+ } else if (fileName.hasSuffix(".aiff")) {
+ audioCompressionType = MKTAG('A','I','F','F');
} else {
error("sciAudio: unsupported file type");
}
@@ -122,20 +124,31 @@ void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan
}
sciAudioFile->open("sciAudio/" + fileName);
- Audio::SeekableAudioStream *audioStream = nullptr;
+ Audio::RewindableAudioStream *audioStream = nullptr;
switch (audioCompressionType) {
case MKTAG('M','P','3',' '):
+#ifdef USE_MAD
audioStream = Audio::makeMP3Stream(sciAudioFile, DisposeAfterUse::YES);
+#endif
+ break;
+ case MKTAG('W','A','V',' '):
+ audioStream = Audio::makeWAVStream(sciAudioFile, DisposeAfterUse::YES);
+ break;
+ case MKTAG('A','I','F','F'):
+ audioStream = Audio::makeAIFFStream(sciAudioFile, DisposeAfterUse::YES);
break;
default:
break;
}
+ if (!audioStream) {
+ error("sciAudio: requested compression not compiled into ScummVM");
+ }
+
// We only support one audio handle
_mixer->playStream(soundType, &_audioHandle,
Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audioStream, loopCount));
-#endif
} else if (command == "stop") {
_mixer->stopHandle(_audioHandle);
} else {