Minot coding style fix
[zyn.git] / addsynth_component_filter_sv.cpp
blobbfb945a24707a415404c5682bde00ea623242795
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 #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 "filter_parameters.h"
29 #include "envelope_parameters.h"
30 #include "resonance.h"
31 #include "fft.h"
32 #include "oscillator.h"
33 #include "portamento.h"
34 #include "addsynth_internal.h"
35 #include "log.h"
37 #define filter ((zyn_filter_sv_handle)context)
39 float
40 zyn_component_filter_sv_get_float(
41 void * context,
42 unsigned int parameter)
44 switch (parameter)
46 case ZYNADD_PARAMETER_FLOAT_FREQUNECY:
47 return zyn_filter_sv_get_frequency(filter);
48 case ZYNADD_PARAMETER_FLOAT_Q_FACTOR:
49 return zyn_filter_sv_get_q_factor(filter);
50 case ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING:
51 return zyn_filter_sv_get_frequency_tracking(filter);
52 case ZYNADD_PARAMETER_FLOAT_VOLUME:
53 return zyn_filter_sv_get_gain(filter);
56 LOG_ERROR("Unknown sv filter float parameter %u", parameter);
57 assert(0);
59 return 0.0;
62 void
63 zyn_component_filter_sv_set_float(
64 void * context,
65 unsigned int parameter,
66 float value)
68 switch (parameter)
70 case ZYNADD_PARAMETER_FLOAT_FREQUNECY:
71 zyn_filter_sv_set_frequency(filter, value);
72 return;
73 case ZYNADD_PARAMETER_FLOAT_Q_FACTOR:
74 zyn_filter_sv_set_q_factor(filter, value);
75 return;
76 case ZYNADD_PARAMETER_FLOAT_FREQUENCY_TRACKING:
77 zyn_filter_sv_set_frequency_tracking(filter, value);
78 return;
79 case ZYNADD_PARAMETER_FLOAT_VOLUME:
80 return zyn_filter_sv_set_gain(filter, value);
81 return;
84 LOG_ERROR("Unknown sv filter float parameter %u", parameter);
85 assert(0);
88 signed int
89 zyn_component_filter_sv_get_int(
90 void * context,
91 unsigned int parameter)
93 switch (parameter)
95 case ZYNADD_PARAMETER_INT_STAGES:
96 return zyn_filter_sv_get_stages(filter);
97 case ZYNADD_PARAMETER_ENUM_FILTER_TYPE:
98 return zyn_filter_sv_get_type(filter);
101 LOG_ERROR("Unknown sv filter int/enum parameter %u", parameter);
102 assert(0);
104 return -1;
107 void
108 zyn_component_filter_sv_set_int(
109 void * context,
110 unsigned int parameter,
111 signed int value)
113 switch (parameter)
115 case ZYNADD_PARAMETER_INT_STAGES:
116 return zyn_filter_sv_set_stages(filter, value);
117 case ZYNADD_PARAMETER_ENUM_FILTER_TYPE:
118 zyn_filter_sv_set_type(filter, value);
119 return;
122 LOG_ERROR("Unknown sv filter int/enum parameter %u", parameter);
123 assert(0);
126 bool
127 zyn_component_filter_sv_get_bool(
128 void * context,
129 unsigned int parameter)
131 LOG_ERROR("Unknown sv filter bool parameter %u", parameter);
132 assert(0);
134 return false;
137 void
138 zyn_component_filter_sv_set_bool(
139 void * context,
140 unsigned int parameter,
141 bool value)
143 LOG_ERROR("Unknown sv filter bool parameter %u", parameter);
144 assert(0);
147 #undef filter
149 void
150 zyn_addsynth_component_init_filter_sv(
151 struct zyn_component_descriptor * component_ptr,
152 zyn_filter_sv_handle filter)
154 ZYN_INIT_COMPONENT(component_ptr, filter, zyn_component_filter_sv_);