1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 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 *****************************************************************************/
27 #include "lfo_parameters.h"
28 #include "filter_parameters.h"
29 #include "envelope_parameters.h"
30 #include "resonance.h"
32 #include "oscillator.h"
33 #include "portamento.h"
34 #include "addsynth_internal.h"
36 #define LOG_LEVEL LOG_LEVEL_ERROR
39 #define voice_params_ptr ((struct zyn_addnote_voice_parameters * )context)
42 zyn_component_voice_globals_get_float(
44 unsigned int parameter
)
50 LOG_ERROR("Unknown voice global float parameter %u", parameter
);
56 zyn_component_voice_globals_set_float(
58 unsigned int parameter
,
65 LOG_ERROR("Unknown voice global float parameter %u", parameter
);
70 zyn_component_voice_globals_get_int(
72 unsigned int parameter
)
78 LOG_ERROR("Unknown voice global int/enum parameter %u", parameter
);
84 zyn_component_voice_globals_set_int(
86 unsigned int parameter
,
93 LOG_ERROR("Unknown voice global int/enum parameter %u", parameter
);
98 zyn_component_voice_globals_get_bool(
100 unsigned int parameter
)
104 case ZYNADD_PARAMETER_BOOL_ENABLED
:
105 return voice_params_ptr
->enabled
;
106 case ZYNADD_PARAMETER_BOOL_RESONANCE
:
107 return voice_params_ptr
->resonance
;
108 case ZYNADD_PARAMETER_BOOL_WHITE_NOISE
:
109 return voice_params_ptr
->white_noise
;
112 LOG_ERROR("Unknown voice global bool parameter %u", parameter
);
118 zyn_component_voice_globals_set_bool(
120 unsigned int parameter
,
125 case ZYNADD_PARAMETER_BOOL_ENABLED
:
126 LOG_DEBUG("voice enabled -> %s (%p)", value
? "on" : "off", voice_params_ptr
);
127 voice_params_ptr
->enabled
= value
;
129 case ZYNADD_PARAMETER_BOOL_RESONANCE
:
130 LOG_DEBUG("voice resonance -> %s (%p)", value
? "on" : "off", voice_params_ptr
);
131 voice_params_ptr
->resonance
= value
;
133 case ZYNADD_PARAMETER_BOOL_WHITE_NOISE
:
134 LOG_DEBUG("voice white noise -> %s (%p)", value
? "on" : "off", voice_params_ptr
);
135 voice_params_ptr
->white_noise
= value
;
139 LOG_ERROR("Unknown voice global bool parameter %u", parameter
);
143 #undef voice_params_ptr
146 zyn_addsynth_component_init_voice_globals(
147 struct zyn_component_descriptor
* component_ptr
,
148 struct zyn_addnote_voice_parameters
* voice_params_ptr
)
150 //LOG_DEBUG("voice globals init (%p, %p)", component_ptr, voice_params_ptr);
151 ZYN_INIT_COMPONENT(component_ptr
, voice_params_ptr
, zyn_component_voice_globals_
);