Previously it was only available when running as a Jack application. Signed-off-by: Kristian Amlie <kristian@amlie.name>pull/2020/head
| @@ -589,6 +589,9 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeEmptyMessage(),); | |||
| } | |||
| std::snprintf(tmpBuf, STR_MAX, "%i\n", plugin->getParameterScalePointCount(i)); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMETER_RANGES_%i:%i\n", pluginId, i); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| @@ -606,6 +609,20 @@ protected: | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast<double>(plugin->getParameterValue(i))); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| for (uint32_t p = 0; p < plugin->getParameterScalePointCount(i); p++) { | |||
| std::snprintf(tmpBuf, STR_MAX, "PARAMETER_SCALEPOINT_%i:%i:%i\n", pluginId, i, p); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| std::snprintf(tmpBuf, STR_MAX, "%.12g\n", plugin->getParameterScalePointValue(i, p)); | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); | |||
| if (plugin->getParameterScalePointLabel(i, p, tmpBuf)) { | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeAndFixMessage(tmpBuf),); | |||
| } else { | |||
| CARLA_SAFE_ASSERT_RETURN(fUiServer.writeEmptyMessage(),); | |||
| } | |||
| } | |||
| } | |||
| fUiServer.syncMessages(); | |||
| @@ -280,6 +280,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
| paramUnit = self.readlineblock() | |||
| paramComment = self.readlineblock() | |||
| paramGroupName = self.readlineblock() | |||
| scalePointCount = int(self.readlineblock()) | |||
| paramInfo = { | |||
| 'name': paramName, | |||
| @@ -287,7 +288,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
| 'unit': paramUnit, | |||
| 'comment': paramComment, | |||
| 'groupName': paramGroupName, | |||
| 'scalePointCount': 0, | |||
| 'scalePointCount': scalePointCount, | |||
| } | |||
| self.host._set_parameterInfo(pluginId, paramId, paramInfo) | |||
| @@ -317,6 +318,12 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
| } | |||
| self.host._set_parameterRanges(pluginId, paramId, paramRanges) | |||
| elif msg.startswith("PARAMETER_SCALEPOINT_"): | |||
| pluginId, param, point = [int(i) for i in msg.replace("PARAMETER_SCALEPOINT_", "").split(":")] | |||
| value = float(self.readlineblock()) | |||
| label = self.readlineblock() | |||
| self.host._set_parameterScalePoint(pluginId, param, point, value, label) | |||
| elif msg.startswith("PROGRAM_COUNT_"): | |||
| pluginId, count, current = [int(i) for i in msg.replace("PROGRAM_COUNT_", "").split(":")] | |||
| self.host._set_programCount(pluginId, count) | |||
| @@ -3272,6 +3272,7 @@ class PluginStoreInfo(): | |||
| self.parameterData = [] | |||
| self.parameterRanges = [] | |||
| self.parameterValues = [] | |||
| self.parameterScalePoints = [] | |||
| self.programCount = 0 | |||
| self.programCurrent = -1 | |||
| self.programNames = [] | |||
| @@ -3484,7 +3485,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
| return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterInfo[parameterId] | |||
| def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId): | |||
| return PyCarlaScalePointInfo | |||
| return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterScalePoints[parameterId][scalePointId] | |||
| def get_parameter_data(self, pluginId, parameterId): | |||
| return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterData[parameterId] | |||
| @@ -3765,6 +3766,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
| plugin.parameterData = [] | |||
| plugin.parameterRanges = [] | |||
| plugin.parameterValues = [] | |||
| plugin.parameterScalePoints = [] | |||
| # add placeholders | |||
| for _ in range(count): | |||
| @@ -3772,6 +3774,26 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
| plugin.parameterData.append(PyParameterData.copy()) | |||
| plugin.parameterRanges.append(PyParameterRanges.copy()) | |||
| plugin.parameterValues.append(0.0) | |||
| plugin.parameterScalePoints.append([]) | |||
| def _set_parameterScalePoint(self, pluginId, param, point, value, label): | |||
| plugin = self.fPluginsInfo.get(pluginId, None) | |||
| if plugin is None: | |||
| print("_set_parameterScalePointCount failed for", pluginId) | |||
| return | |||
| if param < 0 or param >= plugin.parameterCount: | |||
| print("_set_parameterScalePointCount failed for parameter", param) | |||
| return | |||
| if point < 0 or point >= plugin.parameterInfo[param]["scalePointCount"]: | |||
| print("_set_parameterScalePointCount failed for scale point", point) | |||
| return | |||
| plugin.parameterScalePoints[param][point] = { | |||
| "value": value, | |||
| "label": label, | |||
| } | |||
| def _set_programCount(self, pluginId, count): | |||
| plugin = self.fPluginsInfo.get(pluginId, None) | |||
| @@ -3810,6 +3832,11 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
| else: | |||
| print("_set_parameterInfo failed for", pluginId, "and index", paramIndex) | |||
| # add placeholders | |||
| plugin.parameterScalePoints[paramIndex] = [] | |||
| for _ in range(info["scalePointCount"]): | |||
| plugin.parameterScalePoints[paramIndex].append({}) | |||
| def _set_parameterData(self, pluginId, paramIndex, data): | |||
| plugin = self.fPluginsInfo.get(pluginId, None) | |||
| if plugin is None: | |||