Browse Source

Support mod:volts as LV2 unit

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
ba5ca7006d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 9 additions and 0 deletions
  1. +3
    -0
      source/backend/plugin/CarlaPluginLV2.cpp
  2. +2
    -0
      source/includes/lv2_rdf.hpp
  3. +4
    -0
      source/utils/CarlaLv2Utils.hpp

+ 3
- 0
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -1271,6 +1271,9 @@ public:
case LV2_PORT_UNIT_SEMITONE:
std::strncpy(strBuf, "semi", STR_MAX);
return true;
case LV2_PORT_UNIT_VOLTS:
std::strncpy(strBuf, "v", STR_MAX);
return true;
}
}
}


+ 2
- 0
source/includes/lv2_rdf.hpp View File

@@ -96,6 +96,7 @@ typedef uint32_t LV2_Property;
#define LV2_PORT_UNIT_PC 22
#define LV2_PORT_UNIT_S 23
#define LV2_PORT_UNIT_SEMITONE 24
#define LV2_PORT_UNIT_VOLTS 25

#define LV2_IS_PORT_UNIT_BAR(x) ((x) == LV2_PORT_UNIT_BAR)
#define LV2_IS_PORT_UNIT_BEAT(x) ((x) == LV2_PORT_UNIT_BEAT)
@@ -121,6 +122,7 @@ typedef uint32_t LV2_Property;
#define LV2_IS_PORT_UNIT_PC(x) ((x) == LV2_PORT_UNIT_PC)
#define LV2_IS_PORT_UNIT_S(x) ((x) == LV2_PORT_UNIT_S)
#define LV2_IS_PORT_UNIT_SEMITONE(x) ((x) == LV2_PORT_UNIT_SEMITONE)
#define LV2_IS_PORT_UNIT_VOLTS(x) ((x) == LV2_PORT_UNIT_VOLTS)

// Port Types
#define LV2_PORT_INPUT 0x001


+ 4
- 0
source/utils/CarlaLv2Utils.hpp View File

@@ -2291,6 +2291,8 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
rdfPort->Unit.Unit = LV2_PORT_UNIT_S;
else if (std::strcmp(unitUnit, LV2_UNITS__semitone12TET) == 0)
rdfPort->Unit.Unit = LV2_PORT_UNIT_SEMITONE;
else if (std::strcmp(unitUnit, "http://moddevices.com/ns/mod#volts") == 0)
rdfPort->Unit.Unit = LV2_PORT_UNIT_VOLTS;
else
carla_stderr("lv2_rdf_new(\"%s\") - got unknown unit '%s'", uri, unitUnit);
}
@@ -2603,6 +2605,8 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
rdfParam.Unit.Unit = LV2_PORT_UNIT_S;
else if (std::strcmp(unitUnit, LV2_UNITS__semitone12TET) == 0)
rdfParam.Unit.Unit = LV2_PORT_UNIT_SEMITONE;
else if (std::strcmp(unitUnit, "http://moddevices.com/ns/mod#volts") == 0)
rdfParam.Unit.Unit = LV2_PORT_UNIT_VOLTS;
else
carla_stderr("lv2_rdf_new(\"%s\") - got unknown unit '%s'", uri, unitUnit);
}


Loading…
Cancel
Save