2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2016 by Christian Schoenebeck * |
* Copyright (C) 2003-2017 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
4298 |
return pGroup; |
return pGroup; |
4299 |
} |
} |
4300 |
|
|
4301 |
|
/** |
4302 |
|
* Make a (semi) deep copy of the Script object given by @a orig |
4303 |
|
* and assign it to this object. Note: the ScriptGroup this Script |
4304 |
|
* object belongs to remains untouched by this call. |
4305 |
|
* |
4306 |
|
* @param orig - original Script object to be copied from |
4307 |
|
*/ |
4308 |
|
void Script::CopyAssign(const Script* orig) { |
4309 |
|
Name = orig->Name; |
4310 |
|
Compression = orig->Compression; |
4311 |
|
Encoding = orig->Encoding; |
4312 |
|
Language = orig->Language; |
4313 |
|
Bypass = orig->Bypass; |
4314 |
|
data = orig->data; |
4315 |
|
} |
4316 |
|
|
4317 |
void Script::RemoveAllScriptReferences() { |
void Script::RemoveAllScriptReferences() { |
4318 |
File* pFile = pGroup->pFile; |
File* pFile = pGroup->pFile; |
4319 |
for (int i = 0; pFile->GetInstrument(i); ++i) { |
for (int i = 0; pFile->GetInstrument(i); ++i) { |
5629 |
mGroups[pFile->GetSample(i)->GetGroup()]->AddSample(s); |
mGroups[pFile->GetSample(i)->GetGroup()]->AddSample(s); |
5630 |
mSamples[pFile->GetSample(i)] = s; |
mSamples[pFile->GetSample(i)] = s; |
5631 |
} |
} |
5632 |
|
|
5633 |
|
// clone script groups and their scripts |
5634 |
|
for (int iGroup = 0; pFile->GetScriptGroup(iGroup); ++iGroup) { |
5635 |
|
ScriptGroup* sg = pFile->GetScriptGroup(iGroup); |
5636 |
|
ScriptGroup* dg = AddScriptGroup(); |
5637 |
|
dg->Name = "COPY" + ToString(iCallCount) + "_" + sg->Name; |
5638 |
|
for (int iScript = 0; sg->GetScript(iScript); ++iScript) { |
5639 |
|
Script* ss = sg->GetScript(iScript); |
5640 |
|
Script* ds = dg->AddScript(); |
5641 |
|
ds->CopyAssign(ss); |
5642 |
|
} |
5643 |
|
} |
5644 |
|
|
5645 |
//BUG: For some reason this method only works with this additional |
//BUG: For some reason this method only works with this additional |
5646 |
// Save() call in between here. |
// Save() call in between here. |
5647 |
// |
// |