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_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 |
~PluginDssi(); |
35 |
void ConnectPort(unsigned long Port, LADSPA_Data* DataLocation); |
36 |
char* Configure(const char* Key, const char* Value); |
37 |
void Activate(); |
38 |
void RunSynth(unsigned long SampleCount, snd_seq_event_t* Events, |
39 |
unsigned long EventCount); |
40 |
private: |
41 |
LinuxSampler::SamplerChannel* pChannel; |
42 |
LADSPA_Data* Out[2]; |
43 |
}; |
44 |
|
45 |
class PluginInfo { |
46 |
public: |
47 |
static const LADSPA_Descriptor* LadspaDescriptor() { |
48 |
return &Instance.Ladspa; |
49 |
} |
50 |
static const DSSI_Descriptor* DssiDescriptor() { |
51 |
return &Instance.Dssi; |
52 |
} |
53 |
private: |
54 |
LADSPA_Descriptor Ladspa; |
55 |
DSSI_Descriptor Dssi; |
56 |
LADSPA_PortDescriptor PortDescriptors[2]; |
57 |
LADSPA_PortRangeHint PortRangeHints[2]; |
58 |
const char* PortNames[2]; |
59 |
|
60 |
PluginInfo(); |
61 |
static PluginInfo Instance; |
62 |
}; |
63 |
|
64 |
extern "C" { |
65 |
// LADSPA interface |
66 |
static LADSPA_Handle instantiate(const LADSPA_Descriptor* Descriptor, |
67 |
unsigned long SampleRate); |
68 |
static void connect_port(LADSPA_Handle Instance, unsigned long Port, |
69 |
LADSPA_Data* DataLocation); |
70 |
static void activate(LADSPA_Handle Instance); |
71 |
static void run(LADSPA_Handle Instance, unsigned long SampleCount); |
72 |
static void cleanup(LADSPA_Handle Instance); |
73 |
|
74 |
// DSSI interface |
75 |
static char* configure(LADSPA_Handle Instance, |
76 |
const char* Key, |
77 |
const char* Value); |
78 |
static void run_synth(LADSPA_Handle Instance, |
79 |
unsigned long SampleCount, |
80 |
snd_seq_event_t* Events, |
81 |
unsigned long EventCount); |
82 |
static void run_multiple_synths(unsigned long InstanceCount, |
83 |
LADSPA_Handle* Instances, |
84 |
unsigned long SampleCount, |
85 |
snd_seq_event_t** Events, |
86 |
unsigned long* EventCounts); |
87 |
} |
88 |
} |
89 |
|
90 |
#endif |