clap

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

commit 33898cfbc7005e7f95811a351778d822c1edfefb
parent c28994f6959313606897c104e78cef8e653855e0
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Wed, 14 Jan 2015 15:58:46 +0100

clap_plugin_params_restore(): need the steady_time

Diffstat:
Mexamples/thyns/plugin.c | 9+++++++--
Minclude/clap/ext/params.c | 7++++---
Minclude/clap/ext/params.h | 8+++++++-
3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/examples/thyns/plugin.c b/examples/thyns/plugin.c @@ -167,9 +167,14 @@ thyns_state_save(struct clap_plugin *plugin, void **buffer, uint32_t *size) } bool -thyns_state_restore(struct clap_plugin *plugin, const void *buffer, uint32_t size) +thyns_state_restore(struct clap_plugin *plugin, + const void *buffer, + uint32_t size) { - clap_plugin_params_restore(plugin, buffer, size); + struct thyns_plugin *p = plugin->plugin_data; + + clap_plugin_params_restore( + plugin, buffer, size, p->host->steady_time(p->host)); return true; } diff --git a/include/clap/ext/params.c b/include/clap/ext/params.c @@ -59,7 +59,8 @@ clap_plugin_params_save(struct clap_plugin *plugin, static inline void clap_plugin_params_restore(struct clap_plugin *plugin, const uint8_t *buffer, - uint32_t size) + uint32_t size, + uint64_t steady_time) { struct clap_plugin_params *params = plugin->extension(plugin, CLAP_EXT_PARAMS); if (!params) @@ -104,7 +105,7 @@ clap_plugin_params_restore(struct clap_plugin *plugin, struct clap_event ev; ev.next = NULL; ev.type = CLAP_EVENT_PARAM_SET; - ev.steady_time = 0; + ev.steady_time = steady_time; ev.param.is_global = true; ev.param.key = 0; ev.param.index = index; @@ -113,7 +114,7 @@ clap_plugin_params_restore(struct clap_plugin *plugin, process.inputs = NULL; process.outputs = NULL; process.samples_count = 0; - process.steady_time = 0; + process.steady_time = steady_time; process.events = &ev; switch (d.type) { diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h @@ -64,10 +64,16 @@ clap_plugin_params_save(struct clap_plugin *plugin, uint8_t *buffer, uint32_t *size); +/* Helper that will deserialize parameters value from the buffer + * and send CLAP_EVENT_PARAM_SET to the plugin to restore them. + * The steady_time is required because the plugin can discard + * events from the past. + */ static inline void clap_plugin_params_restore(struct clap_plugin *plugin, const uint8_t *buffer, - uint32_t size); + uint32_t size, + uint64_t steady_time); # include "params.c"