diff options
author | sluicebox | 2019-10-21 11:09:28 -0700 |
---|---|---|
committer | sluicebox | 2019-10-21 11:13:24 -0700 |
commit | 4b13347df8bd208d6bfbc9125d13e973f261469e (patch) | |
tree | 6cba614d5967bad5d7cd0a60138427f67ed40c07 /engines/sci/sound | |
parent | 4ed93d2bcb702f3030c4f26031aa87938eb82b48 (diff) | |
download | scummvm-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
Diffstat (limited to 'engines/sci/sound')
-rw-r--r-- | engines/sci/sound/audio32.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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 { |