4855 |
* @param index - number of the sought script (0..n) |
* @param index - number of the sought script (0..n) |
4856 |
* @returns sought script or NULL if there's no such script |
* @returns sought script or NULL if there's no such script |
4857 |
*/ |
*/ |
4858 |
Script* ScriptGroup::GetScript(uint index) { |
Script* ScriptGroup::GetScript(size_t index) { |
4859 |
if (!pScripts) LoadScripts(); |
if (!pScripts) LoadScripts(); |
4860 |
if (index >= pScripts->size()) return NULL; |
if (index >= pScripts->size()) return NULL; |
4861 |
return (*pScripts)[index]; |
return (*pScripts)[index]; |
5501 |
File* pFile = (File*) GetParent(); |
File* pFile = (File*) GetParent(); |
5502 |
for (uint k = 0; k < scriptPoolFileOffsets.size(); ++k) { |
for (uint k = 0; k < scriptPoolFileOffsets.size(); ++k) { |
5503 |
uint32_t soughtOffset = scriptPoolFileOffsets[k].fileOffset; |
uint32_t soughtOffset = scriptPoolFileOffsets[k].fileOffset; |
5504 |
for (uint i = 0; pFile->GetScriptGroup(i); ++i) { |
for (size_t i = 0; pFile->GetScriptGroup(i); ++i) { |
5505 |
ScriptGroup* group = pFile->GetScriptGroup(i); |
ScriptGroup* group = pFile->GetScriptGroup(i); |
5506 |
for (uint s = 0; group->GetScript(s); ++s) { |
for (uint s = 0; group->GetScript(s); ++s) { |
5507 |
Script* script = group->GetScript(s); |
Script* script = group->GetScript(s); |
5539 |
* @param index - instrument script slot index |
* @param index - instrument script slot index |
5540 |
* @returns script or NULL if index is out of bounds |
* @returns script or NULL if index is out of bounds |
5541 |
*/ |
*/ |
5542 |
Script* Instrument::GetScriptOfSlot(uint index) { |
Script* Instrument::GetScriptOfSlot(size_t index) { |
5543 |
LoadScripts(); |
LoadScripts(); |
5544 |
if (index >= pScriptRefs->size()) return NULL; |
if (index >= pScriptRefs->size()) return NULL; |
5545 |
return pScriptRefs->at(index).script; |
return pScriptRefs->at(index).script; |
5600 |
* @param index1 - index of the first script slot to swap |
* @param index1 - index of the first script slot to swap |
5601 |
* @param index2 - index of the second script slot to swap |
* @param index2 - index of the second script slot to swap |
5602 |
*/ |
*/ |
5603 |
void Instrument::SwapScriptSlots(uint index1, uint index2) { |
void Instrument::SwapScriptSlots(size_t index1, size_t index2) { |
5604 |
LoadScripts(); |
LoadScripts(); |
5605 |
if (index1 >= pScriptRefs->size() || index2 >= pScriptRefs->size()) |
if (index1 >= pScriptRefs->size() || index2 >= pScriptRefs->size()) |
5606 |
return; |
return; |
5615 |
* |
* |
5616 |
* @param index - index of script slot to remove |
* @param index - index of script slot to remove |
5617 |
*/ |
*/ |
5618 |
void Instrument::RemoveScriptSlot(uint index) { |
void Instrument::RemoveScriptSlot(size_t index) { |
5619 |
LoadScripts(); |
LoadScripts(); |
5620 |
if (index >= pScriptRefs->size()) return; |
if (index >= pScriptRefs->size()) return; |
5621 |
pScriptRefs->erase( pScriptRefs->begin() + index ); |
pScriptRefs->erase( pScriptRefs->begin() + index ); |
5656 |
* GigaStudio 4 software. It will currently only work with LinuxSampler and |
* GigaStudio 4 software. It will currently only work with LinuxSampler and |
5657 |
* gigedit. |
* gigedit. |
5658 |
*/ |
*/ |
5659 |
uint Instrument::ScriptSlotCount() const { |
size_t Instrument::ScriptSlotCount() const { |
5660 |
return uint(pScriptRefs ? pScriptRefs->size() : scriptPoolFileOffsets.size()); |
return pScriptRefs ? pScriptRefs->size() : scriptPoolFileOffsets.size(); |
5661 |
} |
} |
5662 |
|
|
5663 |
/** @brief Whether script execution shall be skipped. |
/** @brief Whether script execution shall be skipped. |
5676 |
* @param index - index of the script slot on this instrument |
* @param index - index of the script slot on this instrument |
5677 |
* @see Script::Bypass |
* @see Script::Bypass |
5678 |
*/ |
*/ |
5679 |
bool Instrument::IsScriptSlotBypassed(uint index) { |
bool Instrument::IsScriptSlotBypassed(size_t index) { |
5680 |
if (index >= ScriptSlotCount()) return false; |
if (index >= ScriptSlotCount()) return false; |
5681 |
return pScriptRefs ? pScriptRefs->at(index).bypass |
return pScriptRefs ? pScriptRefs->at(index).bypass |
5682 |
: scriptPoolFileOffsets.at(index).bypass; |
: scriptPoolFileOffsets.at(index).bypass; |
5716 |
* the @c Script identified by passed @p uuid. |
* the @c Script identified by passed @p uuid. |
5717 |
*/ |
*/ |
5718 |
bool Instrument::ReferencesScriptWithUuid(const _UUID& uuid) { |
bool Instrument::ReferencesScriptWithUuid(const _UUID& uuid) { |
5719 |
const uint nSlots = ScriptSlotCount(); |
const size_t nSlots = ScriptSlotCount(); |
5720 |
for (uint iSlot = 0; iSlot < nSlots; ++iSlot) |
for (size_t iSlot = 0; iSlot < nSlots; ++iSlot) |
5721 |
if (_UUIDFromCArray(&GetScriptOfSlot(iSlot)->Uuid[0]) == uuid) |
if (_UUIDFromCArray(&GetScriptOfSlot(iSlot)->Uuid[0]) == uuid) |
5722 |
return true; |
return true; |
5723 |
return false; |
return false; |
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; |
6711 |
} |
} |
6712 |
|
|
6713 |
// clone script groups and their scripts |
// clone script groups and their scripts |
6714 |
for (int iGroup = 0; pFile->GetScriptGroup(iGroup); ++iGroup) { |
for (size_t iGroup = 0; pFile->GetScriptGroup(iGroup); ++iGroup) { |
6715 |
ScriptGroup* sg = pFile->GetScriptGroup(iGroup); |
ScriptGroup* sg = pFile->GetScriptGroup(iGroup); |
6716 |
ScriptGroup* dg = AddScriptGroup(); |
ScriptGroup* dg = AddScriptGroup(); |
6717 |
dg->Name = "COPY" + ToString(iCallCount) + "_" + sg->Name; |
dg->Name = "COPY" + ToString(iCallCount) + "_" + sg->Name; |
7103 |
* @param index - number of the sought group (0..n) |
* @param index - number of the sought group (0..n) |
7104 |
* @returns sought script group or NULL if there's no such group |
* @returns sought script group or NULL if there's no such group |
7105 |
*/ |
*/ |
7106 |
ScriptGroup* File::GetScriptGroup(uint 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); |