Refactor LTC File decoder, prepare for Lua bindings
[ardour.git] / libs / ardour / ardour / lv2_extensions.h
1 /*
2   Copyright 2016 Robin Gareus <robin@gareus.org>
3
4   Permission to use, copy, modify, and/or distribute this software for any
5   purpose with or without fee is hereby granted, provided that the above
6   copyright notice and this permission notice appear in all copies.
7
8   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef _ardour_lv2_extensions_h_
18 #define _ardour_lv2_extensions_h_
19
20 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
21
22 /**
23    @defgroup inlinedisplay Inline-Display
24
25    Support for displaying a miniaturized generic view
26          directly in the host's Mixer Window.
27
28    @{
29 */
30
31 #define LV2_INLINEDISPLAY_URI "http://harrisonconsoles.com/lv2/inlinedisplay"
32 #define LV2_INLINEDISPLAY_PREFIX LV2_INLINEDISPLAY_URI "#"
33 #define LV2_INLINEDISPLAY__interface LV2_INLINEDISPLAY_PREFIX "interface"
34 #define LV2_INLINEDISPLAY__queue_draw LV2_INLINEDISPLAY_PREFIX "queue_draw"
35 #define LV2_INLINEDISPLAY__in_gui LV2_INLINEDISPLAY_PREFIX "in_gui"
36
37 /** Opaque handle for LV2_Inline_Display::queue_draw() */
38 typedef void* LV2_Inline_Display_Handle;
39
40 /** raw image pixmap format is ARGB32,
41  * the data pointer is owned by the plugin and must be valid
42  * from the first call to render until cleanup.
43  */
44 typedef struct {
45         unsigned char *data;
46         int width;
47         int height;
48         int stride;
49 } LV2_Inline_Display_Image_Surface;
50
51 /** a LV2 Feature provided by the Host to the plugin */
52 typedef struct {
53         /** Opaque host data */
54         LV2_Inline_Display_Handle handle;
55         /** Request from run() that the host should call render() at a later time
56          * to update the inline display */
57         void (*queue_draw)(LV2_Inline_Display_Handle handle);
58 } LV2_Inline_Display;
59
60 /**
61  * Plugin Inline-Display Interface.
62  */
63 typedef struct {
64         /**
65          * The render method. This is called by the host in a non-realtime context,
66          * usually the main GUI thread.
67          * The data pointer is owned by the plugin and must be valid
68          * from the first call to render until cleanup.
69          *
70          * @param instance The LV2 instance
71          * @param w the max available width
72          * @param h the max available height
73          * @return pointer to a LV2_Inline_Display_Image_Surface or NULL
74          */
75         LV2_Inline_Display_Image_Surface* (*render)(LV2_Handle instance, uint32_t w, uint32_t h);
76 } LV2_Inline_Display_Interface;
77
78 /**
79    @}
80 */
81
82 /**
83    @defgroup automate Self-Automation
84
85    Support for plugins to write automation data via Atom Events
86
87    @{
88 */
89
90 #define LV2_AUTOMATE_URI "http://ardour.org/lv2/automate"
91 #define LV2_AUTOMATE_URI_PREFIX LV2_AUTOMATE_URI "#"
92 /** an lv2:optionalFeature */
93 #define LV2_AUTOMATE_URI__can_write LV2_AUTOMATE_URI_PREFIX "canWriteAutomatation"
94 /** atom:supports */
95 #define LV2_AUTOMATE_URI__control LV2_AUTOMATE_URI_PREFIX "automationControl"
96 /** lv2:portProperty */
97 #define LV2_AUTOMATE_URI__controlled LV2_AUTOMATE_URI_PREFIX "automationControlled"
98 #define LV2_AUTOMATE_URI__controller LV2_AUTOMATE_URI_PREFIX "automationController"
99
100 /** atom messages */
101 #define LV2_AUTOMATE_URI__event LV2_AUTOMATE_URI_PREFIX "event"
102 #define LV2_AUTOMATE_URI__setup LV2_AUTOMATE_URI_PREFIX "setup"
103 #define LV2_AUTOMATE_URI__finalize LV2_AUTOMATE_URI_PREFIX "finalize"
104 #define LV2_AUTOMATE_URI__start LV2_AUTOMATE_URI_PREFIX "start"
105 #define LV2_AUTOMATE_URI__end LV2_AUTOMATE_URI_PREFIX "end"
106 #define LV2_AUTOMATE_URI__parameter LV2_AUTOMATE_URI_PREFIX "parameter"
107 #define LV2_AUTOMATE_URI__value LV2_AUTOMATE_URI_PREFIX "value"
108
109 /**
110    @}
111 */
112
113 /**
114    @defgroup license License-Report
115
116    Allow for commercial LV2 to report their
117          licensing status.
118
119    @{
120 */
121
122 #define LV2_PLUGINLICENSE_URI "http://harrisonconsoles.com/lv2/license"
123 #define LV2_PLUGINLICENSE_PREFIX LV2_PLUGINLICENSE_URI "#"
124 #define LV2_PLUGINLICENSE__interface LV2_PLUGINLICENSE_PREFIX "interface"
125 #define LV2_PLUGINLICENSE__interface2 LV2_PLUGINLICENSE_PREFIX "interface2"
126
127
128 typedef struct _LV2_License_Interface {
129         /* @return -1 if no license is needed; 0 if unlicensed, 1 if licensed */
130         int   (*is_licensed)(LV2_Handle instance);
131         /* @return a string copy of the licensee name if licensed, or NULL, the caller needs to free this */
132         char* (*licensee)(LV2_Handle instance);
133         /* @return a URI identifying the plugin-bundle or plugin for which a given license is valid */
134         const char* (*product_uri)(LV2_Handle instance);
135         /* @return human readable product name for the URI */
136         const char* (*product_name)(LV2_Handle instance);
137         /* @return link to website or webstore */
138         const char* (*store_url)(LV2_Handle instance);
139         /* interface2 ext: preferred location to install the license file, the caller needs to free this */
140         char* (*preferred_license_file_path)(LV2_Handle instance);
141         /* interface2 ext: currently used license file (if any, may be NULL), the caller needs to free this */
142         char* (*current_license_file_path)(LV2_Handle instance);
143         /* interface2 ext: free() allocated strings (licensee, license_file_paths) */
144         void (*free)(char*);
145 } LV2_License_Interface;
146
147 /**
148    @}
149 */
150
151 /**
152    @defgroup plugin provided bypass
153
154          A port with the designation "processing#enable" must
155          control a plugin's internal bypass mode.
156
157          If the port value is larger than zero the plugin processes
158          normally.
159
160          If the port value is zero, the plugin is expected to bypass
161          all signals unmodified.
162
163          The plugin is responsible for providing a click-free transition
164          between the states.
165
166          (values less than zero are reserved for future use:
167          e.g click-free insert/removal of latent plugins.
168          Generally values <= 0 are to be treated as bypassed.)
169
170    lv2:designation <http://ardour.org/lv2/processing#enable> ;
171
172    @{
173 */
174
175 #define LV2_PROCESSING_URI "http://ardour.org/lv2/processing"
176 #define LV2_PROCESSING_URI_PREFIX LV2_PROCESSING_URI "#"
177 #define LV2_PROCESSING_URI__enable LV2_PROCESSING_URI_PREFIX "enable"
178
179 /**
180    @}
181 */
182
183 /**
184    @defgroup midnam MIDI Naming
185
186    @{
187 */
188
189
190 #define LV2_MIDNAM_URI "http://ardour.org/lv2/midnam"
191 #define LV2_MIDNAM_PREFIX LV2_MIDNAM_URI "#"
192 #define LV2_MIDNAM__interface LV2_MIDNAM_PREFIX "interface"
193 #define LV2_MIDNAM__update LV2_MIDNAM_PREFIX "update"
194
195 typedef void* LV2_Midnam_Handle;
196
197 /** a LV2 Feature provided by the Host to the plugin */
198 typedef struct {
199         /** Opaque host data */
200         LV2_Midnam_Handle handle;
201         /** Request from run() that the host should re-read the midnam */
202         void (*update)(LV2_Midnam_Handle handle);
203 } LV2_Midnam;
204
205 typedef struct {
206         /** Query midnam document. The plugin
207          * is expected to return a null-terminated XML
208          * text which is a valid midnam desciption
209          * (or NULL in case of error).
210          *
211          * The midnam <Model> must be unique and
212          * specific for the given plugin-instance.
213          */
214         char* (*midnam)(LV2_Handle instance);
215
216         /** The unique model id used ith the midnam,
217          * (or NULL).
218          */
219         char* (*model)(LV2_Handle instance);
220
221         /** free allocated strings. The host
222          * calls this for every value returned by
223          * \ref midnam and \ref model.
224          */
225         void (*free)(char*);
226 } LV2_Midnam_Interface;
227
228 /**
229    @}
230 */
231
232 /**
233    @defgroup bankpatch
234
235    @{
236 */
237
238
239 #define LV2_BANKPATCH_URI "http://ardour.org/lv2/bankpatch"
240 #define LV2_BANKPATCH_PREFIX LV2_BANKPATCH_URI "#"
241 #define LV2_BANKPATCH__notify LV2_BANKPATCH_PREFIX "notify"
242
243 typedef void* LV2_BankPatch_Handle;
244
245 /** a LV2 Feature provided by the Host to the plugin */
246 typedef struct {
247         /** Opaque host data */
248         LV2_BankPatch_Handle handle;
249         /** Info from plugin's run(), notify host that bank/program changed */
250         void (*notify)(LV2_BankPatch_Handle handle, uint8_t channel, uint32_t bank, uint8_t pgm);
251 } LV2_BankPatch;
252
253 /**
254    @}
255 */
256 #endif