Commit f9c88ca6 authored by ale's avatar ale

Disable bad ui state code

Just listen for the knob input ports in the UI plugin too.
parent 7e50ba3f
......@@ -117,10 +117,9 @@
lv2:index 8 ;
lv2:symbol "hu_latency_regain" ;
lv2:name "Humanizer Latency Regain" ;
lv2:default 0.0 ;
lv2:default 1.0 ;
lv2:minimum 0.0 ;
lv2:maximum 100.0 ;
units:unit units:ms ;
lv2:maximum 1.0 ;
] , [
a lv2:InputPort ,
lv2:ControlPort ;
......
......@@ -278,6 +278,7 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
if (plugin->send_settings_to_ui) {
plugin->send_settings_to_ui = 0;
#if 0
// Forge container object of type 'ui_state'
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_frame_time(&plugin->forge, 0);
......@@ -295,6 +296,7 @@ static void run(LV2_Handle instance, uint32_t sample_count) {
lv2_atom_forge_key(&plugin->forge, plugin->uris.ui_hu_velocity_stddev);
lv2_atom_forge_float(&plugin->forge, plugin->hsettings.velocity_stddev);
lv2_atom_forge_pop(&plugin->forge, &frame);
#endif
}
// Incrementally process control events and render audio data.
......
......@@ -111,17 +111,17 @@ static void on_load_dialog_response(GtkDialog *widget, gint response, void *hand
};
}
#define WRITECONTROLVALUE(var, port) \
val = ui->humanize_enabled ? ui-> var : 0; \
#define WRITECONTROLVALUE(expr, port) \
val = ui->humanize_enabled ? expr : 0; \
ui->write(ui->controller, port, sizeof(float), 0, (const void *)&val)
static void write_control_values(struct plugin_ui *ui) {
float val;
WRITECONTROLVALUE(humanize_latency_max_value, PORT_HUMANIZE_LATENCY_MAX);
WRITECONTROLVALUE(humanize_latency_stddev_value, PORT_HUMANIZE_LATENCY_STDDEV);
WRITECONTROLVALUE(humanize_latency_laid_back_value, PORT_HUMANIZE_LATENCY_LAID_BACK);
WRITECONTROLVALUE(humanize_latency_regain_value, PORT_HUMANIZE_LATENCY_REGAIN);
WRITECONTROLVALUE(humanize_velocity_stddev_value, PORT_HUMANIZE_VELOCITY_STDDEV);
WRITECONTROLVALUE(ui->humanize_latency_max_value * 400.0, PORT_HUMANIZE_LATENCY_MAX);
WRITECONTROLVALUE(ui->humanize_latency_stddev_value * 100.0, PORT_HUMANIZE_LATENCY_STDDEV);
WRITECONTROLVALUE(ui->humanize_latency_laid_back_value* 100.0, PORT_HUMANIZE_LATENCY_LAID_BACK);
WRITECONTROLVALUE(ui->humanize_latency_regain_value, PORT_HUMANIZE_LATENCY_REGAIN);
WRITECONTROLVALUE(ui->humanize_velocity_stddev_value, PORT_HUMANIZE_VELOCITY_STDDEV);
}
static void on_humanize_button_click(GtkButton *widget, void *handle) {
......@@ -283,6 +283,7 @@ static void cleanup(LV2UI_Handle handle) {
}
static int recv_ui_state(struct plugin_ui *ui, const LV2_Atom_Object *obj) {
#if 0
const LV2_Atom *hu_latency_max_val = NULL;
const LV2_Atom *hu_latency_stddev_val = NULL;
const LV2_Atom *hu_latency_laidback_val = NULL;
......@@ -307,9 +308,9 @@ static int recv_ui_state(struct plugin_ui *ui, const LV2_Atom_Object *obj) {
}
// Get the values we need from the body of the property value atoms.
ui->humanize_latency_max_value = ((const LV2_Atom_Float *)hu_latency_max_val)->body;
ui->humanize_latency_stddev_value = ((const LV2_Atom_Float *)hu_latency_stddev_val)->body;
ui->humanize_latency_laid_back_value = ((const LV2_Atom_Float *)hu_latency_laidback_val)->body;
ui->humanize_latency_max_value = 400 * ((const LV2_Atom_Float *)hu_latency_max_val)->body;
ui->humanize_latency_stddev_value = 100 * ((const LV2_Atom_Float *)hu_latency_stddev_val)->body;
ui->humanize_latency_laid_back_value = 100 * ((const LV2_Atom_Float *)hu_latency_laidback_val)->body;
ui->humanize_latency_regain_value = ((const LV2_Atom_Float *)hu_latency_regain_val)->body;
ui->humanize_velocity_stddev_value = ((const LV2_Atom_Float *)hu_velocity_stddev_val)->body;
......@@ -326,6 +327,7 @@ static int recv_ui_state(struct plugin_ui *ui, const LV2_Atom_Object *obj) {
gtk_widget_queue_draw(ui->humanize_latency_laid_back_knob);
gtk_widget_queue_draw(ui->humanize_latency_regain_knob);
gtk_widget_queue_draw(ui->humanize_velocity_stddev_knob);
#endif
return 1;
}
......@@ -351,7 +353,7 @@ static void port_event(LV2UI_Handle handle, uint32_t port_index,
const void *buffer) {
struct plugin_ui *ui = (struct plugin_ui *)handle;
if (format == ui->uris.atom_eventTransfer) {
if (format == ui->uris.atom_eventTransfer && port_index == PORT_NOTIFY) {
const LV2_Atom *atom = (const LV2_Atom *)buffer;
if (lv2_atom_forge_is_object_type(&ui->forge, atom->type)) {
const LV2_Atom_Object *obj = (const LV2_Atom_Object *)atom;
......@@ -376,6 +378,26 @@ static void port_event(LV2UI_Handle handle, uint32_t port_index,
} else {
lv2_log_error(&ui->logger, "Unknown message type\n");
}
} else if (port_index == PORT_HUMANIZE_LATENCY_MAX) {
float val = *(float *)buffer;
ui->humanize_latency_max_value = val / 400.0;
gtk_widget_queue_draw(ui->humanize_latency_max_knob);
} else if (port_index == PORT_HUMANIZE_LATENCY_STDDEV) {
float val = *(float *)buffer;
ui->humanize_latency_stddev_value = val / 100.0;
gtk_widget_queue_draw(ui->humanize_latency_stddev_knob);
} else if (port_index == PORT_HUMANIZE_LATENCY_LAID_BACK) {
float val = *(float *)buffer;
ui->humanize_latency_laid_back_value = val / 100.0;
gtk_widget_queue_draw(ui->humanize_latency_laid_back_knob);
} else if (port_index == PORT_HUMANIZE_LATENCY_REGAIN) {
float val = *(float *)buffer;
ui->humanize_latency_max_value = val;
gtk_widget_queue_draw(ui->humanize_latency_max_knob);
} else if (port_index == PORT_HUMANIZE_VELOCITY_STDDEV) {
float val = *(float *)buffer;
ui->humanize_velocity_stddev_value = val;
gtk_widget_queue_draw(ui->humanize_velocity_stddev_knob);
} else {
lv2_log_warning(&ui->logger, "Unknown port event format\n");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment