update GUI on remote preset change
This commit is contained in:
29
gdigi.c
29
gdigi.c
@@ -202,19 +202,18 @@ void push_message(GString *msg)
|
||||
printf("%02x ", (unsigned char)msg->str[x]);
|
||||
printf("\n");
|
||||
|
||||
if (get_message_id(msg) == ACK) {
|
||||
switch (get_message_id(msg)) {
|
||||
case ACK:
|
||||
g_message("Received ACK");
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_message_id(msg) == NACK) {
|
||||
case NACK:
|
||||
g_message("Received NACK");
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_message_id(msg) == RECEIVE_PARAMETER_VALUE) {
|
||||
case RECEIVE_PARAMETER_VALUE:
|
||||
unpack_message(msg);
|
||||
SettingParam *param = setting_param_new_from_data(&msg->str[8], NULL);
|
||||
g_message("Received parameter change ID: %d Position: %d Value: %d", param->id, param->position, param->value);
|
||||
@@ -226,12 +225,30 @@ void push_message(GString *msg)
|
||||
setting_param_free(param);
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
case RECEIVE_DEVICE_NOTIFICATION:
|
||||
unpack_message(msg);
|
||||
unsigned char *str = (unsigned char*)msg->str;
|
||||
switch (str[8]) {
|
||||
case NOTIFY_PRESET_MOVED:
|
||||
if (str[11] == PRESETS_EDIT_BUFFER && str[12] == 0) {
|
||||
g_message("Loaded preset %d from bank %d", str[10], str[9]);
|
||||
|
||||
GDK_THREADS_ENTER();
|
||||
g_timeout_add(0, apply_current_preset_to_gui, NULL);
|
||||
GDK_THREADS_LEAVE();
|
||||
} else
|
||||
g_message("%d %d moved to %d %d", str[9], str[10], str[11], str[12]);
|
||||
return;
|
||||
default:
|
||||
g_message("Received unhandled device notification");
|
||||
}
|
||||
default:
|
||||
g_mutex_lock(message_queue_mutex);
|
||||
g_queue_push_tail(message_queue, msg);
|
||||
g_mutex_unlock(message_queue_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
gpointer read_data_thread(gboolean *stop)
|
||||
{
|
||||
|
||||
17
gdigi.h
17
gdigi.h
@@ -637,6 +637,23 @@ typedef enum {
|
||||
PRESETS_EXTERNAL = 6
|
||||
} PresetBank;
|
||||
|
||||
typedef enum {
|
||||
/* Version 0 only */
|
||||
NOTIFY_PRESET_LOADED = 0,
|
||||
NOTIFY_PRESET_STORED = 1,
|
||||
|
||||
NOTIFY_MODIFIER_GROUP_CHANGED = 2,
|
||||
|
||||
/* Version 1 */
|
||||
NOTIFY_PRESET_MOVED = 3,
|
||||
NOTIFY_OBJECT_MOVED = 4,
|
||||
NOTIFY_OBJECT_RENAMED = 5,
|
||||
NOTIFY_MEDIA_CARD_PRESENT_CHANGED = 6,
|
||||
NOTIFY_ALL_GLOBALS_CHANGED = 7,
|
||||
NOTIFY_PRESET_INDEX_TABLE_CHANGED = 8,
|
||||
NOTIFY_PRESET_RENAMED = 9
|
||||
} NotifyCode;
|
||||
|
||||
typedef enum {
|
||||
REQUEST_WHO_AM_I = 0x01,
|
||||
RECEIVE_WHO_AM_I = 0x02,
|
||||
|
||||
6
gui.c
6
gui.c
@@ -199,6 +199,12 @@ static void apply_current_preset()
|
||||
preset_free(preset);
|
||||
}
|
||||
|
||||
gboolean apply_current_preset_to_gui(gpointer data)
|
||||
{
|
||||
apply_current_preset();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param settings effect parameters
|
||||
* \param amt amount of effect parameters
|
||||
|
||||
1
gui.h
1
gui.h
@@ -22,6 +22,7 @@
|
||||
|
||||
void show_error_message(GtkWidget *parent, gchar *message);
|
||||
void apply_setting_param_to_gui(SettingParam *param);
|
||||
gboolean apply_current_preset_to_gui(gpointer data);
|
||||
void gui_create(Device *device);
|
||||
void gui_free();
|
||||
gboolean unsupported_device_dialog(Device **device);
|
||||
|
||||
Reference in New Issue
Block a user