23 |
|
|
24 |
#include "../common/global.h" |
#include "../common/global.h" |
25 |
#include "../common/Thread.h" |
#include "../common/Thread.h" |
26 |
|
#include "../common/Condition.h" |
27 |
#include "../common/RingBuffer.h" |
#include "../common/RingBuffer.h" |
28 |
#include "../Sampler.h" |
#include "../Sampler.h" |
29 |
|
|
35 |
/** |
/** |
36 |
* Instrument loader thread for the LinuxSampler Control Protocol (LSCP) |
* Instrument loader thread for the LinuxSampler Control Protocol (LSCP) |
37 |
* Server for loading instruments in the background. This loader will only |
* Server for loading instruments in the background. This loader will only |
38 |
* load one instrument by one. |
* load one instrument by one. The thread will actually only be created once |
39 |
|
* StartnewLoad() method was called the first time. After that the thread |
40 |
|
* will exist for the whole life time of the LSCPInstrumentLoader instance |
41 |
|
* and just block until new loading jobs arrive. |
42 |
*/ |
*/ |
43 |
class LSCPInstrumentLoader : public Thread { |
class LSCPInstrumentLoader : public Thread { |
44 |
public: |
public: |
47 |
virtual ~LSCPInstrumentLoader(); |
virtual ~LSCPInstrumentLoader(); |
48 |
protected: |
protected: |
49 |
struct command_t { |
struct command_t { |
50 |
String Filename; |
String* pFilename; |
51 |
uint uiInstrumentIndex; |
uint uiInstrumentIndex; |
52 |
Engine* pEngine; |
Engine* pEngine; |
53 |
}; |
}; |
54 |
|
|
55 |
// Instance variables. |
// Instance variables. |
56 |
RingBuffer<command_t>* pQueue; ///< queue with commands for loading new instruments. |
RingBuffer<command_t>* pQueue; ///< queue with commands for loading new instruments. |
57 |
|
Condition conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives |
58 |
|
|
59 |
int Main(); ///< Implementation of virtual method from class Thread. |
int Main(); ///< Implementation of virtual method from class Thread. |
60 |
}; |
}; |