6412 |
pSample->DeleteChunks(); |
pSample->DeleteChunks(); |
6413 |
delete pSample; |
delete pSample; |
6414 |
|
|
|
SampleList::iterator tmp = SamplesIterator; |
|
6415 |
// remove all references to the sample |
// remove all references to the sample |
6416 |
for (Instrument* instrument = GetFirstInstrument() ; instrument ; |
size_t iIns = 0; |
6417 |
instrument = GetNextInstrument()) { |
for (Instrument* instrument = GetInstrument(iIns); instrument; |
6418 |
|
instrument = GetInstrument(++iIns)) |
6419 |
|
{ |
6420 |
size_t iRgn = 0; |
size_t iRgn = 0; |
6421 |
for (Region* region = instrument->GetRegionAt(iRgn); region; |
for (Region* region = instrument->GetRegionAt(iRgn); region; |
6422 |
region = instrument->GetRegionAt(++iRgn)) |
region = instrument->GetRegionAt(++iRgn)) |
6429 |
} |
} |
6430 |
} |
} |
6431 |
} |
} |
|
SamplesIterator = tmp; // restore iterator |
|
6432 |
} |
} |
6433 |
|
|
6434 |
void File::LoadSamples() { |
void File::LoadSamples() { |
6546 |
__notify_progress(pProgress, 1.0); // notify done |
__notify_progress(pProgress, 1.0); // notify done |
6547 |
} |
} |
6548 |
|
|
6549 |
|
/** |
6550 |
|
* Returns a pointer to the first <i>Instrument</i> object of the file, |
6551 |
|
* <i>NULL</i> otherwise. |
6552 |
|
* |
6553 |
|
* @deprecated This method is not reentrant-safe, use GetInstrument() |
6554 |
|
* instead. |
6555 |
|
*/ |
6556 |
Instrument* File::GetFirstInstrument() { |
Instrument* File::GetFirstInstrument() { |
6557 |
if (!pInstruments) LoadInstruments(); |
if (!pInstruments) LoadInstruments(); |
6558 |
if (!pInstruments) return NULL; |
if (!pInstruments) return NULL; |
6560 |
return static_cast<gig::Instrument*>( (InstrumentsIterator != pInstruments->end()) ? *InstrumentsIterator : NULL ); |
return static_cast<gig::Instrument*>( (InstrumentsIterator != pInstruments->end()) ? *InstrumentsIterator : NULL ); |
6561 |
} |
} |
6562 |
|
|
6563 |
|
/** |
6564 |
|
* Returns a pointer to the next <i>Instrument</i> object of the file, |
6565 |
|
* <i>NULL</i> otherwise. |
6566 |
|
* |
6567 |
|
* @deprecated This method is not reentrant-safe, use GetInstrument() |
6568 |
|
* instead. |
6569 |
|
*/ |
6570 |
Instrument* File::GetNextInstrument() { |
Instrument* File::GetNextInstrument() { |
6571 |
if (!pInstruments) return NULL; |
if (!pInstruments) return NULL; |
6572 |
InstrumentsIterator++; |
InstrumentsIterator++; |
6594 |
* @param pProgress - optional: callback function for progress notification |
* @param pProgress - optional: callback function for progress notification |
6595 |
* @returns sought instrument or NULL if there's no such instrument |
* @returns sought instrument or NULL if there's no such instrument |
6596 |
*/ |
*/ |
6597 |
Instrument* File::GetInstrument(uint index, progress_t* pProgress) { |
Instrument* File::GetInstrument(size_t index, progress_t* pProgress) { |
6598 |
if (!pInstruments) { |
if (!pInstruments) { |
6599 |
// TODO: hack - we simply load ALL samples here, it would have been done in the Region constructor anyway (ATM) |
// TODO: hack - we simply load ALL samples here, it would have been done in the Region constructor anyway (ATM) |
6600 |
|
|
6625 |
} |
} |
6626 |
} |
} |
6627 |
if (!pInstruments) return NULL; |
if (!pInstruments) return NULL; |
6628 |
InstrumentsIterator = pInstruments->begin(); |
if (index >= pInstruments->size()) return NULL; |
6629 |
for (uint i = 0; InstrumentsIterator != pInstruments->end(); i++) { |
return static_cast<gig::Instrument*>( (*pInstruments)[index] ); |
|
if (i == index) return static_cast<gig::Instrument*>( *InstrumentsIterator ); |
|
|
InstrumentsIterator++; |
|
|
} |
|
|
return NULL; |
|
6630 |
} |
} |
6631 |
|
|
6632 |
/** @brief Add a new instrument definition. |
/** @brief Add a new instrument definition. |
7325 |
|
|
7326 |
memset(&pData[48], 0, sublen - 48); |
memset(&pData[48], 0, sublen - 48); |
7327 |
|
|
7328 |
for (Instrument* instrument = GetFirstInstrument() ; instrument ; |
size_t iIns = 0; |
7329 |
instrument = GetNextInstrument()) { |
for (Instrument* instrument = GetInstrument(iIns); instrument; |
7330 |
|
instrument = GetInstrument(++iIns)) |
7331 |
|
{ |
7332 |
int nbusedsamples = 0; |
int nbusedsamples = 0; |
7333 |
int nbusedchannels = 0; |
int nbusedchannels = 0; |
7334 |
int nbdimregions = 0; |
int nbdimregions = 0; |
7433 |
void File::UpdateFileOffsets() { |
void File::UpdateFileOffsets() { |
7434 |
DLS::File::UpdateFileOffsets(); |
DLS::File::UpdateFileOffsets(); |
7435 |
|
|
7436 |
for (Instrument* instrument = GetFirstInstrument(); instrument; |
size_t i = 0; |
7437 |
instrument = GetNextInstrument()) |
for (Instrument* instrument = GetInstrument(i); instrument; |
7438 |
|
instrument = GetInstrument(++i)) |
7439 |
{ |
{ |
7440 |
instrument->UpdateScriptFileOffsets(); |
instrument->UpdateScriptFileOffsets(); |
7441 |
} |
} |