--- libgig/trunk/src/DLS.cpp 2003/11/16 17:47:00 11 +++ libgig/trunk/src/DLS.cpp 2004/12/04 14:13:49 317 @@ -2,8 +2,8 @@ * * * libgig - C++ cross-platform Gigasampler format file loader library * * * - * Copyright (C) 2003 by Christian Schoenebeck * - * * + * Copyright (C) 2003, 2004 by Christian Schoenebeck * + * * * * * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -414,7 +414,18 @@ WavePoolCount = ptbl->ReadUint32(); pWavePoolTable = new uint32_t[WavePoolCount]; ptbl->SetPos(headersize); - ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); + + // Check for 64 bit offsets (used in gig v3 files) + if (ptbl->GetSize() - headersize == WavePoolCount * 8) { + for (int i = 0 ; i < WavePoolCount ; i++) { + // Just ignore the upper bits for now + uint32_t upper = ptbl->ReadUint32(); + pWavePoolTable[i] = ptbl->ReadUint32(); + if (upper || (pWavePoolTable[i] & 0x80000000)) + throw DLS::Exception("Files larger than 2 GB not yet supported"); + } + } + else ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); pSamples = NULL; pInstruments = NULL;