Skip to content

Commit

Permalink
updating consts and structures from the latest ARA SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
defiantnerd committed Jun 9, 2024
1 parent 0cc7d6d commit d72e7df
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/clap_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void Plugin::connectClap(const clap_plugin_t* clap)
getExtension(_plugin, _ext._tail, CLAP_EXT_TAIL);
getExtension(_plugin, _ext._gui, CLAP_EXT_GUI);
getExtension(_plugin, _ext._timer, CLAP_EXT_TIMER_SUPPORT);
getExtension(_plugin, _ext._ara, CLAP_EXT_ARA_PLUGIN_EXTENSION);
getExtension(_plugin, _ext._ara, CLAP_EXT_ARA_PLUGINEXTENSION);

getExtension(_plugin, _ext._contextmenu, CLAP_EXT_CONTEXT_MENU);
if (_ext._contextmenu == nullptr)
Expand Down
55 changes: 42 additions & 13 deletions src/detail/ara/ara.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,32 @@

// ARA support
//
// the structs and identifiers are a copy from the ARA SDK (file ARA_API/ARACLAP.h from https://github.com/Celemony/ARA_API).
// ARA is Copyright (c) 2022-2024, Celemony Software GmbH, All Rights Reserved.
//
// The ARA SDK is available under Apache-2.0 license here:
//
// https://github.com/Celemony/ARA_SDK
//
// More information about ARA can be found here: https://vwww.celemony.com/ara
//
// the clap-wrapper itself does not require the ARA SDK because CLAP is a shell API only and
// just passes pointers through extensions to the ARA plugin core.
//

//! Factory ID for retrieving the clap_ara_factory_t extension from clap_plugin_entry_t.get_factory()
static CLAP_CONSTEXPR const char CLAP_EXT_ARA_FACTORY[] = "com.celemony.ara.factory.draft/1";
static CLAP_CONSTEXPR const char CLAP_EXT_ARA_FACTORY[] = "org.ara-audio.ara.factory/2";

//! Extension ID for retrieving the clap_ara_plugin_extension_t from clap_plugin_t.get_extension()
static CLAP_CONSTEXPR const char CLAP_EXT_ARA_PLUGIN_EXTENSION[] =
"com.celemony.ara.plugin_extension.draft/1";
static CLAP_CONSTEXPR const char CLAP_EXT_ARA_PLUGINEXTENSION[] = "org.ara-audio.ara.pluginextension/2";

//! Add this feature if your plugin supports ARA.
//! This allows hosts to detect ARA early on in the setup phase.
#define CLAP_PLUGIN_FEATURE_ARA_SUPPORTED "ara:supported"

//! Add this feature if your plugin requires ARA to operate (will not work as normal insert plug-in).
//! This allows non-ARA CLAP hosts to suppress the plug-in since it cannot be used there.
#define CLAP_PLUGIN_FEATURE_ONLY_ARA "only-ara"
#define CLAP_PLUGIN_FEATURE_ARA_REQUIRED "ara:required"

// VST3 class category name
#define kARAMainFactoryClass "ARA Main Factory Class"
Expand All @@ -25,35 +40,49 @@ extern "C"
#endif

// substitute types so we don't need to include the ARA SDK in full
typedef void* ARAFactoryPtr;
typedef void* ARAPlugInExtensionInstancePtr;
typedef void* ARADocumentControllerRef;
typedef void *ARAFactoryPtr;
typedef void *ARAPlugInExtensionInstancePtr;
typedef void *ARADocumentControllerRef;
typedef int32_t ARAPlugInInstanceRoleFlags;

/***************************************************************************************************/
//! Extension interface to connect to ARA at CLAP factory level.
//! The host can pass CLAP_EXT_ARA_FACTORY to clap_plugin_entry_t.get_factory() to directly obtain an
//! ARAFactory, which allows for creating and maintaining the model independently of any clap_plugin_t
//! instances, enabling tasks such as automatic tempo detection or audio-to-MIDI conversion.
//! For rendering and editing the model however, there must be an associated clap_plugin_t provided in
//! the same binary - the descriptor for which is returned at the same index as the related ARAFactory.

typedef struct clap_ara_factory
{
//! Get the number of ARA factories (i.e. ARA-capable plug.-ins) available.
//! Note that the regular clap_plugin_factory can contain more plug-ins if these do not support
//! ARA - make no assumption about items returned here being related to the items returned there
//! in terms of count or order.
uint32_t(CLAP_ABI* get_factory_count)(const struct clap_ara_factory* factory);
uint32_t(CLAP_ABI *get_factory_count)(const struct clap_ara_factory *factory);

//! Get the ARA factory for the plug-in at the given index.
//! The returned pointer must remain valid until clap_plugin_entry_t.deinit() is called.
//! The returned ARAFactory must be equal to the ARAFactory returned from instances of the
//! associated CLAP plug-in through their clap_ara_plugin_extension_t.get_factory().
ARAFactoryPtr(CLAP_ABI* get_ara_factory)(const struct clap_ara_factory* factory, uint32_t index);
ARAFactoryPtr(CLAP_ABI *get_ara_factory)(const struct clap_ara_factory *factory, uint32_t index);

//! Get the ID of the CLAP plug-in associated with the ARA factory for the given index.
//! The plug-in must be in the same binary.
//! The returned pointer must remain valid until clap_plugin_entry_t.deinit is called.
const char*(CLAP_ABI* get_plugin_id)(const struct clap_ara_factory* factory, uint32_t index);
const char *(CLAP_ABI *get_plugin_id)(const struct clap_ara_factory *factory, uint32_t index);
} clap_ara_factory_t;

/***************************************************************************************************/
//! Extension interface to connect to ARA at CLAP plug-in level.
//! This interface provides access to the ARA specific extension of a CLAP plug-in.
//! Return an pointer to a clap_ara_plugin_extension_t when clap_plugin_t.get_extension() is called
//! with CLAP_EXT_ARA_PLUGINEXTENSION.

typedef struct clap_ara_plugin_extension
{
//! Access the ARAFactory associated with this plug-in.
ARAFactoryPtr(CLAP_ABI* get_factory)(const clap_plugin_t* plugin);
ARAFactoryPtr(CLAP_ABI *get_factory)(const clap_plugin_t *plugin);

//! Bind the CLAP instance to an ARA document controller, switching it from "normal" operation
//! to ARA mode with the assigned roles, and exposing the ARA plug-in extension.
Expand All @@ -68,8 +97,8 @@ extern "C"
//! the clap_plugin_t instance and for deleting ARA document controller is undefined.
//! Plug-ins must handle both potential destruction orders to allow for a simpler reference
//! counting implementation on the host side.
ARAPlugInExtensionInstancePtr(CLAP_ABI* bind_to_document_controller)(
const clap_plugin_t* plugin, ARADocumentControllerRef documentControllerRef,
ARAPlugInExtensionInstancePtr(CLAP_ABI *bind_to_document_controller)(
const clap_plugin_t *plugin, ARADocumentControllerRef documentControllerRef,
ARAPlugInInstanceRoleFlags knownRoles, ARAPlugInInstanceRoleFlags assignedRoles);
} clap_ara_plugin_extension_t;

Expand Down
5 changes: 3 additions & 2 deletions src/detail/vst3/categories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <clap/plugin-features.h>
#include <pluginterfaces/base/ipluginbase.h>
#include <pluginterfaces/vst/ivstaudioprocessor.h>
#include "../ara/ara.h"

using namespace Steinberg;
using namespace Steinberg::Vst;
Expand Down Expand Up @@ -101,8 +102,8 @@ static const struct _translate
{ CLAP_PLUGIN_FEATURE_MIXING , "Mixing"},
{ CLAP_PLUGIN_FEATURE_MASTERING , "Mastering"},

{ "only-ara" , "OnlyARA" },
{ "ara::required" , "OnlyARA" },
{ CLAP_PLUGIN_FEATURE_ARA_SUPPORTED , "OnlyARA" },
{ CLAP_PLUGIN_FEATURE_ARA_REQUIRED , "OnlyARA" },

{ "external" , "External"},

Expand Down
1 change: 1 addition & 0 deletions src/wrapasvst3_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,6 @@ FUnknown* ClapAsVst3::createInstance(void* context)
ara_factory->get_ara_factory(ara_factory, ctx->index), Steinberg::FUID(ctx->classinfo.cid)));
}
}

return nullptr; // this should never happen.
}

0 comments on commit d72e7df

Please sign in to comment.