clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 1dd8297410d160be007e387eccfc4fe8c3f5bb44
parent 84b25440a67de620be2d45a5b4a034d1e2f46442
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Wed,  7 Jan 2015 01:09:19 +0100

thyns: implement params count / params get

Diffstat:
Mexamples/thyns/plugin.c | 35+++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/examples/thyns/plugin.c b/examples/thyns/plugin.c @@ -87,7 +87,7 @@ thyns_plugin_deactivate(struct clap_plugin *plugin) uint32_t thyns_params_count(struct clap_plugin *plugin) { - return 2 * THYNS_OSC_PARAM_COUNT; + return sizeof (struct thyns_params) / sizeof (union clap_param_value); } bool @@ -95,7 +95,38 @@ thyns_params_get(struct clap_plugin *plugin, uint32_t index, struct clap_param *param) { - return false; + if (index >= thyns_params_count(plugin)) + return false; + + struct thyns_plugin *p = plugin->plugin_data; + uint32_t i = 0; + + if (index < i + THYNS_OSC_PARAM_COUNT) + thyns_osc_param_info(index - i, p->thyns.params.osc1[index - i], + "osc1:", param); + i += THYNS_OSC_PARAM_COUNT; + + if (index < i + THYNS_OSC_PARAM_COUNT) + thyns_osc_param_info(index - i, p->thyns.params.osc2[index - i], + "osc2:", param); + i += THYNS_OSC_PARAM_COUNT; + + if (index < i + THYNS_FILT_PARAM_COUNT) + thyns_filt_param_info(index - i, p->thyns.params.filt[index - i], + "filt:", param); + i += THYNS_FILT_PARAM_COUNT; + + if (index < i + THYNS_ENV_PARAM_COUNT) + thyns_env_param_info(index - i, p->thyns.params.amp_env[index - i], + "amp_env:", param); + i += THYNS_ENV_PARAM_COUNT; + + if (index < i + THYNS_ENV_PARAM_COUNT) + thyns_env_param_info(index - i, p->thyns.params.filt_env[index - i], + "filt_env:", param); + i += THYNS_ENV_PARAM_COUNT; + + return true; } struct thyns_plugin *