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 |
LADSPA_Data* Out[2]; |
55 |
}; |
56 |
|
57 |
class PluginInfo { |
58 |
public: |
59 |
static const LADSPA_Descriptor* LadspaDescriptor() { |
60 |
return &Instance.Ladspa; |
61 |
} |
62 |
static const DSSI_Descriptor* DssiDescriptor() { |
63 |
return &Instance.Dssi; |
64 |
} |
65 |
private: |
66 |
LADSPA_Descriptor Ladspa; |
67 |
DSSI_Descriptor Dssi; |
68 |
LADSPA_PortDescriptor PortDescriptors[2]; |
69 |
LADSPA_PortRangeHint PortRangeHints[2]; |
70 |
const char* PortNames[2]; |
71 |
|
72 |
PluginInfo(); |
73 |
static PluginInfo Instance; |
74 |
}; |
75 |
|
76 |
extern "C" { |
77 |
// LADSPA interface |
78 |
static LADSPA_Handle instantiate(const LADSPA_Descriptor* Descriptor, |
79 |
unsigned long SampleRate); |
80 |
static void connect_port(LADSPA_Handle Instance, unsigned long Port, |
81 |
LADSPA_Data* DataLocation); |
82 |
static void activate(LADSPA_Handle Instance); |
83 |
static void run(LADSPA_Handle Instance, unsigned long SampleCount); |
84 |
static void cleanup(LADSPA_Handle Instance); |
85 |
|
86 |
// DSSI interface |
87 |
static char* configure(LADSPA_Handle Instance, |
88 |
const char* Key, |
89 |
const char* Value); |
90 |
static void run_multiple_synths(unsigned long InstanceCount, |
91 |
LADSPA_Handle* Instances, |
92 |
unsigned long SampleCount, |
93 |
snd_seq_event_t** Events, |
94 |
unsigned long* EventCounts); |
95 |
} |
96 |
} |
97 |
|
98 |
#endif |