Expose all 8 voices
[zyn.git] / zynadd_dynparam_forest_map.c
blob73b31aaa6fedc8620d76d5cfee27d8e2cc372817
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 <stdarg.h>
23 #include <assert.h>
24 #include <lv2.h>
26 #include "common.h"
27 #include "list.h"
28 #include "addsynth.h"
29 #include "lv2dynparam/lv2dynparam.h"
30 #include "lv2dynparam/plugin.h"
31 #include "zynadd_internal.h"
33 #define LOG_LEVEL LOG_LEVEL_ERROR
34 #include "log.h"
36 const char * g_shape_names[ZYN_LFO_SHAPES_COUNT];
37 const char * g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPES_COUNT];
38 const char * g_sv_filter_type_names[ZYN_FILTER_SV_TYPES_COUNT];
39 const char * g_filter_type_names[ZYN_FILTER_TYPES_COUNT];
40 const char * g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTIONS_COUNT];
41 const char * g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPES_COUNT];
42 const char * g_oscillator_spectrum_adjust_type_names[ZYN_OSCILLATOR_SPECTRUM_ADJUST_TYPES_COUNT];
44 void
45 lv2dynparam_group_init(
46 struct zyn_forest_map * map_ptr,
47 unsigned int parent,
48 unsigned int group,
49 const char * name,
50 ...)
52 va_list ap;
53 const char * hint_name;
54 const char * hint_value;
56 LOG_DEBUG("group \"%s\"", name);
58 map_ptr->groups[group].parent = parent;
59 map_ptr->groups[group].name = name;
61 map_ptr->groups[group].hints.count = 0;
62 map_ptr->groups[group].hints.names = (char **)map_ptr->groups[group].hint_names;
63 map_ptr->groups[group].hints.values = (char **)map_ptr->groups[group].hint_values;
65 va_start(ap, name);
66 while ((hint_name = va_arg(ap, const char *)) != NULL)
68 assert(map_ptr->groups[group].hints.count < ZYN_MAX_HINTS);
69 map_ptr->groups[group].hint_names[map_ptr->groups[group].hints.count] = hint_name;
71 hint_value = va_arg(ap, const char *);
72 if (hint_value == NULL)
74 LOG_DEBUG("hint \"%s\"", hint_name);
76 else
78 LOG_DEBUG("hint \"%s\":\"%s\"", hint_name, hint_value);
79 map_ptr->groups[group].hint_values[map_ptr->groups[group].hints.count] = hint_value;
82 map_ptr->groups[group].hints.count++;
84 va_end(ap);
87 void zynadd_init_forest_map_globals() __attribute__((constructor));
88 void zynadd_init_forest_map_globals()
90 g_shape_names[ZYN_LFO_SHAPE_TYPE_SINE] = "Sine";
91 g_shape_names[ZYN_LFO_SHAPE_TYPE_TRIANGLE] = "Triangle";
92 g_shape_names[ZYN_LFO_SHAPE_TYPE_SQUARE] = "Square";
93 g_shape_names[ZYN_LFO_SHAPE_TYPE_RAMP_UP] = "Ramp Up";
94 g_shape_names[ZYN_LFO_SHAPE_TYPE_RAMP_DOWN] = "Ramp Down";
95 g_shape_names[ZYN_LFO_SHAPE_TYPE_EXP_DOWN_1] = "E1Down";
96 g_shape_names[ZYN_LFO_SHAPE_TYPE_EXP_DOWN_2] = "E2Down";
98 g_filter_type_names[ZYN_FILTER_TYPE_ANALOG] = "Analog";
99 g_filter_type_names[ZYN_FILTER_TYPE_FORMANT] = "Formant";
100 g_filter_type_names[ZYN_FILTER_TYPE_STATE_VARIABLE] = "State variable";
102 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_LPF1] = "Low-pass - 1 pole";
103 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_HPF1] = "High-pass - 1 pole";
104 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_LPF2] = "Low-pass - 2 poles";
105 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_HPF2] = "High-pass - 2 poles";
106 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_BPF2] = "Band-pass - 2 poles";
107 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_NF2] = "Notch - 2 poles";
108 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_PKF2] = "Peak - 2 poles";
109 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_LSH2] = "Low Shelf - 2 poles";
110 g_analog_filter_type_names[ZYN_FILTER_ANALOG_TYPE_HSH2] = "High Shelf - 2 poles";
112 g_sv_filter_type_names[ZYN_FILTER_SV_TYPE_LOWPASS] = "Low-pass";
113 g_sv_filter_type_names[ZYN_FILTER_SV_TYPE_HIGHPASS] = "High-pass";
114 g_sv_filter_type_names[ZYN_FILTER_SV_TYPE_BANDPASS] = "Band-pass";
115 g_sv_filter_type_names[ZYN_FILTER_SV_TYPE_NOTCH] = "Notch";
117 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_SINE] = "Sine";
118 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_TRIANGLE] = "Triangle";
119 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_PULSE] = "Pulse";
120 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_SAW] = "Saw";
121 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_POWER] = "Power";
122 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_GAUSS] = "Gauss";
123 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_DIODE] = "Diode";
124 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_ABS_SINE] = "Abs sine";
125 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_PULSE_SINE] = "Pulse sine";
126 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_STRETCH_SINE] = "Stretch sine";
127 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_CHIRP] = "Chirp";
128 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_ABS_STRETCH_SINE] = "Abs stretch sine";
129 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_CHEBYSHEV] = "Chebyshev";
130 g_oscillator_base_function_names[ZYN_OSCILLATOR_BASE_FUNCTION_SQRT] = "Sqr";
132 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_NONE] = "None";
133 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_ATAN] = "Atan";
134 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_ASYM1] = "Asym1";
135 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_POW] = "Pow";
136 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_SINE] = "Sine";
137 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_QUANTISIZE] = "Quantisize";
138 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_ZIGZAG] = "Zig-Zag";
139 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_LIMITER] = "Limiter";
140 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_UPPER_LIMITER] = "Upper limiter";
141 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_LOWER_LIMITER] = "Lower limiter";
142 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_INVERSE_LIMITER] = "Inverse limiter";
143 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_CLIP] = "Clip";
144 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_ASYM2] = "Asym2";
145 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_POW2] = "Pow2";
146 g_oscillator_waveshape_type_names[ZYN_OSCILLATOR_WAVESHAPE_TYPE_SIGMOID] = "Sigmoid";
148 g_oscillator_spectrum_adjust_type_names[ZYN_OSCILLATOR_SPECTRUM_ADJUST_TYPE_NONE] = "None";
149 g_oscillator_spectrum_adjust_type_names[ZYN_OSCILLATOR_SPECTRUM_ADJUST_TYPE_POW] = "Pow";
150 g_oscillator_spectrum_adjust_type_names[ZYN_OSCILLATOR_SPECTRUM_ADJUST_TYPE_THERSHOLD_DOWN] = "Thershold down";
151 g_oscillator_spectrum_adjust_type_names[ZYN_OSCILLATOR_SPECTRUM_ADJUST_TYPE_THERSHOLD_UP] = "Thershold up";