clap

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

commit 160f22c62abe4e852656aa5c06bbcfb8d823659a
parent d03bfbbbe56d6277f19754434d05d84f0f52d9ae
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Sat,  1 Oct 2016 16:08:31 +0200

Improve the preset library

Diffstat:
Minclude/clap/ext/presets.h | 35+++++++++++++++++------------------
Minclude/clap/ext/state.h | 6+++---
2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/include/clap/ext/presets.h b/include/clap/ext/presets.h @@ -7,6 +7,8 @@ struct clap_preset_info { + char plugin_id[CLAP_ID_SIZE]; // used to identify which plugin can load the preset + char id[CLAP_ID_SIZE]; // used to identify a preset in a preset bank char name[CLAP_NAME_SIZE]; // display name char desc[CLAP_DESC_SIZE]; // desc and how to use it char author[CLAP_NAME_SIZE]; @@ -15,11 +17,16 @@ struct clap_preset_info uint8_t score; // 0 = garbage, ..., 100 = best }; -struct clap_preset_handle +struct clap_plugin_preset { - void *priv; - int32_t num_presets; - // TODO cookie for fast rescan of huge bank file + /* Get the current preset info */ + bool (*get_current_preset_info)(struct clap_plugin *plugin, + struct clap_preset_info *preset); + + /* Load a preset from a bank file */ + bool (*load_preset)(struct clap_plugin *plugin, + const char *path, + const char *preset_id); }; /* The principle behind this extension is that the host gets a list of @@ -30,7 +37,7 @@ struct clap_preset_library /* Copies at most *path_size bytes into path. * If directory_index is bigger than the number of directories, * then return false. */ - bool (*get_directory)(struct clap_preset_library *reader, + bool (*get_directory)(struct clap_preset_library *library, int directory_index, char *path, int32_t *path_size); @@ -42,25 +49,17 @@ struct clap_preset_library void (*close_bank)(struct clap_plugin_preset_reader *reader, struct clap_preset_handle *handle); + int32_t (*get_bank_size)(struct clap_preset_library *library, + void *bank_handle); + /* Get a preset info from its path and returns true. * In case of a preset bank file, index is used, and *has_next * should be set to false when index reaches the last preset. * If the preset is not found, then it should return false. */ bool (*get_preset_info)(struct clap_plugin_presets *presets, - void *cookie, + void *bank_handle, struct clap_preset_info *preset_info, - int32_t index, - bool *has_next); - - /* Get the current preset info */ - bool (*get_current_preset_info)(struct clap_plugin *plugin, - struct clap_preset_info *preset); - - /* Loads the preset at path, and in case of a preset bank, - * the one at index. */ - bool (*load_preset)(struct clap_plugin *plugin, - const char *path, - int32_t index); + int32_t index); }; #endif /* !CLAP_EXT_PRESETS_H */ diff --git a/include/clap/ext/state.h b/include/clap/ext/state.h @@ -13,9 +13,9 @@ struct clap_plugin_state bool (*save)(struct clap_plugin *plugin, void **buffer, int32_t *size); bool (*restore)(struct clap_plugin *plugin, const void *buffer, int32_t size); - /* Same as above except this one focus on a parameter group. */ - bool (*save_group)(struct clap_plugin *plugin, const char *group_id, void **buffer, int32_t *size); - bool (*restore_group)(struct clap_plugin *plugin, const char *group_id, const void *buffer, int32_t size); + /* Same as above except this one focus on a parameter module. */ + bool (*save_module)(struct clap_plugin *plugin, const char *module_id, void **buffer, int32_t *size); + bool (*restore_module)(struct clap_plugin *plugin, const char *module_id, const void *buffer, int32_t size); }; #endif /* !CLAP_EXT_STATE_H */