prepare custom LV2 extensions
[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 /** Alias for cairo_image_surface_t */
40 typedef void* LV2_Inline_Display_Image_Surface;
41
42 typedef struct {
43         /** Opaque host data */
44         LV2_Inline_Display_Handle handle;
45         /** Request from run() that the host should call render() */
46         void (*queue_draw)(LV2_Inline_Display_Handle handle);
47 } LV2_Inline_Display;
48
49 /**
50  * Plugin Inline-Display Interface.
51  */
52 typedef struct {
53         /**
54          * The render method. This is called by the host in a non-realtime context,
55          * usually the main GUI thread.
56          *
57          * @param instance The LV2 instance
58          * @param w the max available width
59          * @return pointer to a cairo image surface or NULL
60          */
61         LV2_Inline_Display_Image_Surface (*render)(LV2_Handle instance, uint32_t w, uint32_t h);
62 } LV2_Inline_Display_Interface;
63
64 /**
65    @}
66 */
67
68 /**
69    @defgroup automate Self-Automation
70
71    Support for plugins to write automation data via Atom Events
72
73    @{
74 */
75
76 #define LV2_AUTOMATE_URI "http://ardour.org/lv2/automate"
77 #define LV2_AUTOMATE_URI_PREFIX LV2_AUTOMATE_URI "#"
78 /** an lv2:optionalFeature */
79 #define LV2_AUTOMATE_URI__can_write LV2_AUTOMATE_URI_PREFIX "canWriteAutomatation"
80 /** atom:supports */
81 #define LV2_AUTOMATE_URI__control LV2_AUTOMATE_URI_PREFIX "automationControl"
82 /** lv2:portProperty */
83 #define LV2_AUTOMATE_URI__controlled LV2_AUTOMATE_URI_PREFIX "automationControlled"
84
85 /** atom messages */
86 #define LV2_AUTOMATE_URI__event LV2_AUTOMATE_URI_PREFIX "event"
87 #define LV2_AUTOMATE_URI__setup LV2_AUTOMATE_URI_PREFIX "setup"
88 #define LV2_AUTOMATE_URI__finalize LV2_AUTOMATE_URI_PREFIX "finalize"
89 #define LV2_AUTOMATE_URI__start LV2_AUTOMATE_URI_PREFIX "start"
90 #define LV2_AUTOMATE_URI__end LV2_AUTOMATE_URI_PREFIX "end"
91 #define LV2_AUTOMATE_URI__parameter LV2_AUTOMATE_URI_PREFIX "parameter"
92 #define LV2_AUTOMATE_URI__value LV2_AUTOMATE_URI_PREFIX "value"
93
94 /**
95    @}
96 */
97
98 /**
99    @defgroup license License-Report
100
101    Allow for commercial LV2 to report their
102          licensing status.
103
104    @{
105 */
106
107 #define LV2_PLUGINLICENSE_URI "http://harrisonconsoles.com/lv2/license"
108 #define LV2_PLUGINLICENSE_PREFIX LV2_INLINEDISPLAY_URI "#"
109 #define LV2_PLUGINLICENSE__interface LV2_INLINEDISPLAY_PREFIX "interface"
110
111 typedef struct _LV2_License_Interface {
112         /* @return -1 if no license is needed; 0 if unlicensed, 1 if licensed */
113         int   (*is_licensed)(LV2_Handle instance);
114         /* @return a string copy of the licensee name if licensed, or NULL, the caller needs to free this */
115         char* (*licensee)(LV2_Handle instance);
116         /* @return a URI identifying the plugin-bundle or plugin for which a given license is valid */
117         const char* (*product_uri)(LV2_Handle instance);
118         /* @return human readable product name for the URI */
119         const char* (*product_name)(LV2_Handle instance);
120         /* @return link to website or webstore */
121         const char* (*store_url)(LV2_Handle instance);
122 } LV2_License_Interface;
123
124 /**
125    @}
126 */
127
128 #endif