23 |
|
|
24 |
#include <lv2.h> |
#include <lv2.h> |
25 |
#include "lv2_event.h" |
#include "lv2_event.h" |
26 |
#include "lv2-saverestore.h" |
#include "lv2_persist.h" |
27 |
|
#include "lv2_uri_map.h" |
28 |
|
#include "lv2_files.h" |
29 |
#include "../../drivers/Plugin.h" |
#include "../../drivers/Plugin.h" |
30 |
|
|
31 |
namespace { |
namespace { |
39 |
void Activate(); |
void Activate(); |
40 |
void Run(uint32_t SampleCount); |
void Run(uint32_t SampleCount); |
41 |
void Deactivate(); |
void Deactivate(); |
42 |
char* Save(const char* Directory, LV2SR_File*** Files); |
void Save(LV2_Persist_Store_Function store, void* data); |
43 |
char* Restore(const LV2SR_File** Files); |
void Restore(LV2_Persist_Retrieve_Function retrieve, void* data); |
44 |
|
|
45 |
|
protected: |
46 |
|
virtual String PathToState(const String& string); |
47 |
|
virtual String PathFromState(const String& string); |
48 |
|
|
49 |
private: |
private: |
50 |
|
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 |
float* Out[2]; |
float* Out[2]; |
55 |
LV2_Event_Buffer* MidiBuf; |
LV2_Event_Buffer* MidiBuf; |
56 |
|
LV2_URI_Map_Feature* UriMap; |
57 |
|
LV2_Files_Path_Support* PathSupport; |
58 |
|
LV2_Files_New_File_Support* NewFileSupport; |
59 |
|
|
60 |
|
String DefaultState; |
61 |
}; |
}; |
62 |
|
|
63 |
class PluginInfo { |
class PluginInfo { |
65 |
static const LV2_Descriptor* Lv2Descriptor() { |
static const LV2_Descriptor* Lv2Descriptor() { |
66 |
return &Instance.Lv2; |
return &Instance.Lv2; |
67 |
} |
} |
68 |
static const LV2SR_Descriptor* Lv2srDescriptor() { |
static const LV2_Persist* Lv2PersistDescriptor() { |
69 |
return &Instance.Lv2sr; |
return &Instance.Persist; |
70 |
} |
} |
71 |
private: |
private: |
72 |
LV2_Descriptor Lv2; |
LV2_Descriptor Lv2; |
73 |
LV2SR_Descriptor Lv2sr; |
LV2_Persist Persist; |
74 |
|
|
75 |
PluginInfo(); |
PluginInfo(); |
76 |
static PluginInfo Instance; |
static PluginInfo Instance; |
88 |
static void cleanup(LV2_Handle instance); |
static void cleanup(LV2_Handle instance); |
89 |
static const void* extension_data(const char* uri); |
static const void* extension_data(const char* uri); |
90 |
|
|
91 |
static char* save(LV2_Handle handle, const char* directory, |
static void save(LV2_Handle handle, |
92 |
LV2SR_File*** files); |
LV2_Persist_Store_Function store, |
93 |
static char* restore(LV2_Handle handle, const LV2SR_File** files); |
void* data); |
94 |
|
|
95 |
|
static void restore(LV2_Handle handle, |
96 |
|
LV2_Persist_Retrieve_Function retrieve, |
97 |
|
void* data); |
98 |
} |
} |
99 |
} |
} |
100 |
|
|