aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-05-13 08:25:58 +0000
committerJames Brown2002-05-13 08:25:58 +0000
commit4466f1555b6158ec7f8e35f46def08c744b0ae1f (patch)
tree5c18e675712290fab11ac2993eae2ee9ad313119
parent2a53e8f661c06b79a9a2d7443f4fb1e6be71cf13 (diff)
downloadscummvm-rg350-4466f1555b6158ec7f8e35f46def08c744b0ae1f.tar.gz
scummvm-rg350-4466f1555b6158ec7f8e35f46def08c744b0ae1f.tar.bz2
scummvm-rg350-4466f1555b6158ec7f8e35f46def08c744b0ae1f.zip
The DIG SFX support - thanks to aquadran
svn-id: r4303
-rw-r--r--insane.cpp6
-rw-r--r--resource.cpp13
-rw-r--r--sound.cpp53
3 files changed, 63 insertions, 9 deletions
diff --git a/insane.cpp b/insane.cpp
index ee74e1779d..c6b42555e9 100644
--- a/insane.cpp
+++ b/insane.cpp
@@ -257,8 +257,10 @@ void SmushPlayer::parseIACT() {
break;
default :
- error("trk %d: unknown tag inside iMUS %08x",
- trk, _imusSubTag[idx]);
+ error("trk %d: unknown tag inside iMUS %08x [%c%c%c%c]",
+ trk, _imusSubTag[idx], _imusSubTag[idx] >> 24,
+ _imusSubTag[idx] >> 16, _imusSubTag[idx] >> 8,
+ _imusSubTag[idx]);
}
_imusSubSize[idx] -= sublen;
diff --git a/resource.cpp b/resource.cpp
index 6a823e617c..12bb6697a4 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -557,13 +557,12 @@ int Scumm::readSoundResource(int type, int idx)
basetag = fileReadDword();
total_size = fileReadDwordBE();
- if (_gameId == GID_SAMNMAX || _features & GF_AFTER_V7) {
- if (basetag == MKID('MIDI')) {
- fileSeek(_fileHandle, -8, SEEK_CUR);
- fileRead(_fileHandle, createResource(type, idx, total_size + 8),
- total_size + 8);
- return 1;
- }
+ //if (_gameId == GID_SAMNMAX || _features & GF_AFTER_V7) {
+ if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) {
+ fileSeek(_fileHandle, -8, SEEK_CUR);
+ fileRead(_fileHandle, createResource(type, idx, total_size + 8),
+ total_size + 8);
+ return 1;
} else if (basetag == MKID('SOU ')) {
best_pri = -1;
while (pos < total_size) {
diff --git a/sound.cpp b/sound.cpp
index 48b8505a6d..4b0477d771 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -87,6 +87,59 @@ void Scumm::processSoundQues()
data[1], data[2], data[3], data[4], data[5], data[6], data[7]
);
#endif
+ if ((_gameId == GID_DIG) && (data[0] == 12)){
+ uint32 size, rate, tag, chan;
+ uint8 * ptr = getResourceAddress(rtSound, data[1]);
+ if (ptr != NULL) {
+ ptr+=16; /* Skip header */
+ for (;;) {
+ tag = READ_BE_UINT32(ptr); ptr+=4;
+ switch(tag) {
+ case MKID_BE('FRMT'):
+ size = READ_BE_UINT32(ptr); ptr+=16;
+ rate = READ_BE_UINT32(ptr); ptr+=4;
+ chan = READ_BE_UINT32(ptr); ptr+=4;
+ break;
+ case MKID_BE('TEXT'):
+ case MKID_BE('REGN'):
+ case MKID_BE('STOP'):
+ size = READ_BE_UINT32(ptr); ptr+=size+4;
+ break;
+ case MKID_BE('DATA'):
+ size = READ_BE_UINT32(ptr); ptr+=4;
+ break;
+ default:
+ error("Unknown sfx header %c%c%c%c", tag>>24, tag>>16, tag>>8, tag);
+ }
+ if (tag == MKID_BE('DATA')) break;
+ }
+ if (chan == 1)
+ {
+ uint32 s_size = (size * 2) / 3;
+ byte * buffer = (byte*)malloc (s_size);
+ uint32 l = 0, r = 0, tmp;
+ memset (buffer, 0, s_size);
+ for (; l < size - 1; l += 3)
+ {
+ tmp = (ptr[l + 1] & 0x0f) << 8;
+ tmp = (tmp | ptr[l + 0]) << 4;
+ tmp -= 0x8000;
+// buffer[r++] = (uint8)(tmp & 0xff);
+ buffer[r++] = (uint8)((tmp >> 8) & 0xff);
+
+ tmp = (ptr[l + 1] & 0xf0) << 4;
+ tmp = (tmp | ptr[l + 2]) << 4;
+ tmp -= 0x8000;
+// buffer[r++] = (uint8)(tmp & 0xff);
+ buffer[r++] = (uint8)((tmp >> 8) & 0xff);
+ }
+ _mixer->play_raw(NULL, buffer, s_size, rate, SoundMixer::FLAG_AUTOFREE);
+ } else {
+ warning("DIG: ignoring stereo sample");
+ }
+ }
+ }
+
if (!(_features & GF_AFTER_V7)) {
if (se)
_vars[VAR_SOUNDRESULT] =