.gitignore file
[zyn.git] / addsynth_component_filter_globals.cpp
blob6b65dae584cbd5c71f4050591e5add415ad1848d
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 zyn_addsynth_ptr ((struct zyn_addsynth *)context)
48 float
49 zyn_component_filter_globals_get_float(
50 void * context,
51 unsigned int parameter)
53 switch (parameter)
55 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT:
56 return zyn_addsynth_ptr->m_filter_velocity_sensing_amount;
57 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION:
58 return zyn_addsynth_ptr->m_filter_velocity_scale_function;
61 LOG_ERROR("Unknown filter global float parameter %u", parameter);
62 assert(0);
63 return 0.0;
66 void
67 zyn_component_filter_globals_set_float(
68 void * context,
69 unsigned int parameter,
70 float value)
72 switch (parameter)
74 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_AMOUNT:
75 zyn_addsynth_ptr->m_filter_velocity_sensing_amount = value;
76 return;
77 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING_FUNCTION:
78 zyn_addsynth_ptr->m_filter_velocity_scale_function = -value;
79 return;
82 LOG_ERROR("Unknown filter global float parameter %u", parameter);
83 assert(0);
86 signed int
87 zyn_component_filter_globals_get_int(
88 void * context,
89 unsigned int parameter)
91 switch (parameter)
93 case ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY:
94 return zyn_addsynth_ptr->filter_type;
97 LOG_ERROR("Unknown filter global int/enum parameter %u", parameter);
98 assert(0);
100 return -1;
103 void
104 zyn_component_filter_globals_set_int(
105 void * context,
106 unsigned int parameter,
107 signed int value)
109 switch (parameter)
111 case ZYNADD_PARAMETER_ENUM_FILTER_CATEGORY:
112 assert(value >= 0 && value < ZYN_FILTER_TYPES_COUNT);
113 zyn_addsynth_ptr->filter_type = value;
114 zyn_addsynth_ptr->m_filter_params.m_category = ZYN_FILTER_TYPE_ANALOG; /* XXX */
115 return;
118 LOG_ERROR("Unknown filter global int/enum parameter %u", parameter);
119 assert(0);
122 bool
123 zyn_component_filter_globals_get_bool(
124 void * context,
125 unsigned int parameter)
127 LOG_ERROR("Unknown filter global bool parameter %u", parameter);
128 assert(0);
130 return false;
133 void
134 zyn_component_filter_globals_set_bool(
135 void * context,
136 unsigned int parameter,
137 bool value)
139 LOG_ERROR("Unknown filter global bool parameter %u", parameter);
140 assert(0);
143 #undef zyn_addsynth_ptr
145 void
146 zyn_addsynth_component_init_filter_globals(
147 struct zyn_component_descriptor * component_ptr,
148 struct zyn_addsynth * zyn_addsynth_ptr)
150 ZYN_INIT_COMPONENT(component_ptr, zyn_addsynth_ptr, zyn_component_filter_globals_);