Diffstat (limited to 'core/multimedia/opieplayer/modplug/load_amf.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/modplug/load_amf.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/modplug/load_amf.cpp b/core/multimedia/opieplayer/modplug/load_amf.cpp index 188b5f5..2cf131b 100644 --- a/core/multimedia/opieplayer/modplug/load_amf.cpp +++ b/core/multimedia/opieplayer/modplug/load_amf.cpp | |||
@@ -357,64 +357,64 @@ BOOL CSoundFile::ReadAMF(LPCBYTE lpStream, DWORD dwMemLength) | |||
357 | if ((pins->nLoopEnd > pins->nLoopStart + 2) | 357 | if ((pins->nLoopEnd > pins->nLoopStart + 2) |
358 | && (pins->nLoopEnd <= pins->nLength)) pins->uFlags |= CHN_LOOP; | 358 | && (pins->nLoopEnd <= pins->nLength)) pins->uFlags |= CHN_LOOP; |
359 | } | 359 | } |
360 | } | 360 | } |
361 | // Read Track Mapping Table | 361 | // Read Track Mapping Table |
362 | USHORT *pTrackMap = (USHORT *)(lpStream+dwMemPos); | 362 | USHORT *pTrackMap = (USHORT *)(lpStream+dwMemPos); |
363 | UINT realtrackcnt = 0; | 363 | UINT realtrackcnt = 0; |
364 | dwMemPos += pfh->numtracks * sizeof(USHORT); | 364 | dwMemPos += pfh->numtracks * sizeof(USHORT); |
365 | for (UINT iTrkMap=0; iTrkMap<pfh->numtracks; iTrkMap++) | 365 | for (UINT iTrkMap=0; iTrkMap<pfh->numtracks; iTrkMap++) |
366 | { | 366 | { |
367 | if (realtrackcnt < pTrackMap[iTrkMap]) realtrackcnt = pTrackMap[iTrkMap]; | 367 | if (realtrackcnt < pTrackMap[iTrkMap]) realtrackcnt = pTrackMap[iTrkMap]; |
368 | } | 368 | } |
369 | // Store tracks positions | 369 | // Store tracks positions |
370 | BYTE **pTrackData = new BYTE *[realtrackcnt]; | 370 | BYTE **pTrackData = new BYTE *[realtrackcnt]; |
371 | memset(pTrackData, 0, sizeof(pTrackData)); | 371 | memset(pTrackData, 0, sizeof(pTrackData)); |
372 | for (UINT iTrack=0; iTrack<realtrackcnt; iTrack++) if (dwMemPos + 3 <= dwMemLength) | 372 | for (UINT iTrack=0; iTrack<realtrackcnt; iTrack++) if (dwMemPos + 3 <= dwMemLength) |
373 | { | 373 | { |
374 | UINT nTrkSize = *(USHORT *)(lpStream+dwMemPos); | 374 | UINT nTrkSize = *(USHORT *)(lpStream+dwMemPos); |
375 | nTrkSize += (UINT)lpStream[dwMemPos+2] << 16; | 375 | nTrkSize += (UINT)lpStream[dwMemPos+2] << 16; |
376 | if (dwMemPos + nTrkSize * 3 + 3 <= dwMemLength) | 376 | if (dwMemPos + nTrkSize * 3 + 3 <= dwMemLength) |
377 | { | 377 | { |
378 | pTrackData[iTrack] = (BYTE *)(lpStream + dwMemPos); | 378 | pTrackData[iTrack] = (BYTE *)(lpStream + dwMemPos); |
379 | } | 379 | } |
380 | dwMemPos += nTrkSize * 3 + 3; | 380 | dwMemPos += nTrkSize * 3 + 3; |
381 | } | 381 | } |
382 | // Create the patterns from the list of tracks | 382 | // Create the patterns from the list of tracks |
383 | for (UINT iPat=0; iPat<pfh->numorders; iPat++) | 383 | for (UINT iPat=0; iPat<pfh->numorders; iPat++) |
384 | { | 384 | { |
385 | MODCOMMAND *p = AllocatePattern(PatternSize[iPat], m_nChannels); | 385 | MODCOMMAND *p = AllocatePattern(PatternSize[iPat], m_nChannels); |
386 | if (!p) break; | 386 | if (!p) break; |
387 | Patterns[iPat] = p; | 387 | Patterns[iPat] = p; |
388 | for (UINT iChn=0; iChn<m_nChannels; iChn++) | 388 | for (UINT iChn=0; iChn<m_nChannels; iChn++) |
389 | { | 389 | { |
390 | UINT nTrack = ptracks[iPat][iChn]; | 390 | UINT nTrack = ptracks[iPat][iChn]; |
391 | if ((nTrack) && (nTrack <= pfh->numtracks)) | 391 | if ((nTrack) && (nTrack <= pfh->numtracks)) |
392 | { | 392 | { |
393 | UINT realtrk = pTrackMap[nTrack-1]; | 393 | UINT realtrk = pTrackMap[nTrack-1]; |
394 | if (realtrk) | 394 | if (realtrk) |
395 | { | 395 | { |
396 | realtrk--; | 396 | realtrk--; |
397 | if ((realtrk < realtrackcnt) && (pTrackData[realtrk])) | 397 | if ((realtrk < realtrackcnt) && (pTrackData[realtrk])) |
398 | { | 398 | { |
399 | AMF_Unpack(p+iChn, pTrackData[realtrk], PatternSize[iPat], m_nChannels); | 399 | AMF_Unpack(p+iChn, pTrackData[realtrk], PatternSize[iPat], m_nChannels); |
400 | } | 400 | } |
401 | } | 401 | } |
402 | } | 402 | } |
403 | } | 403 | } |
404 | } | 404 | } |
405 | delete pTrackData; | 405 | delete [] pTrackData; |
406 | // Read Sample Data | 406 | // Read Sample Data |
407 | for (UINT iSeek=1; iSeek<=maxsampleseekpos; iSeek++) | 407 | for (UINT iSeek=1; iSeek<=maxsampleseekpos; iSeek++) |
408 | { | 408 | { |
409 | if (dwMemPos >= dwMemLength) break; | 409 | if (dwMemPos >= dwMemLength) break; |
410 | for (UINT iSmp=0; iSmp<m_nSamples; iSmp++) if (iSeek == sampleseekpos[iSmp]) | 410 | for (UINT iSmp=0; iSmp<m_nSamples; iSmp++) if (iSeek == sampleseekpos[iSmp]) |
411 | { | 411 | { |
412 | MODINSTRUMENT *pins = &Ins[iSmp+1]; | 412 | MODINSTRUMENT *pins = &Ins[iSmp+1]; |
413 | dwMemPos += ReadSample(pins, RS_PCM8U, (LPCSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); | 413 | dwMemPos += ReadSample(pins, RS_PCM8U, (LPCSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); |
414 | break; | 414 | break; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | return TRUE; | 417 | return TRUE; |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||