215 |
} |
} |
216 |
|
|
217 |
/** |
/** |
218 |
* Load an instrument from a .gig file. |
* More or less a workaround to set the instrument name, index and load |
219 |
|
* status variable to zero percent immediately, that is without blocking |
220 |
|
* the calling thread. It might be used in future for other preparations |
221 |
|
* as well though. |
222 |
* |
* |
223 |
* @param FileName - file name of the Gigasampler instrument file |
* @param FileName - file name of the Gigasampler instrument file |
224 |
* @param Instrument - index of the instrument in the .gig file |
* @param Instrument - index of the instrument in the .gig file |
225 |
* @throws LinuxSamplerException on error |
* @see LoadInstrument() |
|
* @returns detailed description of the method call result |
|
226 |
*/ |
*/ |
227 |
void Engine::LoadInstrument(const char* FileName, uint Instrument) { |
void Engine::PrepareLoadInstrument(const char* FileName, uint Instrument) { |
228 |
|
InstrumentFile = FileName; |
229 |
|
InstrumentIdx = Instrument; |
230 |
|
InstrumentStat = 0; |
231 |
|
} |
232 |
|
|
233 |
|
/** |
234 |
|
* Load an instrument from a .gig file. PrepareLoadInstrument() has to |
235 |
|
* be called first to provide the information which instrument to load. |
236 |
|
* This method will then actually start to load the instrument and block |
237 |
|
* the calling thread until loading was completed. |
238 |
|
* |
239 |
|
* @returns detailed description of the method call result |
240 |
|
* @see PrepareLoadInstrument() |
241 |
|
*/ |
242 |
|
void Engine::LoadInstrument() { |
243 |
|
|
244 |
DisableAndLock(); |
DisableAndLock(); |
245 |
|
|
251 |
Instruments.HandBack(pInstrument, this); |
Instruments.HandBack(pInstrument, this); |
252 |
} |
} |
253 |
|
|
|
InstrumentFile = FileName; |
|
|
InstrumentIdx = Instrument; |
|
|
InstrumentStat = 0; |
|
|
|
|
254 |
// delete all key groups |
// delete all key groups |
255 |
ActiveKeyGroups.clear(); |
ActiveKeyGroups.clear(); |
256 |
|
|
257 |
// request gig instrument from instrument manager |
// request gig instrument from instrument manager |
258 |
try { |
try { |
259 |
instrument_id_t instrid; |
instrument_id_t instrid; |
260 |
instrid.FileName = FileName; |
instrid.FileName = InstrumentFile; |
261 |
instrid.iInstrument = Instrument; |
instrid.iInstrument = InstrumentIdx; |
262 |
pInstrument = Instruments.Borrow(instrid, this); |
pInstrument = Instruments.Borrow(instrid, this); |
263 |
if (!pInstrument) { |
if (!pInstrument) { |
264 |
InstrumentStat = -1; |
InstrumentStat = -1; |
1212 |
} |
} |
1213 |
|
|
1214 |
String Engine::Version() { |
String Engine::Version() { |
1215 |
String s = "$Revision: 1.24 $"; |
String s = "$Revision: 1.25 $"; |
1216 |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword |
1217 |
} |
} |
1218 |
|
|