diff options
author | Paweł Kołodziejski | 2003-12-26 22:53:30 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2003-12-26 22:53:30 +0000 |
commit | 160b94fdaaa585f0af5a9d6dde3b2a839109d663 (patch) | |
tree | dfa8a399bb59514ae38f52fee78c57aea0c0a65b | |
parent | ec56e09af6a56e7d90bf97ed5723b21e7f2fcb26 (diff) | |
download | scummvm-rg350-160b94fdaaa585f0af5a9d6dde3b2a839109d663.tar.gz scummvm-rg350-160b94fdaaa585f0af5a9d6dde3b2a839109d663.tar.bz2 scummvm-rg350-160b94fdaaa585f0af5a9d6dde3b2a839109d663.zip |
added handing voc loops
svn-id: r11951
-rw-r--r-- | scumm/imuse_digi.cpp | 9 | ||||
-rw-r--r-- | sound/voc.cpp | 15 | ||||
-rw-r--r-- | sound/voc.h | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index 4a25804be2..350bcca4c1 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -777,7 +777,7 @@ void IMuseDigital::setBundleVoice(byte *src) { } void IMuseDigital::startSound(int sound) { - debug(5, "IMuseDigital::startSound(%d)", sound); + debug(0, "IMuseDigital::startSound(%d)", sound); int l, r; for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) { @@ -835,7 +835,8 @@ void IMuseDigital::startSound(int sound) { _voiceVocData = NULL; } else if (READ_UINT32(ptr) == MKID('Crea')) { - byte *t_ptr= readCreativeVoc(ptr, size, _channel[l].freq); + int32 loops = 0; + byte *t_ptr= readCreativeVoc(ptr, size, _channel[l].freq, loops); _channel[l].mixerSize = _channel[l].freq * 2; _channel[l].size = size * 2; _channel[l].bits = 8; @@ -998,7 +999,7 @@ void IMuseDigital::startSound(int sound) { } void IMuseDigital::stopSound(int sound) { - debug(5, "IMuseDigital::stopSound(%d)", sound); + debug(0, "IMuseDigital::stopSound(%d)", sound); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { if ((_channel[l].idSound == sound) && _channel[l].used) { _channel[l].toBeRemoved = true; @@ -1233,7 +1234,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int } int IMuseDigital::getSoundStatus(int sound) const { - debug(5, "IMuseDigital::getSoundStatus(%d)", sound); + debug(0, "IMuseDigital::getSoundStatus(%d)", sound); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { if ((_channel[l].idSound == sound) && _channel[l].used) { return 1; diff --git a/sound/voc.cpp b/sound/voc.cpp index 2fc77e6781..b0429ce2ac 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -26,23 +26,27 @@ #include "sound/voc.h" -byte *readCreativeVoc(byte *ptr, int32 &size, int &rate) { +byte *readCreativeVoc(byte *ptr, int32 &size, int &rate, int32 &loops) { + assert(strncmp((char *)ptr, "Creative Voice File\x1A", 20) == 0); int32 offset = READ_LE_UINT16(ptr + 20); int16 version = READ_LE_UINT16(ptr + 22); int16 code = READ_LE_UINT16(ptr + 24); assert(version == 0x010A || version == 0x0114); assert(code == ~version + 0x1234); + bool quit = 0; - byte *ret_sound = 0; size = 0; - int loops = 0; + byte *ret_sound = 0; + size = 0; + while (!quit) { int len = READ_LE_UINT32(ptr + offset); offset += 4; code = len & 0xFF; len >>= 8; switch(code) { - case 0: quit = 1; break; + case 0: quit = 1; + break; case 1: { int time_constant = ptr[offset++]; int packing = ptr[offset++]; @@ -62,7 +66,8 @@ byte *readCreativeVoc(byte *ptr, int32 &size, int &rate) { } } break; case 6: // begin of loop - loops = len + 1; + loops = (uint16)READ_LE_UINT16(ptr + offset); + warning("voc loops: %d", loops); break; case 7: // end of loop break; diff --git a/sound/voc.h b/sound/voc.h index f29e804b4e..0dbbba524b 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -55,7 +55,7 @@ struct VocBlockHeader { * return the corresponding sample frequency. */ extern int getSampleRateFromVOCRate(int vocSR); -extern byte *readCreativeVoc(byte *ptr, int32 &size, int &rate); +extern byte *readCreativeVoc(byte *ptr, int32 &size, int &rate, int32 &loops); extern byte *loadVocSample(File *file, int32 &size, int &rate); #endif |