From 7a86204e5cc1e38d0ce6a6095d339cda83f4704c Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 26 Jul 2010 18:13:35 +0000 Subject: SOUND: Move the Mac snd decoder from SCI to /sound For use with Kyra1 Mac instrument samples. T7G Mac and Loom Mac also use this format for their custom instrument samples. svn-id: r51327 --- engines/sci/sound/audio.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'engines/sci/sound/audio.cpp') diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 2e92754cad..4a2a8e65d7 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -36,6 +36,7 @@ #include "sound/audiostream.h" #include "sound/decoders/aiff.h" #include "sound/decoders/flac.h" +#include "sound/decoders/mac_snd.h" #include "sound/decoders/mp3.h" #include "sound/decoders/raw.h" #include "sound/decoders/vorbis.h" @@ -338,19 +339,9 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 } else if (audioRes->size > 14 && READ_BE_UINT16(audioRes->data) == 1 && READ_BE_UINT16(audioRes->data + 2) == 1 && READ_BE_UINT16(audioRes->data + 4) == 5 && READ_BE_UINT32(audioRes->data + 10) == 0x00018051) { // Mac snd detected - // See http://developer.apple.com/legacy/mac/library/documentation/mac/Sound/Sound-60.html#HEADING60-15 for more details + Common::MemoryReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO); - uint32 soundHeaderOffset = READ_BE_UINT32(audioRes->data + 16); - assert(READ_BE_UINT32(audioRes->data + soundHeaderOffset) == 0); - size = READ_BE_UINT32(audioRes->data + soundHeaderOffset + 4); - _audioRate = READ_BE_UINT16(audioRes->data + soundHeaderOffset + 8); // Really floating point, but we're just truncating - - if (*(audioRes->data + soundHeaderOffset + 20) != 0) - error("Unhandled Mac snd extended/compressed header"); - - data = (byte *)malloc(size); - memcpy(data, audioRes->data + soundHeaderOffset + 22, size); - flags = Audio::FLAG_UNSIGNED; + audioSeekStream = Audio::makeMacSndStream(sndStream, DisposeAfterUse::YES); } else { // SCI1 raw audio size = audioRes->size; -- cgit v1.2.3