4801 |
|
|
4802 |
ScriptGroup::~ScriptGroup() { |
ScriptGroup::~ScriptGroup() { |
4803 |
if (pScripts) { |
if (pScripts) { |
4804 |
std::list<Script*>::iterator iter = pScripts->begin(); |
std::vector<Script*>::iterator iter = pScripts->begin(); |
4805 |
std::list<Script*>::iterator end = pScripts->end(); |
std::vector<Script*>::iterator end = pScripts->end(); |
4806 |
while (iter != end) { |
while (iter != end) { |
4807 |
delete *iter; |
delete *iter; |
4808 |
++iter; |
++iter; |
4840 |
// now store the name of this group as <LSNM> chunk as subchunk of the <RTIS> list chunk |
// now store the name of this group as <LSNM> chunk as subchunk of the <RTIS> list chunk |
4841 |
::SaveString(CHUNK_ID_LSNM, NULL, pList, Name, String("Unnamed Group"), true, 64); |
::SaveString(CHUNK_ID_LSNM, NULL, pList, Name, String("Unnamed Group"), true, 64); |
4842 |
|
|
4843 |
for (std::list<Script*>::iterator it = pScripts->begin(); |
for (std::vector<Script*>::iterator it = pScripts->begin(); |
4844 |
it != pScripts->end(); ++it) |
it != pScripts->end(); ++it) |
4845 |
{ |
{ |
4846 |
(*it)->UpdateChunks(pProgress); |
(*it)->UpdateChunks(pProgress); |
4857 |
*/ |
*/ |
4858 |
Script* ScriptGroup::GetScript(uint index) { |
Script* ScriptGroup::GetScript(uint index) { |
4859 |
if (!pScripts) LoadScripts(); |
if (!pScripts) LoadScripts(); |
4860 |
std::list<Script*>::iterator it = pScripts->begin(); |
if (index >= pScripts->size()) return NULL; |
4861 |
for (uint i = 0; it != pScripts->end(); ++i, ++it) |
return (*pScripts)[index]; |
|
if (i == index) return *it; |
|
|
return NULL; |
|
4862 |
} |
} |
4863 |
|
|
4864 |
/** @brief Add new instrument script. |
/** @brief Add new instrument script. |
4891 |
*/ |
*/ |
4892 |
void ScriptGroup::DeleteScript(Script* pScript) { |
void ScriptGroup::DeleteScript(Script* pScript) { |
4893 |
if (!pScripts) LoadScripts(); |
if (!pScripts) LoadScripts(); |
4894 |
std::list<Script*>::iterator iter = |
std::vector<Script*>::iterator iter = |
4895 |
find(pScripts->begin(), pScripts->end(), pScript); |
find(pScripts->begin(), pScripts->end(), pScript); |
4896 |
if (iter == pScripts->end()) |
if (iter == pScripts->end()) |
4897 |
throw gig::Exception("Could not delete script, could not find given script"); |
throw gig::Exception("Could not delete script, could not find given script"); |
4904 |
|
|
4905 |
void ScriptGroup::LoadScripts() { |
void ScriptGroup::LoadScripts() { |
4906 |
if (pScripts) return; |
if (pScripts) return; |
4907 |
pScripts = new std::list<Script*>; |
pScripts = new std::vector<Script*>; |
4908 |
if (!pList) return; |
if (!pList) return; |
4909 |
|
|
4910 |
size_t i = 0; |
size_t i = 0; |
6410 |
pSample->DeleteChunks(); |
pSample->DeleteChunks(); |
6411 |
delete pSample; |
delete pSample; |
6412 |
|
|
|
SampleList::iterator tmp = SamplesIterator; |
|
6413 |
// remove all references to the sample |
// remove all references to the sample |
6414 |
for (Instrument* instrument = GetFirstInstrument() ; instrument ; |
size_t iIns = 0; |
6415 |
instrument = GetNextInstrument()) { |
for (Instrument* instrument = GetInstrument(iIns); instrument; |
6416 |
|
instrument = GetInstrument(++iIns)) |
6417 |
|
{ |
6418 |
size_t iRgn = 0; |
size_t iRgn = 0; |
6419 |
for (Region* region = instrument->GetRegionAt(iRgn); region; |
for (Region* region = instrument->GetRegionAt(iRgn); region; |
6420 |
region = instrument->GetRegionAt(++iRgn)) |
region = instrument->GetRegionAt(++iRgn)) |
6427 |
} |
} |
6428 |
} |
} |
6429 |
} |
} |
|
SamplesIterator = tmp; // restore iterator |
|
6430 |
} |
} |
6431 |
|
|
6432 |
void File::LoadSamples() { |
void File::LoadSamples() { |
7323 |
|
|
7324 |
memset(&pData[48], 0, sublen - 48); |
memset(&pData[48], 0, sublen - 48); |
7325 |
|
|
7326 |
for (Instrument* instrument = GetFirstInstrument() ; instrument ; |
size_t iIns = 0; |
7327 |
instrument = GetNextInstrument()) { |
for (Instrument* instrument = GetInstrument(iIns); instrument; |
7328 |
|
instrument = GetInstrument(++iIns)) |
7329 |
|
{ |
7330 |
int nbusedsamples = 0; |
int nbusedsamples = 0; |
7331 |
int nbusedchannels = 0; |
int nbusedchannels = 0; |
7332 |
int nbdimregions = 0; |
int nbdimregions = 0; |
7431 |
void File::UpdateFileOffsets() { |
void File::UpdateFileOffsets() { |
7432 |
DLS::File::UpdateFileOffsets(); |
DLS::File::UpdateFileOffsets(); |
7433 |
|
|
7434 |
for (Instrument* instrument = GetFirstInstrument(); instrument; |
size_t i = 0; |
7435 |
instrument = GetNextInstrument()) |
for (Instrument* instrument = GetInstrument(i); instrument; |
7436 |
|
instrument = GetInstrument(++i)) |
7437 |
{ |
{ |
7438 |
instrument->UpdateScriptFileOffsets(); |
instrument->UpdateScriptFileOffsets(); |
7439 |
} |
} |