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 *****************************************************************************/
27 #include "lv2dynparam/lv2dynparam.h"
28 #include "lv2dynparam/plugin.h"
29 #include "zynadd_internal.h"
30 #include "zynadd_dynparam_value_changed_callbacks.h"
32 #define LOG_LEVEL LOG_LEVEL_ERROR
35 #define parameter_ptr ((struct zynadd_parameter *)context)
38 zynadd_bool_parameter_changed(
44 LOG_DEBUG("bool parameter \"%s\" changed to \"%s\"", parameter_ptr
->name_ptr
, value
? "true" : "false");
46 if (parameter_ptr
->scope
== LV2DYNPARAM_PARAMETER_SCOPE_TYPE_HIDE_OTHER
||
47 parameter_ptr
->scope
== LV2DYNPARAM_PARAMETER_SCOPE_TYPE_SHOW_OTHER
)
49 current_value
= zyn_addsynth_get_bool_parameter(
50 parameter_ptr
->addsynth_component
,
51 parameter_ptr
->addsynth_parameter
);
53 if ((current_value
&& value
) ||
54 (!current_value
&& !value
))
56 /* value not changed */
60 if ((parameter_ptr
->scope
== LV2DYNPARAM_PARAMETER_SCOPE_TYPE_HIDE_OTHER
&& value
) ||
61 (parameter_ptr
->scope
== LV2DYNPARAM_PARAMETER_SCOPE_TYPE_SHOW_OTHER
&& !value
))
63 LOG_DEBUG("Removing parameter \"%s\" with semi scope", parameter_ptr
->other_parameter
->name_ptr
);
65 /* enabling randomize -> remove panorama parameter */
66 if (!lv2dynparam_plugin_param_remove(
67 parameter_ptr
->synth_ptr
->dynparams
,
68 parameter_ptr
->other_parameter
->lv2parameter
))
75 LOG_DEBUG("Appearing parameter \"%s\" with semi scope", parameter_ptr
->other_parameter
->name_ptr
);
77 if (!zynadd_appear_parameter(parameter_ptr
->synth_ptr
, parameter_ptr
->other_parameter
))
84 zyn_addsynth_set_bool_parameter(
85 parameter_ptr
->addsynth_component
,
86 parameter_ptr
->addsynth_parameter
,
93 zynadd_float_parameter_changed(
97 zyn_addsynth_set_float_parameter(
98 parameter_ptr
->addsynth_component
,
99 parameter_ptr
->addsynth_parameter
,
106 zynadd_int_parameter_changed(
110 // LOG_ERROR("int parameter changed to value %d", value);
112 zyn_addsynth_set_int_parameter(
113 parameter_ptr
->addsynth_component
,
114 parameter_ptr
->addsynth_parameter
,
121 zynadd_enum_parameter_changed(
124 unsigned int value_index
)
126 zyn_addsynth_set_int_parameter(
127 parameter_ptr
->addsynth_component
,
128 parameter_ptr
->addsynth_parameter
,