clap

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

commit fcfe833dc2826684135a080dcc0a6deba63ecb1b
parent 3226e80dbdc096121386460ca83079649161743c
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Mon,  6 Mar 2023 17:18:57 +0100

Simplify preset discovery to not pull a uri parsing complexity

Diffstat:
Minclude/clap/ext/draft/preset-load.h | 10++++++++--
Minclude/clap/factory/draft/preset-discovery.h | 27++++++++++++++-------------
2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/include/clap/ext/draft/preset-load.h b/include/clap/ext/draft/preset-load.h @@ -16,7 +16,10 @@ typedef struct clap_plugin_preset_load { // The preset discovery provider defines the uri and load_key to be passed to this function. // // [main-thread] - bool(CLAP_ABI *from_uri)(const clap_plugin_t *plugin, const char *uri, const char *load_key); + bool(CLAP_ABI *from_location)(const clap_plugin_t *plugin, + uint32_t location_kind, + const char *location, + const char *load_key); } clap_plugin_preset_load_t; typedef struct clap_host_preset_load { @@ -36,7 +39,10 @@ typedef struct clap_host_preset_load { // must be null. // // [main-thread] - void(CLAP_ABI *loaded)(const clap_host_t *host, const char *uri, const char *load_key); + void(CLAP_ABI *loaded)(const clap_host_t *host, + uint32_t location_kind, + const char *location, + const char *load_key); } clap_host_preset_load_t; #ifdef __cplusplus diff --git a/include/clap/factory/draft/preset-discovery.h b/include/clap/factory/draft/preset-discovery.h @@ -48,12 +48,20 @@ // Use it to retrieve const clap_preset_discovery_factory_t* from // clap_plugin_entry.get_factory() static const CLAP_CONSTEXPR char CLAP_PRESET_DISCOVERY_FACTORY_ID[] = - "clap.preset-discovery-factory/draft-1"; + "clap.preset-discovery-factory/draft-2"; #ifdef __cplusplus extern "C" { #endif +enum clap_preset_discovery_location_kind { + // The preset are located in a file on the OS filesystem + CLAP_PRESET_DISCOVERY_LOCATION_FILE = 0, + + // The preset is bundled within the plugin DSO itself + CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN = 1, +}; + enum clap_preset_discovery_flags { // This is for factory or sound-pack presets. CLAP_PRESET_DISCOVERY_IS_FACTORY_CONTENT = 1 << 0, @@ -185,22 +193,15 @@ typedef struct clap_preset_discovery_filetype { // Defines a place in which to search for presets typedef struct clap_preset_discovery_location { - uint32_t flags; // see enum clap_preset_discovery_flags - const char *name; // name of this location - - // URI: - // - file:/// for pointing to a file or directory; directories are scanned recursively - // eg: file:///home/abique/.u-he/Diva/Presets/Diva (on Linux) - // eg: file:///C:/Users/abique/Documents/u-he/Diva.data/Presets/ (on Windows) - // - // - plugin:// for presets which are bundled within the plugin DSO. - // In that case, the uri must be exactly `plugin://` and nothing more. - const char *uri; + uint32_t flags; // see enum clap_preset_discovery_flags + const char *name; // name of this location + uint32_t kind; // See clap_preset_discovery_location_kind + const char *location; // Actual location in which to crawl presets } clap_preset_discovery_location_t; // Describes an installed sound pack. typedef struct clap_preset_discovery_soundpack { - uint64_t flags; // see enum clap_preset_discovery_flags + uint32_t flags; // see enum clap_preset_discovery_flags const char *id; // sound pack identifier const char *name; // name of this sound pack const char *description; // reasonably short description of the sound pack