Minot coding style fix
[zyn.git] / addsynth_component_filter_globals.cpp
blob5b826e8154c670f0c9dd68734062cbacefe35d68
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 zyn_addsynth_ptr ((struct zyn_addsynth *)context)
39 float
40 zyn_component_filter_globals_get_float(
41 void * context,
42 unsigned int parameter)
44 switch (parameter)
46 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT:
47 return zyn_addsynth_ptr->m_filter_velocity_sensing_amount;
48 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION:
49 return zyn_addsynth_ptr->m_filter_velocity_scale_function;
52 LOG_ERROR("Unknown filter global float parameter %u", parameter);
53 assert(0);
54 return 0.0;
57 void
58 zyn_component_filter_globals_set_float(
59 void * context,
60 unsigned int parameter,
61 float value)
63 switch (parameter)
65 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT:
66 zyn_addsynth_ptr->m_filter_velocity_sensing_amount = value;
67 return;
68 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION:
69 zyn_addsynth_ptr->m_filter_velocity_scale_function = -value;
70 return;
73 LOG_ERROR("Unknown filter global float parameter %u", parameter);
74 assert(0);
77 signed int
78 zyn_component_filter_globals_get_int(
79 void * context,
80 unsigned int parameter)
82 switch (parameter)
84 case ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY:
85 return zyn_addsynth_ptr->filter_type;
88 LOG_ERROR("Unknown filter global int/enum parameter %u", parameter);
89 assert(0);
91 return -1;
94 void
95 zyn_component_filter_globals_set_int(
96 void * context,
97 unsigned int parameter,
98 signed int value)
100 switch (parameter)
102 case ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY:
103 assert(value >= 0 && value < ZYN_FILTER_TYPES_COUNT);
104 zyn_addsynth_ptr->filter_type = value;
105 zyn_addsynth_ptr->m_filter_params.m_category = ZYN_FILTER_TYPE_ANALOG; /* XXX */
106 return;
109 LOG_ERROR("Unknown filter global int/enum parameter %u", parameter);
110 assert(0);
113 bool
114 zyn_component_filter_globals_get_bool(
115 void * context,
116 unsigned int parameter)
118 LOG_ERROR("Unknown filter global bool parameter %u", parameter);
119 assert(0);
121 return false;
124 void
125 zyn_component_filter_globals_set_bool(
126 void * context,
127 unsigned int parameter,
128 bool value)
130 LOG_ERROR("Unknown filter global bool parameter %u", parameter);
131 assert(0);
134 #undef zyn_addsynth_ptr
136 void
137 zyn_addsynth_component_init_filter_globals(
138 struct zyn_component_descriptor * component_ptr,
139 struct zyn_addsynth * zyn_addsynth_ptr)
141 ZYN_INIT_COMPONENT(component_ptr, zyn_addsynth_ptr, zyn_component_filter_globals_);