212 |
* call File::Save() to make changes persistent. |
* call File::Save() to make changes persistent. |
213 |
*/ |
*/ |
214 |
void Articulator::UpdateChunks() { |
void Articulator::UpdateChunks() { |
215 |
ArticulationList::iterator iter = pArticulations->begin(); |
if (pArticulations) { |
216 |
ArticulationList::iterator end = pArticulations->end(); |
ArticulationList::iterator iter = pArticulations->begin(); |
217 |
for (; iter != end; ++iter) { |
ArticulationList::iterator end = pArticulations->end(); |
218 |
(*iter)->UpdateChunks(); |
for (; iter != end; ++iter) { |
219 |
|
(*iter)->UpdateChunks(); |
220 |
|
} |
221 |
} |
} |
222 |
} |
} |
223 |
|
|
257 |
} |
} |
258 |
} |
} |
259 |
|
|
260 |
|
Info::~Info() { |
261 |
|
} |
262 |
|
|
263 |
/** @brief Load given INFO field. |
/** @brief Load given INFO field. |
264 |
* |
* |
265 |
* Load INFO field from INFO chunk with chunk ID \a ChunkID from INFO |
* Load INFO field from INFO chunk with chunk ID \a ChunkID from INFO |
268 |
void Info::LoadString(uint32_t ChunkID, RIFF::List* lstINFO, String& s) { |
void Info::LoadString(uint32_t ChunkID, RIFF::List* lstINFO, String& s) { |
269 |
RIFF::Chunk* ck = lstINFO->GetSubChunk(ChunkID); |
RIFF::Chunk* ck = lstINFO->GetSubChunk(ChunkID); |
270 |
if (ck) { |
if (ck) { |
271 |
// TODO: no check for ZSTR terminated strings yet |
const char* str = (char*)ck->LoadChunkData(); |
272 |
s = (char*) ck->LoadChunkData(); |
int size = ck->GetSize(); |
273 |
|
int len; |
274 |
|
for (len = 0 ; len < size ; len++) |
275 |
|
if (str[len] == '\0') break; |
276 |
|
s.assign(str, len); |
277 |
ck->ReleaseChunkData(); |
ck->ReleaseChunkData(); |
278 |
} |
} |
279 |
} |
} |
282 |
* |
* |
283 |
* Apply given info value to info chunk with ID \a ChunkID, which is a |
* Apply given info value to info chunk with ID \a ChunkID, which is a |
284 |
* subchunk of INFO list chunk \a lstINFO. If the given chunk already |
* subchunk of INFO list chunk \a lstINFO. If the given chunk already |
285 |
* exists, value \a s will be applied, otherwise if it doesn't exist yet |
* exists, value \a s will be applied. Otherwise if it doesn't exist yet |
286 |
* and \a sDefault is not an empty string, such a chunk will be created |
* and either \a s or \a sDefault is not an empty string, such a chunk |
287 |
* and \a sDefault will be applied. |
* will be created and either \a s or \a sDefault will be applied |
288 |
|
* (depending on which one is not an empty string, if both are not an |
289 |
|
* empty string \a s will be preferred). |
290 |
* |
* |
291 |
* @param ChunkID - 32 bit RIFF chunk ID of INFO subchunk |
* @param ChunkID - 32 bit RIFF chunk ID of INFO subchunk |
292 |
* @param lstINFO - parent (INFO) RIFF list chunk |
* @param lstINFO - parent (INFO) RIFF list chunk |
299 |
ck->Resize(s.size() + 1); |
ck->Resize(s.size() + 1); |
300 |
char* pData = (char*) ck->LoadChunkData(); |
char* pData = (char*) ck->LoadChunkData(); |
301 |
memcpy(pData, s.c_str(), s.size() + 1); |
memcpy(pData, s.c_str(), s.size() + 1); |
302 |
} else if (sDefault != "") { // create chunk and use default value |
} else if (s != "" || sDefault != "") { // create chunk |
303 |
ck = lstINFO->AddSubChunk(ChunkID, sDefault.size() + 1); |
const String& sToSave = (s != "") ? s : sDefault; |
304 |
|
ck = lstINFO->AddSubChunk(ChunkID, sToSave.size() + 1); |
305 |
char* pData = (char*) ck->LoadChunkData(); |
char* pData = (char*) ck->LoadChunkData(); |
306 |
memcpy(pData, sDefault.c_str(), sDefault.size() + 1); |
memcpy(pData, sToSave.c_str(), sToSave.size() + 1); |
307 |
} |
} |
308 |
} |
} |
309 |
|
|
324 |
// get current date |
// get current date |
325 |
time_t now = time(NULL); |
time_t now = time(NULL); |
326 |
tm* pNowBroken = localtime(&now); |
tm* pNowBroken = localtime(&now); |
327 |
String defaultCreationDate = ToString(pNowBroken->tm_year) + "-" + |
String defaultCreationDate = ToString(1900 + pNowBroken->tm_year) + "-" + |
328 |
ToString(pNowBroken->tm_mon) + "-" + |
ToString(pNowBroken->tm_mon + 1) + "-" + |
329 |
ToString(pNowBroken->tm_mday); |
ToString(pNowBroken->tm_mday); |
330 |
String defaultSoftware = libraryName() + " " + libraryVersion(); |
String defaultSoftware = libraryName() + " " + libraryVersion(); |
331 |
String defaultComments = "Created with " + libraryName() + " " + libraryVersion(); |
String defaultComments = "Created with " + libraryName() + " " + libraryVersion(); |
828 |
// get sample's wave pool table index |
// get sample's wave pool table index |
829 |
int index = -1; |
int index = -1; |
830 |
File* pFile = (File*) GetParent()->GetParent(); |
File* pFile = (File*) GetParent()->GetParent(); |
831 |
File::SampleList::iterator iter = pFile->pSamples->begin(); |
if (pFile->pSamples) { |
832 |
File::SampleList::iterator end = pFile->pSamples->end(); |
File::SampleList::iterator iter = pFile->pSamples->begin(); |
833 |
for (int i = 0; iter != end; ++iter, i++) { |
File::SampleList::iterator end = pFile->pSamples->end(); |
834 |
if (*iter == pSample) { |
for (int i = 0; iter != end; ++iter, i++) { |
835 |
index = i; |
if (*iter == pSample) { |
836 |
break; |
index = i; |
837 |
|
break; |
838 |
|
} |
839 |
} |
} |
840 |
} |
} |
841 |
if (index < 0) throw Exception("Could not save Region, could not find Region's sample"); |
if (index < 0) throw Exception("Could not save Region, could not find Region's sample"); |
902 |
} |
} |
903 |
|
|
904 |
void Instrument::LoadRegions() { |
void Instrument::LoadRegions() { |
905 |
|
if (!pRegions) pRegions = new RegionList; |
906 |
RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN); |
RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN); |
907 |
if (!lrgn) throw DLS::Exception("Mandatory chunks in <ins > chunk not found."); |
if (lrgn) { |
908 |
uint32_t regionCkType = (lrgn->GetSubList(LIST_TYPE_RGN2)) ? LIST_TYPE_RGN2 : LIST_TYPE_RGN; // prefer regions level 2 |
uint32_t regionCkType = (lrgn->GetSubList(LIST_TYPE_RGN2)) ? LIST_TYPE_RGN2 : LIST_TYPE_RGN; // prefer regions level 2 |
909 |
RIFF::List* rgn = lrgn->GetFirstSubList(); |
RIFF::List* rgn = lrgn->GetFirstSubList(); |
910 |
while (rgn) { |
while (rgn) { |
911 |
if (rgn->GetListType() == regionCkType) { |
if (rgn->GetListType() == regionCkType) { |
912 |
if (!pRegions) pRegions = new RegionList; |
pRegions->push_back(new Region(this, rgn)); |
913 |
pRegions->push_back(new Region(this, rgn)); |
} |
914 |
|
rgn = lrgn->GetNextSubList(); |
915 |
} |
} |
|
rgn = lrgn->GetNextSubList(); |
|
916 |
} |
} |
917 |
} |
} |
918 |
|
|
919 |
Region* Instrument::AddRegion() { |
Region* Instrument::AddRegion() { |
920 |
if (!pRegions) pRegions = new RegionList; |
if (!pRegions) LoadRegions(); |
921 |
RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN); |
RIFF::List* lrgn = pCkInstrument->GetSubList(LIST_TYPE_LRGN); |
922 |
if (!lrgn) lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN); |
if (!lrgn) lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN); |
923 |
RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN); |
RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN); |
924 |
Region* pNewRegion = new Region(this, rgn); |
Region* pNewRegion = new Region(this, rgn); |
925 |
pRegions->push_back(pNewRegion); |
pRegions->push_back(pNewRegion); |
926 |
|
Regions = pRegions->size(); |
927 |
return pNewRegion; |
return pNewRegion; |
928 |
} |
} |
929 |
|
|
932 |
RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pRegion); |
RegionList::iterator iter = find(pRegions->begin(), pRegions->end(), pRegion); |
933 |
if (iter == pRegions->end()) return; |
if (iter == pRegions->end()) return; |
934 |
pRegions->erase(iter); |
pRegions->erase(iter); |
935 |
|
Regions = pRegions->size(); |
936 |
delete pRegion; |
delete pRegion; |
937 |
} |
} |
938 |
|
|
951 |
if (!insh) insh = pCkInstrument->AddSubChunk(CHUNK_ID_INSH, 12); |
if (!insh) insh = pCkInstrument->AddSubChunk(CHUNK_ID_INSH, 12); |
952 |
uint8_t* pData = (uint8_t*) insh->LoadChunkData(); |
uint8_t* pData = (uint8_t*) insh->LoadChunkData(); |
953 |
// update 'insh' chunk |
// update 'insh' chunk |
954 |
Regions = pRegions->size(); |
Regions = (pRegions) ? pRegions->size() : 0; |
955 |
midi_locale_t locale; |
midi_locale_t locale; |
956 |
locale.instrument = MIDIProgram; |
locale.instrument = MIDIProgram; |
957 |
locale.bank = MIDI_BANK_ENCODE(MIDIBankCoarse, MIDIBankFine); |
locale.bank = MIDI_BANK_ENCODE(MIDIBankCoarse, MIDIBankFine); |
960 |
memccpy(&pData[0], &Regions, 1, 4); |
memccpy(&pData[0], &Regions, 1, 4); |
961 |
memccpy(&pData[4], &locale, 2, 4); |
memccpy(&pData[4], &locale, 2, 4); |
962 |
// update Region's chunks |
// update Region's chunks |
963 |
|
if (!pRegions) return; |
964 |
RegionList::iterator iter = pRegions->begin(); |
RegionList::iterator iter = pRegions->begin(); |
965 |
RegionList::iterator end = pRegions->end(); |
RegionList::iterator end = pRegions->end(); |
966 |
for (; iter != end; ++iter) { |
for (; iter != end; ++iter) { |
1043 |
Instruments = colh->ReadUint32(); |
Instruments = colh->ReadUint32(); |
1044 |
|
|
1045 |
RIFF::Chunk* ptbl = pRIFF->GetSubChunk(CHUNK_ID_PTBL); |
RIFF::Chunk* ptbl = pRIFF->GetSubChunk(CHUNK_ID_PTBL); |
1046 |
if (!ptbl) throw DLS::Exception("Mandatory <ptbl> chunk not found."); |
if (!ptbl) { // pool table is missing - this is probably an ".art" file |
1047 |
WavePoolHeaderSize = ptbl->ReadUint32(); |
WavePoolCount = 0; |
1048 |
WavePoolCount = ptbl->ReadUint32(); |
pWavePoolTable = NULL; |
1049 |
pWavePoolTable = new uint32_t[WavePoolCount]; |
pWavePoolTableHi = NULL; |
1050 |
pWavePoolTableHi = new uint32_t[WavePoolCount]; |
WavePoolHeaderSize = 8; |
1051 |
ptbl->SetPos(WavePoolHeaderSize); |
b64BitWavePoolOffsets = false; |
1052 |
|
} else { |
1053 |
// Check for 64 bit offsets (used in gig v3 files) |
WavePoolHeaderSize = ptbl->ReadUint32(); |
1054 |
b64BitWavePoolOffsets = (ptbl->GetSize() - WavePoolHeaderSize == WavePoolCount * 8); |
WavePoolCount = ptbl->ReadUint32(); |
1055 |
if (b64BitWavePoolOffsets) { |
pWavePoolTable = new uint32_t[WavePoolCount]; |
1056 |
for (int i = 0 ; i < WavePoolCount ; i++) { |
pWavePoolTableHi = new uint32_t[WavePoolCount]; |
1057 |
pWavePoolTableHi[i] = ptbl->ReadUint32(); |
ptbl->SetPos(WavePoolHeaderSize); |
1058 |
pWavePoolTable[i] = ptbl->ReadUint32(); |
|
1059 |
if (pWavePoolTable[i] & 0x80000000) |
// Check for 64 bit offsets (used in gig v3 files) |
1060 |
throw DLS::Exception("Files larger than 2 GB not yet supported"); |
b64BitWavePoolOffsets = (ptbl->GetSize() - WavePoolHeaderSize == WavePoolCount * 8); |
1061 |
|
if (b64BitWavePoolOffsets) { |
1062 |
|
for (int i = 0 ; i < WavePoolCount ; i++) { |
1063 |
|
pWavePoolTableHi[i] = ptbl->ReadUint32(); |
1064 |
|
pWavePoolTable[i] = ptbl->ReadUint32(); |
1065 |
|
if (pWavePoolTable[i] & 0x80000000) |
1066 |
|
throw DLS::Exception("Files larger than 2 GB not yet supported"); |
1067 |
|
} |
1068 |
|
} else { // conventional 32 bit offsets |
1069 |
|
ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); |
1070 |
|
for (int i = 0 ; i < WavePoolCount ; i++) pWavePoolTableHi[i] = 0; |
1071 |
} |
} |
|
} else { // conventional 32 bit offsets |
|
|
ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t)); |
|
|
for (int i = 0 ; i < WavePoolCount ; i++) pWavePoolTableHi[i] = 0; |
|
1072 |
} |
} |
1073 |
|
|
1074 |
pSamples = NULL; |
pSamples = NULL; |
1099 |
if (pWavePoolTable) delete[] pWavePoolTable; |
if (pWavePoolTable) delete[] pWavePoolTable; |
1100 |
if (pWavePoolTableHi) delete[] pWavePoolTableHi; |
if (pWavePoolTableHi) delete[] pWavePoolTableHi; |
1101 |
if (pVersion) delete pVersion; |
if (pVersion) delete pVersion; |
1102 |
|
for (std::list<RIFF::File*>::iterator i = ExtensionFiles.begin() ; i != ExtensionFiles.end() ; i++) |
1103 |
|
delete *i; |
1104 |
} |
} |
1105 |
|
|
1106 |
Sample* File::GetFirstSample() { |
Sample* File::GetFirstSample() { |
1117 |
} |
} |
1118 |
|
|
1119 |
void File::LoadSamples() { |
void File::LoadSamples() { |
1120 |
|
if (!pSamples) pSamples = new SampleList; |
1121 |
RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL); |
RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL); |
1122 |
if (wvpl) { |
if (wvpl) { |
1123 |
unsigned long wvplFileOffset = wvpl->GetFilePos(); |
unsigned long wvplFileOffset = wvpl->GetFilePos(); |
1124 |
RIFF::List* wave = wvpl->GetFirstSubList(); |
RIFF::List* wave = wvpl->GetFirstSubList(); |
1125 |
while (wave) { |
while (wave) { |
1126 |
if (wave->GetListType() == LIST_TYPE_WAVE) { |
if (wave->GetListType() == LIST_TYPE_WAVE) { |
|
if (!pSamples) pSamples = new SampleList; |
|
1127 |
unsigned long waveFileOffset = wave->GetFilePos(); |
unsigned long waveFileOffset = wave->GetFilePos(); |
1128 |
pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset)); |
pSamples->push_back(new Sample(this, wave, waveFileOffset - wvplFileOffset)); |
1129 |
} |
} |
1137 |
RIFF::List* wave = dwpl->GetFirstSubList(); |
RIFF::List* wave = dwpl->GetFirstSubList(); |
1138 |
while (wave) { |
while (wave) { |
1139 |
if (wave->GetListType() == LIST_TYPE_WAVE) { |
if (wave->GetListType() == LIST_TYPE_WAVE) { |
|
if (!pSamples) pSamples = new SampleList; |
|
1140 |
unsigned long waveFileOffset = wave->GetFilePos(); |
unsigned long waveFileOffset = wave->GetFilePos(); |
1141 |
pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset)); |
pSamples->push_back(new Sample(this, wave, waveFileOffset - dwplFileOffset)); |
1142 |
} |
} |
1154 |
* @returns pointer to new Sample object |
* @returns pointer to new Sample object |
1155 |
*/ |
*/ |
1156 |
Sample* File::AddSample() { |
Sample* File::AddSample() { |
1157 |
|
if (!pSamples) LoadSamples(); |
1158 |
__ensureMandatoryChunksExist(); |
__ensureMandatoryChunksExist(); |
1159 |
RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL); |
RIFF::List* wvpl = pRIFF->GetSubList(LIST_TYPE_WVPL); |
1160 |
// create new Sample object and its respective 'wave' list chunk |
// create new Sample object and its respective 'wave' list chunk |
|
if (!pSamples) pSamples = new SampleList; |
|
1161 |
RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE); |
RIFF::List* wave = wvpl->AddSubList(LIST_TYPE_WAVE); |
1162 |
Sample* pSample = new Sample(this, wave, 0 /*arbitrary value, we update offsets when we save*/); |
Sample* pSample = new Sample(this, wave, 0 /*arbitrary value, we update offsets when we save*/); |
1163 |
pSamples->push_back(pSample); |
pSamples->push_back(pSample); |
1193 |
} |
} |
1194 |
|
|
1195 |
void File::LoadInstruments() { |
void File::LoadInstruments() { |
1196 |
|
if (!pInstruments) pInstruments = new InstrumentList; |
1197 |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
1198 |
if (lstInstruments) { |
if (lstInstruments) { |
1199 |
RIFF::List* lstInstr = lstInstruments->GetFirstSubList(); |
RIFF::List* lstInstr = lstInstruments->GetFirstSubList(); |
1200 |
while (lstInstr) { |
while (lstInstr) { |
1201 |
if (lstInstr->GetListType() == LIST_TYPE_INS) { |
if (lstInstr->GetListType() == LIST_TYPE_INS) { |
|
if (!pInstruments) pInstruments = new InstrumentList; |
|
1202 |
pInstruments->push_back(new Instrument(this, lstInstr)); |
pInstruments->push_back(new Instrument(this, lstInstr)); |
1203 |
} |
} |
1204 |
lstInstr = lstInstruments->GetNextSubList(); |
lstInstr = lstInstruments->GetNextSubList(); |
1214 |
* @returns pointer to new Instrument object |
* @returns pointer to new Instrument object |
1215 |
*/ |
*/ |
1216 |
Instrument* File::AddInstrument() { |
Instrument* File::AddInstrument() { |
1217 |
|
if (!pInstruments) LoadInstruments(); |
1218 |
__ensureMandatoryChunksExist(); |
__ensureMandatoryChunksExist(); |
|
if (!pInstruments) pInstruments = new InstrumentList; |
|
1219 |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
RIFF::List* lstInstruments = pRIFF->GetSubList(LIST_TYPE_LINS); |
1220 |
RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS); |
RIFF::List* lstInstr = lstInstruments->AddSubList(LIST_TYPE_INS); |
1221 |
Instrument* pInstrument = new Instrument(this, lstInstr); |
Instrument* pInstrument = new Instrument(this, lstInstr); |
1223 |
return pInstrument; |
return pInstrument; |
1224 |
} |
} |
1225 |
|
|
1226 |
/** @brief Delete a instrument. |
/** @brief Delete an instrument. |
1227 |
* |
* |
1228 |
* This will delete the given Instrument object from the DLS file. You |
* This will delete the given Instrument object from the DLS file. You |
1229 |
* have to call Save() to make this persistent to the file. |
* have to call Save() to make this persistent to the file. |
1353 |
/** |
/** |
1354 |
* Updates (persistently) the wave pool table with offsets to all |
* Updates (persistently) the wave pool table with offsets to all |
1355 |
* currently available samples. <b>Caution:</b> this method assumes the |
* currently available samples. <b>Caution:</b> this method assumes the |
1356 |
* 'ptbl' chunk to be already of the correct size, so usually this |
* 'ptbl' chunk to be already of the correct size and the file to be |
1357 |
* method is only called after a Save() call. |
* writable, so usually this method is only called after a Save() call. |
1358 |
* |
* |
1359 |
* @throws Exception - if 'ptbl' chunk is too small (should only occur |
* @throws Exception - if 'ptbl' chunk is too small (should only occur |
1360 |
* if there's a bug) |
* if there's a bug) |
1367 |
WavePoolCount = (pSamples) ? pSamples->size() : 0; |
WavePoolCount = (pSamples) ? pSamples->size() : 0; |
1368 |
const unsigned long ulRequiredSize = WavePoolHeaderSize + iOffsetSize * WavePoolCount; |
const unsigned long ulRequiredSize = WavePoolHeaderSize + iOffsetSize * WavePoolCount; |
1369 |
if (ptbl->GetSize() < ulRequiredSize) throw Exception("Fatal error, 'ptbl' chunk too small"); |
if (ptbl->GetSize() < ulRequiredSize) throw Exception("Fatal error, 'ptbl' chunk too small"); |
1370 |
uint8_t* pData = (uint8_t*) ptbl->LoadChunkData(); |
// save the 'ptbl' chunk's current read/write position |
1371 |
|
unsigned long ulOriginalPos = ptbl->GetPos(); |
1372 |
// update headers |
// update headers |
1373 |
memccpy(&pData[0], &WavePoolHeaderSize, 1, 4); |
ptbl->SetPos(0); |
1374 |
memccpy(&pData[4], &WavePoolCount, 1, 4); |
ptbl->WriteUint32(&WavePoolHeaderSize); |
1375 |
|
ptbl->WriteUint32(&WavePoolCount); |
1376 |
// update offsets |
// update offsets |
1377 |
|
ptbl->SetPos(WavePoolHeaderSize); |
1378 |
if (b64BitWavePoolOffsets) { |
if (b64BitWavePoolOffsets) { |
1379 |
for (int i = 0 ; i < WavePoolCount ; i++) { |
for (int i = 0 ; i < WavePoolCount ; i++) { |
1380 |
memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTableHi[i], 1, 4); |
ptbl->WriteUint32(&pWavePoolTableHi[i]); |
1381 |
memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTable[i], 1, 4); |
ptbl->WriteUint32(&pWavePoolTable[i]); |
1382 |
} |
} |
1383 |
} else { // conventional 32 bit offsets |
} else { // conventional 32 bit offsets |
1384 |
for (int i = 0 ; i < WavePoolCount ; i++) |
for (int i = 0 ; i < WavePoolCount ; i++) |
1385 |
memccpy(&pData[WavePoolHeaderSize + i*iOffsetSize], &pWavePoolTable[i], 1, 4); |
ptbl->WriteUint32(&pWavePoolTable[i]); |
1386 |
} |
} |
1387 |
|
// restore 'ptbl' chunk's original read/write position |
1388 |
|
ptbl->SetPos(ulOriginalPos); |
1389 |
} |
} |
1390 |
|
|
1391 |
/** |
/** |
1408 |
SampleList::iterator iter = pSamples->begin(); |
SampleList::iterator iter = pSamples->begin(); |
1409 |
SampleList::iterator end = pSamples->end(); |
SampleList::iterator end = pSamples->end(); |
1410 |
for (int i = 0 ; iter != end ; ++iter, i++) { |
for (int i = 0 ; iter != end ; ++iter, i++) { |
1411 |
uint64_t _64BitOffset = wvplFileOffset - (*iter)->pWaveList->GetFilePos() - LIST_HEADER_SIZE; |
uint64_t _64BitOffset = (*iter)->pWaveList->GetFilePos() - wvplFileOffset - LIST_HEADER_SIZE; |
1412 |
(*iter)->ulWavePoolOffset = _64BitOffset; |
(*iter)->ulWavePoolOffset = _64BitOffset; |
1413 |
pWavePoolTableHi[i] = (uint32_t) (_64BitOffset >> 32); |
pWavePoolTableHi[i] = (uint32_t) (_64BitOffset >> 32); |
1414 |
pWavePoolTable[i] = (uint32_t) _64BitOffset; |
pWavePoolTable[i] = (uint32_t) _64BitOffset; |
1417 |
SampleList::iterator iter = pSamples->begin(); |
SampleList::iterator iter = pSamples->begin(); |
1418 |
SampleList::iterator end = pSamples->end(); |
SampleList::iterator end = pSamples->end(); |
1419 |
for (int i = 0 ; iter != end ; ++iter, i++) { |
for (int i = 0 ; iter != end ; ++iter, i++) { |
1420 |
uint64_t _64BitOffset = wvplFileOffset - (*iter)->pWaveList->GetFilePos() - LIST_HEADER_SIZE; |
uint64_t _64BitOffset = (*iter)->pWaveList->GetFilePos() - wvplFileOffset - LIST_HEADER_SIZE; |
1421 |
(*iter)->ulWavePoolOffset = _64BitOffset; |
(*iter)->ulWavePoolOffset = _64BitOffset; |
1422 |
pWavePoolTable[i] = (uint32_t) _64BitOffset; |
pWavePoolTable[i] = (uint32_t) _64BitOffset; |
1423 |
} |
} |