3 Copyright 2012 Filipe Coelho <falktx@falktx.com>
5 Permission to use, copy, modify, and/or distribute this software for any
6 purpose with or without fee is hereby granted, provided that the above
7 copyright notice and this permission notice appear in all copies.
9 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 C header for the LV2 programs extension <http://kxstudio.sf.net/ns/lv2ext/programs>.
23 #ifndef LV2_PROGRAMS_H
24 #define LV2_PROGRAMS_H
29 #define LV2_PROGRAMS_URI "http://kxstudio.sf.net/ns/lv2ext/programs"
30 #define LV2_PROGRAMS_PREFIX LV2_PROGRAMS_URI "#"
32 #define LV2_PROGRAMS__Host LV2_PROGRAMS_PREFIX "Host"
33 #define LV2_PROGRAMS__Interface LV2_PROGRAMS_PREFIX "Interface"
34 #define LV2_PROGRAMS__UIInterface LV2_PROGRAMS_PREFIX "UIInterface"
40 typedef void* LV2_Programs_Handle
;
42 typedef struct _LV2_Program_Descriptor
{
44 /** Bank number for this program. Note that this extension does not
45 support MIDI-style separation of bank LSB and MSB values. There is
46 no restriction on the set of available banks: the numbers do not
47 need to be contiguous, there does not need to be a bank 0, etc. */
50 /** Program number (unique within its bank) for this program. There is
51 no restriction on the set of available programs: the numbers do not
52 need to be contiguous, there does not need to be a program 0, etc. */
55 /** Name of the program. */
58 } LV2_Program_Descriptor
;
61 Programs extension, plugin data.
63 When the plugin's extension_data is called with argument LV2_PROGRAMS__Interface,
64 the plugin MUST return an LV2_Programs_Instance structure, which remains valid
65 for the lifetime of the plugin.
67 typedef struct _LV2_Programs_Interface
{
71 * This member is a function pointer that provides a description
72 * of a program (named preset sound) available on this plugin.
74 * The index argument is an index into the plugin's list of
75 * programs, not a program number as represented by the Program
76 * field of the LV2_Program_Descriptor. (This distinction is
77 * needed to support plugins that use non-contiguous program or
80 * This function returns a LV2_Program_Descriptor pointer that is
81 * guaranteed to be valid only until the next call to get_program
82 * or deactivate, on the same plugin instance. This function must
83 * return NULL if passed an index argument out of range, so that
84 * the host can use it to query the number of programs as well as
87 const LV2_Program_Descriptor
*(*get_program
)(LV2_Handle handle
,
93 * This member is a function pointer that selects a new program
94 * for this plugin. The program change should take effect
95 * immediately at the start of the next run() call. (This
96 * means that a host providing the capability of changing programs
97 * between any two notes on a track must vary the block size so as
98 * to place the program change at the right place. A host that
99 * wanted to avoid this would probably just instantiate a plugin
102 * Plugins should ignore a select_program() call with an invalid
105 * A plugin is not required to select any particular default
106 * program on activate(): it's the host's duty to set a program
109 * A plugin is permitted to re-write the values of its input
110 * control ports when select_program is called. The host should
111 * re-read the input control port values and update its own
112 * records appropriately. (This is the only circumstance in which
113 * a LV2 plugin is allowed to modify its own control-input ports.)
115 void (*select_program
)(LV2_Handle handle
,
119 } LV2_Programs_Interface
;
122 Programs extension, UI data.
124 When the UI's extension_data is called with argument LV2_PROGRAMS__UIInterface,
125 the UI MUST return an LV2_Programs_UI_Interface structure, which remains valid
126 for the lifetime of the UI.
128 typedef struct _LV2_Programs_UI_Interface
{
132 * This is exactly the same as select_program in LV2_Programs_Instance,
133 * but this struct relates to the UI instead of the plugin.
135 * When called, UIs should update their state to match the selected program.
137 void (*select_program
)(LV2UI_Handle handle
,
141 } LV2_Programs_UI_Interface
;
144 Feature data for LV2_PROGRAMS__Host.
146 typedef struct _LV2_Programs_Host
{
150 LV2_Programs_Handle handle
;
155 * Tell the host to reload a plugin's program.
156 * Parameter handle MUST be the 'handle' member of this struct.
157 * Parameter index is program index to change.
158 * When index is -1, host should reload all the programs.
160 * The plugin MUST NEVER call this function on a RT context or during run().
162 * NOTE: This call is to inform the host about a program's bank, program or name change.
163 * It DOES NOT change the current selected program.
165 void (*program_changed
)(LV2_Programs_Handle handle
,
174 #endif /* LV2_PROGRAMS_H */