/[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 2174 - (hide annotations) (download) (as text)
Tue Apr 12 15:19:56 2011 UTC (13 years ago) by capela
File MIME type: text/x-c++hdr
File size: 4141 byte(s)
* plugin changes:
    - LV2 Persist + Files support (patch by David Robillard)

1 persson 1777 /***************************************************************************
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 capela 2174 #include "lv2_persist.h"
27     #include "lv2_uri_map.h"
28     #include "lv2_files.h"
29 persson 1777 #include "../../drivers/Plugin.h"
30    
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     void ConnectPort(uint32_t Port, void* DataLocation);
39     void Activate();
40     void Run(uint32_t SampleCount);
41     void Deactivate();
42 capela 2174 void Save(LV2_Persist_Store_Function store, void* data);
43     void Restore(LV2_Persist_Retrieve_Function retrieve, void* data);
44 persson 1777
45 capela 2174 protected:
46     virtual String PathToState(const String& string);
47     virtual String PathFromState(const String& string);
48    
49 persson 1777 private:
50 capela 2174 uint32_t uri_to_id(const char* map, const char* uri) {
51     return UriMap->uri_to_id(UriMap->callback_data, map, uri);
52     }
53    
54 persson 1777 float* Out[2];
55     LV2_Event_Buffer* MidiBuf;
56 capela 2174 LV2_URI_Map_Feature* UriMap;
57     LV2_Files_Path_Support* PathSupport;
58     LV2_Files_New_File_Support* NewFileSupport;
59    
60     String DefaultState;
61 persson 1777 };
62    
63     class PluginInfo {
64     public:
65     static const LV2_Descriptor* Lv2Descriptor() {
66     return &Instance.Lv2;
67     }
68 capela 2174 static const LV2_Persist* Lv2PersistDescriptor() {
69     return &Instance.Persist;
70 persson 1777 }
71     private:
72     LV2_Descriptor Lv2;
73 capela 2174 LV2_Persist Persist;
74 persson 1777
75     PluginInfo();
76     static PluginInfo Instance;
77     };
78    
79     extern "C" {
80     static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
81     double sample_rate, const char* bundle_path,
82     const LV2_Feature* const* features);
83     static void connect_port(LV2_Handle instance, uint32_t port,
84     void* data_location);
85     static void activate(LV2_Handle instance);
86     static void run(LV2_Handle instance, uint32_t sample_count);
87     static void deactivate(LV2_Handle instance);
88     static void cleanup(LV2_Handle instance);
89     static const void* extension_data(const char* uri);
90    
91 capela 2174 static void save(LV2_Handle handle,
92     LV2_Persist_Store_Function store,
93     void* data);
94    
95     static void restore(LV2_Handle handle,
96     LV2_Persist_Retrieve_Function retrieve,
97     void* data);
98 persson 1777 }
99     }
100    
101     #endif

  ViewVC Help
Powered by ViewVC