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_PLUGINLV2_H |
22 |
#define LS_PLUGINLV2_H |
23 |
|
24 |
#include <lv2.h> |
25 |
#include "lv2_event.h" |
26 |
#include "lv2-saverestore.h" |
27 |
#include "../../drivers/Plugin.h" |
28 |
|
29 |
namespace { |
30 |
|
31 |
class PluginLv2 : public LinuxSampler::Plugin { |
32 |
public: |
33 |
PluginLv2(const LV2_Descriptor* Descriptor, |
34 |
double SampleRate, const char* BundlePath, |
35 |
const LV2_Feature* const* Features); |
36 |
void ConnectPort(uint32_t Port, void* DataLocation); |
37 |
void Activate(); |
38 |
void Run(uint32_t SampleCount); |
39 |
void Deactivate(); |
40 |
char* Save(const char* Directory, LV2SR_File*** Files); |
41 |
char* Restore(const LV2SR_File** Files); |
42 |
|
43 |
private: |
44 |
float* Out[2]; |
45 |
LV2_Event_Buffer* MidiBuf; |
46 |
}; |
47 |
|
48 |
class PluginInfo { |
49 |
public: |
50 |
static const LV2_Descriptor* Lv2Descriptor() { |
51 |
return &Instance.Lv2; |
52 |
} |
53 |
static const LV2SR_Descriptor* Lv2srDescriptor() { |
54 |
return &Instance.Lv2sr; |
55 |
} |
56 |
private: |
57 |
LV2_Descriptor Lv2; |
58 |
LV2SR_Descriptor Lv2sr; |
59 |
|
60 |
PluginInfo(); |
61 |
static PluginInfo Instance; |
62 |
}; |
63 |
|
64 |
extern "C" { |
65 |
static LV2_Handle instantiate(const LV2_Descriptor* descriptor, |
66 |
double sample_rate, const char* bundle_path, |
67 |
const LV2_Feature* const* features); |
68 |
static void connect_port(LV2_Handle instance, uint32_t port, |
69 |
void* data_location); |
70 |
static void activate(LV2_Handle instance); |
71 |
static void run(LV2_Handle instance, uint32_t sample_count); |
72 |
static void deactivate(LV2_Handle instance); |
73 |
static void cleanup(LV2_Handle instance); |
74 |
static const void* extension_data(const char* uri); |
75 |
|
76 |
static char* save(LV2_Handle handle, const char* directory, |
77 |
LV2SR_File*** files); |
78 |
static char* restore(LV2_Handle handle, const LV2SR_File** files); |
79 |
} |
80 |
} |
81 |
|
82 |
#endif |