Mercurial > hg > pub > prymula > com
comparison DPF-Prymula-audioplugins/dpf/distrho/src/lv2/options.h @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:cf2cb71d31dd | 3:84e66ea83026 |
---|---|
1 /* | |
2 Copyright 2012-2016 David Robillard <http://drobilla.net> | |
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 /** | |
18 @defgroup options Options | |
19 | |
20 Instantiation time options, see <http://lv2plug.in/ns/ext/options> for | |
21 details. | |
22 | |
23 @{ | |
24 */ | |
25 | |
26 #ifndef LV2_OPTIONS_H | |
27 #define LV2_OPTIONS_H | |
28 | |
29 #include <stdint.h> | |
30 | |
31 #include "urid.h" | |
32 #include "lv2.h" | |
33 | |
34 #define LV2_OPTIONS_URI "http://lv2plug.in/ns/ext/options" ///< http://lv2plug.in/ns/ext/options | |
35 #define LV2_OPTIONS_PREFIX LV2_OPTIONS_URI "#" ///< http://lv2plug.in/ns/ext/options# | |
36 | |
37 #define LV2_OPTIONS__Option LV2_OPTIONS_PREFIX "Option" ///< http://lv2plug.in/ns/ext/options#Option | |
38 #define LV2_OPTIONS__interface LV2_OPTIONS_PREFIX "interface" ///< http://lv2plug.in/ns/ext/options#interface | |
39 #define LV2_OPTIONS__options LV2_OPTIONS_PREFIX "options" ///< http://lv2plug.in/ns/ext/options#options | |
40 #define LV2_OPTIONS__requiredOption LV2_OPTIONS_PREFIX "requiredOption" ///< http://lv2plug.in/ns/ext/options#requiredOption | |
41 #define LV2_OPTIONS__supportedOption LV2_OPTIONS_PREFIX "supportedOption" ///< http://lv2plug.in/ns/ext/options#supportedOption | |
42 | |
43 #ifdef __cplusplus | |
44 extern "C" { | |
45 #endif | |
46 | |
47 /** | |
48 The context of an Option, which defines the subject it applies to. | |
49 */ | |
50 typedef enum { | |
51 /** | |
52 This option applies to the instance itself. The subject must be | |
53 ignored. | |
54 */ | |
55 LV2_OPTIONS_INSTANCE, | |
56 | |
57 /** | |
58 This option applies to some named resource. The subject is a URI mapped | |
59 to an integer (a LV2_URID, like the key) | |
60 */ | |
61 LV2_OPTIONS_RESOURCE, | |
62 | |
63 /** | |
64 This option applies to some blank node. The subject is a blank node | |
65 identifier, which is valid only within the current local scope. | |
66 */ | |
67 LV2_OPTIONS_BLANK, | |
68 | |
69 /** | |
70 This option applies to a port on the instance. The subject is the | |
71 port's index. | |
72 */ | |
73 LV2_OPTIONS_PORT | |
74 } LV2_Options_Context; | |
75 | |
76 /** | |
77 An option. | |
78 | |
79 This is a property with a subject, also known as a triple or statement. | |
80 | |
81 This struct is useful anywhere a statement needs to be passed where no | |
82 memory ownership issues are present (since the value is a const pointer). | |
83 | |
84 Options can be passed to an instance via the feature LV2_OPTIONS__options | |
85 with data pointed to an array of options terminated by a zeroed option, or | |
86 accessed/manipulated using LV2_Options_Interface. | |
87 */ | |
88 typedef struct _LV2_Options_Option { | |
89 LV2_Options_Context context; /**< Context (type of subject). */ | |
90 uint32_t subject; /**< Subject. */ | |
91 LV2_URID key; /**< Key (property). */ | |
92 uint32_t size; /**< Size of value in bytes. */ | |
93 LV2_URID type; /**< Type of value (datatype). */ | |
94 const void* value; /**< Pointer to value (object). */ | |
95 } LV2_Options_Option; | |
96 | |
97 /** A status code for option functions. */ | |
98 typedef enum { | |
99 LV2_OPTIONS_SUCCESS = 0, /**< Completed successfully. */ | |
100 LV2_OPTIONS_ERR_UNKNOWN = 1, /**< Unknown error. */ | |
101 LV2_OPTIONS_ERR_BAD_SUBJECT = 1 << 1, /**< Invalid/unsupported subject. */ | |
102 LV2_OPTIONS_ERR_BAD_KEY = 1 << 2, /**< Invalid/unsupported key. */ | |
103 LV2_OPTIONS_ERR_BAD_VALUE = 1 << 3 /**< Invalid/unsupported value. */ | |
104 } LV2_Options_Status; | |
105 | |
106 /** | |
107 Interface for dynamically setting options (LV2_OPTIONS__interface). | |
108 */ | |
109 typedef struct _LV2_Options_Interface { | |
110 /** | |
111 Get the given options. | |
112 | |
113 Each element of the passed options array MUST have type, subject, and | |
114 key set. All other fields (size, type, value) MUST be initialised to | |
115 zero, and are set to the option value if such an option is found. | |
116 | |
117 This function is in the "instantiation" LV2 threading class, so no other | |
118 instance functions may be called concurrently. | |
119 | |
120 @return Bitwise OR of LV2_Options_Status values. | |
121 */ | |
122 uint32_t (*get)(LV2_Handle instance, | |
123 LV2_Options_Option* options); | |
124 | |
125 /** | |
126 Set the given options. | |
127 | |
128 This function is in the "instantiation" LV2 threading class, so no other | |
129 instance functions may be called concurrently. | |
130 | |
131 @return Bitwise OR of LV2_Options_Status values. | |
132 */ | |
133 uint32_t (*set)(LV2_Handle instance, | |
134 const LV2_Options_Option* options); | |
135 } LV2_Options_Interface; | |
136 | |
137 #ifdef __cplusplus | |
138 } /* extern "C" */ | |
139 #endif | |
140 | |
141 #endif /* LV2_OPTIONS_H */ | |
142 | |
143 /** | |
144 @} | |
145 */ |