aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsluicebox2019-10-21 11:09:28 -0700
committersluicebox2019-10-21 11:13:24 -0700
commit4b13347df8bd208d6bfbc9125d13e973f261469e (patch)
tree6cba614d5967bad5d7cd0a60138427f67ed40c07
parent4ed93d2bcb702f3030c4f26031aa87938eb82b48 (diff)
downloadscummvm-rg350-4b13347df8bd208d6bfbc9125d13e973f261469e.tar.gz
scummvm-rg350-4b13347df8bd208d6bfbc9125d13e973f261469e.tar.bz2
scummvm-rg350-4b13347df8bd208d6bfbc9125d13e973f261469e.zip
SCI32: Add support for AIFF audio
Used by at least LSL6 Mac CD for voices
-rw-r--r--engines/sci/sci.cpp1
-rw-r--r--engines/sci/sound/audio32.cpp22
2 files changed, 23 insertions, 0 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 09adf73d3b..f44bed6817 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -160,6 +160,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
SearchMan.addSubDirectoryMatching(gameDataDir, "Sound Folder"); // Mac audio files
SearchMan.addSubDirectoryMatching(gameDataDir, "Voices Folder", 0, 2, true); // Mac audio36 files (recursive for Torin)
SearchMan.addSubDirectoryMatching(gameDataDir, "Voices"); // Mac audio36 files
+ SearchMan.addSubDirectoryMatching(gameDataDir, "Voices/AUD#"); // LSL6 Mac audio36 files
SearchMan.addSubDirectoryMatching(gameDataDir, "VMD Folder"); // Mac VMD files
// Add the patches directory, except for KQ6CD; The patches folder in some versions of KQ6CD
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp
index 9bf08c5f74..0f08e803fb 100644
--- a/engines/sci/sound/audio32.cpp
+++ b/engines/sci/sound/audio32.cpp
@@ -22,6 +22,7 @@
#include "sci/sound/audio32.h"
#include "audio/audiostream.h" // for SeekableAudioStream
+#include "audio/decoders/aiff.h" // for makeAIFFStream
#include "audio/decoders/mac_snd.h" // for makeMacSndStream
#include "audio/decoders/raw.h" // for makeRawStream, RawFlags::FLAG_16BITS
#include "audio/decoders/wave.h" // for makeWAVStream
@@ -84,6 +85,25 @@ bool detectWaveAudio(Common::SeekableReadStream &stream) {
return true;
}
+bool detectAIFFAudio(Common::SeekableReadStream &stream) {
+ const size_t initialPosition = stream.pos();
+
+ byte blockHeader[8];
+ if (stream.read(blockHeader, sizeof(blockHeader)) != sizeof(blockHeader)) {
+ stream.seek(initialPosition);
+ return false;
+ }
+
+ stream.seek(initialPosition);
+ const uint32 headerType = READ_BE_UINT32(blockHeader);
+
+ if (headerType != MKTAG('F', 'O', 'R', 'M')) {
+ return false;
+ }
+
+ return true;
+}
+
bool detectMacSndAudio(Common::SeekableReadStream &stream) {
const size_t initialPosition = stream.pos();
@@ -811,6 +831,8 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool
audioStream = makeSOLStream(dataStream, DisposeAfterUse::YES);
} else if (detectWaveAudio(*dataStream)) {
audioStream = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
+ } else if (detectAIFFAudio(*dataStream)) {
+ audioStream = Audio::makeAIFFStream(dataStream, DisposeAfterUse::YES);
} else if (detectMacSndAudio(*dataStream)) {
audioStream = Audio::makeMacSndStream(dataStream, DisposeAfterUse::YES);
} else {