Add some foaf and doap info to zynadd.ttl
[zyn.git] / addsynth_component_voice_globals.cpp
blob3408d5512897774db99a3d78122444add84cab69
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 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 #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 "lfo.h"
29 #include "filter_parameters.h"
30 #include "filter_base.h"
31 #include "filter_common.h"
32 #include "analog_filter.h"
33 #include "sv_filter.h"
34 #include "formant_filter.h"
35 #include "filter.h"
36 #include "envelope_parameters.h"
37 #include "envelope.h"
38 #include "addnote.h"
39 #include "resonance.h"
40 #include "fft.h"
41 #include "oscillator.h"
42 #include "portamento.h"
43 #include "addsynth_internal.h"
45 #define LOG_LEVEL LOG_LEVEL_ERROR
46 #include "log.h"
48 #define voice_params_ptr ((struct zyn_addnote_voice_parameters * )context)
50 float
51 zyn_component_voice_globals_get_float(
52 void * context,
53 unsigned int parameter)
55 switch (parameter)
59 LOG_ERROR("Unknown voice global float parameter %u", parameter);
60 assert(0);
61 return 0.0;
64 void
65 zyn_component_voice_globals_set_float(
66 void * context,
67 unsigned int parameter,
68 float value)
70 switch (parameter)
74 LOG_ERROR("Unknown voice global float parameter %u", parameter);
75 assert(0);
78 signed int
79 zyn_component_voice_globals_get_int(
80 void * context,
81 unsigned int parameter)
83 switch (parameter)
87 LOG_ERROR("Unknown voice global int/enum parameter %u", parameter);
88 assert(0);
89 return 0;
92 void
93 zyn_component_voice_globals_set_int(
94 void * context,
95 unsigned int parameter,
96 signed int value)
98 switch (parameter)
102 LOG_ERROR("Unknown voice global int/enum parameter %u", parameter);
103 assert(0);
106 bool
107 zyn_component_voice_globals_get_bool(
108 void * context,
109 unsigned int parameter)
111 switch (parameter)
113 case ZYNADD_PARAMETER_BOOL_RESONANCE:
114 return voice_params_ptr->resonance;
115 case ZYNADD_PARAMETER_BOOL_WHITE_NOISE:
116 return voice_params_ptr->white_noise;
119 LOG_ERROR("Unknown voice global bool parameter %u", parameter);
120 assert(0);
121 return false;
124 void
125 zyn_component_voice_globals_set_bool(
126 void * context,
127 unsigned int parameter,
128 bool value)
130 switch (parameter)
132 case ZYNADD_PARAMETER_BOOL_RESONANCE:
133 LOG_DEBUG("voice resonance -> %s (%p)", value ? "on" : "off", voice_params_ptr);
134 voice_params_ptr->resonance = value;
135 return;
136 case ZYNADD_PARAMETER_BOOL_WHITE_NOISE:
137 LOG_DEBUG("voice white noise -> %s (%p)", value ? "on" : "off", voice_params_ptr);
138 voice_params_ptr->white_noise = value;
139 return;
142 LOG_ERROR("Unknown voice global bool parameter %u", parameter);
143 assert(0);
146 #undef voice_params_ptr
148 void
149 zyn_addsynth_component_init_voice_globals(
150 struct zyn_component_descriptor * component_ptr,
151 struct zyn_addnote_voice_parameters * voice_params_ptr)
153 //LOG_DEBUG("voice globals init (%p, %p)", component_ptr, voice_params_ptr);
154 ZYN_INIT_COMPONENT(component_ptr, voice_params_ptr, zyn_component_voice_globals_);