1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2008 Andreas Persson * |
4 |
* * |
5 |
* This program 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 program 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 program; if not, write to the Free Software * |
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * |
18 |
* MA 02110-1301 USA * |
19 |
***************************************************************************/ |
20 |
|
21 |
#ifndef LS_PLUGIN_H |
22 |
#define LS_PLUGIN_H |
23 |
|
24 |
#include "../Sampler.h" |
25 |
#include "../common/Thread.h" |
26 |
#include "../network/lscpserver.h" |
27 |
#include "audio/AudioOutputDevicePlugin.h" |
28 |
#include "midi/MidiInputDevicePlugin.h" |
29 |
|
30 |
namespace LinuxSampler { |
31 |
|
32 |
class EventThread; |
33 |
|
34 |
class PluginGlobal { |
35 |
public: |
36 |
PluginGlobal(); |
37 |
virtual ~PluginGlobal(); |
38 |
|
39 |
Sampler* pSampler; |
40 |
int RefCount; |
41 |
private: |
42 |
LSCPServer* pLSCPServer; |
43 |
EventThread* pEventThread; |
44 |
}; |
45 |
|
46 |
class EventThread : public Thread { |
47 |
public: |
48 |
EventThread(Sampler* pSampler); |
49 |
int Main(); |
50 |
private: |
51 |
Sampler* pSampler; |
52 |
}; |
53 |
|
54 |
|
55 |
/** @brief Base class for LinuxSampler plugin implementations |
56 |
* |
57 |
* When LinuxSampler is run as a plugin in a sequencer, the |
58 |
* classes that implement the different type of plugin interfaces |
59 |
* (VST, DSSI, LV2, etc) can inherit from this class. |
60 |
* |
61 |
* The plugin gets access to audio and midi devices that it can |
62 |
* use to let the engine render the audio. Methods to get and set |
63 |
* the state of the sampler is also provided. |
64 |
*/ |
65 |
class Plugin { |
66 |
protected: |
67 |
Plugin(); |
68 |
~Plugin(); |
69 |
void Init(int SampleRate, int FragmentSize); |
70 |
|
71 |
void InitState(); |
72 |
String GetState(); |
73 |
bool SetState(String State); |
74 |
|
75 |
AudioOutputDevicePlugin* pAudioDevice; |
76 |
MidiInputDevicePlugin* pMidiDevice; |
77 |
static PluginGlobal* global; |
78 |
private: |
79 |
void RemoveChannels(); |
80 |
}; |
81 |
} |
82 |
|
83 |
#endif |