Browse Source

Many VST3 hosting details, get UIs to appear

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 1 year ago
parent
commit
776acbba63
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 734 additions and 41 deletions
  1. +659
    -35
      source/backend/plugin/CarlaPluginVST3.cpp
  2. +3
    -1
      source/backend/utils/PluginDiscovery.cpp
  3. +63
    -4
      source/discovery/carla-discovery.cpp
  4. +9
    -1
      source/includes/travesty/edit_controller.h

+ 659
- 35
source/backend/plugin/CarlaPluginVST3.cpp
File diff suppressed because it is too large
View File


+ 3
- 1
source/backend/utils/PluginDiscovery.cpp View File

@@ -508,7 +508,7 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
#endif
break;
case CB::PLUGIN_VST3:
// handled separately
wildcard = "*.vst3";
break;
case CB::PLUGIN_CLAP:
wildcard = "*.clap";
@@ -527,6 +527,8 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
break;
}

CARLA_SAFE_ASSERT_RETURN(wildcard != nullptr, nullptr);

const std::vector<water::File> binaries(ptype == CB::PLUGIN_VST3
? findVST3s(pluginPath)
: directories


+ 63
- 4
source/discovery/carla-discovery.cpp View File

@@ -1452,6 +1452,37 @@ struct carla_v3_host_application : v3_host_application_cpp {
static v3_result V3_API carla_create_instance(void*, v3_tuid, v3_tuid, void**) { return V3_NOT_IMPLEMENTED; }
};

struct carla_v3_param_value_queue : v3_param_value_queue_cpp {
carla_v3_param_value_queue()
{
query_interface = carla_query_interface;
ref = v3_ref_static;
unref = v3_unref_static;
queue.get_param_id = carla_get_param_id;
queue.get_point_count = carla_get_point_count;
queue.get_point = carla_get_point;
queue.add_point = carla_add_point;
}

static v3_result V3_API carla_query_interface(void* const self, const v3_tuid iid, void** const iface)
{
if (v3_tuid_match(iid, v3_funknown_iid) ||
v3_tuid_match(iid, v3_param_value_queue_iid))
{
*iface = self;
return V3_OK;
}

*iface = nullptr;
return V3_NO_INTERFACE;
}

static v3_param_id V3_API carla_get_param_id(void*) { return 0; }
static int32_t V3_API carla_get_point_count(void*) { return 0; }
static v3_result V3_API carla_get_point(void*, int32_t, int32_t*, double*) { return V3_NOT_IMPLEMENTED; }
static v3_result V3_API carla_add_point(void*, int32_t, double, int32_t*) { return V3_NOT_IMPLEMENTED; }
};

struct carla_v3_param_changes : v3_param_changes_cpp {
carla_v3_param_changes()
{
@@ -1706,6 +1737,21 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
v3_cpp_obj_initialize(controller, hostContext);
}

// connect component to controller
v3_connection_point** connComponent = nullptr;
if (v3_cpp_obj_query_interface(component, v3_connection_point_iid, &connComponent) != V3_OK)
connComponent = nullptr;

v3_connection_point** connController = nullptr;
if (v3_cpp_obj_query_interface(controller, v3_connection_point_iid, &connController) != V3_OK)
connController = nullptr;

if (connComponent != nullptr && connController != nullptr)
{
v3_cpp_obj(connComponent)->connect(connComponent, connController);
v3_cpp_obj(connController)->connect(connController, connComponent);
}

// fill in all the details
uint hints = 0x0;
int audioIns = 0;
@@ -1770,7 +1816,7 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
CARLA_SAFE_ASSERT_CONTINUE(cvIns <= MAX_DISCOVERY_CV_IO);
CARLA_SAFE_ASSERT_CONTINUE(cvOuts <= MAX_DISCOVERY_CV_IO);

if (v3_plugin_view** const view = v3_cpp_obj(controller)->create_view(controller, "view"))
if (v3_plugin_view** const view = v3_cpp_obj(controller)->create_view(controller, "editor"))
{
if (v3_cpp_obj(view)->is_platform_type_supported(view, V3_VIEW_PLATFORM_TYPE_NATIVE) == V3_TRUE)
hints |= PLUGIN_HAS_CUSTOM_UI;
@@ -1800,9 +1846,9 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
? new v3_audio_bus_buffers[numAudioInputBuses]
: nullptr;

v3_audio_bus_buffers* const outputsBuffers = numAudioOutputBuses > 0
? new v3_audio_bus_buffers[numAudioOutputBuses]
: nullptr;
v3_audio_bus_buffers* const outputsBuffers = numAudioOutputBuses > 0
? new v3_audio_bus_buffers[numAudioOutputBuses]
: nullptr;

for (int32_t b=0; b<numAudioInputBuses; ++b)
{
@@ -1903,6 +1949,19 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
v3_cpp_obj_unref(processor);
}

// disconnect and unref connection points
if (connComponent != nullptr && connController != nullptr)
{
v3_cpp_obj(connComponent)->disconnect(connComponent, connController);
v3_cpp_obj(connController)->disconnect(connController, connComponent);
}

if (connComponent != nullptr)
v3_cpp_obj_unref(connComponent);

if (connController != nullptr)
v3_cpp_obj_unref(connController);

if (shouldTerminateController)
v3_cpp_obj_terminate(controller);



+ 9
- 1
source/includes/travesty/edit_controller.h View File

@@ -1,6 +1,6 @@
/*
* travesty, pure C VST3-compatible interface
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -132,6 +132,14 @@ static constexpr const v3_tuid v3_midi_mapping_iid =
* C++ variants
*/

struct v3_component_handler_cpp : v3_funknown {
v3_component_handler comp;
};

struct v3_component_handler2_cpp : v3_funknown {
v3_component_handler2 comp2;
};

struct v3_edit_controller_cpp : v3_funknown {
v3_plugin_base base;
v3_edit_controller ctrl;


Loading…
Cancel
Save