00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __SLV2_PLUGININSTANCE_H__
00020 #define __SLV2_PLUGININSTANCE_H__
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026 #include <stddef.h>
00027 #include <stdlib.h>
00028 #include "lv2.h"
00029 #include "slv2/plugin.h"
00030 #include "slv2/port.h"
00031
00032 typedef struct _InstanceImpl* SLV2InstanceImpl;
00033
00036
00037
00038
00039
00040
00041
00042
00043
00044 typedef struct _Instance {
00045 const LV2_Descriptor* lv2_descriptor;
00046 LV2_Handle lv2_handle;
00047 SLV2InstanceImpl pimpl;
00048 }* SLV2Instance;
00049
00077 SLV2Instance
00078 slv2_plugin_instantiate(SLV2Plugin plugin,
00079 double sample_rate,
00080 const LV2_Feature*const* features);
00081
00082
00087 void
00088 slv2_instance_free(SLV2Instance instance);
00089
00090 #ifndef LIBSLV2_SOURCE
00091
00096 static inline const char*
00097 slv2_instance_get_uri(SLV2Instance instance)
00098 {
00099 return instance->lv2_descriptor->URI;
00100 }
00101
00102
00108 static inline void
00109 slv2_instance_connect_port(SLV2Instance instance,
00110 uint32_t port_index,
00111 void* data_location)
00112 {
00113 instance->lv2_descriptor->connect_port
00114 (instance->lv2_handle, port_index, data_location);
00115 }
00116
00117
00124 static inline void
00125 slv2_instance_activate(SLV2Instance instance)
00126 {
00127 if (instance->lv2_descriptor->activate)
00128 instance->lv2_descriptor->activate(instance->lv2_handle);
00129 }
00130
00131
00137 static inline void
00138 slv2_instance_run(SLV2Instance instance,
00139 uint32_t sample_count)
00140 {
00141
00142 instance->lv2_descriptor->run(instance->lv2_handle, sample_count);
00143 }
00144
00145
00151 static inline void
00152 slv2_instance_deactivate(SLV2Instance instance)
00153 {
00154 if (instance->lv2_descriptor->deactivate)
00155 instance->lv2_descriptor->deactivate(instance->lv2_handle);
00156 }
00157
00158
00164 static inline const void*
00165 slv2_instance_get_extension_data(SLV2Instance instance,
00166 const char* uri)
00167 {
00168 if (instance->lv2_descriptor->extension_data)
00169 return instance->lv2_descriptor->extension_data(uri);
00170 else
00171 return NULL;
00172 }
00173
00174
00182 static inline const LV2_Descriptor*
00183 slv2_instance_get_descriptor(SLV2Instance instance)
00184 {
00185 return instance->lv2_descriptor;
00186 }
00187
00188
00196 static inline LV2_Handle
00197 slv2_instance_get_handle(SLV2Instance instance)
00198 {
00199 return instance->lv2_handle;
00200 }
00201
00202 #endif
00203
00206 #ifdef __cplusplus
00207 }
00208 #endif
00209
00210
00211 #endif
00212