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 *****************************************************************************/
28 #include "lfo_parameters.h"
30 #include "filter_parameters.h"
31 #include "filter_base.h"
32 #include "filter_common.h"
33 #include "analog_filter.h"
34 #include "sv_filter.h"
35 #include "formant_filter.h"
37 #include "envelope_parameters.h"
40 #include "resonance.h"
42 #include "oscillator.h"
43 #include "portamento.h"
44 #include "addsynth_internal.h"
47 #define zyn_addsynth_ptr ((struct zyn_addsynth *)context)
50 zyn_component_amp_globals_get_float(
52 unsigned int parameter
)
56 case ZYNADD_PARAMETER_FLOAT_PANORAMA
:
57 return zyn_addsynth_ptr
->panorama
;
58 case ZYNADD_PARAMETER_FLOAT_VOLUME
:
59 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PVolume
);
60 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING
:
61 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PAmpVelocityScaleFunction
);
62 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH
:
63 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchStrength
);
64 case ZYNADD_PARAMETER_FLOAT_PUNCH_TIME
:
65 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchTime
);
66 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH
:
67 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchStretch
);
68 case ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING
:
69 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchVelocitySensing
);
70 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE
:
71 return zyn_addsynth_ptr
->pitch_bend_range
;
72 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND
:
73 return zyn_addsynth_ptr
->pitch_bend
;
75 LOG_ERROR("Unknown float amplitude global parameter %u", parameter
);
81 zyn_component_amp_globals_set_float(
83 unsigned int parameter
,
88 case ZYNADD_PARAMETER_FLOAT_PANORAMA
:
89 zyn_addsynth_ptr
->panorama
= value
;
91 case ZYNADD_PARAMETER_FLOAT_VOLUME
:
92 zyn_addsynth_ptr
->GlobalPar
.PVolume
= percent_to_0_127(value
);
94 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING
:
95 zyn_addsynth_ptr
->GlobalPar
.PAmpVelocityScaleFunction
= percent_to_0_127(value
);
97 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH
:
98 zyn_addsynth_ptr
->GlobalPar
.PPunchStrength
= percent_to_0_127(value
);
100 case ZYNADD_PARAMETER_FLOAT_PUNCH_TIME
:
101 zyn_addsynth_ptr
->GlobalPar
.PPunchTime
= percent_to_0_127(value
);
103 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH
:
104 zyn_addsynth_ptr
->GlobalPar
.PPunchStretch
= percent_to_0_127(value
);
106 case ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING
:
107 zyn_addsynth_ptr
->GlobalPar
.PPunchVelocitySensing
= percent_to_0_127(value
);
109 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE
:
110 zyn_addsynth_ptr
->pitch_bend_range
= value
;
111 ZYN_UPDATE_PITCH_BEND(zyn_addsynth_ptr
);
113 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND
:
114 zyn_addsynth_ptr
->pitch_bend
= value
;
115 ZYN_UPDATE_PITCH_BEND(zyn_addsynth_ptr
);
118 LOG_ERROR("Unknown float amplitude global parameter %u", parameter
);
124 zyn_component_amp_globals_get_int(
126 unsigned int parameter
)
133 zyn_component_amp_globals_set_int(
135 unsigned int parameter
,
142 zyn_component_amp_globals_get_bool(
144 unsigned int parameter
)
148 case ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA
:
149 return zyn_addsynth_ptr
->random_panorama
;
150 case ZYNADD_PARAMETER_BOOL_STEREO
:
151 return zyn_addsynth_ptr
->stereo
;
152 case ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING
:
153 return zyn_addsynth_ptr
->random_grouping
;
155 LOG_ERROR("Unknown bool amplitude global parameter %u", parameter
);
161 zyn_component_amp_globals_set_bool(
163 unsigned int parameter
,
168 case ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA
:
169 zyn_addsynth_ptr
->random_panorama
= value
;
171 case ZYNADD_PARAMETER_BOOL_STEREO
:
172 zyn_addsynth_ptr
->stereo
= value
;
174 case ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING
:
175 zyn_addsynth_ptr
->random_grouping
= value
;
178 LOG_ERROR("Unknown bool amplitude global parameter %u", parameter
);
183 #undef zyn_addsynth_ptr
186 zyn_addsynth_component_init_amp_globals(
187 struct zyn_component_descriptor
* component_ptr
,
188 struct zyn_addsynth
* zyn_addsynth_ptr
)
190 ZYN_INIT_COMPONENT(component_ptr
, zyn_addsynth_ptr
, zyn_component_amp_globals_
);