| @@ -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). | * Get a plugin's parameter text (custom display of internal values). | ||||
| * @param pluginId Plugin | * @param pluginId Plugin | ||||
| * @param parameterId Parameter index | * @param parameterId Parameter index | ||||
| * @param value Parameter value | |||||
| * @see PARAMETER_USES_CUSTOM_TEXT | * @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. | * Get a plugin's program name. | ||||
| @@ -326,7 +326,7 @@ public: | |||||
| /*! | /*! | ||||
| * Get the custom text of the parameter \a parameterId. | * 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. | * Get the unit of the parameter \a parameterId. | ||||
| @@ -904,7 +904,7 @@ protected: | |||||
| return 0.0f; | 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()) | if (CarlaPlugin* const plugin = _getFirstPlugin()) | ||||
| { | { | ||||
| @@ -913,7 +913,7 @@ protected: | |||||
| static char strBuf[STR_MAX+1]; | static char strBuf[STR_MAX+1]; | ||||
| carla_zeroChar(strBuf, STR_MAX+1); | carla_zeroChar(strBuf, STR_MAX+1); | ||||
| plugin->getParameterText(index, value, strBuf); | |||||
| plugin->getParameterText(index, /*value,*/ strBuf); | |||||
| return strBuf; | return strBuf; | ||||
| } | } | ||||
| @@ -1361,9 +1361,9 @@ public: | |||||
| return handlePtr->getParameterValue(index); | 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) | static uint32_t _get_midi_program_count(NativePluginHandle handle) | ||||
| @@ -367,7 +367,7 @@ void CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const str | |||||
| strBuf[0] = '\0'; | 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_RETURN(parameterId < getParameterCount(),); | ||||
| CARLA_SAFE_ASSERT(false); // this should never happen | CARLA_SAFE_ASSERT(false); // this should never happen | ||||
| @@ -174,7 +174,15 @@ public: | |||||
| CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,); | 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 | 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; | pData->param.data[j].hints |= PARAMETER_IS_ENABLED; | ||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| //pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT; | |||||
| pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT; | |||||
| #endif | #endif | ||||
| if (fInstance->isParameterAutomatable(static_cast<int>(j))) | if (fInstance->isParameterAutomatable(static_cast<int>(j))) | ||||
| @@ -407,7 +407,7 @@ public: | |||||
| CarlaPlugin::getParameterName(parameterId, strBuf); | 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 != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,); | ||||
| @@ -416,14 +416,14 @@ public: | |||||
| CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | ||||
| // FIXME - try | // 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); | std::strncpy(strBuf, text, STR_MAX); | ||||
| return; | return; | ||||
| } | } | ||||
| carla_safe_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__); | 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 | void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override | ||||
| @@ -276,19 +276,17 @@ public: | |||||
| dispatcher(effGetParamName, static_cast<int32_t>(parameterId), 0, strBuf, 0.0f); | 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 | void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); | ||||
| CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | ||||
| strBuf[0] = '\0'; | 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') | if (strBuf[0] == '\0') | ||||
| std::snprintf(strBuf, STR_MAX, "%f", getParameterValue(parameterId)); | std::snprintf(strBuf, STR_MAX, "%f", getParameterValue(parameterId)); | ||||
| } | } | ||||
| #endif | |||||
| void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override | 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; | pData->param.data[j].hints |= PARAMETER_IS_ENABLED; | ||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| //pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT; | |||||
| pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT; | |||||
| #endif | #endif | ||||
| if ((pData->hints & PLUGIN_USES_OLD_VSTSDK) != 0 || dispatcher(effCanBeAutomated, static_cast<int32_t>(j), 0, nullptr, 0.0f) == 1) | if ((pData->hints & PLUGIN_USES_OLD_VSTSDK) != 0 || dispatcher(effCanBeAutomated, static_cast<int32_t>(j), 0, nullptr, 0.0f) == 1) | ||||
| @@ -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_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr); | ||||
| carla_debug("carla_get_parameter_text(%i, %i)", pluginId, parameterId); | 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()) | if (parameterId < plugin->getParameterCount()) | ||||
| { | { | ||||
| carla_zeroChar(textBuf, STR_MAX+1); | carla_zeroChar(textBuf, STR_MAX+1); | ||||
| plugin->getParameterText(parameterId, value, textBuf); | |||||
| plugin->getParameterText(parameterId, textBuf); | |||||
| return textBuf; | return textBuf; | ||||
| } | } | ||||
| @@ -1540,10 +1540,9 @@ class Host(object): | |||||
| # Get a plugin's parameter text (custom display of internal values). | # Get a plugin's parameter text (custom display of internal values). | ||||
| # @param pluginId Plugin | # @param pluginId Plugin | ||||
| # @param parameterId Parameter index | # @param parameterId Parameter index | ||||
| # @param value Parameter value | |||||
| # @see PARAMETER_USES_CUSTOM_TEXT | # @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. | # Get a plugin's program name. | ||||
| # @param pluginId Plugin | # @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.argtypes = [c_uint] | ||||
| self.lib.carla_get_custom_data_count.restype = c_uint32 | 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_parameter_text.restype = c_char_p | ||||
| self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32] | self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32] | ||||
| @@ -231,7 +231,7 @@ typedef struct _NativePluginDescriptor { | |||||
| uint32_t (*get_parameter_count)(NativePluginHandle handle); | uint32_t (*get_parameter_count)(NativePluginHandle handle); | ||||
| const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index); | const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index); | ||||
| float (*get_parameter_value)(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); | uint32_t (*get_midi_program_count)(NativePluginHandle handle); | ||||
| const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index); | const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index); | ||||
| @@ -278,13 +278,10 @@ protected: | |||||
| return 0.0f; | 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); | CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | ||||
| return nullptr; | return nullptr; | ||||
| // unused | |||||
| (void)value; | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -456,9 +453,9 @@ public: | |||||
| return handlePtr->getParameterValue(index); | 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) | static uint32_t _get_midi_program_count(NativePluginHandle handle) | ||||