6303 |
delete pGroups; |
delete pGroups; |
6304 |
} |
} |
6305 |
if (pScriptGroups) { |
if (pScriptGroups) { |
6306 |
std::list<ScriptGroup*>::iterator iter = pScriptGroups->begin(); |
std::vector<ScriptGroup*>::iterator iter = pScriptGroups->begin(); |
6307 |
std::list<ScriptGroup*>::iterator end = pScriptGroups->end(); |
std::vector<ScriptGroup*>::iterator end = pScriptGroups->end(); |
6308 |
while (iter != end) { |
while (iter != end) { |
6309 |
delete *iter; |
delete *iter; |
6310 |
++iter; |
++iter; |
7105 |
*/ |
*/ |
7106 |
ScriptGroup* File::GetScriptGroup(size_t index) { |
ScriptGroup* File::GetScriptGroup(size_t index) { |
7107 |
if (!pScriptGroups) LoadScriptGroups(); |
if (!pScriptGroups) LoadScriptGroups(); |
7108 |
std::list<ScriptGroup*>::iterator it = pScriptGroups->begin(); |
if (index >= pScriptGroups->size()) return NULL; |
7109 |
for (uint i = 0; it != pScriptGroups->end(); ++i, ++it) |
return (*pScriptGroups)[index]; |
|
if (i == index) return *it; |
|
|
return NULL; |
|
7110 |
} |
} |
7111 |
|
|
7112 |
/** @brief Get instrument script group (by name). |
/** @brief Get instrument script group (by name). |
7119 |
*/ |
*/ |
7120 |
ScriptGroup* File::GetScriptGroup(const String& name) { |
ScriptGroup* File::GetScriptGroup(const String& name) { |
7121 |
if (!pScriptGroups) LoadScriptGroups(); |
if (!pScriptGroups) LoadScriptGroups(); |
7122 |
std::list<ScriptGroup*>::iterator it = pScriptGroups->begin(); |
for (size_t i = 0; i < pScriptGroups->size(); ++i) { |
7123 |
for (uint i = 0; it != pScriptGroups->end(); ++i, ++it) |
ScriptGroup* pGroup = (*pScriptGroups)[i]; |
7124 |
if ((*it)->Name == name) return *it; |
if (pGroup->Name == name) return pGroup; |
7125 |
|
} |
7126 |
return NULL; |
return NULL; |
7127 |
} |
} |
7128 |
|
|
7155 |
*/ |
*/ |
7156 |
void File::DeleteScriptGroup(ScriptGroup* pScriptGroup) { |
void File::DeleteScriptGroup(ScriptGroup* pScriptGroup) { |
7157 |
if (!pScriptGroups) LoadScriptGroups(); |
if (!pScriptGroups) LoadScriptGroups(); |
7158 |
std::list<ScriptGroup*>::iterator iter = |
std::vector<ScriptGroup*>::iterator iter = |
7159 |
find(pScriptGroups->begin(), pScriptGroups->end(), pScriptGroup); |
find(pScriptGroups->begin(), pScriptGroups->end(), pScriptGroup); |
7160 |
if (iter == pScriptGroups->end()) |
if (iter == pScriptGroups->end()) |
7161 |
throw gig::Exception("Could not delete script group, could not find given script group"); |
throw gig::Exception("Could not delete script group, could not find given script group"); |
7170 |
|
|
7171 |
void File::LoadScriptGroups() { |
void File::LoadScriptGroups() { |
7172 |
if (pScriptGroups) return; |
if (pScriptGroups) return; |
7173 |
pScriptGroups = new std::list<ScriptGroup*>; |
pScriptGroups = new std::vector<ScriptGroup*>; |
7174 |
RIFF::List* lstLS = pRIFF->GetSubList(LIST_TYPE_3LS); |
RIFF::List* lstLS = pRIFF->GetSubList(LIST_TYPE_3LS); |
7175 |
if (lstLS) { |
if (lstLS) { |
7176 |
size_t i = 0; |
size_t i = 0; |
7215 |
// of the respective instrument script chunk as reference. |
// of the respective instrument script chunk as reference. |
7216 |
if (pScriptGroups) { |
if (pScriptGroups) { |
7217 |
// Update instrument script (group) chunks. |
// Update instrument script (group) chunks. |
7218 |
for (std::list<ScriptGroup*>::iterator it = pScriptGroups->begin(); |
for (std::vector<ScriptGroup*>::iterator it = pScriptGroups->begin(); |
7219 |
it != pScriptGroups->end(); ++it) |
it != pScriptGroups->end(); ++it) |
7220 |
{ |
{ |
7221 |
(*it)->UpdateChunks(pProgress); |
(*it)->UpdateChunks(pProgress); |