redesign VCA control over gain (and theoretically other scalar controls)
[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
36 /** Opaque handle for LV2_Inline_Display::queue_draw() */
37 typedef void* LV2_Inline_Display_Handle;
38
39 /** raw image pixmap format is ARGB32,
40  * the data pointer is owned by the plugin and must be valid
41  * from the first call to render until cleanup.
42  */
43 typedef struct {
44         unsigned char *data;
45         int width;
46         int height;
47         int stride;
48 } LV2_Inline_Display_Image_Surface;
49
50 /** a LV2 Feature provided by the Host to the plugin */
51 typedef struct {
52         /** Opaque host data */
53         LV2_Inline_Display_Handle handle;
54         /** Request from run() that the host should call render() at a later time
55          * to update the inline display */
56         void (*queue_draw)(LV2_Inline_Display_Handle handle);
57 } LV2_Inline_Display;
58
59 /**
60  * Plugin Inline-Display Interface.
61  */
62 typedef struct {
63         /**
64          * The render method. This is called by the host in a non-realtime context,
65          * usually the main GUI thread.
66          * The data pointer is owned by the plugin and must be valid
67          * from the first call to render until cleanup.
68          *
69          * @param instance The LV2 instance
70          * @param w the max available width
71          * @param h the max available height
72          * @return pointer to a LV2_Inline_Display_Image_Surface or NULL
73          */
74         LV2_Inline_Display_Image_Surface* (*render)(LV2_Handle instance, uint32_t w, uint32_t h);
75 } LV2_Inline_Display_Interface;
76
77 /**
78    @}
79 */
80
81 /**
82    @defgroup automate Self-Automation
83
84    Support for plugins to write automation data via Atom Events
85
86    @{
87 */
88
89 #define LV2_AUTOMATE_URI "http://ardour.org/lv2/automate"
90 #define LV2_AUTOMATE_URI_PREFIX LV2_AUTOMATE_URI "#"
91 /** an lv2:optionalFeature */
92 #define LV2_AUTOMATE_URI__can_write LV2_AUTOMATE_URI_PREFIX "canWriteAutomatation"
93 /** atom:supports */
94 #define LV2_AUTOMATE_URI__control LV2_AUTOMATE_URI_PREFIX "automationControl"
95 /** lv2:portProperty */
96 #define LV2_AUTOMATE_URI__controlled LV2_AUTOMATE_URI_PREFIX "automationControlled"
97 #define LV2_AUTOMATE_URI__controller LV2_AUTOMATE_URI_PREFIX "automationController"
98
99 /** atom messages */
100 #define LV2_AUTOMATE_URI__event LV2_AUTOMATE_URI_PREFIX "event"
101 #define LV2_AUTOMATE_URI__setup LV2_AUTOMATE_URI_PREFIX "setup"
102 #define LV2_AUTOMATE_URI__finalize LV2_AUTOMATE_URI_PREFIX "finalize"
103 #define LV2_AUTOMATE_URI__start LV2_AUTOMATE_URI_PREFIX "start"
104 #define LV2_AUTOMATE_URI__end LV2_AUTOMATE_URI_PREFIX "end"
105 #define LV2_AUTOMATE_URI__parameter LV2_AUTOMATE_URI_PREFIX "parameter"
106 #define LV2_AUTOMATE_URI__value LV2_AUTOMATE_URI_PREFIX "value"
107
108 /**
109    @}
110 */
111
112 /**
113    @defgroup license License-Report
114
115    Allow for commercial LV2 to report their
116          licensing status.
117
118    @{
119 */
120
121 #define LV2_PLUGINLICENSE_URI "http://harrisonconsoles.com/lv2/license"
122 #define LV2_PLUGINLICENSE_PREFIX LV2_PLUGINLICENSE_URI "#"
123 #define LV2_PLUGINLICENSE__interface LV2_PLUGINLICENSE_PREFIX "interface"
124 #define LV2_PLUGINLICENSE__interface2 LV2_PLUGINLICENSE_PREFIX "interface2"
125
126
127 typedef struct _LV2_License_Interface {
128         /* @return -1 if no license is needed; 0 if unlicensed, 1 if licensed */
129         int   (*is_licensed)(LV2_Handle instance);
130         /* @return a string copy of the licensee name if licensed, or NULL, the caller needs to free this */
131         char* (*licensee)(LV2_Handle instance);
132         /* @return a URI identifying the plugin-bundle or plugin for which a given license is valid */
133         const char* (*product_uri)(LV2_Handle instance);
134         /* @return human readable product name for the URI */
135         const char* (*product_name)(LV2_Handle instance);
136         /* @return link to website or webstore */
137         const char* (*store_url)(LV2_Handle instance);
138         /* interface2 ext: preferred location to install the license file, the caller needs to free this */
139         char* (*preferred_license_file_path)(LV2_Handle instance);
140         /* interface2 ext: currently used license file (if any, may be NULL), the caller needs to free this */
141         char* (*current_license_file_path)(LV2_Handle instance);
142         /* interface2 ext: free() allocated strings (licensee, license_file_paths) */
143         void (*free)(char*);
144 } LV2_License_Interface;
145
146 /**
147    @}
148 */
149
150 /**
151    @defgroup plugin provided bypass
152
153          A port with the designation "processing#enable" must
154          control a plugin's internal bypass mode.
155
156          If the port value is larger than zero the plugin processes
157          normally.
158
159          If the port value is zero, the plugin is expected to bypass
160          all signals unmodified.
161
162          The plugin is responsible for providing a click-free transition
163          between the states.
164
165          (values less than zero are reserved for future use:
166          e.g click-free insert/removal of latent plugins.
167          Generally values <= 0 are to be treated as bypassed.)
168
169    lv2:designation <http://ardour.org/lv2/processing#enable> ;
170
171    @{
172 */
173
174 #define LV2_PROCESSING_URI "http://ardour.org/lv2/processing"
175 #define LV2_PROCESSING_URI_PREFIX LV2_PROCESSING_URI "#"
176 #define LV2_PROCESSING_URI__enable LV2_PROCESSING_URI_PREFIX "enable"
177
178 /**
179    @}
180 */
181
182 /**
183    @defgroup midnam MIDI Naming
184
185    @{
186 */
187
188
189 #define LV2_MIDNAM_URI "http://ardour.org/lv2/midnam"
190 #define LV2_MIDNAM_PREFIX LV2_MIDNAM_URI "#"
191 #define LV2_MIDNAM__interface LV2_MIDNAM_PREFIX "interface"
192 #define LV2_MIDNAM__update LV2_MIDNAM_PREFIX "update"
193
194 typedef void* LV2_Midnam_Handle;
195
196 /** a LV2 Feature provided by the Host to the plugin */
197 typedef struct {
198         /** Opaque host data */
199         LV2_Midnam_Handle handle;
200         /** Request from run() that the host should re-read the midnam */
201         void (*update)(LV2_Midnam_Handle handle);
202 } LV2_Midnam;
203
204 typedef struct {
205         /** Query midnam document. The plugin
206          * is expected to return a null-terminated XML
207          * text which is a valid midnam desciption
208          * (or NULL in case of error).
209          *
210          * The midnam <Model> must be unique and
211          * specific for the given plugin-instance.
212          */
213         char* (*midnam)(LV2_Handle instance);
214
215         /** The unique model id used ith the midnam,
216          * (or NULL).
217          */
218         char* (*model)(LV2_Handle instance);
219
220         /** free allocated strings. The host
221          * calls this for every value returned by
222          * \ref midnam and \ref model.
223          */
224         void (*free)(char*);
225 } LV2_Midnam_Interface;
226
227 /**
228    @}
229 */
230 #endif