diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/control.c | 2 | ||||
-rw-r--r-- | src/control.h | 35 | ||||
-rw-r--r-- | src/jalv_gtk.c | 23 |
3 files changed, 29 insertions, 31 deletions
diff --git a/src/control.c b/src/control.c index 1a93fa7..b0392e3 100644 --- a/src/control.c +++ b/src/control.c @@ -47,7 +47,6 @@ new_port_control(LilvWorld* const world, 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->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); @@ -133,7 +132,6 @@ new_property_control(LilvWorld* const world, 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->forge = forge; id->label = lilv_world_get(world, property, nodes->rdfs_label, NULL); id->min = lilv_world_get(world, property, nodes->lv2_minimum, NULL); diff --git a/src/control.h b/src/control.h index ad5168a..a5acf40 100644 --- a/src/control.h +++ b/src/control.h @@ -37,24 +37,23 @@ typedef struct { LV2_URID property; ///< Iff type == PROPERTY uint32_t index; ///< Iff type == PORT } id; - LilvNode* node; ///< Port or property - LilvNode* symbol; ///< Symbol - LilvNode* label; ///< Human readable label - LV2_Atom_Forge* forge; ///< Forge (for URIDs) - LilvNode* group; ///< Port/control group, or NULL - void* widget; ///< Control Widget - size_t n_points; ///< Number of scale points - ScalePoint* points; ///< Scale points - LV2_URID value_type; ///< Type of control value - LilvNode* min; ///< Minimum value - LilvNode* max; ///< Maximum value - LilvNode* def; ///< Default value - bool is_toggle; ///< Boolean (0 and 1 only) - bool is_integer; ///< Integer values only - bool is_enumeration; ///< Point values only - bool is_logarithmic; ///< Logarithmic scale - bool is_writable; ///< Writable (input) - bool is_readable; ///< Readable (output) + LilvNode* node; ///< Port or property + LilvNode* symbol; ///< Symbol + LilvNode* label; ///< Human readable label + LilvNode* group; ///< Port/control group, or NULL + void* widget; ///< Control Widget + size_t n_points; ///< Number of scale points + ScalePoint* points; ///< Scale points + LV2_URID value_type; ///< Type of control value + LilvNode* min; ///< Minimum value + LilvNode* max; ///< Maximum value + LilvNode* def; ///< Default value + bool is_toggle; ///< Boolean (0 and 1 only) + bool is_integer; ///< Integer values only + bool is_enumeration; ///< Point values only + bool is_logarithmic; ///< Logarithmic scale + bool is_writable; ///< Writable (input) + bool is_readable; ///< Readable (output) } ControlID; /// Set of plugin controls diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index b599bd4..5a1c393 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -586,20 +586,21 @@ differ_enough(float a, float b) static void set_float_control(const ControlID* control, float value) { - if (control->value_type == control->forge->Int) { + LV2_Atom_Forge* const forge = &s_jalv->forge; + if (control->value_type == forge->Int) { const int32_t ival = lrintf(value); - set_control(control, sizeof(ival), control->forge->Int, &ival); - } else if (control->value_type == control->forge->Long) { + set_control(control, sizeof(ival), forge->Int, &ival); + } else if (control->value_type == forge->Long) { const int64_t lval = lrintf(value); - set_control(control, sizeof(lval), control->forge->Long, &lval); - } else if (control->value_type == control->forge->Float) { - set_control(control, sizeof(value), control->forge->Float, &value); - } else if (control->value_type == control->forge->Double) { + set_control(control, sizeof(lval), forge->Long, &lval); + } else if (control->value_type == forge->Float) { + set_control(control, sizeof(value), forge->Float, &value); + } else if (control->value_type == forge->Double) { const double dval = value; - set_control(control, sizeof(dval), control->forge->Double, &dval); - } else if (control->value_type == control->forge->Bool) { + set_control(control, sizeof(dval), forge->Double, &dval); + } else if (control->value_type == forge->Bool) { const int32_t ival = value; - set_control(control, sizeof(ival), control->forge->Bool, &ival); + set_control(control, sizeof(ival), forge->Bool, &ival); } Controller* controller = (Controller*)control->widget; @@ -901,7 +902,7 @@ string_changed(GtkEntry* widget, gpointer data) const ControlID* control = (const ControlID*)data; const char* string = gtk_entry_get_text(widget); - set_control(control, strlen(string) + 1, control->forge->String, string); + set_control(control, strlen(string) + 1, s_jalv->forge.String, string); } static void |