Minor detune bandwidth optimization
[zyn.git] / addsynth.h
blob76f8136b33ea175d30340e5d620aee8fb6660176
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 #ifndef ADDSYNTH_H__D1C82A9B_D028_4BAE_9D98_BEC4DFCD0240__INCLUDED
22 #define ADDSYNTH_H__D1C82A9B_D028_4BAE_9D98_BEC4DFCD0240__INCLUDED
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 #if 0
28 } /* Adjust editor indent */
29 #endif
31 typedef void * zyn_addsynth_handle;
33 typedef void * zyn_addsynth_component;
35 bool
36 zyn_addsynth_create(
37 float sample_rate,
38 unsigned int voices_count,
39 zyn_addsynth_handle * handle_ptr);
41 void
42 zyn_addsynth_get_audio_output(
43 zyn_addsynth_handle handle,
44 zyn_sample_type * buffer_left,
45 zyn_sample_type * buffer_right);
47 void
48 zyn_addsynth_note_on(
49 zyn_addsynth_handle handle,
50 unsigned int note,
51 unsigned int velocity);
53 void
54 zyn_addsynth_note_off(
55 zyn_addsynth_handle handle,
56 unsigned int note);
58 void
59 zyn_addsynth_all_notes_off(
60 zyn_addsynth_handle handle);
62 void
63 zyn_addsynth_all_sound_off(
64 zyn_addsynth_handle handle);
66 void
67 zyn_addsynth_destroy(
68 zyn_addsynth_handle handle);
70 #define ZYNADD_COMPONENT_AMP_GLOBALS 0
71 #define ZYNADD_COMPONENT_AMP_ENV 1
72 #define ZYNADD_COMPONENT_AMP_LFO 2
73 #define ZYNADD_COMPONENT_FILTER_GLOBALS 3
74 #define ZYNADD_COMPONENT_FILTER_ANALOG 4
75 #define ZYNADD_COMPONENT_FILTER_FORMANT 5
76 #define ZYNADD_COMPONENT_FILTER_SV 6
77 #define ZYNADD_COMPONENT_FILTER_ENV 7
78 #define ZYNADD_COMPONENT_FILTER_LFO 8
79 #define ZYNADD_COMPONENT_FREQUENCY_GLOBALS 9
80 #define ZYNADD_COMPONENT_FREQUENCY_ENV 10
81 #define ZYNADD_COMPONENT_FREQUENCY_LFO 11
82 #define ZYNADD_COMPONENT_PORTAMENTO 12
84 #define ZYNADD_GLOBAL_COMPONENTS_COUNT 13
86 #define ZYNADD_COMPONENT_VOICE_GLOBALS 0
87 #define ZYNADD_COMPONENT_VOICE_OSCILLATOR 1
89 #define ZYNADD_VOICE_COMPONENTS_COUNT 2
91 /* when parameter index is used in more than one component
92 it does need not to conflict with unique parameters */
93 #define ZYNADD_PARAMETER_REUSED_OFFSET 100
95 /* float - reused */
96 #define ZYNADD_PARAMETER_FLOAT_VOLUME (ZYNADD_PARAMETER_REUSED_OFFSET + 0) /* 0 .. 100 */
97 #define ZYNADD_PARAMETER_FLOAT_FREQUNECY (ZYNADD_PARAMETER_REUSED_OFFSET + 1) /* -5 .. 5; 0 .. 1 for legacy filter implementations */
98 #define ZYNADD_PARAMETER_FLOAT_Q_FACTOR (ZYNADD_PARAMETER_REUSED_OFFSET + 2) /* 0 .. 1 */
99 #define ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING (ZYNADD_PARAMETER_REUSED_OFFSET + 3) /* -1 .. 1 */
101 /* float - globals */
102 #define ZYNADD_PARAMETER_FLOAT_PANORAMA 0 /* -1 .. 1 */
103 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING 1 /* 0 .. 100 */
104 #define ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH 2 /* 0 .. 100 */
105 #define ZYNADD_PARAMETER_FLOAT_PUNCH_TIME 3 /* 0 .. 100 */
106 #define ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH 4 /* 0 .. 100 */
107 #define ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING 5 /* 0 .. 100 */
108 #define ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE 6 /* -6400 .. 6400, in cents */
109 #define ZYNADD_PARAMETER_FLOAT_PITCH_BEND 7 /* -1 .. 1 */
111 /* float - envelope */
112 #define ZYNADD_PARAMETER_FLOAT_ENV_ATTACK_VALUE 0 /* 0 .. 100 */
113 #define ZYNADD_PARAMETER_FLOAT_ENV_ATTACK_DURATION 1 /* 0 .. 100 */
114 #define ZYNADD_PARAMETER_FLOAT_ENV_DECAY_VALUE 2 /* 0 .. 100 */
115 #define ZYNADD_PARAMETER_FLOAT_ENV_DECAY_DURATION 3 /* 0 .. 100 */
116 #define ZYNADD_PARAMETER_FLOAT_ENV_SUSTAIN_VALUE 4 /* 0 .. 100 */
117 #define ZYNADD_PARAMETER_FLOAT_ENV_RELEASE_VALUE 5 /* 0 .. 100 */
118 #define ZYNADD_PARAMETER_FLOAT_ENV_RELEASE_DURATION 6 /* 0 .. 100 */
119 #define ZYNADD_PARAMETER_FLOAT_ENV_STRETCH 7 /* 0 .. 200 */
121 /* float - lfo */
122 #define ZYNADD_PARAMETER_FLOAT_LFO_FREQUENCY 0 /* 0 .. 1 */
123 #define ZYNADD_PARAMETER_FLOAT_LFO_DEPTH 1 /* 0 .. 100 */
124 #define ZYNADD_PARAMETER_FLOAT_LFO_START_PHASE 2 /* 0 .. 1 */
125 #define ZYNADD_PARAMETER_FLOAT_LFO_DELAY 3 /* 0 .. 4?, seconds */
126 #define ZYNADD_PARAMETER_FLOAT_LFO_STRETCH 4 /* -1 .. 1 */
127 #define ZYNADD_PARAMETER_FLOAT_LFO_DEPTH_RANDOMNESS 5 /* 0 .. 100 */
128 #define ZYNADD_PARAMETER_FLOAT_LFO_FREQUENCY_RANDOMNESS 6 /* 0 .. 100 */
130 /* float filter globals */
131 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT 0 /* 0 .. 1 */
132 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION 1 /* -1 .. 1 */
134 /* float - oscillator */
135 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_BASE_FUNCTION_ADJUST 0 /* 0 .. 1 */
136 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_WAVESHAPE_DRIVE 1 /* 0 .. 100 */
137 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_SPECTRUM_ADJUST 2 /* 0 .. 100 */
139 /* float - portamento */
140 #define ZYNADD_PARAMETER_FLOAT_PORTAMENTO_TIME 0 /* 0 .. 1 */
141 #define ZYNADD_PARAMETER_FLOAT_PORTAMENTO_TIME_STRETCH 1 /* -1 .. 1 */
143 /* bool - globals */
144 #define ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA 0
145 #define ZYNADD_PARAMETER_BOOL_STEREO 1
146 #define ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING 2
148 /* bool - envelope */
149 #define ZYNADD_PARAMETER_BOOL_ENV_FORCED_RELEASE 0
150 #define ZYNADD_PARAMETER_BOOL_ENV_LINEAR 1
152 /* bool - lfo */
153 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_START_PHASE 0
154 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_DEPTH 1
155 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_FREQUENCY 2
157 /* bool - portamento */
158 #define ZYNADD_PARAMETER_BOOL_PORTAMENTO_ENABLED 0
159 #define ZYNADD_PARAMETER_BOOL_PORTAMENTO_PITCH_THRESHOLD_ABOVE 1
161 /* bool - voice */
162 #define ZYNADD_PARAMETER_BOOL_ENABLED 0
163 #define ZYNADD_PARAMETER_BOOL_RESONANCE 1
164 #define ZYNADD_PARAMETER_BOOL_WHITE_NOISE 2
166 #define ZYNADD_PARAMETER_ENUM_LFO_SHAPE 1000
167 #define ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY 1001
168 #define ZYNADD_PARAMETER_ENUM_FILTER_TYPE 1002
169 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_BASE_FUNCTION 1003
170 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_WAVESHAPE_TYPE 1004
171 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_SPECTRUM_ADJUST_TYPE 1005
173 #define ZYNADD_PARAMETER_INT_STAGES 0 /* 1 .. 5 */
175 #define ZYNADD_PARAMETER_INT_PORTAMENTO_PITCH_THRESHOLD 1 /* 0 .. 127 */
177 zyn_addsynth_component
178 zyn_addsynth_get_global_component(
179 zyn_addsynth_handle handle,
180 unsigned int component);
182 zyn_addsynth_component
183 zyn_addsynth_get_voice_component(
184 zyn_addsynth_handle handle,
185 unsigned int voice,
186 unsigned int component);
188 float
189 zyn_addsynth_get_float_parameter(
190 zyn_addsynth_component component,
191 unsigned int parameter);
193 void
194 zyn_addsynth_set_float_parameter(
195 zyn_addsynth_component component,
196 unsigned int parameter,
197 float value);
199 signed int
200 zyn_addsynth_get_int_parameter(
201 zyn_addsynth_component component,
202 unsigned int parameter);
204 void
205 zyn_addsynth_set_int_parameter(
206 zyn_addsynth_component component,
207 unsigned int parameter,
208 signed int value);
210 bool
211 zyn_addsynth_get_bool_parameter(
212 zyn_addsynth_component component,
213 unsigned int parameter);
215 void
216 zyn_addsynth_set_bool_parameter(
217 zyn_addsynth_component component,
218 unsigned int parameter,
219 bool value);
221 #if 0
222 { /* Adjust editor indent */
223 #endif
224 #ifdef __cplusplus
225 } /* extern "C" */
226 #endif
228 #endif /* #ifndef ADDSYNTH_H__D1C82A9B_D028_4BAE_9D98_BEC4DFCD0240__INCLUDED */