clap

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

commit 2adeb1eaf4ca5ac823472223e50073bbf8d95e53
parent 2fbf6b9d0c653eb9a8e45e7d75a7836b49c09fbb
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Sun, 30 Nov 2014 13:23:25 +0100

Improve preset extension

Diffstat:
Minclude/clap/ext/presets.h | 37++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/include/clap/ext/presets.h b/include/clap/ext/presets.h @@ -15,13 +15,40 @@ struct clap_preset uint8_t score; // 0 = garbage, ..., 5 = favorite }; +struct clap_preset_iterator; + struct clap_plugin_presets { - /* Returns a newly allocated preset list. The caller has to free it. */ - uint32_t (*get_presets_count)(struct clap_plugin *plugin); - bool (*get_preset)(struct clap_plugin *plugin, - uint32_t index, - struct clap_preset *preset); + /* Allocate a new preset iterator positioned at the beginning of the + * preset collection, store its pointer into (*iter). + * Returns true on success, false otherwise. + * If the collection is empty, then it must return false and (*iter) + * should be NULL. */ + bool (*iter_begin)(struct clap_plugin *plugin, + struct clap_preset_iterator **iter); + + /* Iterate to the next value. If the iterator reached the end of the + * collection, returns false. + * Returns true on success. */ + bool (*iter_next)(struct clap_plugin *plugin, + struct clap_preset_iterator *iter); + + /* Release the iterator. + * If iter is NULL, then do nothing. */ + void (*iter_destroy)(struct clap_plugin *plugin, + struct clap_preset_iterator *iter); + + /* Get preset at the current iterator position. + * Returns true on success, false otherwise. */ + bool (*iter_get)(struct clap_plugin *plugin, + struct clap_preset_iterator *iter, + struct clap_preset *preset); + + /* Get a preset info by its URL and returns true. + * If the preset is not found, then it should return false. */ + bool (*get)(struct clap_plugin *plugin, + const char *url, + struct clap_preset *preset); }; #endif /* !CLAP_EXT_PRESETS_H */