aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2010-07-26 18:13:35 +0000
committerMatthew Hoops2010-07-26 18:13:35 +0000
commit7a86204e5cc1e38d0ce6a6095d339cda83f4704c (patch)
tree4f676dded353c93f44aae6a11bf1ea742ad88751 /engines
parent5fb760b053db695fdcf2222ae8e462bc5b300663 (diff)
downloadscummvm-rg350-7a86204e5cc1e38d0ce6a6095d339cda83f4704c.tar.gz
scummvm-rg350-7a86204e5cc1e38d0ce6a6095d339cda83f4704c.tar.bz2
scummvm-rg350-7a86204e5cc1e38d0ce6a6095d339cda83f4704c.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sound/audio.cpp15
1 files changed, 3 insertions, 12 deletions
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;