File: addsynth_component_frequency_globals.cpp

package info (click to toggle)
zyn 1%2Bgit.20100609-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 856 kB
  • ctags: 1,512
  • sloc: cpp: 5,828; ansic: 5,427; python: 241; sh: 31; makefile: 11
file content (314 lines) | stat: -rw-r--r-- 6,422 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/* -*- Mode: C ; c-basic-offset: 2 -*- */
/*****************************************************************************
 *
 *   Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; version 2 of the License
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *****************************************************************************/

#include <stdbool.h>
#include <assert.h>

#include "common.h"
#include "globals.h"
#include "addsynth.h"
#include "lfo_parameters.h"
#include "filter_parameters.h"
#include "envelope_parameters.h"
#include "resonance.h"
#include "fft.h"
#include "oscillator.h"
#include "portamento.h"
#include "addsynth_internal.h"
#include "log.h"

float
zyn_component_frequency_globals_get_float(
  void * context,
  unsigned int parameter)
{
  assert(0);
  return 0;
}

void
zyn_component_frequency_globals_set_float(
  void * context,
  unsigned int parameter,
  float value)
{
  assert(0);
}

signed int
zyn_component_frequency_globals_get_int(
  void * context,
  unsigned int parameter)
{
  assert(0);
  return 0;
}

void
zyn_component_frequency_globals_set_int(
  void * context,
  unsigned int parameter,
  signed int value)
{
  assert(0);
}

bool
zyn_component_frequency_globals_get_bool(
  void * context,
  unsigned int parameter)
{
  assert(0);
  return false;
}

void
zyn_component_frequency_globals_set_bool(
  void * context,
  unsigned int parameter,
  bool value)
{
  assert(0);
}

void
zyn_addsynth_component_init_frequency_globals(
  struct zyn_component_descriptor * component_ptr)
{
  ZYN_INIT_COMPONENT(component_ptr, NULL, zyn_component_frequency_globals_);
}

#define detune_ptr ((struct zyn_detune * )context)

float
zyn_component_detune_get_float(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_FLOAT_DETUNE_FINE:
    return detune_ptr->fine;
  default:
    LOG_ERROR("Unknown detune parameter %u", parameter);
    assert(0);
  }
}

void
zyn_component_detune_set_float(
  void * context,
  unsigned int parameter,
  float value)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_FLOAT_DETUNE_FINE:
    detune_ptr->fine = value;
    return;
  default:
    LOG_ERROR("Unknown detune parameter %u", parameter);
    assert(0);
  }
}

signed int
zyn_component_detune_get_int(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_ENUM_DETUNE_TYPE:
    return detune_ptr->type;
  case ZYNADD_PARAMETER_INT_DETUNE_OCTAVE:
    return detune_ptr->octave;
  case ZYNADD_PARAMETER_INT_DETUNE_COARSE:
    return detune_ptr->coarse;
  }

  LOG_ERROR("Unknown int detune parameter %u", parameter);
  assert(0);
  return -1;
}

void
zyn_component_detune_set_int(
  void * context,
  unsigned int parameter,
  signed int value)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_ENUM_DETUNE_TYPE:
    detune_ptr->type = value;
    return;
  case ZYNADD_PARAMETER_INT_DETUNE_OCTAVE:
    detune_ptr->octave = value;
    return;
  case ZYNADD_PARAMETER_INT_DETUNE_COARSE:
    detune_ptr->coarse = value;
    return;
  }

  LOG_ERROR("Unknown int detune parameter %u", parameter);
  assert(0);
}

bool
zyn_component_detune_get_bool(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown bool detune parameter %u", parameter);
    assert(0);
  }
}

void
zyn_component_detune_set_bool(
  void * context,
  unsigned int parameter,
  bool value)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown bool detune parameter %u", parameter);
    assert(0);
  }
}

#undef detune_ptr

void
zyn_addsynth_component_init_detune(
  struct zyn_component_descriptor * component_ptr,
  struct zyn_detune * detune_ptr)
{
  ZYN_INIT_COMPONENT(component_ptr, detune_ptr, zyn_component_detune_);
}

#define fixed_detune_ptr ((struct zyn_fixed_detune * )context)

float
zyn_component_fixed_detune_get_float(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown fixed detune parameter %u", parameter);
    assert(0);
  }
}

void
zyn_component_fixed_detune_set_float(
  void * context,
  unsigned int parameter,
  float value)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown fixed detune parameter %u", parameter);
    assert(0);
  }
}

signed int
zyn_component_fixed_detune_get_int(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_ENUM_FIXED_DETUNE_MODE:
    return fixed_detune_ptr->mode;
  case ZYNADD_PARAMETER_INT_FIXED_DETUNE_EQUAL_TEMPERATE:
    return fixed_detune_ptr->equal_temperate;
  }

  LOG_ERROR("Unknown int fixed detune parameter %u", parameter);
  assert(0);
  return -1;
}

void
zyn_component_fixed_detune_set_int(
  void * context,
  unsigned int parameter,
  signed int value)
{
  switch (parameter)
  {
  case ZYNADD_PARAMETER_ENUM_FIXED_DETUNE_MODE:
    fixed_detune_ptr->mode = value;
    return;
  case ZYNADD_PARAMETER_INT_FIXED_DETUNE_EQUAL_TEMPERATE:
    fixed_detune_ptr->equal_temperate = value;
    return;
  }

  LOG_ERROR("Unknown int fixed detune parameter %u", parameter);
  assert(0);
}

bool
zyn_component_fixed_detune_get_bool(
  void * context,
  unsigned int parameter)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown bool fixed detune parameter %u", parameter);
    assert(0);
  }
}

void
zyn_component_fixed_detune_set_bool(
  void * context,
  unsigned int parameter,
  bool value)
{
  switch (parameter)
  {
  default:
    LOG_ERROR("Unknown bool fixed detune parameter %u", parameter);
    assert(0);
  }
}

#undef fixed_detune_ptr

void
zyn_addsynth_component_init_fixed_detune(
  struct zyn_component_descriptor * component_ptr,
  struct zyn_fixed_detune * fixed_detune_ptr)
{
  ZYN_INIT_COMPONENT(component_ptr, fixed_detune_ptr, zyn_component_fixed_detune_);
}