1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2005 Christian Schoenebeck * |
4 |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
7 |
* the Free Software Foundation; either version 2 of the License, or * |
8 |
* (at your option) any later version. * |
9 |
* * |
10 |
* This library is distributed in the hope that it will be useful, * |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
* GNU General Public License for more details. * |
14 |
* * |
15 |
* You should have received a copy of the GNU General Public License * |
16 |
* along with this library; if not, write to the Free Software * |
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
18 |
* MA 02111-1307 USA * |
19 |
***************************************************************************/ |
20 |
|
21 |
#ifndef __LSCPINSTRUMENTLOADER_H__ |
22 |
#define __LSCPINSTRUMENTLOADER_H__ |
23 |
|
24 |
#include "../common/global.h" |
25 |
#include "../common/Thread.h" |
26 |
#include "../common/RingBuffer.h" |
27 |
#include "../Sampler.h" |
28 |
|
29 |
/// Maximum numbers of instruments waiting to be loaded by the LSCPInstrumentLoader. |
30 |
#define INSTRUMENT_LOADER_QUEUE_SIZE 200 |
31 |
|
32 |
using namespace LinuxSampler; |
33 |
|
34 |
/** |
35 |
* Instrument loader thread for the LinuxSampler Control Protocol (LSCP) |
36 |
* Server for loading instruments in the background. This loader will only |
37 |
* load one instrument by one. |
38 |
*/ |
39 |
class LSCPInstrumentLoader : public Thread { |
40 |
public: |
41 |
LSCPInstrumentLoader(); |
42 |
void StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine); |
43 |
virtual ~LSCPInstrumentLoader(); |
44 |
protected: |
45 |
struct command_t { |
46 |
String Filename; |
47 |
uint uiInstrumentIndex; |
48 |
Engine* pEngine; |
49 |
}; |
50 |
|
51 |
// Instance variables. |
52 |
RingBuffer<command_t>* pQueue; ///< queue with commands for loading new instruments. |
53 |
|
54 |
int Main(); ///< Implementation of virtual method from class Thread. |
55 |
}; |
56 |
|
57 |
#endif // __LSCPINSTRUMENTLOADER_H__ |