add switch_user_preset and switch_system_preset
This commit is contained in:
42
gdigi.c
42
gdigi.c
@@ -30,8 +30,9 @@ static char magic[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x7F, 0x7F, 0x04, 0x7
|
|||||||
static char presets_user[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x21, 0x00, 0x07, 0x01, 0x6C, 0xF7}; /* this command seems to query user presets? */
|
static char presets_user[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x21, 0x00, 0x07, 0x01, 0x6C, 0xF7}; /* this command seems to query user presets? */
|
||||||
static char presets_system[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x21, 0x00, 0x07, 0x00, 0x6D, 0xF7}; /* this command seems to query system presets? */
|
static char presets_system[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x21, 0x00, 0x07, 0x00, 0x6D, 0xF7}; /* this command seems to query system presets? */
|
||||||
|
|
||||||
static char magic3[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x2A, 0x00, 0x04, 0x04, 0x00, 0x62, 0x05, 0xF7, 0x00, 0x00};
|
static char magic3[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x2A, 0x00, 0x04, 0x04, 0x00, 0x62, 0x05, 0xF7, 0x00, 0x00}; /* seems to query active preset name */
|
||||||
static char magic4[] = {0x0B, 0xB0, 0x40, 0x00};
|
static char magic4[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x2B, 0x00, 0x04, 0x00, 0x01, 0x77, 0x05, 0xF7, 0x00, 0x00};
|
||||||
|
static char magic5[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x3A, 0x00, 0x04, 0x00, 0x01, 0x77, 0x05, 0xF7, 0x00, 0x00};
|
||||||
|
|
||||||
int read_device(struct usb_dev_handle *handle, int bytes)
|
int read_device(struct usb_dev_handle *handle, int bytes)
|
||||||
{
|
{
|
||||||
@@ -355,6 +356,43 @@ void set_comp_on_off(struct usb_dev_handle *handle, gboolean val)
|
|||||||
printf("wrote: %d\n", i);
|
printf("wrote: %d\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* x = 0 to 60 */
|
||||||
|
void switch_user_preset(struct usb_dev_handle *handle, int x)
|
||||||
|
{
|
||||||
|
static char switch_preset[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x39, 0x00, 0x04, 0x01 /* bank = user */, 0x00 /* no */, 0x04, 0x04, 0x00, 0x00, 0x01, 0x06, 0x00 /* confirm */, 0xF7, 0x00, 0x00};
|
||||||
|
int val;
|
||||||
|
|
||||||
|
switch_preset[14] = x;
|
||||||
|
val = (7 - ((x & 0xf0) >> 4)) << 4;
|
||||||
|
val += (x & 0x0f);
|
||||||
|
if (((x & 0x0f) % 2) == 1) {
|
||||||
|
val -= 1;
|
||||||
|
} else {
|
||||||
|
val += 1;
|
||||||
|
}
|
||||||
|
switch_preset[21] = val;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
i = usb_bulk_write(handle, 4, switch_preset, sizeof(switch_preset), TIMEOUT);
|
||||||
|
printf("wrote: %d\n", i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* x = 0 to 60 */
|
||||||
|
void switch_system_preset(struct usb_dev_handle *handle, int x)
|
||||||
|
{
|
||||||
|
static char switch_preset[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x39, 0x00, 0x04, 0x00 /* bank = system */, 0x00 /* no */, 0x04, 0x04, 0x00, 0x00, 0x01, 0x06, 0x00 /* confirm */, 0xF7, 0x00, 0x00};
|
||||||
|
int val;
|
||||||
|
|
||||||
|
switch_preset[14] = x;
|
||||||
|
val = (7 - ((x & 0xf0) >> 4)) << 4;
|
||||||
|
val += (x & 0x0f);
|
||||||
|
switch_preset[21] = val;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
i = usb_bulk_write(handle, 4, switch_preset, sizeof(switch_preset), TIMEOUT);
|
||||||
|
printf("wrote: %d\n", i);
|
||||||
|
}
|
||||||
|
|
||||||
void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, int))
|
void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, int))
|
||||||
{
|
{
|
||||||
int val = gtk_spin_button_get_value_as_int(spinbutton);
|
int val = gtk_spin_button_get_value_as_int(spinbutton);
|
||||||
|
|||||||
Reference in New Issue
Block a user