clap

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

commit 170eee68bed454db05c0f713765196284663c4f2
parent 4c444baf83fda93e1cb5b27e799985851a0caade
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Sun,  9 Oct 2016 17:20:58 +0200

Update the preset library

Diffstat:
Minclude/clap/ext/presets.h | 30++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/include/clap/ext/presets.h b/include/clap/ext/presets.h @@ -14,11 +14,15 @@ struct clap_preset_info char author[CLAP_NAME_SIZE]; char categories[CLAP_TAGS_SIZE]; // "cat1;cat2;cat3;..." char tags[CLAP_TAGS_SIZE]; // "tag1;tag2;tag3;..." - uint8_t score; // 0 = garbage, ..., 100 = best + int8_t score; // 0 = garbage, ..., 100 = best, -1 = no score }; +/* Interface implemented by the plugin */ struct clap_plugin_preset { + /* Create a preset library for this plugin */ + struct clap_preset_library *(*create_preset_library)(struct clap_plugin *plugin); + /* Get the current preset info */ bool (*get_current_preset_info)(struct clap_plugin *plugin, struct clap_preset_info *preset); @@ -29,9 +33,15 @@ struct clap_plugin_preset const char *preset_id); }; +/* opaque type */ +struct clap_bank_handle; + /* The principle behind this extension is that the host gets a list of * directories to scan recursively, and then for each files, it can ask - * the interface to load the preset. */ + * the interface to load the preset. + * + * Every file are considered as preset bank, so they can contain between + * 0 and many presets. */ struct clap_preset_library { /* Copies at most *path_size bytes into path. @@ -42,22 +52,22 @@ struct clap_preset_library char *path, int32_t *path_size); - bool (*open_bank)(struct clap_plugin_preset_reader *reader, - const char *path, - struct clap_preset_handle *handle); + bool (*open_bank)(struct clap_preset_library *library, + const char *path, + struct clap_bank_handle *handle); - void (*close_bank)(struct clap_plugin_preset_reader *reader, - struct clap_preset_handle *handle); + void (*close_bank)(struct clap_preset_library *library, + struct clap_bank_handle *handle); int32_t (*get_bank_size)(struct clap_preset_library *library, - void *bank_handle); + struct clap_bank_handle *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 *bank_handle, + bool (*get_bank_preset)(struct clap_preset_library *library, + struct clap_bank_handle *handle, struct clap_preset_info *preset_info, int32_t index); };