clap

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

commit b08b23334656b6a7d398654ce233ec38026547d2
parent 8169b4264b99651f1b9da14a87c72de236b79185
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Tue,  3 Jan 2023 09:40:43 +0100

add set_flags() and make the comments use //

Diffstat:
Minclude/clap/factory/draft/preset-discovery.h | 122+++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 60 insertions(+), 62 deletions(-)

diff --git a/include/clap/factory/draft/preset-discovery.h b/include/clap/factory/draft/preset-discovery.h @@ -1,4 +1,4 @@ -/** +/* Preset Discovery API. Preset Discovery enables a plug-in host to identify where presets are found, what @@ -43,102 +43,100 @@ static const CLAP_CONSTEXPR char CLAP_PRESET_DISCOVERY_FACTORY_ID[] = extern "C" { #endif -/** Receiver that receives the metadata for a single preset file. - * The host would define the various callbacks in this interface and the preset parser function - * would then call them. - * - * This interface isn't thread-safe. - */ +enum clap_preset_discovery_flags { + // This location/collection is meant for storing factory presets, most likely read-only + CLAP_PRESET_DISCOVERY_IS_FACTORY_CONTENT = 1 << 0, + + // This location/collection is meant for storing user created presets + CLAP_PRESET_DISCOVERY_IS_USER_CONTENT = 1 << 1, + + // This location/collection is meant for demo presets, those are preset which may trigger + // some limitation in the plugin because they require additionnal features which the user + // needs to purchase or the content itself needs to be bought and is only available in + // demo mode. + CLAP_PRESET_DISCOVERY_IS_DEMO_CONTENT = 1 << 2, +}; + +// Receiver that receives the metadata for a single preset file. +// The host would define the various callbacks in this interface and the preset parser function +// would then call them. +// +// This interface isn't thread-safe. typedef const struct clap_preset_metadata_receiver { - /** If there is an error reading metadata from a file this should be called with an error - * message. - * os_error: the operating system error, if applicable. If not applicable set it to a non-error value: - * 0 on unix and Windows. - */ + // If there is an error reading metadata from a file this should be called with an error + // message. + // os_error: the operating system error, if applicable. If not applicable set it to a non-error + // value: 0 on unix and Windows. void(CLAP_ABI *on_error)(const struct clap_preset_metadata_receiver *receiver, int32_t os_error, const char *error_message); - /** Marks this file as a container file meaning that it can contain other presets. */ + // Marks this file as a container file meaning that it can contain other presets. void(CLAP_ABI *mark_as_container_file)(const struct clap_preset_metadata_receiver *receiver); - /** If the file being parsed is a preset container file (mark_as_container_file has been called) - * then this must be called for every preset in the file and before any preset metadata is - * sent with the calls below. If the file is not a container file then this should not be - * called at all. - * - * The path defines a human friendly path to the preset in the container file. It - * should be unique within the container file. - * - * The preset_id is a machine friendly string used to load the preset inside the container via a - * the preset-load plug-in extension. The preset_id can also just be the path if that's what the - * extension wants but it could also be some other unique id like a database primary key or a - * binary offset. It's use is entirely up to the plug-in. - */ + // If the file being parsed is a preset container file (mark_as_container_file has been called) + // then this must be called for every preset in the file and before any preset metadata is + // sent with the calls below. If the file is not a container file then this should not be + // called at all. + // + // The path defines a human friendly path to the preset in the container file. It + // should be unique within the container file. + // + // The preset_id is a machine friendly string used to load the preset inside the container via a + // the preset-load plug-in extension. The preset_id can also just be the path if that's what the + // extension wants but it could also be some other unique id like a database primary key or a + // binary offset. It's use is entirely up to the plug-in. void(CLAP_ABI *begin_contained_preset)(const struct clap_preset_metadata_receiver *receiver, const char *path, const char *preset_id); - /** Marks this preset as a bank preset, meaning that it can be assigned to the plug-in as a - * preset but will update the banks in the plug-in. - */ + // Marks this preset as a bank preset, meaning that it can be assigned to the plug-in as a + // preset but will update the banks in the plug-in. void(CLAP_ABI *mark_as_bank_preset)(const struct clap_preset_metadata_receiver *receiver); - /** Sets plug-in id that this preset can be used with. */ + // Sets plug-in id that this preset can be used with. void(CLAP_ABI *set_plugin_id)(const struct clap_preset_metadata_receiver *receiver, const char *plugin_id); - /** Sets the collection to which the preset belongs to. */ + // Sets the collection to which the preset belongs to. void(CLAP_ABI *set_collection_id)(const struct clap_preset_metadata_receiver, const char *collection_id); - /** Adds a creator name for the preset. */ + // Sets the flags, see clap_preset_discovery_flags. + // If unset, they are then inherited from the location. + void(CLAP_ABI *set_flags)(const struct clap_preset_metadata_receiver, uint32_t flags); + + // Adds a creator name for the preset. void(CLAP_ABI *add_creator)(const struct clap_preset_metadata_receiver *receiver, const char *creator); - /** Sets a description of the preset. */ + // Sets a description of the preset. void(CLAP_ABI *set_description)(const struct clap_preset_metadata_receiver *receiver, const char *description); - /** Sets the creation time and last modification time of the preset. - * If one of the time isn't known, then set it to 0. */ + // Sets the creation time and last modification time of the preset. + // If one of the time isn't known, then set it to 0. void(CLAP_ABI *set_timestamps)(const struct clap_preset_metadata_receiver *receiver, uint64_t creation_time, uint64_t modification_time); - /** - * Adds a feature to the preset. - * See plugin-features.h and preset-features.h - * - * The feature string is arbitrary, it is the indexer's job to understand it and remap it to its - * internal categorization and tagging system. - * - * Examples: - * kick, drum, tom, snare, clap, cymbal, bass, lead, metalic, hardsync, crossmod, acid, - * distorted, drone, pad, dirty, etc... - */ + // Adds a feature to the preset. + // See plugin-features.h and preset-features.h + // + // The feature string is arbitrary, it is the indexer's job to understand it and remap it to its + // internal categorization and tagging system. + // + // Examples: + // kick, drum, tom, snare, clap, cymbal, bass, lead, metalic, hardsync, crossmod, acid, + // distorted, drone, pad, dirty, etc... void(CLAP_ABI *add_feature)(const struct clap_preset_metadata_receiver *receiver, const char *feature); -} *clap_preset_metadata_receiver_t; - -enum clap_preset_discovery_flags { - // This location/collection is meant for storing factory presets, most likely read-only - CLAP_PRESET_DISCOVERY_IS_FACTORY_CONTENT = 1 << 0, - - // This location/collection is meant for storing user created presets - CLAP_PRESET_DISCOVERY_IS_USER_CONTENT = 1 << 1, - - // This location/collection is meant for demo presets, those are preset which may trigger - // some limitation in the plugin because they require additionnal features which the user - // needs to purchase or the content itself needs to be bought and is only available in - // demo mode. - CLAP_PRESET_DISCOVERY_IS_DEMO_CONTENT = 1 << 2, -}; +} * clap_preset_metadata_receiver_t; // Defines a place in which to search for presets typedef struct clap_preset_location { - uint64_t flags; // see enum clap_preset_discovery_flags + uint32_t flags; // see enum clap_preset_discovery_flags // name of this location char name[CLAP_NAME_SIZE];