Add some foaf and doap info to zynadd.ttl
[zyn.git] / addsynth_component_filter_sv.cpp
blob66cea5e99b472f902447a1974aaf6ff9c6251352
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 #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"
44 #include "log.h"
46 #define filter ((zyn_filter_sv_handle)context)
48 float
49 zyn_component_filter_sv_get_float(
50 void * context,
51 unsigned int parameter)
53 switch (parameter)
55 case ZYNADD_PARAMETER_FLOAT_FREQUNECY:
56 return zyn_filter_sv_get_frequency(filter);
57 case ZYNADD_PARAMETER_FLOAT_Q_FACTOR:
58 return zyn_filter_sv_get_q_factor(filter);
59 case ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING:
60 return zyn_filter_sv_get_frequency_tracking(filter);
61 case ZYNADD_PARAMETER_FLOAT_VOLUME:
62 return zyn_filter_sv_get_gain(filter);
65 LOG_ERROR("Unknown sv filter float parameter %u", parameter);
66 assert(0);
68 return 0.0;
71 void
72 zyn_component_filter_sv_set_float(
73 void * context,
74 unsigned int parameter,
75 float value)
77 switch (parameter)
79 case ZYNADD_PARAMETER_FLOAT_FREQUNECY:
80 zyn_filter_sv_set_frequency(filter, value);
81 return;
82 case ZYNADD_PARAMETER_FLOAT_Q_FACTOR:
83 zyn_filter_sv_set_q_factor(filter, value);
84 return;
85 case ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING:
86 zyn_filter_sv_set_frequency_tracking(filter, value);
87 return;
88 case ZYNADD_PARAMETER_FLOAT_VOLUME:
89 return zyn_filter_sv_set_gain(filter, value);
90 return;
93 LOG_ERROR("Unknown sv filter float parameter %u", parameter);
94 assert(0);
97 signed int
98 zyn_component_filter_sv_get_int(
99 void * context,
100 unsigned int parameter)
102 switch (parameter)
104 case ZYNADD_PARAMETER_INT_STAGES:
105 return zyn_filter_sv_get_stages(filter);
106 case ZYNADD_PARAMETER_ENUM_FILTER_TYPE:
107 return zyn_filter_sv_get_type(filter);
110 LOG_ERROR("Unknown sv filter int/enum parameter %u", parameter);
111 assert(0);
113 return -1;
116 void
117 zyn_component_filter_sv_set_int(
118 void * context,
119 unsigned int parameter,
120 signed int value)
122 switch (parameter)
124 case ZYNADD_PARAMETER_INT_STAGES:
125 return zyn_filter_sv_set_stages(filter, value);
126 case ZYNADD_PARAMETER_ENUM_FILTER_TYPE:
127 zyn_filter_sv_set_type(filter, value);
128 return;
131 LOG_ERROR("Unknown sv filter int/enum parameter %u", parameter);
132 assert(0);
135 bool
136 zyn_component_filter_sv_get_bool(
137 void * context,
138 unsigned int parameter)
140 LOG_ERROR("Unknown sv filter bool parameter %u", parameter);
141 assert(0);
143 return false;
146 void
147 zyn_component_filter_sv_set_bool(
148 void * context,
149 unsigned int parameter,
150 bool value)
152 LOG_ERROR("Unknown sv filter bool parameter %u", parameter);
153 assert(0);
156 #undef filter
158 void
159 zyn_addsynth_component_init_filter_sv(
160 struct zyn_component_descriptor * component_ptr,
161 zyn_filter_sv_handle filter)
163 ZYN_INIT_COMPONENT(component_ptr, filter, zyn_component_filter_sv_);