413 |
uint32_t headersize = ptbl->ReadUint32(); |
uint32_t headersize = ptbl->ReadUint32(); |
414 |
WavePoolCount = ptbl->ReadUint32(); |
WavePoolCount = ptbl->ReadUint32(); |
415 |
pWavePoolTable = new uint32_t[WavePoolCount]; |
pWavePoolTable = new uint32_t[WavePoolCount]; |
416 |
|
pWavePoolTableHi = new uint32_t[WavePoolCount]; |
417 |
ptbl->SetPos(headersize); |
ptbl->SetPos(headersize); |
418 |
|
|
419 |
// Check for 64 bit offsets (used in gig v3 files) |
// Check for 64 bit offsets (used in gig v3 files) |
420 |
if (ptbl->GetSize() - headersize == WavePoolCount * 8) { |
if (ptbl->GetSize() - headersize == WavePoolCount * 8) { |
421 |
for (int i = 0 ; i < WavePoolCount ; i++) { |
for (int i = 0 ; i < WavePoolCount ; i++) { |
422 |
// Just ignore the upper bits for now |
pWavePoolTableHi[i] = ptbl->ReadUint32(); |
|
uint32_t upper = ptbl->ReadUint32(); |
|
423 |
pWavePoolTable[i] = ptbl->ReadUint32(); |
pWavePoolTable[i] = ptbl->ReadUint32(); |
424 |
if (upper || (pWavePoolTable[i] & 0x80000000)) |
if (pWavePoolTable[i] & 0x80000000) |
425 |
throw DLS::Exception("Files larger than 2 GB not yet supported"); |
throw DLS::Exception("Files larger than 2 GB not yet supported"); |
426 |
} |
} |
427 |
} |
} |
428 |
else ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); |
else { |
429 |
|
ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); |
430 |
|
for (int i = 0 ; i < WavePoolCount ; i++) pWavePoolTableHi[i] = 0; |
431 |
|
} |
432 |
|
|
433 |
pSamples = NULL; |
pSamples = NULL; |
434 |
pInstruments = NULL; |
pInstruments = NULL; |
456 |
} |
} |
457 |
|
|
458 |
if (pWavePoolTable) delete[] pWavePoolTable; |
if (pWavePoolTable) delete[] pWavePoolTable; |
459 |
|
if (pWavePoolTableHi) delete[] pWavePoolTableHi; |
460 |
if (pVersion) delete pVersion; |
if (pVersion) delete pVersion; |
461 |
} |
} |
462 |
|
|
543 |
std::cout << "DLS::Exception: " << Message << std::endl; |
std::cout << "DLS::Exception: " << Message << std::endl; |
544 |
} |
} |
545 |
|
|
546 |
|
|
547 |
|
// *************** functions *************** |
548 |
|
// * |
549 |
|
|
550 |
|
/** |
551 |
|
* Returns the name of this C++ library. This is usually "libgig" of |
552 |
|
* course. This call is equivalent to RIFF::libraryName() and |
553 |
|
* gig::libraryName(). |
554 |
|
*/ |
555 |
|
String libraryName() { |
556 |
|
return PACKAGE; |
557 |
|
} |
558 |
|
|
559 |
|
/** |
560 |
|
* Returns version of this C++ library. This call is equivalent to |
561 |
|
* RIFF::libraryVersion() and gig::libraryVersion(). |
562 |
|
*/ |
563 |
|
String libraryVersion() { |
564 |
|
return VERSION; |
565 |
|
} |
566 |
|
|
567 |
} // namespace DLS |
} // namespace DLS |