clap

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

commit d081e196957c3509902bf8d96d5f49de52b00074
parent f39973f2c61dd588f41271d27edcfa73dd6d4730
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Tue, 29 Jun 2021 18:10:16 +0200

More constexpr

Diffstat:
Minclude/clap/ext/audio-ports.h | 10+++++-----
Minclude/clap/ext/draft/check-for-update.h | 8++++----
Minclude/clap/ext/draft/event-filter.h | 8++++----
Minclude/clap/ext/draft/file-reference.h | 3++-
Minclude/clap/ext/draft/midi-mappings.h | 4++--
Minclude/clap/ext/draft/note-name.h | 7++++---
Minclude/clap/ext/draft/preset-load.h | 8++++----
Minclude/clap/ext/draft/quick-controls.h | 4++--
Minclude/clap/ext/draft/thread-pool.h | 10+++++-----
Minclude/clap/ext/draft/track-info.h | 4++--
Minclude/clap/ext/draft/tuning.h | 8++++----
Minclude/clap/ext/draft/vst2-convert.h | 4++--
Minclude/clap/ext/draft/vst3-convert.h | 4++--
Minclude/clap/ext/event-loop.h | 8++++----
Minclude/clap/ext/gui-cocoa.h | 8++++----
Minclude/clap/ext/gui-free-standing.h | 2+-
Minclude/clap/ext/gui-win32.h | 4++--
Minclude/clap/ext/gui-x11.h | 2+-
Minclude/clap/ext/gui.h | 2+-
Minclude/clap/ext/latency.h | 4++--
Minclude/clap/ext/log.h | 8++++----
Minclude/clap/ext/params.h | 10+++++-----
Minclude/clap/ext/render.h | 2+-
Minclude/clap/ext/state.h | 2+-
Minclude/clap/ext/thread-check.h | 8++++----
Minclude/clap/version.h | 14+++++++-------
26 files changed, 79 insertions(+), 77 deletions(-)

diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h @@ -3,10 +3,6 @@ #include "../clap.h" #include "../channel-map.h" -#ifdef __cplusplus -extern "C" { -#endif - /// @page Audio Ports /// /// This extension provides a way for the plugin to describe: @@ -33,7 +29,11 @@ extern "C" { /// Plugin with very complex configuration possibilities should let the user configure the ports /// from the plugin GUI, and call @ref clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_ALL). -static const char CLAP_EXT_AUDIO_PORTS[] = "clap/audio-ports"; +static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS[] = "clap/audio-ports"; + +#ifdef __cplusplus +extern "C" { +#endif typedef struct clap_audio_port_info { clap_id id; // stable identifier diff --git a/include/clap/ext/draft/check-for-update.h b/include/clap/ext/draft/check-for-update.h @@ -1,13 +1,13 @@ #pragma once +#include "../../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_CHECK_FOR_UPDATE[] = "clap/draft/check_for_update"; + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" - -static const char CLAP_EXT_CHECK_FOR_UPDATE[] = "clap/draft/check_for_update"; - typedef struct clap_check_for_update_info { const char *version; const char *release_date; // YYYY-MM-DD diff --git a/include/clap/ext/draft/event-filter.h b/include/clap/ext/draft/event-filter.h @@ -1,13 +1,13 @@ #pragma once +#include "../../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_EVENT_FILTER[] = "clap/draft/event_filter"; + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" - -static const char CLAP_EXT_EVENT_FILTER[] = "clap/draft/event_filter"; - // This extension lets the host know which event types the plugin is interested // in. typedef struct clap_plugin_event_filter { diff --git a/include/clap/ext/draft/file-reference.h b/include/clap/ext/draft/file-reference.h @@ -3,7 +3,7 @@ #include "../../clap.h" #include "../../hash.h" -static const char CLAP_EXT_FILE_REFERENCE[] = "clap/draft/file-reference"; +static CLAP_CONSTEXPR const char CLAP_EXT_FILE_REFERENCE[] = "clap/draft/file-reference"; #ifdef __cplusplus extern "C" { @@ -61,6 +61,7 @@ typedef struct clap_host_file_reference { // [main-thread] void (*changed)(const clap_host *host); + // [main-thread] void (*set_dirty)(const clap_host *host, clap_id resource_id); } clap_host_file_reference; diff --git a/include/clap/ext/draft/midi-mappings.h b/include/clap/ext/draft/midi-mappings.h @@ -2,12 +2,12 @@ #include "../../clap.h" +static CLAP_CONSTEXPR const char CLAP_EXT_MIDI_MAPPINGS[] = "clap/draft/midi-mappings"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_MIDI_MAPPINGS[] = "clap/draft/midi-mappings"; - enum { CLAP_MIDI_MAPPING_CC7, CLAP_MIDI_MAPPING_CC14, diff --git a/include/clap/ext/draft/note-name.h b/include/clap/ext/draft/note-name.h @@ -1,12 +1,13 @@ #pragma once + +#include "../../clap.h" + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" - -static const char CLAP_EXT_NOTE_NAME[] = "clap/draft/note-name"; +static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_NAME[] = "clap/draft/note-name"; typedef struct clap_note_name { char name[CLAP_NAME_SIZE]; diff --git a/include/clap/ext/draft/preset-load.h b/include/clap/ext/draft/preset-load.h @@ -1,13 +1,13 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - #include "../../clap.h" static const char CLAP_EXT_PRESET_LOAD[] = "clap/draft/preset-load"; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct clap_plugin_preset_load { // Loads a preset in the plugin native preset file format from a path. // [main-thread] diff --git a/include/clap/ext/draft/quick-controls.h b/include/clap/ext/draft/quick-controls.h @@ -2,12 +2,12 @@ #include "../../clap.h" +static CLAP_CONSTEXPR const char CLAP_EXT_QUICK_CONTROLS[] = "clap/draft/quick-controls"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_QUICK_CONTROLS[] = "clap/draft/quick-controls"; - enum { CLAP_QUICK_CONTROLS_COUNT = 8 }; typedef struct clap_quick_controls_page { diff --git a/include/clap/ext/draft/thread-pool.h b/include/clap/ext/draft/thread-pool.h @@ -1,9 +1,5 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - #include "../../clap.h" /// @page @@ -36,7 +32,11 @@ extern "C" { /// } /// @endcode -static const char CLAP_EXT_THREAD_POOL[] = "clap/draft/thread-pool"; +static CLAP_CONSTEXPR const char CLAP_EXT_THREAD_POOL[] = "clap/draft/thread-pool"; + +#ifdef __cplusplus +extern "C" { +#endif typedef struct clap_plugin_thread_pool { // Called by the thread pool diff --git a/include/clap/ext/draft/track-info.h b/include/clap/ext/draft/track-info.h @@ -4,12 +4,12 @@ #include "../../channel-map.h" #include "../../color.h" +static CLAP_CONSTEXPR const char CLAP_EXT_TRACK_INFO[] = "clap/draft/track-info"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_TRACK_INFO[] = "clap/draft/track-info"; - typedef struct clap_track_info { clap_id id; int32_t index; diff --git a/include/clap/ext/draft/tuning.h b/include/clap/ext/draft/tuning.h @@ -1,13 +1,13 @@ #pragma once +#include "../../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_TUNING[] = "clap/draft/tuning"; + #ifdef __cplusplus extern "C" { #endif -#include "../../clap.h" - -static const char CLAP_EXT_TUNING[] = "clap/draft/tuning"; - // This extension provides a dynamic tuning table to the plugin. typedef struct clap_host_tuning { // The plugin can ask the host, the frequency of a given key, diff --git a/include/clap/ext/draft/vst2-convert.h b/include/clap/ext/draft/vst2-convert.h @@ -3,12 +3,12 @@ #include "../../clap.h" #include "../../stream.h" +static CLAP_CONSTEXPR const char CLAP_EXT_VST2_CONVERT[] = "clap/draft/vst2-convert"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_VST2_CONVERT[] = "clap/draft/vst2-convert"; - typedef struct clap_plugin_vst2_convert { // Copies the name and VST2 plugin id that we can convert from. // Returns the lenght of the name. diff --git a/include/clap/ext/draft/vst3-convert.h b/include/clap/ext/draft/vst3-convert.h @@ -3,12 +3,12 @@ #include "../../clap.h" #include "../../stream.h" +static CLAP_CONSTEXPR const char CLAP_EXT_VST3_CONVERT[] = "clap/draft/vst3-convert"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_VST3_CONVERT[] = "clap/draft/vst3-convert"; - typedef struct clap_plugin_vst3_convert { // Copies the name and VST3 plugin id that we can convert from. // [thread-safe] diff --git a/include/clap/ext/event-loop.h b/include/clap/ext/event-loop.h @@ -2,14 +2,14 @@ #include <stddef.h> +#include "../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_EVENT_LOOP[] = "clap/event-loop"; + #ifdef __cplusplus extern "C" { #endif -#include "../clap.h" - -static const char CLAP_EXT_EVENT_LOOP[] = "clap/event-loop"; - #ifdef _WIN32 typedef void *clap_fd; #else diff --git a/include/clap/ext/gui-cocoa.h b/include/clap/ext/gui-cocoa.h @@ -1,13 +1,13 @@ #pragma once +#include "../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_GUI_COCOA[] = "clap/gui-cocoa"; + #ifdef __cplusplus extern "C" { #endif -#include "../clap.h" - -static const char CLAP_EXT_GUI_COCOA[] = "clap/gui-cocoa"; - typedef struct clap_plugin_gui_cocoa { // [main-thread] bool (*attach)(const clap_plugin *plugin, void *nsView); diff --git a/include/clap/ext/gui-free-standing.h b/include/clap/ext/gui-free-standing.h @@ -2,7 +2,7 @@ #include "../clap.h" -static const char CLAP_EXT_GUI_FREE_STANDING[] = "clap/gui-free-standing"; +static CLAP_CONSTEXPR const char CLAP_EXT_GUI_FREE_STANDING[] = "clap/gui-free-standing"; #ifdef __cplusplus extern "C" { diff --git a/include/clap/ext/gui-win32.h b/include/clap/ext/gui-win32.h @@ -2,12 +2,12 @@ #include "../clap.h" +static CLAP_CONSTEXPR const char CLAP_EXT_GUI_WIN32[] = "clap/gui-win32"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_GUI_WIN32[] = "clap/gui-win32"; - // we don't want to include windows.h from this file. typedef void *clap_hwnd; diff --git a/include/clap/ext/gui-x11.h b/include/clap/ext/gui-x11.h @@ -2,7 +2,7 @@ #include "../clap.h" -static const char CLAP_EXT_GUI_X11[] = "clap/gui-x11"; +static CLAP_CONSTEXPR const char CLAP_EXT_GUI_X11[] = "clap/gui-x11"; #ifdef __cplusplus extern "C" { diff --git a/include/clap/ext/gui.h b/include/clap/ext/gui.h @@ -2,7 +2,7 @@ #include "../clap.h" -static const char CLAP_EXT_GUI[] = "clap/gui"; +static CLAP_CONSTEXPR const char CLAP_EXT_GUI[] = "clap/gui"; #ifdef __cplusplus extern "C" { diff --git a/include/clap/ext/latency.h b/include/clap/ext/latency.h @@ -3,12 +3,12 @@ #include "../clap.h" #include <stdint.h> +static CLAP_CONSTEXPR const char CLAP_EXT_LATENCY[] = "clap/latency"; + #ifdef __cplusplus extern "C" { #endif -static const char CLAP_EXT_LATENCY[] = "clap/latency"; - // The audio ports scan has to be done while the plugin is deactivated. typedef struct clap_plugin_latency { // Returns the plugin latency. diff --git a/include/clap/ext/log.h b/include/clap/ext/log.h @@ -1,13 +1,13 @@ #pragma once +#include "../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_LOG[] = "clap/log"; + #ifdef __cplusplus extern "C" { #endif -#include "../clap.h" - -static const char CLAP_EXT_LOG[] = "clap/log"; - enum { CLAP_LOG_DEBUG = 0, CLAP_LOG_INFO = 1, diff --git a/include/clap/ext/params.h b/include/clap/ext/params.h @@ -2,10 +2,6 @@ #include "../clap.h" -#ifdef __cplusplus -extern "C" { -#endif - /// @page Parameters /// @brief parameters management /// @@ -71,7 +67,11 @@ extern "C" { /// - if a parameter is created with an id that may have been used before, call: /// - clap_host_params.clear(host, param_id, CLAP_PARAM_CLEAR_ALL) -static const char CLAP_EXT_PARAMS[] = "clap/params"; +static CLAP_CONSTEXPR const char CLAP_EXT_PARAMS[] = "clap/params"; + +#ifdef __cplusplus +extern "C" { +#endif enum { // Is this param stepped? (integer values only) diff --git a/include/clap/ext/render.h b/include/clap/ext/render.h @@ -2,7 +2,7 @@ #include "../clap.h" -static const char CLAP_EXT_RENDER[] = "clap/render"; +static CLAP_CONSTEXPR const char CLAP_EXT_RENDER[] = "clap/render"; #ifdef __cplusplus extern "C" { diff --git a/include/clap/ext/state.h b/include/clap/ext/state.h @@ -3,7 +3,7 @@ #include "../clap.h" #include "../stream.h" -static const char CLAP_EXT_STATE[] = "clap/state"; +static CLAP_CONSTEXPR const char CLAP_EXT_STATE[] = "clap/state"; #ifdef __cplusplus extern "C" { diff --git a/include/clap/ext/thread-check.h b/include/clap/ext/thread-check.h @@ -1,13 +1,13 @@ #pragma once +#include "../clap.h" + +static CLAP_CONSTEXPR const char CLAP_EXT_THREAD_CHECK[] = "clap/thread-check"; + #ifdef __cplusplus extern "C" { #endif -#include "../clap.h" - -static const char CLAP_EXT_THREAD_CHECK[] = "clap/thread-check"; - // This interface is useful to do runtime checks and make // sure that the functions are called on the correct threads. // It is highly recommended to implement this extension diff --git a/include/clap/version.h b/include/clap/version.h @@ -17,7 +17,11 @@ typedef struct clap_version { int revision; } clap_version; -static const clap_version CLAP_VERSION = {0, 7, 0}; +#ifdef __cplusplus +} +#endif + +static CLAP_CONSTEXPR const clap_version CLAP_VERSION = {0, 7, 0}; static CLAP_CONSTEXPR bool clap_version_is_compatible(const clap_version &v) { // For version 0, we require the same minor version because we may still break the ABI at this point @@ -25,8 +29,4 @@ static CLAP_CONSTEXPR bool clap_version_is_compatible(const clap_version &v) { return v.minor == CLAP_VERSION.minor; return false; -} - -#ifdef __cplusplus -} -#endif -\ No newline at end of file +} +\ No newline at end of file