Expose voice detune parameter of the lv2 plugin
[zyn.git] / addsynth_component_frequency_globals.cpp
blob8f751f3bad831d81d0f89f2136709435a5afad76
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *****************************************************************************/
21 #include <stdbool.h>
22 #include <assert.h>
24 #include "common.h"
25 #include "globals.h"
26 #include "addsynth.h"
27 #include "lfo_parameters.h"
28 #include "filter_parameters.h"
29 #include "envelope_parameters.h"
30 #include "resonance.h"
31 #include "fft.h"
32 #include "oscillator.h"
33 #include "portamento.h"
34 #include "addsynth_internal.h"
35 #include "log.h"
37 float
38 zyn_component_frequency_globals_get_float(
39 void * context,
40 unsigned int parameter)
42 assert(0);
43 return 0;
46 void
47 zyn_component_frequency_globals_set_float(
48 void * context,
49 unsigned int parameter,
50 float value)
52 assert(0);
55 signed int
56 zyn_component_frequency_globals_get_int(
57 void * context,
58 unsigned int parameter)
60 assert(0);
61 return 0;
64 void
65 zyn_component_frequency_globals_set_int(
66 void * context,
67 unsigned int parameter,
68 signed int value)
70 assert(0);
73 bool
74 zyn_component_frequency_globals_get_bool(
75 void * context,
76 unsigned int parameter)
78 assert(0);
79 return false;
82 void
83 zyn_component_frequency_globals_set_bool(
84 void * context,
85 unsigned int parameter,
86 bool value)
88 assert(0);
91 void
92 zyn_addsynth_component_init_frequency_globals(
93 struct zyn_component_descriptor * component_ptr)
95 ZYN_INIT_COMPONENT(component_ptr, NULL, zyn_component_frequency_globals_);
98 #define detune_ptr ((struct zyn_detune * )context)
100 float
101 zyn_component_detune_get_float(
102 void * context,
103 unsigned int parameter)
105 switch (parameter)
107 case ZYNADD_PARAMETER_FLOAT_DETUNE_FINE:
108 return detune_ptr->fine;
109 default:
110 LOG_ERROR("Unknown detune parameter %u", parameter);
111 assert(0);
115 void
116 zyn_component_detune_set_float(
117 void * context,
118 unsigned int parameter,
119 float value)
121 switch (parameter)
123 case ZYNADD_PARAMETER_FLOAT_DETUNE_FINE:
124 detune_ptr->fine = value;
125 return;
126 default:
127 LOG_ERROR("Unknown detune parameter %u", parameter);
128 assert(0);
132 signed int
133 zyn_component_detune_get_int(
134 void * context,
135 unsigned int parameter)
137 switch (parameter)
139 case ZYNADD_PARAMETER_ENUM_DETUNE_TYPE:
140 return detune_ptr->type;
141 case ZYNADD_PARAMETER_INT_DETUNE_OCTAVE:
142 return detune_ptr->octave;
143 case ZYNADD_PARAMETER_INT_DETUNE_COARSE:
144 return detune_ptr->coarse;
147 LOG_ERROR("Unknown int detune parameter %u", parameter);
148 assert(0);
149 return -1;
152 void
153 zyn_component_detune_set_int(
154 void * context,
155 unsigned int parameter,
156 signed int value)
158 switch (parameter)
160 case ZYNADD_PARAMETER_ENUM_DETUNE_TYPE:
161 detune_ptr->type = value;
162 return;
163 case ZYNADD_PARAMETER_INT_DETUNE_OCTAVE:
164 detune_ptr->octave = value;
165 return;
166 case ZYNADD_PARAMETER_INT_DETUNE_COARSE:
167 detune_ptr->coarse = value;
168 return;
171 LOG_ERROR("Unknown int detune parameter %u", parameter);
172 assert(0);
175 bool
176 zyn_component_detune_get_bool(
177 void * context,
178 unsigned int parameter)
180 switch (parameter)
182 default:
183 LOG_ERROR("Unknown bool detune parameter %u", parameter);
184 assert(0);
188 void
189 zyn_component_detune_set_bool(
190 void * context,
191 unsigned int parameter,
192 bool value)
194 switch (parameter)
196 default:
197 LOG_ERROR("Unknown bool detune parameter %u", parameter);
198 assert(0);
202 #undef detune_ptr
204 void
205 zyn_addsynth_component_init_detune(
206 struct zyn_component_descriptor * component_ptr,
207 struct zyn_detune * detune_ptr)
209 ZYN_INIT_COMPONENT(component_ptr, detune_ptr, zyn_component_detune_);
212 #define fixed_detune_ptr ((struct zyn_fixed_detune * )context)
214 float
215 zyn_component_fixed_detune_get_float(
216 void * context,
217 unsigned int parameter)
219 switch (parameter)
221 default:
222 LOG_ERROR("Unknown fixed detune parameter %u", parameter);
223 assert(0);
227 void
228 zyn_component_fixed_detune_set_float(
229 void * context,
230 unsigned int parameter,
231 float value)
233 switch (parameter)
235 default:
236 LOG_ERROR("Unknown fixed detune parameter %u", parameter);
237 assert(0);
241 signed int
242 zyn_component_fixed_detune_get_int(
243 void * context,
244 unsigned int parameter)
246 switch (parameter)
248 case ZYNADD_PARAMETER_ENUM_FIXED_DETUNE_MODE:
249 return fixed_detune_ptr->mode;
250 case ZYNADD_PARAMETER_INT_FIXED_DETUNE_EQUAL_TEMPERATE:
251 return fixed_detune_ptr->equal_temperate;
254 LOG_ERROR("Unknown int fixed detune parameter %u", parameter);
255 assert(0);
256 return -1;
259 void
260 zyn_component_fixed_detune_set_int(
261 void * context,
262 unsigned int parameter,
263 signed int value)
265 switch (parameter)
267 case ZYNADD_PARAMETER_ENUM_FIXED_DETUNE_MODE:
268 fixed_detune_ptr->mode = value;
269 return;
270 case ZYNADD_PARAMETER_INT_FIXED_DETUNE_EQUAL_TEMPERATE:
271 fixed_detune_ptr->equal_temperate = value;
272 return;
275 LOG_ERROR("Unknown int fixed detune parameter %u", parameter);
276 assert(0);
279 bool
280 zyn_component_fixed_detune_get_bool(
281 void * context,
282 unsigned int parameter)
284 switch (parameter)
286 default:
287 LOG_ERROR("Unknown bool fixed detune parameter %u", parameter);
288 assert(0);
292 void
293 zyn_component_fixed_detune_set_bool(
294 void * context,
295 unsigned int parameter,
296 bool value)
298 switch (parameter)
300 default:
301 LOG_ERROR("Unknown bool fixed detune parameter %u", parameter);
302 assert(0);
306 #undef fixed_detune_ptr
308 void
309 zyn_addsynth_component_init_fixed_detune(
310 struct zyn_component_descriptor * component_ptr,
311 struct zyn_fixed_detune * fixed_detune_ptr)
313 ZYN_INIT_COMPONENT(component_ptr, fixed_detune_ptr, zyn_component_fixed_detune_);