Browse Source

param-text is working again (used in VSTs)

tags/1.9.4
falkTX 10 years ago
parent
commit
b288b50011
11 changed files with 31 additions and 30 deletions
  1. +1
    -2
      source/backend/CarlaHost.h
  2. +1
    -1
      source/backend/CarlaPlugin.hpp
  3. +4
    -4
      source/backend/engine/CarlaEngineNative.cpp
  4. +1
    -1
      source/backend/plugin/CarlaPlugin.cpp
  5. +10
    -2
      source/backend/plugin/JucePlugin.cpp
  6. +3
    -3
      source/backend/plugin/NativePlugin.cpp
  7. +2
    -4
      source/backend/plugin/VstPlugin.cpp
  8. +2
    -2
      source/backend/standalone/CarlaStandalone.cpp
  9. +3
    -4
      source/carla_backend.py
  10. +1
    -1
      source/modules/CarlaNative.h
  11. +3
    -6
      source/modules/CarlaNative.hpp

+ 1
- 2
source/backend/CarlaHost.h View File

@@ -717,10 +717,9 @@ CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
* Get a plugin's parameter text (custom display of internal values).
* @param pluginId Plugin
* @param parameterId Parameter index
* @param value Parameter value
* @see PARAMETER_USES_CUSTOM_TEXT
*/
CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId, float value);
CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId);

/*!
* Get a plugin's program name.


+ 1
- 1
source/backend/CarlaPlugin.hpp View File

@@ -326,7 +326,7 @@ public:
/*!
* Get the custom text of the parameter \a parameterId.
*/
virtual void getParameterText(const uint32_t parameterId, const float value, char* const strBuf) const noexcept;
virtual void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the unit of the parameter \a parameterId.


+ 4
- 4
source/backend/engine/CarlaEngineNative.cpp View File

@@ -904,7 +904,7 @@ protected:
return 0.0f;
}

const char* getParameterText(const uint32_t index, const float value) const
const char* getParameterText(const uint32_t index /*, const float value*/) const
{
if (CarlaPlugin* const plugin = _getFirstPlugin())
{
@@ -913,7 +913,7 @@ protected:
static char strBuf[STR_MAX+1];
carla_zeroChar(strBuf, STR_MAX+1);

plugin->getParameterText(index, value, strBuf);
plugin->getParameterText(index, /*value,*/ strBuf);

return strBuf;
}
@@ -1361,9 +1361,9 @@ public:
return handlePtr->getParameterValue(index);
}

static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index, float value)
static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index /*, float value*/)
{
return handlePtr->getParameterText(index, value);
return handlePtr->getParameterText(index /*, value*/);
}

static uint32_t _get_midi_program_count(NativePluginHandle handle)


+ 1
- 1
source/backend/plugin/CarlaPlugin.cpp View File

@@ -367,7 +367,7 @@ void CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const str
strBuf[0] = '\0';
}

void CarlaPlugin::getParameterText(const uint32_t parameterId, const float, char* const strBuf) const noexcept
void CarlaPlugin::getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT(false); // this should never happen


+ 10
- 2
source/backend/plugin/JucePlugin.cpp View File

@@ -174,7 +174,15 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,);

std::strncpy(strBuf, fInstance->getParameterName(static_cast<int>(parameterId)).toRawUTF8(), STR_MAX);
std::strncpy(strBuf, fInstance->getParameterName(static_cast<int>(parameterId), STR_MAX).toRawUTF8(), STR_MAX);
}

void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,);

std::strncpy(strBuf, fInstance->getParameterText(static_cast<int>(parameterId), STR_MAX).toRawUTF8(), STR_MAX);
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
@@ -406,7 +414,7 @@ public:

pData->param.data[j].hints |= PARAMETER_IS_ENABLED;
#ifndef BUILD_BRIDGE
//pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT;
pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT;
#endif

if (fInstance->isParameterAutomatable(static_cast<int>(j)))


+ 3
- 3
source/backend/plugin/NativePlugin.cpp View File

@@ -407,7 +407,7 @@ public:
CarlaPlugin::getParameterName(parameterId, strBuf);
}

void getParameterText(const uint32_t parameterId, const float value, char* const strBuf) const noexcept override
void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,);
@@ -416,14 +416,14 @@ public:
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);

// FIXME - try
if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value))
if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId /*, fDescriptor->get_parameter_value(fHandle, parameterId)*/))
{
std::strncpy(strBuf, text, STR_MAX);
return;
}

carla_safe_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__);
CarlaPlugin::getParameterText(parameterId, value, strBuf);
CarlaPlugin::getParameterText(parameterId, strBuf);
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override


+ 2
- 4
source/backend/plugin/VstPlugin.cpp View File

@@ -276,19 +276,17 @@ public:
dispatcher(effGetParamName, static_cast<int32_t>(parameterId), 0, strBuf, 0.0f);
}

#if 0
void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);

strBuf[0] = '\0';
dispatcher(effGetParamDisplay, parameterId, 0, strBuf, 0.0f);
dispatcher(effGetParamDisplay, static_cast<int32_t>(parameterId), 0, strBuf, 0.0f);

if (strBuf[0] == '\0')
std::snprintf(strBuf, STR_MAX, "%f", getParameterValue(parameterId));
}
#endif

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
@@ -742,7 +740,7 @@ public:

pData->param.data[j].hints |= PARAMETER_IS_ENABLED;
#ifndef BUILD_BRIDGE
//pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT;
pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT;
#endif

if ((pData->hints & PLUGIN_USES_OLD_VSTSDK) != 0 || dispatcher(effCanBeAutomated, static_cast<int32_t>(j), 0, nullptr, 0.0f) == 1)


+ 2
- 2
source/backend/standalone/CarlaStandalone.cpp View File

@@ -1615,7 +1615,7 @@ uint32_t carla_get_custom_data_count(uint pluginId)

// -------------------------------------------------------------------------------------------------------------------

const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId, float value)
const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId)
{
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
carla_debug("carla_get_parameter_text(%i, %i)", pluginId, parameterId);
@@ -1627,7 +1627,7 @@ const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId, float
if (parameterId < plugin->getParameterCount())
{
carla_zeroChar(textBuf, STR_MAX+1);
plugin->getParameterText(parameterId, value, textBuf);
plugin->getParameterText(parameterId, textBuf);
return textBuf;
}



+ 3
- 4
source/carla_backend.py View File

@@ -1540,10 +1540,9 @@ class Host(object):
# Get a plugin's parameter text (custom display of internal values).
# @param pluginId Plugin
# @param parameterId Parameter index
# @param value Parameter value
# @see PARAMETER_USES_CUSTOM_TEXT
def get_parameter_text(self, pluginId, parameterId, value):
return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId, value))
def get_parameter_text(self, pluginId, parameterId):
return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))

# Get a plugin's program name.
# @param pluginId Plugin
@@ -1895,7 +1894,7 @@ class Host(object):
self.lib.carla_get_custom_data_count.argtypes = [c_uint]
self.lib.carla_get_custom_data_count.restype = c_uint32

self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32, c_float]
self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
self.lib.carla_get_parameter_text.restype = c_char_p

self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]


+ 1
- 1
source/modules/CarlaNative.h View File

@@ -231,7 +231,7 @@ typedef struct _NativePluginDescriptor {
uint32_t (*get_parameter_count)(NativePluginHandle handle);
const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index);
float (*get_parameter_value)(NativePluginHandle handle, uint32_t index);
const char* (*get_parameter_text)(NativePluginHandle handle, uint32_t index, float value);
const char* (*get_parameter_text)(NativePluginHandle handle, uint32_t index /*, float value*/);

uint32_t (*get_midi_program_count)(NativePluginHandle handle);
const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index);


+ 3
- 6
source/modules/CarlaNative.hpp View File

@@ -278,13 +278,10 @@ protected:
return 0.0f;
}

virtual const char* getParameterText(const uint32_t index, const float value) const
virtual const char* getParameterText(const uint32_t index /*, const float value*/) const
{
CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr);
return nullptr;

// unused
(void)value;
}

// -------------------------------------------------------------------
@@ -456,9 +453,9 @@ public:
return handlePtr->getParameterValue(index);
}

static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index, float value)
static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index /*, float value*/)
{
return handlePtr->getParameterText(index, value);
return handlePtr->getParameterText(index /*, value*/);
}

static uint32_t _get_midi_program_count(NativePluginHandle handle)


Loading…
Cancel
Save