1346 |
|
|
1347 |
// if this is the last write, update the checksum chunk in the |
// if this is the last write, update the checksum chunk in the |
1348 |
// file |
// file |
1349 |
if (pCkData->GetPos() == pCkData->GetSize()) { |
if (pCkData->GetPos() == std::min(pCkData->GetSize(), pCkData->GetNewSize())) { |
1350 |
__finalizeCRC(crc); |
__finalizeCRC(crc); |
1351 |
File* pFile = static_cast<File*>(GetParent()); |
File* pFile = static_cast<File*>(GetParent()); |
1352 |
pFile->SetSampleChecksum(this, crc); |
pFile->SetSampleChecksum(this, crc); |
5353 |
if (!lrgn) lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN); |
if (!lrgn) lrgn = pCkInstrument->AddSubList(LIST_TYPE_LRGN); |
5354 |
RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN); |
RIFF::List* rgn = lrgn->AddSubList(LIST_TYPE_RGN); |
5355 |
Region* pNewRegion = new Region(this, rgn); |
Region* pNewRegion = new Region(this, rgn); |
5356 |
|
const size_t idxIt = RegionsIterator - pRegions->begin(); |
5357 |
pRegions->push_back(pNewRegion); |
pRegions->push_back(pNewRegion); |
5358 |
|
RegionsIterator = pRegions->begin() + std::min(idxIt, pRegions->size()); // avoid iterator invalidation |
5359 |
Regions = (uint32_t) pRegions->size(); |
Regions = (uint32_t) pRegions->size(); |
5360 |
// update Region key table for fast lookup |
// update Region key table for fast lookup |
5361 |
UpdateRegionKeyTable(); |
UpdateRegionKeyTable(); |