1 |
/*************************************************************************** |
2 |
* * |
3 |
* Copyright (C) 2008 - 2009 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_PLUGINDSSI_H |
22 |
#define LS_PLUGINDSSI_H |
23 |
|
24 |
#include <ladspa.h> |
25 |
#include <dssi.h> |
26 |
|
27 |
#include "../../drivers/Plugin.h" |
28 |
|
29 |
namespace { |
30 |
|
31 |
class PluginDssi : public LinuxSampler::Plugin { |
32 |
public: |
33 |
PluginDssi(unsigned long SampleRate); |
34 |
private: |
35 |
int RefCount; |
36 |
friend class PluginInstance; |
37 |
}; |
38 |
|
39 |
class PluginInstance { |
40 |
public: |
41 |
PluginInstance(unsigned long SampleRate); |
42 |
~PluginInstance(); |
43 |
void ConnectPort(unsigned long Port, LADSPA_Data* DataLocation); |
44 |
char* Configure(const char* Key, const char* Value); |
45 |
void Activate(); |
46 |
static void RunMultipleSynths(unsigned long InstanceCount, |
47 |
LADSPA_Handle* Instances, |
48 |
unsigned long SampleCount, |
49 |
snd_seq_event_t** Events, |
50 |
unsigned long* EventCounts); |
51 |
private: |
52 |
static PluginDssi* plugin; |
53 |
LinuxSampler::SamplerChannel* pChannel; |
54 |
LinuxSampler::MidiInputPort* pPort; |
55 |
LinuxSampler::AudioChannel* pChannelLeft; |
56 |
LinuxSampler::AudioChannel* pChannelRight; |
57 |
|
58 |
LADSPA_Data* Out[2]; |
59 |
}; |
60 |
|
61 |
class PluginInfo { |
62 |
public: |
63 |
static const LADSPA_Descriptor* LadspaDescriptor() { |
64 |
return &Instance.Ladspa; |
65 |
} |
66 |
static const DSSI_Descriptor* DssiDescriptor() { |
67 |
return &Instance.Dssi; |
68 |
} |
69 |
private: |
70 |
LADSPA_Descriptor Ladspa; |
71 |
DSSI_Descriptor Dssi; |
72 |
LADSPA_PortDescriptor PortDescriptors[2]; |
73 |
LADSPA_PortRangeHint PortRangeHints[2]; |
74 |
const char* PortNames[2]; |
75 |
|
76 |
PluginInfo(); |
77 |
static PluginInfo Instance; |
78 |
}; |
79 |
|
80 |
extern "C" { |
81 |
// LADSPA interface |
82 |
static LADSPA_Handle instantiate(const LADSPA_Descriptor* Descriptor, |
83 |
unsigned long SampleRate); |
84 |
static void connect_port(LADSPA_Handle Instance, unsigned long Port, |
85 |
LADSPA_Data* DataLocation); |
86 |
static void activate(LADSPA_Handle Instance); |
87 |
static void run(LADSPA_Handle Instance, unsigned long SampleCount); |
88 |
static void cleanup(LADSPA_Handle Instance); |
89 |
|
90 |
// DSSI interface |
91 |
static char* configure(LADSPA_Handle Instance, |
92 |
const char* Key, |
93 |
const char* Value); |
94 |
static void run_multiple_synths(unsigned long InstanceCount, |
95 |
LADSPA_Handle* Instances, |
96 |
unsigned long SampleCount, |
97 |
snd_seq_event_t** Events, |
98 |
unsigned long* EventCounts); |
99 |
} |
100 |
} |
101 |
|
102 |
#endif |