94 |
// keep the dimension regions and samples that are in use |
// keep the dimension regions and samples that are in use |
95 |
pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse); |
pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse); |
96 |
} |
} |
97 |
|
if (cmd.pScript) { |
98 |
|
// give old instrument script back to instrument resource manager |
99 |
|
cmd.pScript->resetAll(); |
100 |
|
} |
101 |
cmd.pRegionsInUse->clear(); |
cmd.pRegionsInUse->clear(); |
102 |
|
|
103 |
// delete all key groups |
// delete all key groups |
114 |
if (!newInstrument) { |
if (!newInstrument) { |
115 |
throw InstrumentManagerException("resource was not created"); |
throw InstrumentManagerException("resource was not created"); |
116 |
} |
} |
117 |
|
|
118 |
|
if (newInstrument->scripts.size() > 1) { |
119 |
|
std::cerr << "WARNING: Executing more than one real-time instrument script slot is not implemented yet!\n"; |
120 |
|
} |
121 |
|
::sfz::Script* script = (!newInstrument->scripts.empty()) ? &newInstrument->scripts[0] : NULL; |
122 |
|
if (script) { |
123 |
|
String sourceCode = script->GetSourceCode(); |
124 |
|
LoadInstrumentScript(sourceCode); |
125 |
|
} |
126 |
} |
} |
127 |
catch (InstrumentManagerException e) { |
catch (InstrumentManagerException e) { |
128 |
InstrumentStat = -3; |
InstrumentStat = -3; |
159 |
InstrumentIdxName = newInstrument->GetName(); |
InstrumentIdxName = newInstrument->GetName(); |
160 |
InstrumentStat = 100; |
InstrumentStat = 100; |
161 |
|
|
162 |
ChangeInstrument(newInstrument); |
{ |
163 |
|
InstrumentChangeCmd< ::sfz::Region, ::sfz::Instrument>& cmd = |
164 |
|
ChangeInstrument(newInstrument); |
165 |
|
if (cmd.pScript) { |
166 |
|
// give old instrument script back to instrument resource manager |
167 |
|
cmd.pScript->resetAll(); |
168 |
|
} |
169 |
|
} |
170 |
|
|
171 |
StatusChanged(true); |
StatusChanged(true); |
172 |
} |
} |