Browse Source

A few vst3 host fixes, no longer crash on load

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
f701e1421e
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 10 additions and 13 deletions
  1. +10
    -13
      source/backend/plugin/CarlaPluginVST3.cpp

+ 10
- 13
source/backend/plugin/CarlaPluginVST3.cpp View File

@@ -194,6 +194,7 @@ public:
: CarlaPlugin(engine, id), : CarlaPlugin(engine, id),
fFirstActive(true), fFirstActive(true),
fAudioOutBuffers(nullptr), fAudioOutBuffers(nullptr),
fLastKnownLatency(0),
fLastTimeInfo(), fLastTimeInfo(),
fV3TimeContext(), fV3TimeContext(),
fV3Application(new carla_v3_host_application), fV3Application(new carla_v3_host_application),
@@ -261,11 +262,7 @@ public:


uint32_t getLatencyInFrames() const noexcept override uint32_t getLatencyInFrames() const noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fV3.processor != nullptr, 0);

try {
return v3_cpp_obj(fV3.processor)->get_latency_samples(fV3.processor);
} CARLA_SAFE_EXCEPTION_RETURN("get_latency_samples", 0);
return fLastKnownLatency;
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -302,7 +299,7 @@ public:
uint options = 0x0; uint options = 0x0;


// can't disable fixed buffers if using latency // can't disable fixed buffers if using latency
if (pData->latency.frames == 0)
if (fLastKnownLatency == 0)
options |= PLUGIN_OPTION_FIXED_BUFFERS; options |= PLUGIN_OPTION_FIXED_BUFFERS;


/* TODO /* TODO
@@ -640,7 +637,7 @@ public:
aIns += static_cast<uint32_t>(busInfo.channel_count); aIns += static_cast<uint32_t>(busInfo.channel_count);
} }


for (int32_t j=0; j<numAudioInputBuses; ++j)
for (int32_t j=0; j<numAudioOutputBuses; ++j)
{ {
v3_bus_info busInfo = {}; v3_bus_info busInfo = {};
CARLA_SAFE_ASSERT_BREAK(v3_cpp_obj(fV3.component)->get_bus_info(fV3.component, V3_AUDIO, V3_OUTPUT, j, &busInfo) == V3_OK); CARLA_SAFE_ASSERT_BREAK(v3_cpp_obj(fV3.component)->get_bus_info(fV3.component, V3_AUDIO, V3_OUTPUT, j, &busInfo) == V3_OK);
@@ -946,11 +943,11 @@ public:
pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_OUT; pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_OUT;


// check initial latency // check initial latency
if (const uint32_t latency = v3_cpp_obj(fV3.processor)->get_latency_samples(fV3.processor))
if ((fLastKnownLatency = v3_cpp_obj(fV3.processor)->get_latency_samples(fV3.processor)) != 0)
{ {
pData->client->setLatency(latency);
pData->client->setLatency(fLastKnownLatency);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
pData->latency.recreateBuffers(std::max(aIns+cvIns, aOuts+cvOuts), latency);
pData->latency.recreateBuffers(std::max(aIns+cvIns, aOuts+cvOuts), fLastKnownLatency);
#endif #endif
} }


@@ -1880,8 +1877,7 @@ public:


pData->options = 0x0; pData->options = 0x0;


if (v3_cpp_obj(fV3.processor)->get_latency_samples(fV3.processor) != 0 /*|| hasMidiOutput()*/ ||
isPluginOptionEnabled(options, PLUGIN_OPTION_FIXED_BUFFERS))
if (fLastKnownLatency != 0 /*|| hasMidiOutput()*/ || isPluginOptionEnabled(options, PLUGIN_OPTION_FIXED_BUFFERS))
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; pData->options |= PLUGIN_OPTION_FIXED_BUFFERS;


if (isPluginOptionEnabled(options, PLUGIN_OPTION_USE_CHUNKS)) if (isPluginOptionEnabled(options, PLUGIN_OPTION_USE_CHUNKS))
@@ -1948,11 +1944,12 @@ private:


bool fFirstActive; // first process() call after activate() bool fFirstActive; // first process() call after activate()
float** fAudioOutBuffers; float** fAudioOutBuffers;
uint32_t fLastKnownLatency;
EngineTimeInfo fLastTimeInfo; EngineTimeInfo fLastTimeInfo;
v3_process_context fV3TimeContext; v3_process_context fV3TimeContext;


CarlaScopedPointer<carla_v3_host_application> fV3Application; CarlaScopedPointer<carla_v3_host_application> fV3Application;
inline v3_funknown** getHostContext() const noexcept { return (v3_funknown**)fV3Application.get(); }
inline v3_funknown** getHostContext() const noexcept { return (v3_funknown**)&fV3Application; }


// v3_class_info_2 is ABI compatible with v3_class_info // v3_class_info_2 is ABI compatible with v3_class_info
union ClassInfo { union ClassInfo {


Loading…
Cancel
Save