[Scummvm-cvs-logs] scummvm master -> 4a63352462dc32f52b46e7809acabacc3c2beb5d

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Jan 3 00:27:48 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4a63352462 SCI: sciAudio support for .wav + .aiff files


Commit: 4a63352462dc32f52b46e7809acabacc3c2beb5d
    https://github.com/scummvm/scummvm/commit/4a63352462dc32f52b46e7809acabacc3c2beb5d
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-01-03T00:27:42+01:00

Commit Message:
SCI: sciAudio support for .wav + .aiff files

Changed paths:
    engines/sci/sound/audio.cpp



diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 5d65f5e..57f0415 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 {






More information about the Scummvm-git-logs mailing list