Browse Source

Add some stubs to vst3 host code

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
b15bc2081d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 90 additions and 6 deletions
  1. +10
    -0
      source/backend/plugin/CarlaPluginVST2.cpp
  2. +78
    -4
      source/backend/plugin/CarlaPluginVST3.cpp
  3. +2
    -2
      source/utils/CarlaVst3Utils.hpp

+ 10
- 0
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -216,6 +216,16 @@ public:
return static_cast<int64_t>(fEffect->uniqueID);
}

uint32_t getLatencyInFrames() const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, 0);

const int latency = fEffect->initialDelay;
CARLA_SAFE_ASSERT_RETURN(latency >= 0, 0);

return static_cast<uint32_t>(latency);
}

// -------------------------------------------------------------------
// Information (count)



+ 78
- 4
source/backend/plugin/CarlaPluginVST3.cpp View File

@@ -15,6 +15,10 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

/* TODO list
* noexcept safe calls
* paramId vs index
*/
#include "CarlaPluginInternal.hpp"
#include "CarlaEngine.hpp"
#include "AppConfig.h"
@@ -255,10 +259,40 @@ public:
return getPluginCategoryFromV3SubCategories(fV3ClassInfo.v2.sub_categories);
}

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);
}

// -------------------------------------------------------------------
// Information (count)

// nothing
/* TODO
uint32_t getMidiInCount() const noexcept override
{
}

uint32_t getMidiOutCount() const noexcept override
{
}

uint32_t getParameterScalePointCount(uint32_t parameterId) const noexcept override
{
}
*/

// -------------------------------------------------------------------
// Information (current data)

/* TODO
std::size_t getChunkData(void** dataPtr) noexcept override
{
}
*/

// -------------------------------------------------------------------
// Information (per-plugin data)
@@ -271,14 +305,14 @@ public:
if (pData->latency.frames == 0)
options |= PLUGIN_OPTION_FIXED_BUFFERS;

/*
/* TODO
if (numPrograms > 1)
options |= PLUGIN_OPTION_MAP_PROGRAM_CHANGES;
*/

options |= PLUGIN_OPTION_USE_CHUNKS;

/*
/* TODO
if (hasMidiInput())
{
options |= PLUGIN_OPTION_SEND_CONTROL_CHANGES;
@@ -304,6 +338,12 @@ public:
v3_cpp_obj(fV3.controller)->normalised_parameter_to_plain(fV3.controller, parameterId, normalized));
}

/* TODO
float getParameterScalePointValue(uint32_t parameterId, uint32_t scalePointId) const noexcept override
{
}
*/

bool getLabel(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fV3ClassInfo.v1.name, STR_MAX);
@@ -341,6 +381,12 @@ public:
return true;
}

/* TODO
bool getParameterSymbol(uint32_t parameterId, char* strBuf) const noexcept override
{
}
*/

bool getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fV3.controller != nullptr, false);
@@ -374,14 +420,35 @@ public:
return true;
}

/* TODO
bool getParameterGroupName(uint32_t parameterId, char* strBuf) const noexcept override
{
}

bool getParameterScalePointLabel(uint32_t parameterId, uint32_t scalePointId, char* strBuf) const noexcept override
{
}
*/

// -------------------------------------------------------------------
// Set data (state)

// nothing
/* TODO
void prepareForSave(const bool temporary) override
{
// component to edit controller state or vice-versa here
}
*/

// -------------------------------------------------------------------
// Set data (internal stuff)

/* TODO
void setName(const char* newName) override
{
}
*/

// -------------------------------------------------------------------
// Set data (plugin-specific stuff)

@@ -410,6 +477,12 @@ public:
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, frameOffset, sendCallbackLater);
}

/*
void setChunkData(const void* data, std::size_t dataSize) override
{
}
*/

// -------------------------------------------------------------------
// Set ui stuff

@@ -517,6 +590,7 @@ public:
fUI.window->hide();
}
}

// -------------------------------------------------------------------
// Plugin state



+ 2
- 2
source/utils/CarlaVst3Utils.hpp View File

@@ -123,7 +123,7 @@ typedef v3_plugin_factory** (*V3_GETFN)(void);
CARLA_BACKEND_START_NAMESPACE

static inline
PluginCategory getPluginCategoryFromV3SubCategories(const char* const subcategories)
PluginCategory getPluginCategoryFromV3SubCategories(const char* const subcategories) noexcept
{
if (std::strstr(subcategories, "Instrument") != nullptr)
return PLUGIN_CATEGORY_SYNTH;
@@ -138,7 +138,7 @@ uint32_t v3_cconst(const uint8_t a, const uint8_t b, const uint8_t c, const uint
}

static inline
const char* tuid2str(const v3_tuid iid)
const char* tuid2str(const v3_tuid iid) noexcept
{
static char buf[44];
std::snprintf(buf, sizeof(buf), "0x%08X,0x%08X,0x%08X,0x%08X",


Loading…
Cancel
Save