Skip to content

Commit

Permalink
Merge branch 'clap-1.2.1'
Browse files Browse the repository at this point in the history
* clap-1.2.1:
  TODO--
  BUILD: adapt to new CLAP version
  CLAP: update EXTRA_DIST
  CLAP: move/remove headers
  CLAP: update to 1.2.1

Signed-off-by: Stefan Westerfeld <[email protected]>
  • Loading branch information
swesterfeld committed Jun 11, 2024
2 parents a22c2b0 + e8db89b commit b92c8a1
Show file tree
Hide file tree
Showing 87 changed files with 5,443 additions and 917 deletions.
36 changes: 30 additions & 6 deletions 3rdparty/clap/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
EXTRA_DIST = audio-buffer.h clap.h color.h entry.h events.h fixedpoint.h \
host.h id.h plugin-factory.h plugin-features.h plugin.h \
plugin-invalidation.h private process.h stream.h string-sizes.h \
version.h LICENSE

SUBDIRS = ext helpers private
EXTRA_DIST = string-sizes.h private/macros.h private/std.h events.h \
factory/plugin-factory.h factory/draft/plugin-state-converter.h \
factory/draft/plugin-invalidation.h factory/preset-discovery.h \
ext/draft/triggers.h ext/draft/extensible-audio-ports.h \
ext/draft/transport-control.h ext/draft/resource-directory.h \
ext/draft/undo.h ext/draft/tuning.h ext/thread-check.h \
ext/audio-ports-activation.h ext/configurable-audio-ports.h ext/latency.h \
ext/timer-support.h ext/event-registry.h ext/params.h \
ext/remote-controls.h ext/tail.h ext/state-context.h ext/preset-load.h \
ext/context-menu.h ext/posix-fd-support.h ext/audio-ports.h ext/log.h \
ext/surround.h ext/track-info.h ext/note-ports.h \
ext/audio-ports-config.h ext/thread-pool.h ext/state.h \
ext/param-indication.h ext/gui.h ext/ambisonic.h ext/note-name.h \
ext/voice-info.h ext/render.h clap.h .Makefile.am.swp color.h \
fixedpoint.h helpers/macros.hh helpers/preset-discovery-provider.hxx \
helpers/plugin-proxy.hxx helpers/context-menu-builder.hh \
helpers/host-proxy.hh helpers/misbehaviour-handler.hh \
helpers/version-check.hh helpers/host-proxy.hxx helpers/event-list.hh \
helpers/plugin.hxx helpers/param-queue.hh helpers/hex-encoder.hh \
helpers/heap.hh helpers/plugin.hh helpers/plugin-proxy.hh \
helpers/preset-discovery-indexer.hxx \
helpers/preset-discovery-metadata-receiver.hh \
helpers/preset-discovery-indexer.hh \
helpers/preset-discovery-metadata-receiver.hxx \
helpers/reducing-param-queue.hxx helpers/preset-discovery-provider.hh \
helpers/checking-level.hh helpers/reducing-param-queue.hh \
helpers/note-end-queue.hh helpers/host.hxx helpers/host.hh \
plugin-features.h timestamp.h all.h plugin.h host.h version.h \
audio-buffer.h stream.h process.h entry.h LICENSE \
universal-plugin-id.h id.h
13 changes: 13 additions & 0 deletions 3rdparty/clap/all.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "clap.h"

#include "factory/draft/plugin-invalidation.h"
#include "factory/draft/plugin-state-converter.h"

#include "ext/draft/extensible-audio-ports.h"
#include "ext/draft/resource-directory.h"
#include "ext/draft/transport-control.h"
#include "ext/draft/triggers.h"
#include "ext/draft/tuning.h"
#include "ext/draft/undo.h"
2 changes: 1 addition & 1 deletion 3rdparty/clap/audio-buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct clap_audio_buffer {
float **data32;
double **data64;
uint32_t channel_count;
uint32_t latency; // latency from/to the audio interface
uint32_t latency; // latency from/to the audio interface
uint64_t constant_mask;
} clap_audio_buffer_t;

Expand Down
31 changes: 16 additions & 15 deletions 3rdparty/clap/clap.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* CLAP - CLever Audio Plugin
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
*
Expand Down Expand Up @@ -26,38 +26,39 @@
#pragma once

#include "entry.h"
#include "plugin-factory.h"
#include "plugin-invalidation.h"
#include "plugin-features.h"

#include "factory/plugin-factory.h"
#include "factory/preset-discovery.h"

#include "plugin.h"
#include "plugin-features.h"
#include "host.h"
#include "universal-plugin-id.h"

#include "ext/ambisonic.h"
#include "ext/audio-ports-activation.h"
#include "ext/audio-ports-config.h"
#include "ext/audio-ports.h"
#include "ext/configurable-audio-ports.h"
#include "ext/context-menu.h"
#include "ext/event-registry.h"
#include "ext/gui.h"
#include "ext/latency.h"
#include "ext/log.h"
#include "ext/note-name.h"
#include "ext/note-ports.h"
#include "ext/param-indication.h"
#include "ext/params.h"
#include "ext/posix-fd-support.h"
#include "ext/preset-load.h"
#include "ext/remote-controls.h"
#include "ext/render.h"
#include "ext/state-context.h"
#include "ext/state.h"
#include "ext/surround.h"
#include "ext/tail.h"
#include "ext/thread-check.h"
#include "ext/thread-pool.h"
#include "ext/timer-support.h"
#include "ext/track-info.h"
#include "ext/voice-info.h"

#include "ext/draft/ambisonic.h"
#include "ext/draft/cv.h"
#include "ext/draft/file-reference.h"
#include "ext/draft/midi-mappings.h"
#include "ext/draft/preset-load.h"
#include "ext/draft/quick-controls.h"
#include "ext/draft/state-context.h"
#include "ext/draft/surround.h"
#include "ext/draft/track-info.h"
#include "ext/draft/tuning.h"
94 changes: 81 additions & 13 deletions 3rdparty/clap/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ extern "C" {
// - /usr/lib/clap
//
// Windows
// - %CommonFilesFolder%/CLAP/
// - %LOCALAPPDATA%/Programs/Common/CLAP/
// - %COMMONPROGRAMFILES%\CLAP
// - %LOCALAPPDATA%\Programs\Common\CLAP
//
// MacOS
// - /Library/Audio/Plug-Ins/CLAP
Expand All @@ -31,33 +31,101 @@ extern "C" {
// Each directory should be recursively searched for files and/or bundles as appropriate in your OS
// ending with the extension `.clap`.
//
// Every method must be thread-safe.
// init and deinit in most cases are called once, in a matched pair, when the dso is loaded / unloaded.
// In some rare situations it may be called multiple times in a process, so the functions must be defensive,
// mutex locking and counting calls if undertaking non trivial non idempotent actions.
//
// Rationale:
//
// The intent of the init() and deinit() functions is to provide a "normal" initialization patterh
// which occurs when the shared object is loaded or unloaded. As such, hosts will call each once and
// in matched pairs. In CLAP specifications prior to 1.2.0, this single-call was documented as a
// requirement.
//
// We realized, though, that this is not a requirement hosts can meet. If hosts load a plugin
// which itself wraps another CLAP for instance, while also loading that same clap in its memory
// space, both the host and the wrapper will call init() and deinit() and have no means to communicate
// the state.
//
// With CLAP 1.2.0 and beyond we are changing the spec to indicate that a host should make an
// absolute best effort to call init() and deinit() once, and always in matched pairs (for every
// init() which returns true, one deinit() should be called).
//
// This takes the de-facto burden on plugin writers to deal with multiple calls into a hard requirement.
//
// Most init() / deinit() pairs we have seen are the relatively trivial {return true;} and {}. But
// if your init() function does non-trivial one time work, the plugin author must maintain a counter
// and must manage a mutex lock. The most obvious implementation will maintain a static counter and a
// global mutex, increment the counter on each init, decrement it on each deinit, and only undertake
// the init or deinit action when the counter is zero.
typedef struct clap_plugin_entry {
clap_version_t clap_version; // initialized to CLAP_VERSION

// This function must be called first, and can only be called once.
// Initializes the DSO.
//
// This function must be called first, before any-other CLAP-related function or symbol from this
// DSO.
//
// It also must only be called once, until a later call to deinit() is made, after which init()
// can be called once more to re-initialize the DSO.
// This enables hosts to e.g. quickly load and unload a DSO for scanning its plugins, and then
// load it again later to actually use the plugins if needed.
//
// As stated above, even though hosts are forbidden to do so directly, multiple calls before any
// deinit() call may still happen. Implementations *should* take this into account, and *must*
// do so as of CLAP 1.2.0.
//
// It should be as fast as possible, in order to perform a very quick scan of the plugin
// descriptors.
//
// It is forbidden to display graphical user interface in this call.
// It is forbidden to perform user interaction in this call.
// It is forbidden to display graphical user interfaces in this call.
// It is forbidden to perform any user interaction in this call.
//
// If the initialization depends upon expensive computation, maybe try to do them ahead of time
// and cache the result.
//
// If init() returns false, then the host must not call deinit() nor any other clap
// related symbols from the DSO.
bool (*init)(const char *plugin_path);
// Returns true on success. If init() returns false, then the DSO must be considered
// uninitialized, and the host must not call deinit() nor any other CLAP-related symbols from the
// DSO.
// This function also returns true in the case where the DSO is already initialized, and no
// actual initialization work is done in this call, as explain above.
//
// plugin_path is the path to the DSO (Linux, Windows), or the bundle (macOS).
//
// This function may be called on any thread, including a different one from the one a later call
// to deinit() (or a later init()) can be made.
// However, it is forbidden to call this function simultaneously from multiple threads.
// It is also forbidden to call it simultaneously with *any* other CLAP-related symbols from the
// DSO, including (but not limited to) deinit().
bool(CLAP_ABI *init)(const char *plugin_path);

// No more calls into the DSO must be made after calling deinit().
void (*deinit)(void);
// De-initializes the DSO, freeing any resources allocated or initialized by init().
//
// After this function is called, no more calls into the DSO must be made, except calling init()
// again to re-initialize the DSO.
// This means that after deinit() is called, the DSO can be considered to be in the same state
// as if init() was never called at all yet, enabling it to be re-initialized as needed.
//
// As stated above, even though hosts are forbidden to do so directly, multiple calls before any
// new init() call may still happen. Implementations *should* take this into account, and *must*
// do so as of CLAP 1.2.0.
//
// Just like init(), this function may be called on any thread, including a different one from
// the one init() was called from, or from the one a later init() call can be made.
// However, it is forbidden to call this function simultaneously from multiple threads.
// It is also forbidden to call it simultaneously with *any* other CLAP-related symbols from the
// DSO, including (but not limited to) deinit().
void(CLAP_ABI *deinit)(void);

// Get the pointer to a factory. See plugin-factory.h for an example.
// Get the pointer to a factory. See factory/plugin-factory.h for an example.
//
// Returns null if the factory is not provided.
// The returned pointer must *not* be freed by the caller.
const void *(*get_factory)(const char *factory_id);
//
// Unlike init() and deinit(), this function can be called simultaneously by multiple threads.
//
// [thread-safe]
const void *(CLAP_ABI *get_factory)(const char *factory_id);
} clap_plugin_entry_t;

/* Entry point */
Expand Down
Loading

0 comments on commit b92c8a1

Please sign in to comment.