Diffstat (limited to 'core/multimedia/opieplayer/modplug/load_mdl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/modplug/load_mdl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/modplug/load_mdl.cpp b/core/multimedia/opieplayer/modplug/load_mdl.cpp index 806b68b..e1f78d5 100644 --- a/core/multimedia/opieplayer/modplug/load_mdl.cpp +++ b/core/multimedia/opieplayer/modplug/load_mdl.cpp @@ -184,129 +184,129 @@ BOOL CSoundFile::ReadMDL(const BYTE *lpStream, DWORD dwMemLength) { DWORD dwMemPos, dwPos, blocklen, dwTrackPos; const MDLSONGHEADER *pmsh = (const MDLSONGHEADER *)lpStream; MDLINFOBLOCK *pmib; MDLPATTERNDATA *pmpd; UINT i,j, norders = 0, npatterns = 0, ntracks = 0; UINT ninstruments = 0, nsamples = 0; WORD block; WORD patterntracks[MAX_PATTERNS*32]; BYTE smpinfo[MAX_SAMPLES]; BYTE insvolenv[MAX_INSTRUMENTS]; BYTE inspanenv[MAX_INSTRUMENTS]; LPCBYTE pvolenv, ppanenv, ppitchenv; UINT nvolenv, npanenv, npitchenv; if ((!lpStream) || (dwMemLength < 1024)) return FALSE; if ((pmsh->id != 0x4C444D44) || ((pmsh->version & 0xF0) > 0x10)) return FALSE; memset(patterntracks, 0, sizeof(patterntracks)); memset(smpinfo, 0, sizeof(smpinfo)); memset(insvolenv, 0, sizeof(insvolenv)); memset(inspanenv, 0, sizeof(inspanenv)); dwMemPos = 5; dwTrackPos = 0; pvolenv = ppanenv = ppitchenv = NULL; nvolenv = npanenv = npitchenv = 0; m_nSamples = m_nInstruments = 0; while (dwMemPos+6 < dwMemLength) { block = *((WORD *)(lpStream+dwMemPos)); blocklen = *((DWORD *)(lpStream+dwMemPos+2)); dwMemPos += 6; if (dwMemPos + blocklen > dwMemLength) { if (dwMemPos == 11) return FALSE; break; } switch(block) { // IN: infoblock case 0x4E49: pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos); memcpy(m_szNames[0], pmib->songname, 32); norders = pmib->norders; if (norders > MAX_ORDERS) norders = MAX_ORDERS; m_nRestartPos = pmib->repeatpos; m_nDefaultGlobalVolume = pmib->globalvol; m_nDefaultTempo = pmib->tempo; m_nDefaultSpeed = pmib->speed; m_nChannels = 4; for (i=0; i<32; i++) { ChnSettings[i].nVolume = 64; ChnSettings[i].nPan = (pmib->channelinfo[i] & 0x7F) << 1; if (pmib->channelinfo[i] & 0x80) ChnSettings[i].dwFlags |= CHN_MUTE; else m_nChannels = i+1; } for (j=0; j<norders; j++) Order[j] = pmib->seq[j]; break; // ME: song message case 0x454D: if (blocklen) { - if (m_lpszSongComments) delete m_lpszSongComments; + if (m_lpszSongComments) delete [] m_lpszSongComments; m_lpszSongComments = new char[blocklen]; if (m_lpszSongComments) { memcpy(m_lpszSongComments, lpStream+dwMemPos, blocklen); m_lpszSongComments[blocklen-1] = 0; } } break; // PA: Pattern Data case 0x4150: npatterns = lpStream[dwMemPos]; if (npatterns > MAX_PATTERNS) npatterns = MAX_PATTERNS; dwPos = dwMemPos + 1; for (i=0; i<npatterns; i++) { if (dwPos+18 >= dwMemLength) break; pmpd = (MDLPATTERNDATA *)(lpStream + dwPos); if (pmpd->channels > 32) break; PatternSize[i] = pmpd->lastrow+1; if (m_nChannels < pmpd->channels) m_nChannels = pmpd->channels; dwPos += 18 + 2*pmpd->channels; for (j=0; j<pmpd->channels; j++) { patterntracks[i*32+j] = pmpd->data[j]; } } break; // TR: Track Data case 0x5254: if (dwTrackPos) break; ntracks = *((WORD *)(lpStream+dwMemPos)); dwTrackPos = dwMemPos+2; break; // II: Instruments case 0x4949: ninstruments = lpStream[dwMemPos]; dwPos = dwMemPos+1; for (i=0; i<ninstruments; i++) { UINT nins = lpStream[dwPos]; if ((nins >= MAX_INSTRUMENTS) || (!nins)) break; if (m_nInstruments < nins) m_nInstruments = nins; if (!Headers[nins]) { UINT note = 12; if ((Headers[nins] = new INSTRUMENTHEADER) == NULL) break; INSTRUMENTHEADER *penv = Headers[nins]; memset(penv, 0, sizeof(INSTRUMENTHEADER)); memcpy(penv->name, lpStream+dwPos+2, 32); penv->nGlobalVol = 64; penv->nPPC = 5*12; for (j=0; j<lpStream[dwPos+1]; j++) { const BYTE *ps = lpStream+dwPos+34+14*j; while ((note < (UINT)(ps[1]+12)) && (note < 120)) { penv->NoteMap[note] = note+1; if (ps[0] < MAX_SAMPLES) { int ismp = ps[0]; penv->Keyboard[note] = ps[0]; Ins[ismp].nVolume = ps[2]; Ins[ismp].nPan = ps[4] << 1; Ins[ismp].nVibType = ps[11]; |