/[svn]/linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2356 - (hide annotations) (download) (as text)
Sun Jul 8 14:44:47 2012 UTC (11 years, 9 months ago) by persson
File MIME type: text/x-c++hdr
File size: 4680 byte(s)
* LV2: use urid and atom extensions instead of deprecated uri-map and
  event
* LV2: lv2 package 1.0 is now required to build the LV2 plugin
* LV2: changed number of output channels to 16 stereo, just like the
  VST and AU plugins

1 persson 1777 /***************************************************************************
2     * *
3 persson 2343 * Copyright (C) 2008 - 2012 Andreas Persson *
4 persson 1777 * *
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 persson 2356 #include "../../drivers/Plugin.h"
25    
26 persson 2343 #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
27 persson 2356 #include <lv2/lv2plug.in/ns/ext/atom/atom.h>
28 persson 2343 #include <lv2/lv2plug.in/ns/ext/state/state.h>
29 persson 2356 #include <lv2/lv2plug.in/ns/ext/urid/urid.h>
30 persson 1777
31     namespace {
32    
33     class PluginLv2 : public LinuxSampler::Plugin {
34     public:
35     PluginLv2(const LV2_Descriptor* Descriptor,
36     double SampleRate, const char* BundlePath,
37     const LV2_Feature* const* Features);
38 persson 2356 ~PluginLv2();
39 persson 1777 void ConnectPort(uint32_t Port, void* DataLocation);
40     void Activate();
41     void Run(uint32_t SampleCount);
42     void Deactivate();
43 capela 2340 LV2_State_Status Save(LV2_State_Store_Function store, void* data,
44     uint32_t flags, const LV2_Feature* const* features);
45     LV2_State_Status Restore(LV2_State_Retrieve_Function retrieve, void* data,
46     uint32_t flags, const LV2_Feature* const* features);
47 persson 1777
48 schoenebeck 2304 protected:
49 capela 2174 virtual String PathToState(const String& string);
50     virtual String PathFromState(const String& string);
51    
52 persson 1777 private:
53 persson 2356 LV2_URID uri_to_id(const char* uri) {
54     return UriMap->map(UriMap->handle, uri);
55 capela 2174 }
56    
57 schoenebeck 2304 void SetStateFeatures(const LV2_Feature* const* Features);
58    
59 persson 2356 float** Out;
60     LV2_Atom_Sequence* MidiBuf;
61     LV2_URID_Map* UriMap;
62     LV2_URID MidiEventType;
63 capela 2291 LV2_State_Map_Path* MapPath;
64     LV2_State_Make_Path* MakePath;
65 capela 2174
66     String DefaultState;
67 persson 1777 };
68    
69     class PluginInfo {
70     public:
71     static const LV2_Descriptor* Lv2Descriptor() {
72     return &Instance.Lv2;
73     }
74 capela 2291 static const LV2_State_Interface* Lv2StateInterface() {
75     return &Instance.StateInterface;
76 persson 1777 }
77     private:
78     LV2_Descriptor Lv2;
79 capela 2291 LV2_State_Interface StateInterface;
80 persson 1777
81     PluginInfo();
82     static PluginInfo Instance;
83     };
84    
85     extern "C" {
86     static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
87     double sample_rate, const char* bundle_path,
88     const LV2_Feature* const* features);
89     static void connect_port(LV2_Handle instance, uint32_t port,
90     void* data_location);
91     static void activate(LV2_Handle instance);
92     static void run(LV2_Handle instance, uint32_t sample_count);
93     static void deactivate(LV2_Handle instance);
94     static void cleanup(LV2_Handle instance);
95     static const void* extension_data(const char* uri);
96    
97 persson 2356 static LV2_State_Status save(LV2_Handle handle,
98 capela 2340 LV2_State_Store_Function store,
99 persson 2356 LV2_State_Handle state, uint32_t flags,
100     const LV2_Feature* const* features);
101 capela 2174
102 persson 2356 static LV2_State_Status restore(LV2_Handle handle,
103 capela 2340 LV2_State_Retrieve_Function retrieve,
104 persson 2356 LV2_State_Handle state, uint32_t flags,
105     const LV2_Feature* const* features);
106 persson 1777 }
107     }
108    
109     #endif

  ViewVC Help
Powered by ViewVC