36 |
* |
* |
37 |
* @param Filename - file name of the instrument |
* @param Filename - file name of the instrument |
38 |
* @param uiInstrumentIndex - index of the instrument within the file |
* @param uiInstrumentIndex - index of the instrument within the file |
39 |
* @param pEngine - engine on which the instrument should be loaded |
* @param pEngineChannel - engine channel on which the instrument should be loaded |
40 |
*/ |
*/ |
41 |
void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine) { |
void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel) { |
42 |
// already tell the engine which instrument to load |
// already tell the engine which instrument to load |
43 |
pEngine->PrepareLoadInstrument(Filename.c_str(), uiInstrumentIndex); |
pEngineChannel->PrepareLoadInstrument(Filename.c_str(), uiInstrumentIndex); |
44 |
|
|
45 |
command_t cmd; |
command_t cmd; |
46 |
cmd.pEngine = pEngine; |
cmd.pEngineChannel = pEngineChannel; |
47 |
pQueue->push(&cmd); |
pQueue->push(&cmd); |
48 |
StartThread(); // ensure thread is running |
StartThread(); // ensure thread is running |
49 |
conditionJobsLeft.Set(true); // wake up thread |
conditionJobsLeft.Set(true); // wake up thread |
56 |
command_t cmd; |
command_t cmd; |
57 |
pQueue->pop(&cmd); |
pQueue->pop(&cmd); |
58 |
try { |
try { |
59 |
cmd.pEngine->LoadInstrument(); |
cmd.pEngineChannel->LoadInstrument(); |
60 |
} |
} |
61 |
catch (LinuxSamplerException e) { |
catch (LinuxSamplerException e) { |
62 |
e.PrintMessage(); |
e.PrintMessage(); |
63 |
} |
} |
|
// Always re-enable the engine. |
|
|
cmd.pEngine->Enable(); |
|
64 |
} |
} |
65 |
|
|
66 |
// nothing left to do, sleep until new jobs arrive |
// nothing left to do, sleep until new jobs arrive |