From ae8aac3c5e8b7b6d5cc2225004c6ad49c5b08fe3 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 17 Jul 2014 08:42:19 +0100 Subject: [PATCH] Misc fixing --- source/backend/CarlaStandalone.cpp | 3 ++- source/utils/CarlaStateUtils.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index 9ec2ef73e..7671a9ace 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -2148,6 +2148,7 @@ void carla_set_panning(uint pluginId, float value) void carla_set_ctrl_channel(uint pluginId, int8_t channel) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); + CARLA_SAFE_ASSERT_RETURN(channel >= -1 && channel < MAX_MIDI_CHANNELS,); carla_debug("carla_set_ctrl_channel(%i, %i)", pluginId, channel); if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) @@ -2179,7 +2180,7 @@ void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value) void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); - CARLA_SAFE_ASSERT_RETURN(channel >= MAX_MIDI_CHANNELS,); + CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); carla_debug("carla_set_parameter_midi_channel(%i, %i, %i)", pluginId, parameterId, channel); if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) diff --git a/source/utils/CarlaStateUtils.cpp b/source/utils/CarlaStateUtils.cpp index 86d480e1b..e23d1ee9c 100644 --- a/source/utils/CarlaStateUtils.cpp +++ b/source/utils/CarlaStateUtils.cpp @@ -264,9 +264,12 @@ bool StateSave::fillFromXmlElement(const XmlElement* const xmlElement) } else if (tag.equalsIgnoreCase("controlchannel") || tag.equalsIgnoreCase("control-channel")) { - const int value(text.getIntValue()); - if (value >= 1 && value <= MAX_MIDI_CHANNELS) - ctrlChannel = static_cast(value-1); + if (! text.startsWithIgnoreCase("n")) + { + const int value(text.getIntValue()); + if (value >= 1 && value <= MAX_MIDI_CHANNELS) + ctrlChannel = static_cast(value-1); + } } // -------------------------------------------------------