Add support for linkable parameters.

These changes allow gdigi to link parameters to the expression pedal,
LFO1, and LFO2. The changes have been implemented only for RP355, but
should be easily extendible to other devices.

The design is as follows:

The effect group entries for the linkable effects have only a placeholder
entry "None" at startup.

During startup, we send an unsolicited REQUEST_MODIFIER_LINKABLE_LIST. When we
receive RECEIVE_MODIFIER_LINKABLE_LIST in response, we use it to construct the
ModifierLinkableList and update the combo boxes for the Pedal Assign and LFO
effects.

Whenever the selected chorus/fx effect changes, the list of linkable parameters
also changes, so the device will send us a NOTIFY_MODIFIER_GROUP_CHANGED. Again,
we send a REQUEST_MODIFIER_LINKABLE_LIST and use the response to rebuild
ModifierLinkableList. Then we tear down and rebuild the state associated with
the affected combo boxes.

The changes made are as follows:

1) Add settings for pedal1_assign. This is the min/max value returned
   by the pedal.

2) Add separate EffectGroup for both pedal assignment and the LFO's
   for the non-combo box settings.

3) Fix up a few more missing effects in the xml and modifier lists.
   There is additional work to do here, but that will be in future
   commits.

4) Fixed a missing break in the RECEIVE_DEVICE_NOTIFICATION case
   in push_message().

5) When we receive a NOTIFY_MODIFIER_GROUP_CHANGED message, free the exisiting
   modifier group and send a REQUEST_MODIFIER_LINKABLE_LIST so we can
   rebuild it.

6) When we receive a RECEIVE_MODIFIER_LINKABLE_LIST, protect the calls to
   create_modifier_group() with GDK_THREADS_ENTER() so we don't crash
   because of interactions with the event/gui threads.

7) Added a BUG assert to an error leg in get_message_list().

8) Fix memory leak in get_digitech_devices() found by valgrind.

9) Add a function to tear down the state associated with the entries of a
   pedal assign or LFO combo box.

10) Add a function to build up the entries of a pedal assign or LFO combo
    box from the modifier linkable list received from the device.

11) Use gtk_combo_box_text_append_text() throughout.

12) A few whitespace/readability changes and more comments.
This commit is contained in:
Tim LaBerge
2012-12-16 09:29:16 -08:00
parent 8b998c636f
commit 3a3017b46f
3 changed files with 143 additions and 56 deletions

18
gdigi.c
View File

@@ -462,6 +462,8 @@ void push_message (GString *msg)
str[9], str[10],
str[11], str[12]);
}
break;
case NOTIFY_MODIFIER_GROUP_CHANGED:
{
int i;
@@ -472,10 +474,18 @@ void push_message (GString *msg)
}
printf("\n");
}
debug_msg(DEBUG_MSG2HOST,
"NOTIFY_MODIFIER_GROUP_CHANGED: Modifier group "
"id %d changed",
(str[9] << 8) | (str[10]));
if (ModifierLinkableList) {
modifier_group_free(ModifierLinkableList);
ModifierLinkableList = NULL;
}
send_message(REQUEST_MODIFIER_LINKABLE_LIST, "\x00\x01", 2);
break;
}
default:
@@ -526,9 +536,14 @@ void push_message (GString *msg)
g_string_free(msg, TRUE);
GDK_THREADS_ENTER();
create_modifier_group(EXP_POSITION, EXP_ASSIGN1);
create_modifier_group(LFO1_POSITION, LFO_TYPE);
create_modifier_group(LFO2_POSITION, LFO_TYPE);
GDK_THREADS_LEAVE();
return;
@@ -1130,6 +1145,7 @@ GList *get_message_list(MessageID id)
g_error("get_message_list() doesn't support followning id: %d", id);
g_string_free(data, TRUE);
g_list_free(list);
g_assert(!"BUG");
return NULL;
}
@@ -1420,6 +1436,7 @@ static gint get_digitech_devices(GList **devices)
number++;
*devices = g_list_append(*devices, GINT_TO_POINTER(card_num));
}
free(name);
snd_card_next(&card_num);
}
@@ -1485,6 +1502,7 @@ int main(int argc, char *argv[]) {
}
if (device != NULL) {
/* enable GUI mode */
set_option(GUI_MODE_ON_OFF, USB_POSITION, 1);