2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file loader library * |
* libgig - C++ cross-platform Gigasampler format file loader library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Christian Schoenebeck * |
* Copyright (C) 2003-2005 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
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; |
|
Instruments = 0; |
|
435 |
} |
} |
436 |
|
|
437 |
File::~File() { |
File::~File() { |
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 |