clap

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

commit 42629a42457bd9aa18caee7f9abd92aadff5cee2
parent 6ff505a1f5f151703ee01ffcddfedc5185c7ed76
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sat, 25 Dec 2021 15:20:09 +0100

Rework ambisonic

Diffstat:
Minclude/clap/chmap.h | 7++-----
Ainclude/clap/ext/draft/ambisonic.h | 49+++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/include/clap/chmap.h b/include/clap/chmap.h @@ -16,11 +16,8 @@ enum { // see clap_plugin_surround to inspect the exact channel layout CLAP_CHMAP_SURROUND = 3, - // FuMa channel ordering - CLAP_CHMAP_AMBISONIC_FUMA = 4, - - // ACN channel ordering - CLAP_CHMAP_AMBISONIC_ACN = 5, + // see clap_plugin_ambisonic to inspect the mapping + CLAP_CHMAP_AMBISONIC = 4, }; typedef int32_t clap_chmap; diff --git a/include/clap/ext/draft/ambisonic.h b/include/clap/ext/draft/ambisonic.h @@ -0,0 +1,49 @@ +#pragma once + +#include "../../plugin.h" + +// This extension can be used to specify the channel mapping used by the plugin. + +static CLAP_CONSTEXPR const char CLAP_EXT_AMBISONIC[] = "clap.ambisonic.draft/0"; + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(push, CLAP_ALIGN) + +enum { + // FuMa channel ordering + CLAP_AMBISONIC_FUMA = 0, + + // ACN channel ordering + CLAP_AMBISONIC_ACN = 1, +}; + +typedef struct clap_ambisonic_info { + alignas(4) uint32_t ordering; + alignas(1) bool is_normalized; +} clap_ambisonic_info_t; + +typedef struct clap_plugin_ambisonic { + // Returns true on success + // [main-thread] + bool (*get_info)(const clap_plugin_t *plugin, + bool is_input, + uint32_t port_index, + clap_ambisonic_info_t *info); + +} clap_plugin_ambisonic_t; + +typedef struct clap_host_ambisonic { + // Informs the host that the info have changed. + // The info can only change when the plugin is de-activated. + // [main-thread] + void (*changed)(const clap_host_t *host); +} clap_host_ambisonic_t; + +#pragma pack(pop) + +#ifdef __cplusplus +} +#endif