.gitignore file
[zyn.git] / addsynth.h
blobb3cefec01c026893f448f0948e58c813b139598e
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007 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_destroy(
60 zyn_addsynth_handle handle);
62 #define ZYNADD_COMPONENT_AMP_GLOBALS 0
63 #define ZYNADD_COMPONENT_AMP_ENV 1
64 #define ZYNADD_COMPONENT_AMP_LFO 2
65 #define ZYNADD_COMPONENT_FILTER_GLOBALS 3
66 #define ZYNADD_COMPONENT_FILTER_ANALOG 4
67 #define ZYNADD_COMPONENT_FILTER_FORMANT 5
68 #define ZYNADD_COMPONENT_FILTER_SV 6
69 #define ZYNADD_COMPONENT_FILTER_ENV 7
70 #define ZYNADD_COMPONENT_FILTER_LFO 8
71 #define ZYNADD_COMPONENT_FREQUENCY_GLOBALS 9
72 #define ZYNADD_COMPONENT_FREQUENCY_ENV 10
73 #define ZYNADD_COMPONENT_FREQUENCY_LFO 11
74 #define ZYNADD_COMPONENT_PORTAMENTO 12
76 #define ZYNADD_GLOBAL_COMPONENTS_COUNT 13
78 #define ZYNADD_COMPONENT_VOICE_GLOBALS 0
79 #define ZYNADD_COMPONENT_VOICE_OSCILLATOR 1
81 #define ZYNADD_VOICE_COMPONENTS_COUNT 2
83 /* when parameter index is used in more than one component
84 it does need not to conflict with unique parameters */
85 #define ZYNADD_PARAMETER_REUSED_OFFSET 100
87 /* float - reused */
88 #define ZYNADD_PARAMETER_FLOAT_VOLUME (ZYNADD_PARAMETER_REUSED_OFFSET + 0) /* 0 .. 100 */
89 #define ZYNADD_PARAMETER_FLOAT_FREQUNECY (ZYNADD_PARAMETER_REUSED_OFFSET + 1) /* -5 .. 5; 0 .. 1 for legacy filter implementations */
90 #define ZYNADD_PARAMETER_FLOAT_Q_FACTOR (ZYNADD_PARAMETER_REUSED_OFFSET + 2) /* 0 .. 1 */
91 #define ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING (ZYNADD_PARAMETER_REUSED_OFFSET + 3) /* -1 .. 1 */
93 /* float - globals */
94 #define ZYNADD_PARAMETER_FLOAT_PANORAMA 0 /* -1 .. 1 */
95 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING 1 /* 0 .. 100 */
96 #define ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH 2 /* 0 .. 100 */
97 #define ZYNADD_PARAMETER_FLOAT_PUNCH_TIME 3 /* 0 .. 100 */
98 #define ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH 4 /* 0 .. 100 */
99 #define ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING 5 /* 0 .. 100 */
100 #define ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE 6 /* -6400 .. 6400, in cents */
101 #define ZYNADD_PARAMETER_FLOAT_PITCH_BEND 7 /* -1 .. 1 */
103 /* float - envelope */
104 #define ZYNADD_PARAMETER_FLOAT_ENV_ATTACK_VALUE 0 /* 0 .. 100 */
105 #define ZYNADD_PARAMETER_FLOAT_ENV_ATTACK_DURATION 1 /* 0 .. 100 */
106 #define ZYNADD_PARAMETER_FLOAT_ENV_DECAY_VALUE 2 /* 0 .. 100 */
107 #define ZYNADD_PARAMETER_FLOAT_ENV_DECAY_DURATION 3 /* 0 .. 100 */
108 #define ZYNADD_PARAMETER_FLOAT_ENV_SUSTAIN_VALUE 4 /* 0 .. 100 */
109 #define ZYNADD_PARAMETER_FLOAT_ENV_RELEASE_VALUE 5 /* 0 .. 100 */
110 #define ZYNADD_PARAMETER_FLOAT_ENV_RELEASE_DURATION 6 /* 0 .. 100 */
111 #define ZYNADD_PARAMETER_FLOAT_ENV_STRETCH 7 /* 0 .. 200 */
113 /* float - lfo */
114 #define ZYNADD_PARAMETER_FLOAT_LFO_FREQUENCY 0 /* 0 .. 1 */
115 #define ZYNADD_PARAMETER_FLOAT_LFO_DEPTH 1 /* 0 .. 100 */
116 #define ZYNADD_PARAMETER_FLOAT_LFO_START_PHASE 2 /* 0 .. 1 */
117 #define ZYNADD_PARAMETER_FLOAT_LFO_DELAY 3 /* 0 .. 4?, seconds */
118 #define ZYNADD_PARAMETER_FLOAT_LFO_STRETCH 4 /* -1 .. 1 */
119 #define ZYNADD_PARAMETER_FLOAT_LFO_DEPTH_RANDOMNESS 5 /* 0 .. 100 */
120 #define ZYNADD_PARAMETER_FLOAT_LFO_FREQUENCY_RANDOMNESS 6 /* 0 .. 100 */
122 /* float filter globals */
123 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT 0 /* 0 .. 1 */
124 #define ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION 1 /* -1 .. 1 */
126 /* float - oscillator */
127 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_BASE_FUNCTION_ADJUST 0 /* 0 .. 1 */
128 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_WAVESHAPE_DRIVE 1 /* 0 .. 100 */
129 #define ZYNADD_PARAMETER_FLOAT_OSCILLATOR_SPECTRUM_ADJUST 2 /* 0 .. 100 */
131 /* float - portamento */
132 #define ZYNADD_PARAMETER_FLOAT_PORTAMENTO_TIME 0 /* 0 .. 1 */
133 #define ZYNADD_PARAMETER_FLOAT_PORTAMENTO_TIME_STRETCH 1 /* -1 .. 1 */
135 /* bool - globals */
136 #define ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA 0
137 #define ZYNADD_PARAMETER_BOOL_STEREO 1
138 #define ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING 2
140 /* bool - envelope */
141 #define ZYNADD_PARAMETER_BOOL_ENV_FORCED_RELEASE 0
142 #define ZYNADD_PARAMETER_BOOL_ENV_LINEAR 1
144 /* bool - lfo */
145 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_START_PHASE 0
146 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_DEPTH 1
147 #define ZYNADD_PARAMETER_BOOL_LFO_RANDOM_FREQUENCY 2
149 /* bool - portamento */
150 #define ZYNADD_PARAMETER_BOOL_PORTAMENTO_ENABLED 0
151 #define ZYNADD_PARAMETER_BOOL_PORTAMENTO_PITCH_THRESHOLD_ABOVE 1
153 /* bool - voice */
154 #define ZYNADD_PARAMETER_BOOL_RESONANCE 0
155 #define ZYNADD_PARAMETER_BOOL_WHITE_NOISE 1
157 #define ZYNADD_PARAMETER_ENUM_LFO_SHAPE 1000
158 #define ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY 1001
159 #define ZYNADD_PARAMETER_ENUM_FILTER_TYPE 1002
160 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_BASE_FUNCTION 1003
161 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_WAVESHAPE_TYPE 1004
162 #define ZYNADD_PARAMETER_ENUM_OSCILLATOR_SPECTRUM_ADJUST_TYPE 1005
164 #define ZYNADD_PARAMETER_INT_STAGES 0 /* 1 .. 5 */
166 #define ZYNADD_PARAMETER_INT_PORTAMENTO_PITCH_THRESHOLD 1 /* 0 .. 127 */
168 zyn_addsynth_component
169 zyn_addsynth_get_global_component(
170 zyn_addsynth_handle handle,
171 unsigned int component);
173 zyn_addsynth_component
174 zyn_addsynth_get_voice_component(
175 zyn_addsynth_handle handle,
176 unsigned int component);
178 float
179 zyn_addsynth_get_float_parameter(
180 zyn_addsynth_component component,
181 unsigned int parameter);
183 void
184 zyn_addsynth_set_float_parameter(
185 zyn_addsynth_component component,
186 unsigned int parameter,
187 float value);
189 signed int
190 zyn_addsynth_get_int_parameter(
191 zyn_addsynth_component component,
192 unsigned int parameter);
194 void
195 zyn_addsynth_set_int_parameter(
196 zyn_addsynth_component component,
197 unsigned int parameter,
198 signed int value);
200 bool
201 zyn_addsynth_get_bool_parameter(
202 zyn_addsynth_component component,
203 unsigned int parameter);
205 void
206 zyn_addsynth_set_bool_parameter(
207 zyn_addsynth_component component,
208 unsigned int parameter,
209 bool value);
211 #if 0
212 { /* Adjust editor indent */
213 #endif
214 #ifdef __cplusplus
215 } /* extern "C" */
216 #endif
218 #endif /* #ifndef ADDSYNTH_H__D1C82A9B_D028_4BAE_9D98_BEC4DFCD0240__INCLUDED */