diff options
Diffstat (limited to 'src/control.c')
-rw-r--r-- | src/control.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/control.c b/src/control.c index c384165..41a2b70 100644 --- a/src/control.c +++ b/src/control.c @@ -32,22 +32,21 @@ scale_point_cmp(const ScalePoint* a, const ScalePoint* b) } ControlID* -new_port_control(LilvWorld* const world, - const LilvPlugin* const plugin, - const LilvPort* const port, - uint32_t port_index, - const float sample_rate, - const JalvNodes* const nodes, - LV2_Atom_Forge* const forge) +new_port_control(LilvWorld* const world, + const LilvPlugin* const plugin, + const LilvPort* const port, + uint32_t port_index, + const float sample_rate, + const JalvNodes* const nodes, + const LV2_Atom_Forge* const forge) { ControlID* id = (ControlID*)calloc(1, sizeof(ControlID)); id->type = PORT; + id->id.index = port_index; id->node = lilv_node_duplicate(lilv_port_get_node(plugin, port)); id->symbol = lilv_node_duplicate(lilv_port_get_symbol(plugin, port)); id->label = lilv_port_get_name(plugin, port); - id->forge = forge; - id->index = port_index; id->group = lilv_port_get(plugin, port, nodes->pg_group); id->value_type = forge->Float; id->is_writable = lilv_port_is_a(plugin, port, nodes->lv2_InputPort); @@ -122,18 +121,17 @@ has_range(LilvWorld* const world, } ControlID* -new_property_control(LilvWorld* const world, - const LilvNode* property, - const JalvNodes* const nodes, - LV2_URID_Map* const map, - LV2_Atom_Forge* const forge) +new_property_control(LilvWorld* const world, + const LilvNode* property, + const JalvNodes* const nodes, + LV2_URID_Map* const map, + const LV2_Atom_Forge* const forge) { - ControlID* id = (ControlID*)calloc(1, sizeof(ControlID)); - id->type = PROPERTY; - id->node = lilv_node_duplicate(property); - id->symbol = lilv_world_get_symbol(world, property); - id->forge = forge; - id->property = map->map(map->handle, lilv_node_as_uri(property)); + ControlID* id = (ControlID*)calloc(1, sizeof(ControlID)); + id->type = PROPERTY; + id->id.property = map->map(map->handle, lilv_node_as_uri(property)); + id->node = lilv_node_duplicate(property); + id->symbol = lilv_world_get_symbol(world, property); id->label = lilv_world_get(world, property, nodes->rdfs_label, NULL); id->min = lilv_world_get(world, property, nodes->lv2_minimum, NULL); @@ -198,7 +196,8 @@ ControlID* get_property_control(const Controls* controls, LV2_URID property) { for (size_t i = 0; i < controls->n_controls; ++i) { - if (controls->controls[i]->property == property) { + if (controls->controls[i]->type == PROPERTY && + controls->controls[i]->id.property == property) { return controls->controls[i]; } } |