13
0

Support lv2:port-props:displayPriority

This commit is contained in:
Robin Gareus 2020-11-20 06:03:49 +01:00
parent 7558c1316e
commit 3ac7e11eea
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 13 additions and 1 deletions

View File

@ -120,6 +120,7 @@ struct LIBARDOUR_API ParameterDescriptor : public Evoral::ParameterDescriptor
bool sr_dependent;
bool enumeration;
bool inline_ctrl;
uint32_t display_priority; ///< higher is more important http://lv2plug.in/ns/ext/port-props#displayPriority
};
} // namespace ARDOUR

View File

@ -159,6 +159,7 @@ public:
LilvNode* ext_causesArtifacts;
LilvNode* ext_notAutomatic;
LilvNode* ext_rangeSteps;
LilvNode* ext_displayPriority;
LilvNode* groups_group;
LilvNode* groups_element;
LilvNode* lv2_AudioPort;
@ -2278,7 +2279,8 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
lilv_port_get_range(_impl->plugin, port, &def, &min, &max);
portunits = lilv_port_get_value(_impl->plugin, port, _world.units_unit);
LilvNode* steps = lilv_port_get(_impl->plugin, port, _world.ext_rangeSteps);
LilvNode* steps = lilv_port_get(_impl->plugin, port, _world.ext_rangeSteps);
LilvNode* display_priority = lilv_port_get(_impl->plugin, port, _world.ext_displayPriority);
// TODO: Once we can rely on lilv 0.18.0 being present,
// load_parameter_descriptor() can be used for ports as well
@ -2292,6 +2294,7 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
desc.upper = max ? lilv_node_as_float(max) : 1.0f;
load_parameter_descriptor_units(_world.world, desc, portunits);
if (desc.sr_dependent) {
desc.lower *= _session.sample_rate ();
desc.upper *= _session.sample_rate ();
@ -2307,6 +2310,9 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
if (steps) {
desc.rangesteps = lilv_node_as_float (steps);
}
if (display_priority) {
desc.display_priority = lilv_node_as_int (display_priority);
}
desc.update_steps();
@ -2314,6 +2320,7 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c
lilv_node_free(min);
lilv_node_free(max);
lilv_node_free(steps);
lilv_node_free(display_priority);
lilv_nodes_free(portunits);
return 0;
@ -3337,6 +3344,7 @@ LV2World::LV2World()
ext_causesArtifacts= lilv_new_uri(world, LV2_PORT_PROPS__causesArtifacts);
ext_notAutomatic = lilv_new_uri(world, LV2_PORT_PROPS__notAutomatic);
ext_rangeSteps = lilv_new_uri(world, LV2_PORT_PROPS__rangeSteps);
ext_displayPriority= lilv_new_uri(world, LV2_PORT_PROPS__displayPriority);
groups_group = lilv_new_uri(world, LV2_PORT_GROUPS__group);
groups_element = lilv_new_uri(world, LV2_PORT_GROUPS__element);
lv2_AudioPort = lilv_new_uri(world, LILV_URI_AUDIO_PORT);
@ -3445,6 +3453,7 @@ LV2World::~LV2World()
lilv_node_free(lv2_AudioPort);
lilv_node_free(groups_group);
lilv_node_free(groups_element);
lilv_node_free(ext_displayPriority);
lilv_node_free(ext_rangeSteps);
lilv_node_free(ext_notAutomatic);
lilv_node_free(ext_causesArtifacts);

View File

@ -48,6 +48,7 @@ ParameterDescriptor::ParameterDescriptor(const Evoral::Parameter& parameter)
, sr_dependent(false)
, enumeration(false)
, inline_ctrl(false)
, display_priority(0)
{
ScalePoints sp;
@ -160,6 +161,7 @@ ParameterDescriptor::ParameterDescriptor()
, sr_dependent(false)
, enumeration(false)
, inline_ctrl(false)
, display_priority(0)
{}
void