Diffstat (limited to 'core/multimedia/opieplayer/modplug/load_ams.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/modplug/load_ams.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/modplug/load_ams.cpp b/core/multimedia/opieplayer/modplug/load_ams.cpp index 3dd1c2b..ad1cc01 100644 --- a/core/multimedia/opieplayer/modplug/load_ams.cpp +++ b/core/multimedia/opieplayer/modplug/load_ams.cpp @@ -501,131 +501,131 @@ BOOL CSoundFile::ReadAMS2(LPCBYTE lpStream, DWORD dwMemLength) MODCOMMAND *m = Patterns[ipat] + row * m_nChannels; UINT byte1 = psrc[pos++]; UINT ch = byte1 & 0x1F; // Read Note + Instr if (!(byte1 & 0x40)) { UINT byte2 = psrc[pos++]; UINT note = byte2 & 0x7F; if (note) m[ch].note = (note > 1) ? (note-1) : 0xFF; m[ch].instr = psrc[pos++]; // Read Effect while (byte2 & 0x80) { byte2 = psrc[pos++]; if (byte2 & 0x40) { m[ch].volcmd = VOLCMD_VOLUME; m[ch].vol = byte2 & 0x3F; } else { UINT command = byte2 & 0x3F; UINT param = psrc[pos++]; if (command == 0x0C) { m[ch].volcmd = VOLCMD_VOLUME; m[ch].vol = param / 2; } else if (command < 0x10) { m[ch].command = command; m[ch].param = param; ConvertModCommand(&m[ch]); } else { // TODO: AMS effects } } } } if (byte1 & 0x80) row++; } } dwMemPos += packedlen; } // Read Samples for (UINT iSmp=1; iSmp<=m_nSamples; iSmp++) if (Ins[iSmp].nLength) { if (dwMemPos >= dwMemLength - 9) return TRUE; UINT flags; if (packedsamples[iSmp] & 0x03) { flags = (Ins[iSmp].uFlags & CHN_16BIT) ? RS_AMS16 : RS_AMS8; } else { flags = (Ins[iSmp].uFlags & CHN_16BIT) ? RS_PCM16S : RS_PCM8S; } dwMemPos += ReadSample(&Ins[iSmp], flags, (LPSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); } return TRUE; } ///////////////////////////////////////////////////////////////////// // AMS Sample unpacking void AMSUnpack(const char *psrc, UINT inputlen, char *pdest, UINT dmax, char packcharacter) { UINT tmplen = dmax; signed char *amstmp = new signed char[tmplen]; if (!amstmp) return; // Unpack Loop { signed char *p = amstmp; UINT i=0, j=0; while ((i < inputlen) && (j < tmplen)) { signed char ch = psrc[i++]; if (ch == packcharacter) { BYTE ch2 = psrc[i++]; if (ch2) { ch = psrc[i++]; while (ch2--) { p[j++] = ch; if (j >= tmplen) break; } } else p[j++] = packcharacter; } else p[j++] = ch; } } // Bit Unpack Loop { signed char *p = amstmp; UINT bitcount = 0x80, dh; UINT k=0; for (UINT i=0; i<dmax; i++) { BYTE al = *p++; dh = 0; for (UINT count=0; count<8; count++) { UINT bl = al & bitcount; bl = ((bl|(bl<<8)) >> ((dh+8-count) & 7)) & 0xFF; bitcount = ((bitcount|(bitcount<<8)) >> 1) & 0xFF; pdest[k++] |= bl; if (k >= dmax) { k = 0; dh++; } } bitcount = ((bitcount|(bitcount<<8)) >> dh) & 0xFF; } } // Delta Unpack { signed char old = 0; for (UINT i=0; i<dmax; i++) { int pos = ((LPBYTE)pdest)[i]; if ((pos != 128) && (pos & 0x80)) pos = -(pos & 0x7F); old -= (signed char)pos; pdest[i] = old; } } - delete amstmp; + delete [] amstmp; } |