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 *****************************************************************************/
28 #include "lfo_parameters.h"
29 #include "filter_parameters.h"
30 #include "envelope_parameters.h"
31 #include "resonance.h"
33 #include "oscillator.h"
34 #include "portamento.h"
35 #include "addsynth_internal.h"
38 #define zyn_addsynth_ptr ((struct zyn_addsynth *)context)
41 zyn_component_amp_globals_get_float(
43 unsigned int parameter
)
47 case ZYNADD_PARAMETER_FLOAT_PANORAMA
:
48 return zyn_addsynth_ptr
->panorama
;
49 case ZYNADD_PARAMETER_FLOAT_VOLUME
:
50 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PVolume
);
51 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING
:
52 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PAmpVelocityScaleFunction
);
53 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH
:
54 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchStrength
);
55 case ZYNADD_PARAMETER_FLOAT_PUNCH_TIME
:
56 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchTime
);
57 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH
:
58 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchStretch
);
59 case ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING
:
60 return percent_from_0_127(zyn_addsynth_ptr
->GlobalPar
.PPunchVelocitySensing
);
61 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE
:
62 return zyn_addsynth_ptr
->pitch_bend_range
;
63 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND
:
64 return zyn_addsynth_ptr
->pitch_bend
;
66 LOG_ERROR("Unknown float amplitude global parameter %u", parameter
);
72 zyn_component_amp_globals_set_float(
74 unsigned int parameter
,
79 case ZYNADD_PARAMETER_FLOAT_PANORAMA
:
80 zyn_addsynth_ptr
->panorama
= value
;
82 case ZYNADD_PARAMETER_FLOAT_VOLUME
:
83 zyn_addsynth_ptr
->GlobalPar
.PVolume
= percent_to_0_127(value
);
85 case ZYNADD_PARAMETER_FLOAT_VELOCITY_SENSING
:
86 zyn_addsynth_ptr
->GlobalPar
.PAmpVelocityScaleFunction
= percent_to_0_127(value
);
88 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRENGTH
:
89 zyn_addsynth_ptr
->GlobalPar
.PPunchStrength
= percent_to_0_127(value
);
91 case ZYNADD_PARAMETER_FLOAT_PUNCH_TIME
:
92 zyn_addsynth_ptr
->GlobalPar
.PPunchTime
= percent_to_0_127(value
);
94 case ZYNADD_PARAMETER_FLOAT_PUNCH_STRETCH
:
95 zyn_addsynth_ptr
->GlobalPar
.PPunchStretch
= percent_to_0_127(value
);
97 case ZYNADD_PARAMETER_FLOAT_PUNCH_VELOCITY_SENSING
:
98 zyn_addsynth_ptr
->GlobalPar
.PPunchVelocitySensing
= percent_to_0_127(value
);
100 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND_RANGE
:
101 zyn_addsynth_ptr
->pitch_bend_range
= value
;
102 ZYN_UPDATE_PITCH_BEND(zyn_addsynth_ptr
);
104 case ZYNADD_PARAMETER_FLOAT_PITCH_BEND
:
105 zyn_addsynth_ptr
->pitch_bend
= value
;
106 ZYN_UPDATE_PITCH_BEND(zyn_addsynth_ptr
);
109 LOG_ERROR("Unknown float amplitude global parameter %u", parameter
);
115 zyn_component_amp_globals_get_int(
117 unsigned int parameter
)
124 zyn_component_amp_globals_set_int(
126 unsigned int parameter
,
133 zyn_component_amp_globals_get_bool(
135 unsigned int parameter
)
139 case ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA
:
140 return zyn_addsynth_ptr
->random_panorama
;
141 case ZYNADD_PARAMETER_BOOL_STEREO
:
142 return zyn_addsynth_ptr
->stereo
;
143 case ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING
:
144 return zyn_addsynth_ptr
->random_grouping
;
146 LOG_ERROR("Unknown bool amplitude global parameter %u", parameter
);
152 zyn_component_amp_globals_set_bool(
154 unsigned int parameter
,
159 case ZYNADD_PARAMETER_BOOL_RANDOM_PANORAMA
:
160 zyn_addsynth_ptr
->random_panorama
= value
;
162 case ZYNADD_PARAMETER_BOOL_STEREO
:
163 zyn_addsynth_ptr
->stereo
= value
;
165 case ZYNADD_PARAMETER_BOOL_RANDOM_GROUPING
:
166 zyn_addsynth_ptr
->random_grouping
= value
;
169 LOG_ERROR("Unknown bool amplitude global parameter %u", parameter
);
174 #undef zyn_addsynth_ptr
177 zyn_addsynth_component_init_amp_globals(
178 struct zyn_component_descriptor
* component_ptr
,
179 struct zyn_addsynth
* zyn_addsynth_ptr
)
181 ZYN_INIT_COMPONENT(component_ptr
, zyn_addsynth_ptr
, zyn_component_amp_globals_
);