diff --git a/Makefile b/Makefile index e173a1b..265dfc1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC = gcc CFLAGS = `pkg-config --cflags glib-2.0 gtk+-2.0` -Wall -g OFLAG = -o -LIBS = `pkg-config --libs glib-2.0 gtk+-2.0 libusb` +LIBS = `pkg-config --libs glib-2.0 gtk+-2.0 alsa` .SUFFIXES : .o .c .c.o : diff --git a/README b/README index ba32136..3a58774 100644 --- a/README +++ b/README @@ -1,5 +1,4 @@ -Requirments: libusb, gtk+, glib +Requirments: alsa, gtk+, glib Getting started guide: --disable snd_usb_audio (when it's loaded gdigi can't claim interface) -make && ./gdigi diff --git a/TODO b/TODO index b622a9c..4ea1181 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ -figure out all magic commands --fix usb handling code -make complete gui -amp/cabinet models -expression pedal options diff --git a/gdigi.c b/gdigi.c index 3c1175b..84fd32e 100644 --- a/gdigi.c +++ b/gdigi.c @@ -16,6 +16,8 @@ #include #include +#include + #include #include "gdigi.h" #include "gui.h" @@ -24,8 +26,8 @@ char buf[255]; -struct usb_device *dev; -struct usb_dev_handle *handle; +static snd_rawmidi_t *output; +static char *port_name = "default"; /* static char magic[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x7F, 0x7F, 0x04, 0x7F, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x6E, 0xF7, 0x00}; // causes COMAND to be displayed on device? @@ -68,9 +70,23 @@ char calculate_checksum(gchar *array, int length, int check) return checksum; } -int read_device(struct usb_dev_handle *handle, int bytes) +void open_device() { - int i, x; + snd_rawmidi_open(NULL, &output, port_name, SND_RAWMIDI_NONBLOCK); + snd_rawmidi_nonblock(output, 0); +} + +void send_data(char *data, int lenght) +{ + if (output == NULL) + open_device(); + + snd_rawmidi_write(output, data, lenght); +} + +int read_device(int bytes) +{ + /*int i, x; i = usb_bulk_read(handle, 132, buf, bytes, TIMEOUT); //printf("Called read %d. Device returned %d bytes\n", bytes, i); for (x=0; x 0) return i; - else return 0; + else return 0;*/ } void check_preset(struct usb_dev_handle *handle) { - 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 + /*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 int i; i = usb_bulk_write(handle, 4, magic3, sizeof(magic3), TIMEOUT); - /* UGLY - have to figure out reply formatting */ + // UGLY - have to figure out reply formatting do { i = read_device(handle, 12); if (i==12) { @@ -123,395 +139,345 @@ void check_preset(struct usb_dev_handle *handle) buf[6]==0x53 && buf[7]==0x04 && buf[8]==0x04 && buf[10]==0x09 && buf[11]==0x45) printf("Compressor level: %d\nCompressor attack (X-Edit only for DigiComp): %d\n", buf[3], buf[9]); } - } while (i > 0); + } while (i > 0);*/ } /* level = 0 to 99 */ -void set_wah_min(struct usb_dev_handle *handle, int level) +void set_wah_min(int level) { - static char set_min[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x20, 0x03, 0x14, 0x07, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; + static char set_min[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x20, 0x03, 0x14, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; - set_min[17] = level; - set_min[18] = calculate_checksum(set_min, sizeof(set_min), 18); + set_min[13] = level; + set_min[14] = calculate_checksum(set_min, sizeof(set_min), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_min, sizeof(set_min), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_min, sizeof(set_min)); } /* level = 0 to 99 */ -void set_wah_max(struct usb_dev_handle *handle, int level) +void set_wah_max(int level) { - static char set_max[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x20, 0x04, 0x14, 0x07, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; + static char set_max[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x20, 0x04, 0x14, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; - set_max[17] = level; - set_max[18] = calculate_checksum(set_max, sizeof(set_max), 18); + set_max[13] = level; + set_max[14] = calculate_checksum(set_max, sizeof(set_max), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_max, sizeof(set_max), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_max, sizeof(set_max)); } /* level = 0 to 12 */ -void set_wah_level(struct usb_dev_handle *handle, int level) +void set_wah_level(int level) { - static char set_level[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x05, 0x03, 0x07, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; + static char set_level[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x05, 0x03, 0x00 /* level */, 0x00 /* checksum */, 0xF7}; - set_level[17] = level; - set_level[18] = calculate_checksum(set_level, sizeof(set_level), 18); + set_level[13] = level; + set_level[14] = calculate_checksum(set_level, sizeof(set_level), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_level, sizeof(set_level), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_level, sizeof(set_level)); } -void set_wah_type(struct usb_dev_handle *handle, int type) +void set_wah_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x2C, 0x04, 0x00, 0x00, 0x03, 0x04, 0x01, 0x00 /* type */, 0x00 /* confirm */, 0x05, 0xF7, 0x00, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x2C, 0x00, 0x00, 0x03, 0x01, 0x00 /* type */, 0x00 /* confirm */, 0xF7}; switch (type) { - case WAH_TYPE_CRY: set_type[18] = 4; break; - case WAH_TYPE_FULLRANGE: set_type[18] = 5; break; - case WAH_TYPE_CLYDE: set_type[18] = 6; break; + case WAH_TYPE_CRY: set_type[14] = 4; break; + case WAH_TYPE_FULLRANGE: set_type[14] = 5; break; + case WAH_TYPE_CLYDE: set_type[14] = 6; break; default: break; } - set_type[19] = calculate_checksum(set_type, sizeof(set_type), 19) ^ 0x06; + set_type[15] = calculate_checksum(set_type, sizeof(set_type), 15) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } -void set_wah_on_off(struct usb_dev_handle *handle, gboolean val) +void set_wah_on_off(gboolean val) { - static char set_wah[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x01, 0x03, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_wah[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x01, 0x03, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn wah off */ - set_wah[17] = 0; + set_wah[13] = 0; } else { /* turn wah on */ - set_wah[17] = 1; + set_wah[13] = 1; } - set_wah[18] = calculate_checksum(set_wah, sizeof(set_wah), 18); + set_wah[14] = calculate_checksum(set_wah, sizeof(set_wah), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_wah, sizeof(set_wah), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_wah, sizeof(set_wah)); } /* level = 0 to 99 */ -void set_comp_sustain(struct usb_dev_handle *handle, int level) +void set_comp_sustain(int level) { - static char set_sust[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x50, 0x04, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_sust[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x50, 0x04, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_sust[17] = level; - set_sust[18] = calculate_checksum(set_sust, sizeof(set_sust), 18); + set_sust[13] = level; + set_sust[14] = calculate_checksum(set_sust, sizeof(set_sust), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_sust, sizeof(set_sust), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_sust, sizeof(set_sust)); } /* level = 0 to 99, available only in digi comp */ -void set_comp_tone(struct usb_dev_handle *handle, int level) +void set_comp_tone(int level) { - static char set_tone[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x51, 0x04, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_tone[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x51, 0x04, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_tone[17] = level; - set_tone[18] = calculate_checksum(set_tone, sizeof(set_tone), 18); + set_tone[13] = level; + set_tone[14] = calculate_checksum(set_tone, sizeof(set_tone), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_tone, sizeof(set_tone), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_tone, sizeof(set_tone)); } /* level = 0 to 99 */ -void set_comp_attack(struct usb_dev_handle *handle, int level) +void set_comp_attack(int level) { - static char set_attack[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x53, 0x04, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xf7}; + static char set_attack[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x53, 0x04, 0x00 /* value */, 0x00 /* checksum */, 0xf7}; - set_attack[17] = level; - set_attack[18] = calculate_checksum(set_attack, sizeof(set_attack), 18); + set_attack[13] = level; + set_attack[14] = calculate_checksum(set_attack, sizeof(set_attack), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_attack, sizeof(set_attack), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_attack, sizeof(set_attack)); } /* level = 0 to 99 */ -void set_comp_level(struct usb_dev_handle *handle, int level) +void set_comp_level(int level) { - static char set_level[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x52, 0x04, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_level[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x52, 0x04, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_level[17] = level; - set_level[18] = calculate_checksum(set_level, sizeof(set_level), 18); + set_level[13] = level; + set_level[14] = calculate_checksum(set_level, sizeof(set_level), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_level, sizeof(set_level), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_level, sizeof(set_level)); } -void set_comp_type(struct usb_dev_handle *handle, int type) +void set_comp_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x2C, 0x04, 0x00, 0x4F, 0x04, 0x04, 0x01, 0x00 /* type */, 0x00 /* checksum */, 0x05, 0xF7, 0x00, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x2C, 0x00, 0x4F, 0x04, 0x01, 0x00 /* type */, 0x00 /* checksum */, 0xF7}; switch (type) { - case COMP_TYPE_DIGI: set_type[18] = 0x43; break; - case COMP_TYPE_CS: set_type[18] = 0x44; break; + case COMP_TYPE_DIGI: set_type[14] = 0x43; break; + case COMP_TYPE_CS: set_type[14] = 0x44; break; default: break; } - set_type[19] = calculate_checksum(set_type, sizeof(set_type), 19) ^ 0x06; + set_type[15] = calculate_checksum(set_type, sizeof(set_type), 15) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } -void set_comp_on_off(struct usb_dev_handle *handle, gboolean val) +void set_comp_on_off(gboolean val) { - static char set_comp[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x00, 0x41, 0x04, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_comp[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x00, 0x41, 0x04, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn comp off */ - set_comp[17] = 0; + set_comp[13] = 0; } else { /* turn comp on */ - set_comp[17] = 1; + set_comp[13] = 1; } - set_comp[18] = calculate_checksum(set_comp, sizeof(set_comp), 18); + set_comp[14] = calculate_checksum(set_comp, sizeof(set_comp), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_comp, sizeof(set_comp), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_comp, sizeof(set_comp)); } /* x = 0 to 60 */ -void switch_user_preset(struct usb_dev_handle *handle, int x) +void switch_user_preset(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}; + static char switch_preset[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x39, 0x00, 0x01 /* bank = user */, 0x00 /* no */, 0x04, 0x00, 0x00, 0x01, 0x00 /* confirm */, 0xF7}; - switch_preset[14] = x; - switch_preset[21] = calculate_checksum(switch_preset, sizeof(switch_preset), 21) ^ 0x05; + switch_preset[11] = x; + switch_preset[16] = calculate_checksum(switch_preset, sizeof(switch_preset), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, switch_preset, sizeof(switch_preset), TIMEOUT); - printf("wrote: %d\n", i); + send_data(switch_preset, sizeof(switch_preset)); } /* x = 0 to 60 */ -void switch_system_preset(struct usb_dev_handle *handle, int x) +void switch_system_preset(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}; + static char switch_preset[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x39, 0x00, 0x00 /* bank = system */, 0x00 /* no */, 0x04, 0x00, 0x00, 0x01, 0x00 /* confirm */, 0xF7}; - switch_preset[14] = x; - switch_preset[21] = calculate_checksum(switch_preset, sizeof(switch_preset), 21) ^ 0x05; + switch_preset[11] = x; + switch_preset[16] = calculate_checksum(switch_preset, sizeof(switch_preset), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, switch_preset, sizeof(switch_preset), TIMEOUT); - printf("wrote: %d\n", i); + send_data(switch_preset, sizeof(switch_preset)); } -void set_pickup_type(struct usb_dev_handle *handle, int type) +void set_pickup_type(int type) { - static char pickup[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x00, 0x40, 0x02, 0x07, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; + static char pickup[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x00, 0x40, 0x02, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case PICKUP_TYPE_HB_SC: pickup[17] = 0x42; break; - case PICKUP_TYPE_SC_HB: pickup[17] = 0x41; break; + case PICKUP_TYPE_HB_SC: pickup[13] = 0x42; break; + case PICKUP_TYPE_SC_HB: pickup[13] = 0x41; break; default: break; } - pickup[18] = calculate_checksum(pickup, sizeof(pickup), 18); + pickup[14] = calculate_checksum(pickup, sizeof(pickup), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, pickup, sizeof(pickup), TIMEOUT); - printf("wrote: %d\n", i); + send_data(pickup, sizeof(pickup)); } -void set_pickup_on_off(struct usb_dev_handle *handle, gboolean val) +void set_pickup_on_off(gboolean val) { - static char set_pickup[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x00, 0x41, 0x02, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_pickup[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x00, 0x41, 0x02, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn pickup off */ - set_pickup[17] = 0; + set_pickup[13] = 0; } else { /* turn pickup on */ - set_pickup[17] = 1; + set_pickup[13] = 1; } - set_pickup[18] = calculate_checksum(set_pickup, sizeof(set_pickup), 18); + set_pickup[14] = calculate_checksum(set_pickup, sizeof(set_pickup), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_pickup, sizeof(set_pickup), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_pickup, sizeof(set_pickup)); } -void set_dist_type(struct usb_dev_handle *handle, int type) +void set_dist_type(int type) { - static char set_dist[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x28, 0x04, 0x09, 0x00, 0x06, 0x04, 0x02, 0x05, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_dist[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x28, 0x09, 0x00, 0x06, 0x02, 0x05, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case DIST_TYPE_SCREAMER: set_dist[19] = 0x00; break; - case DIST_TYPE_808: set_dist[19] = 0x0C; break; - case DIST_TYPE_GUYOD: set_dist[19] = 0x05; break; - case DIST_TYPE_DOD250: set_dist[19] = 0x03; break; - case DIST_TYPE_RODENT: set_dist[19] = 0x01; break; - case DIST_TYPE_MX: set_dist[19] = 0x0B; break; - case DIST_TYPE_DS: set_dist[19] = 0x02; break; - case DIST_TYPE_GRUNGE: set_dist[19] = 0x07; break; - case DIST_TYPE_ZONE: set_dist[19] = 0x09; break; - case DIST_TYPE_DEATH: set_dist[19] = 0x0E; break; - case DIST_TYPE_GONK: set_dist[19] = 0x0D; break; - case DIST_TYPE_FUZZY: set_dist[19] = 0x08; break; - case DIST_TYPE_MP: set_dist[19] = 0x04; break; + case DIST_TYPE_SCREAMER: set_dist[15] = 0x00; break; + case DIST_TYPE_808: set_dist[15] = 0x0C; break; + case DIST_TYPE_GUYOD: set_dist[15] = 0x05; break; + case DIST_TYPE_DOD250: set_dist[15] = 0x03; break; + case DIST_TYPE_RODENT: set_dist[15] = 0x01; break; + case DIST_TYPE_MX: set_dist[15] = 0x0B; break; + case DIST_TYPE_DS: set_dist[15] = 0x02; break; + case DIST_TYPE_GRUNGE: set_dist[15] = 0x07; break; + case DIST_TYPE_ZONE: set_dist[15] = 0x09; break; + case DIST_TYPE_DEATH: set_dist[15] = 0x0E; break; + case DIST_TYPE_GONK: set_dist[15] = 0x0D; break; + case DIST_TYPE_FUZZY: set_dist[15] = 0x08; break; + case DIST_TYPE_MP: set_dist[15] = 0x04; break; default: break; } - set_dist[21] = calculate_checksum(set_dist, sizeof(set_dist), 21) ^ 0x05; + set_dist[16] = calculate_checksum(set_dist, sizeof(set_dist), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_dist, sizeof(set_dist), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_dist, sizeof(set_dist)); } -void set_dist_option(struct usb_dev_handle *handle, char option, int value) +void set_dist_option(char option, int value) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x09, 0x00 /* option */, 0x06, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x09, 0x00 /* option */, 0x06, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = value; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = value; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_dist_on_off(struct usb_dev_handle *handle, gboolean val) +void set_dist_on_off(gboolean val) { - static char set_dist[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x09, 0x01, 0x06, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_dist[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x09, 0x01, 0x06, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn dist off */ - set_dist[17] = 0; + set_dist[13] = 0; } else { /* turn dist on */ - set_dist[17] = 1; + set_dist[13] = 1; } - set_dist[18] = calculate_checksum(set_dist, sizeof(set_dist), 18); + set_dist[14] = calculate_checksum(set_dist, sizeof(set_dist), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_dist, sizeof(set_dist), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_dist, sizeof(set_dist)); } /* level = 0 to 99 */ -void set_preset_level(struct usb_dev_handle *handle, int level) +void set_preset_level(int level) { - static char set_level[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x0A, 0x42, 0x12, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_level[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x0A, 0x42, 0x12, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_level[17] = level; - set_level[18] = calculate_checksum(set_level, sizeof(set_level), 18); + set_level[13] = level; + set_level[14] = calculate_checksum(set_level, sizeof(set_level), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_level, sizeof(set_level), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_level, sizeof(set_level)); } -void set_eq_type(struct usb_dev_handle *handle, int type) +void set_eq_type(int type) { - static char set_eq[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x2A, 0x04, 0x0C, 0x02, 0x18, 0x04, 0x02, 0x05, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_eq[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x2A, 0x0C, 0x02, 0x18, 0x02, 0x05, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case EQ_TYPE_BRIGHT: set_eq[19] = 0x42; break; - case EQ_TYPE_MIDBOOST: set_eq[19] = 0x40; break; - case EQ_TYPE_SCOOP: set_eq[19] = 0x41; break; - case EQ_TYPE_WARM: set_eq[19] = 0x43; break; + case EQ_TYPE_BRIGHT: set_eq[15] = 0x42; break; + case EQ_TYPE_MIDBOOST: set_eq[15] = 0x40; break; + case EQ_TYPE_SCOOP: set_eq[15] = 0x41; break; + case EQ_TYPE_WARM: set_eq[15] = 0x43; break; default: break; } - set_eq[21] = calculate_checksum(set_eq, sizeof(set_eq), 21) ^ 0x05; + set_eq[16] = calculate_checksum(set_eq, sizeof(set_eq), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_eq, sizeof(set_eq), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_eq, sizeof(set_eq)); } /* x = 0 to 99 */ -void set_eq_gain(struct usb_dev_handle *handle, int x) +void set_eq_gain(int x) { - static char set_gain[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x09, 0x41, 0x08, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_gain[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x09, 0x41, 0x08, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_gain[17] = x; - set_gain[18] = calculate_checksum(set_gain, sizeof(set_gain), 18); + set_gain[13] = x; + set_gain[14] = calculate_checksum(set_gain, sizeof(set_gain), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_gain, sizeof(set_gain), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_gain, sizeof(set_gain)); } /* x = 0 to 99 */ -void set_eq_level(struct usb_dev_handle *handle, int x) +void set_eq_level(int x) { - static char set_level[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x09, 0x42, 0x08, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_level[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x09, 0x42, 0x08, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_level[17] = x; - set_level[18] = calculate_checksum(set_level, sizeof(set_level), 18); + set_level[13] = x; + set_level[14] = calculate_checksum(set_level, sizeof(set_level), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_level, sizeof(set_level), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_level, sizeof(set_level)); } /* x = 0x00 (-12dB) to 0x18 (12dB) */ -void set_eq_bass(struct usb_dev_handle *handle, int x) +void set_eq_bass(int x) { - static char set_bass[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x03, 0x18, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_bass[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x03, 0x18, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_bass[17] = x; - set_bass[18] = calculate_checksum(set_bass, sizeof(set_bass), 18); + set_bass[13] = x; + set_bass[14] = calculate_checksum(set_bass, sizeof(set_bass), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_bass, sizeof(set_bass), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_bass, sizeof(set_bass)); } /* x = 0x00 (-12dB) to 0x18 (12dB) */ -void set_eq_mid(struct usb_dev_handle *handle, int x) +void set_eq_mid(int x) { - static char set_mid[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x04, 0x18, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_mid[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x04, 0x18, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_mid[17] = x; - set_mid[18] = calculate_checksum(set_mid, sizeof(set_mid), 18); + set_mid[13] = x; + set_mid[14] = calculate_checksum(set_mid, sizeof(set_mid), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_mid, sizeof(set_mid), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_mid, sizeof(set_mid)); } /* x = 0 to 4700 (which transforms into 300-5000 Hz) device itself will accept higher value, but X-Edit allows only 300-5000Hz */ -void set_eq_mid_hz(struct usb_dev_handle *handle, int x) +void set_eq_mid_hz(int x) { - int i; - if (x <= 0x7F) { - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x06, 0x18, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x06, 0x18, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[17] = x; - set_hz[18] = calculate_checksum(set_hz, sizeof(set_hz), 18); + set_hz[13] = x; + set_hz[14] = calculate_checksum(set_hz, sizeof(set_hz), 14) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } else { x -= 0x80; if (x <= 0x7F) { - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x2C, 0x04, 0x0C, 0x06, 0x18, 0x04, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0x05, 0xF7, 0x00, 0x00}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x2C, 0x0C, 0x06, 0x18, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[18] = x; - set_hz[19] = x^0x32; + set_hz[14] = x; + set_hz[15] = calculate_checksum(set_hz, sizeof(set_hz), 15) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } else { x -= 0x80; int a, b, c; @@ -529,56 +495,51 @@ void set_eq_mid_hz(struct usb_dev_handle *handle, int x) x -= 0x80; } - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00 /* a */, 0x04, 0x0C, 0x06, 0x18, 0x04, 0x02, 0x00 /* b */, 0x00 /* value */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00 /* a */, 0x0C, 0x06, 0x18, 0x02, 0x00 /* b */, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[11] = a; - set_hz[18] = b; - set_hz[19] = x; - set_hz[21] = a^b^x^0x1B^set_hz[14]; + set_hz[9] = a; + set_hz[14] = b; + set_hz[15] = x; + set_hz[16] = calculate_checksum(set_hz, sizeof(set_hz), 16) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } } - printf("wrote: %d\n", i); } /* x = 0x00 (-12dB) to 0x18 (12dB) */ -void set_eq_treble(struct usb_dev_handle *handle, int x) +void set_eq_treble(int x) { - static char set_treble[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x05, 0x18, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_treble[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x05, 0x18, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_treble[17] = x; - set_treble[18] = calculate_checksum(set_treble, sizeof(set_treble), 18); + set_treble[13] = x; + set_treble[14] = calculate_checksum(set_treble, sizeof(set_treble), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_treble, sizeof(set_treble), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_treble, sizeof(set_treble)); } /* x = 0 to 7500 (which transforms into 500-8000 Hz) device itself will accept higher value, but X-Edit allows only 500-8000Hz */ -void set_eq_treb_hz(struct usb_dev_handle *handle, int x) +void set_eq_treb_hz(int x) { - int i; - if (x <= 0x7F) { - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x0B, 0x18, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x0B, 0x18, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[17] = x; - set_hz[18] = calculate_checksum(set_hz, sizeof(set_hz), 18); + set_hz[13] = x; + set_hz[14] = calculate_checksum(set_hz, sizeof(set_hz), 14) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } else { x -= 0x80; if (x <= 0x7F) { - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x2C, 0x04, 0x0C, 0x0B, 0x18, 0x04, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0x05, 0xF7, 0x00, 0x00}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x2C, 0x0C, 0x0B, 0x18, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[18] = x; - set_hz[19] = x^0x3F; + set_hz[14] = x; + set_hz[15] = calculate_checksum(set_hz, sizeof(set_hz), 15) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } else { x -= 0x80; int a, b, c; @@ -596,396 +557,348 @@ void set_eq_treb_hz(struct usb_dev_handle *handle, int x) x -= 0x80; } - static char set_hz[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00 /* a */, 0x04, 0x0C, 0x0B, 0x18, 0x04, 0x02, 0x00 /* b */, 0x00 /* value */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_hz[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00 /* a */, 0x0C, 0x0B, 0x18, 0x02, 0x00 /* b */, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_hz[11] = a; - set_hz[18] = b; - set_hz[19] = x; - set_hz[21] = a^b^x^0x1B^set_hz[14]; + set_hz[9] = a; + set_hz[14] = b; + set_hz[15] = x; + set_hz[16] = calculate_checksum(set_hz, sizeof(set_hz), 16) ^ 0x07; - i = usb_bulk_write(handle, 4, set_hz, sizeof(set_hz), TIMEOUT); + send_data(set_hz, sizeof(set_hz)); } } - printf("wrote: %d\n", i); } -void set_eq_on_off(struct usb_dev_handle *handle, gboolean val) +void set_eq_on_off(gboolean val) { - static char set_eq[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0C, 0x0C, 0x18, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_eq[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0C, 0x0C, 0x18, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn eq off */ - set_eq[17] = 0; + set_eq[13] = 0; } else { /* turn eq on */ - set_eq[17] = 1; + set_eq[13] = 1; } - set_eq[18] = calculate_checksum(set_eq, sizeof(set_eq), 18); + set_eq[14] = calculate_checksum(set_eq, sizeof(set_eq), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_eq, sizeof(set_eq), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_eq, sizeof(set_eq)); } -void set_noisegate_type(struct usb_dev_handle *handle, int type) +void set_noisegate_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x28, 0x04, 0x02, 0x40, 0x0C, 0x04, 0x02, 0x03, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x28, 0x02, 0x40, 0x0C, 0x02, 0x03, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case NOISEGATE_GATE: set_type[19] = 0; break; - case NOISEGATE_SWELL: set_type[19] = 1; break; + case NOISEGATE_GATE: set_type[15] = 0; break; + case NOISEGATE_SWELL: set_type[15] = 1; break; default: break; } - set_type[21] = calculate_checksum(set_type, sizeof(set_type), 21) ^ 0x05; + set_type[16] = calculate_checksum(set_type, sizeof(set_type), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } /* x = 0 to 99 */ -void set_gate_option(struct usb_dev_handle *handle, char option, int x) +void set_gate_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x02, 0x00 /* option */, 0x0C, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x02, 0x00 /* option */, 0x0C, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_noisegate_on_off(struct usb_dev_handle *handle, gboolean val) +void set_noisegate_on_off(gboolean val) { - static char set_gate[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x02, 0x41, 0x0C, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_gate[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x02, 0x41, 0x0C, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn noisegate off */ - set_gate[17] = 0; + set_gate[13] = 0; } else { /* turn noisegate on */ - set_gate[17] = 1; + set_gate[13] = 1; } - set_gate[18] = calculate_checksum(set_gate, sizeof(set_gate), 18); + set_gate[14] = calculate_checksum(set_gate, sizeof(set_gate), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_gate, sizeof(set_gate), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_gate, sizeof(set_gate)); } -void set_chorusfx_option(struct usb_dev_handle *handle, char option, int x) +void set_chorusfx_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x03, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x03, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_flanger_option(struct usb_dev_handle *handle, char option, int x) +void set_flanger_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x03, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x03, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_vibrato_option(struct usb_dev_handle *handle, char option, int x) +void set_vibrato_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x05, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x05, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_tremolo_option(struct usb_dev_handle *handle, char option, int x) +void set_tremolo_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x04, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x04, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_envelope_option(struct usb_dev_handle *handle, char option, int x) +void set_envelope_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x06, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x06, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_ya_option(struct usb_dev_handle *handle, char option, int x) +void set_ya_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x05, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x05, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_filter_option(struct usb_dev_handle *handle, char option, int x) +void set_filter_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0B, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0B, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_whammy_option(struct usb_dev_handle *handle, char option, int x) +void set_whammy_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x07, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x07, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_pitch_option(struct usb_dev_handle *handle, char option, int x) +void set_pitch_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x06, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x06, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_ips_option(struct usb_dev_handle *handle, char option, int x) +void set_ips_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x0A, 0x00 /* option */, 0x0E, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x0A, 0x00 /* option */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_chorusfx_type(struct usb_dev_handle *handle, int type) +void set_chorusfx_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00 /* type */, 0x04, 0x03, 0x00, 0x0E, 0x04, 0x02, 0x00 /* type */, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00 /* type */, 0x03, 0x00, 0x0E, 0x02, 0x00 /* type */, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case CHORUS_TYPE_CE: set_type[11] = 0x08; set_type[19] = 0x7B; set_type[18] = 0x03; break; - case CHORUS_TYPE_DUAL: set_type[11] = 0x08; set_type[19] = 0x79; set_type[18] = 0x03; break; - case CHORUS_TYPE_MULTI: set_type[11] = 0x08; set_type[19] = 0x7A; set_type[18] = 0x03; break; - case CHORUS_TYPE_FLANGER: set_type[11] = 0x08; set_type[19] = 0x7D; set_type[18] = 0x03; break; - case CHORUS_TYPE_MXR_FLANGER: set_type[11] = 0x08; set_type[19] = 0x7F; set_type[18] = 0x03; break; - case CHORUS_TYPE_PHASER: set_type[11] = 0x0A; set_type[19] = 0x01; set_type[18] = 0x03; break; - case CHORUS_TYPE_VIBRATO: set_type[11] = 0x08; set_type[19] = 0x60; set_type[18] = 0x03; break; - case CHORUS_TYPE_ROTARY: set_type[11] = 0x08; set_type[19] = 0x61; set_type[18] = 0x03; break; - case CHORUS_TYPE_VIBROPAN: set_type[11] = 0x0A; set_type[19] = 0x0F; set_type[18] = 0x03; break; - case CHORUS_TYPE_TREMOLO: set_type[11] = 0x08; set_type[19] = 0x5E; set_type[18] = 0x03; break; - case CHORUS_TYPE_PANNER: set_type[11] = 0x08; set_type[19] = 0x5F; set_type[18] = 0x03; break; - case CHORUS_TYPE_ENVELOPE: set_type[11] = 0x0A; set_type[19] = 0x0A; set_type[18] = 0x03; break; - case CHORUS_TYPE_AUTOYA: set_type[11] = 0x0A; set_type[19] = 0x0B; set_type[18] = 0x03; break; - case CHORUS_TYPE_YAYA: set_type[11] = 0x0A; set_type[19] = 0x0C; set_type[18] = 0x03; break; - case CHORUS_TYPE_STEP_FILTER: set_type[11] = 0x0A; set_type[19] = 0x0D; set_type[18] = 0x03; break; - case CHORUS_TYPE_WHAMMY: set_type[11] = 0x08; set_type[19] = 0x40; set_type[18] = 0x05; break; - case CHORUS_TYPE_PITCH_SHIFT: set_type[11] = 0x08; set_type[19] = 0x43; set_type[18] = 0x05; break; - case CHORUS_TYPE_DETUNE: set_type[11] = 0x08; set_type[19] = 0x42; set_type[18] = 0x05; break; - case CHORUS_TYPE_IPS: set_type[11] = 0x08; set_type[19] = 0x41; set_type[18] = 0x05; break; + case CHORUS_TYPE_CE: set_type[9] = 0x08; set_type[15] = 0x7B; set_type[14] = 0x03; break; + case CHORUS_TYPE_DUAL: set_type[9] = 0x08; set_type[15] = 0x79; set_type[14] = 0x03; break; + case CHORUS_TYPE_MULTI: set_type[9] = 0x08; set_type[15] = 0x7A; set_type[14] = 0x03; break; + case CHORUS_TYPE_FLANGER: set_type[9] = 0x08; set_type[15] = 0x7D; set_type[14] = 0x03; break; + case CHORUS_TYPE_MXR_FLANGER: set_type[9] = 0x08; set_type[15] = 0x7F; set_type[14] = 0x03; break; + case CHORUS_TYPE_PHASER: set_type[9] = 0x0A; set_type[15] = 0x01; set_type[14] = 0x03; break; + case CHORUS_TYPE_VIBRATO: set_type[9] = 0x08; set_type[15] = 0x60; set_type[14] = 0x03; break; + case CHORUS_TYPE_ROTARY: set_type[9] = 0x08; set_type[15] = 0x61; set_type[14] = 0x03; break; + case CHORUS_TYPE_VIBROPAN: set_type[9] = 0x0A; set_type[15] = 0x0F; set_type[14] = 0x03; break; + case CHORUS_TYPE_TREMOLO: set_type[9] = 0x08; set_type[15] = 0x5E; set_type[14] = 0x03; break; + case CHORUS_TYPE_PANNER: set_type[9] = 0x08; set_type[15] = 0x5F; set_type[14] = 0x03; break; + case CHORUS_TYPE_ENVELOPE: set_type[9] = 0x0A; set_type[15] = 0x0A; set_type[14] = 0x03; break; + case CHORUS_TYPE_AUTOYA: set_type[9] = 0x0A; set_type[15] = 0x0B; set_type[14] = 0x03; break; + case CHORUS_TYPE_YAYA: set_type[9] = 0x0A; set_type[15] = 0x0C; set_type[14] = 0x03; break; + case CHORUS_TYPE_STEP_FILTER: set_type[9] = 0x0A; set_type[15] = 0x0D; set_type[14] = 0x03; break; + case CHORUS_TYPE_WHAMMY: set_type[9] = 0x08; set_type[15] = 0x40; set_type[14] = 0x05; break; + case CHORUS_TYPE_PITCH_SHIFT: set_type[9] = 0x08; set_type[15] = 0x43; set_type[14] = 0x05; break; + case CHORUS_TYPE_DETUNE: set_type[9] = 0x08; set_type[15] = 0x42; set_type[14] = 0x05; break; + case CHORUS_TYPE_IPS: set_type[9] = 0x08; set_type[15] = 0x41; set_type[14] = 0x05; break; default: break; } - set_type[21] = calculate_checksum(set_type, sizeof(set_type), 21) ^ 0x05; + set_type[16] = calculate_checksum(set_type, sizeof(set_type), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } -void set_chorusfx_on_off(struct usb_dev_handle *handle, gboolean val) +void set_chorusfx_on_off(gboolean val) { - static char set_chorus[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x03, 0x01, 0x0E, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_chorus[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x03, 0x01, 0x0E, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn chorusfx off */ - set_chorus[17] = 0; + set_chorus[13] = 0; } else { /* turn chorusfx on */ - set_chorus[17] = 1; + set_chorus[13] = 1; } - set_chorus[18] = calculate_checksum(set_chorus, sizeof(set_chorus), 18); + set_chorus[14] = calculate_checksum(set_chorus, sizeof(set_chorus), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_chorus, sizeof(set_chorus), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_chorus, sizeof(set_chorus)); } /* x = 0 to 139 */ -void set_delay_time(struct usb_dev_handle *handle, int x) +void set_delay_time(int x) { - int i; + if (x <= 0x7F) { + static char set_time[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x07, 0x60, 0x0F, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - if (x <= 0x7F) { /* "short" message format */ - static char set_time[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x07, 0x60, 0x0F, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + set_time[13] = x; + set_time[14] = calculate_checksum(set_time, sizeof(set_time), 14) ^ 0x07; - set_time[17] = x; - set_time[18] = calculate_checksum(set_time, sizeof(set_time), 18); + send_data(set_time, sizeof(set_time)); + } else { + static char set_time[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x0C, 0x07, 0x60, 0x0F, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - i = usb_bulk_write(handle, 4, set_time, sizeof(set_time), TIMEOUT); - } else { /* "long" message format */ - static char set_time[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x0C, 0x04, 0x07, 0x60, 0x0F, 0x04, 0x01, 0x00 /* value */, 0x00 /* checksum */, 0x05, 0xF7, 0x00, 0x00}; + set_time[14] = x - 0x80; + set_time[15] = calculate_checksum(set_time, sizeof(set_time), 15) ^ 0x07; - set_time[18] = x - 0x80; - set_time[19] = calculate_checksum(set_time, sizeof(set_time), 19) ^ 0x06; - - i = usb_bulk_write(handle, 4, set_time, sizeof(set_time), TIMEOUT); + send_data(set_time, sizeof(set_time)); } - printf("wrote: %d\n", i); } -void set_delay_type(struct usb_dev_handle *handle, int type) +void set_delay_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x08, 0x04, 0x07, 0x40, 0x0F, 0x04, 0x02, 0x04, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x08, 0x07, 0x40, 0x0F, 0x02, 0x04, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case DELAY_TYPE_ANALOG: set_type[19] = 0x16; break; - case DELAY_TYPE_DIGITAL: set_type[19] = 0x15; break; - case DELAY_TYPE_MODULATED: set_type[19] = 0x17; break; - case DELAY_TYPE_PONG: set_type[19] = 0x18; break; - case DELAY_TYPE_TAPE: set_type[19] = 0x19; break; + case DELAY_TYPE_ANALOG: set_type[15] = 0x16; break; + case DELAY_TYPE_DIGITAL: set_type[15] = 0x15; break; + case DELAY_TYPE_MODULATED: set_type[15] = 0x17; break; + case DELAY_TYPE_PONG: set_type[15] = 0x18; break; + case DELAY_TYPE_TAPE: set_type[15] = 0x19; break; default: break; } - set_type[21] = calculate_checksum(set_type, sizeof(set_type), 21) ^ 0x05; + set_type[16] = calculate_checksum(set_type, sizeof(set_type), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } -void set_delay_option(struct usb_dev_handle *handle, char option, int x) +void set_delay_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x07, 0x00 /* option */, 0x0F, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x07, 0x00 /* option */, 0x0F, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_delay_on_off(struct usb_dev_handle *handle, gboolean val) +void set_delay_on_off(gboolean val) { - static char set_delay[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x00, 0x04, 0x07, 0x41, 0x0F, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_delay[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00, 0x07, 0x41, 0x0F, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn delay off */ - set_delay[17] = 0; + set_delay[13] = 0; } else { /* turn delay on */ - set_delay[17] = 1; + set_delay[13] = 1; } - set_delay[18] = calculate_checksum(set_delay, sizeof(set_delay), 18); + set_delay[14] = calculate_checksum(set_delay, sizeof(set_delay), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_delay, sizeof(set_delay), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_delay, sizeof(set_delay)); } /* x = 0 to 15 (predelay), otherwise 0 to 99 */ -void set_reverb_option(struct usb_dev_handle *handle, char option, int x) +void set_reverb_option(char option, int x) { - static char set_option[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x07, 0x00 /* option */, 0x10, 0x07, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; + static char set_option[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x07, 0x00 /* option */, 0x10, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - set_option[14] = option; - set_option[17] = x; - set_option[18] = calculate_checksum(set_option, sizeof(set_option), 18); + set_option[11] = option; + set_option[13] = x; + set_option[14] = calculate_checksum(set_option, sizeof(set_option), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_option, sizeof(set_option), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_option, sizeof(set_option)); } -void set_reverb_type(struct usb_dev_handle *handle, int type) +void set_reverb_type(int type) { - static char set_type[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x28, 0x04, 0x07, 0x00, 0x10, 0x04, 0x02, 0x04, 0x00 /* type1 */, 0x06, 0x00 /* checksum */, 0xF7, 0x00}; + static char set_type[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x28, 0x07, 0x00, 0x10, 0x02, 0x04, 0x00 /* type1 */, 0x00 /* checksum */, 0xF7}; switch (type) { - case REVERB_TYPE_TWIN: set_type[19] = 0x7A; break; - case REVERB_TYPE_LEX_AMBIENCE: set_type[19] = 0x7E; break; - case REVERB_TYPE_LEX_STUDIO: set_type[19] = 0x7D; break; - case REVERB_TYPE_LEX_ROOM: set_type[19] = 0x7C; break; - case REVERB_TYPE_LEX_HALL: set_type[19] = 0x7B; break; - case REVERB_TYPE_EMT240_PLATE: set_type[19] = 0x7F; break; + case REVERB_TYPE_TWIN: set_type[15] = 0x7A; break; + case REVERB_TYPE_LEX_AMBIENCE: set_type[15] = 0x7E; break; + case REVERB_TYPE_LEX_STUDIO: set_type[15] = 0x7D; break; + case REVERB_TYPE_LEX_ROOM: set_type[15] = 0x7C; break; + case REVERB_TYPE_LEX_HALL: set_type[15] = 0x7B; break; + case REVERB_TYPE_EMT240_PLATE: set_type[15] = 0x7F; break; default: break; } - set_type[21] = calculate_checksum(set_type, sizeof(set_type), 21) ^ 0x05; + set_type[16] = calculate_checksum(set_type, sizeof(set_type), 16) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_type, sizeof(set_type), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_type, sizeof(set_type)); } -void set_reverb_on_off(struct usb_dev_handle *handle, gboolean val) +void set_reverb_on_off(gboolean val) { - static char set_reverb[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x41, 0x20, 0x04, 0x07, 0x01, 0x10, 0x07, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; + static char set_reverb[] = {0x00, 0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x20, 0x07, 0x01, 0x10, 0x00 /* on/off */, 0x00 /* checksum */, 0xF7}; if (val == FALSE) { /* turn reverb off */ - set_reverb[17] = 0; + set_reverb[13] = 0; } else { /* turn reverb on */ - set_reverb[17] = 1; + set_reverb[13] = 1; } - set_reverb[18] = calculate_checksum(set_reverb, sizeof(set_reverb), 18); + set_reverb[14] = calculate_checksum(set_reverb, sizeof(set_reverb), 14) ^ 0x07; - int i; - i = usb_bulk_write(handle, 4, set_reverb, sizeof(set_reverb), TIMEOUT); - printf("wrote: %d\n", i); + send_data(set_reverb, sizeof(set_reverb)); } /* x = 0 to 59 (preset number) */ -void set_preset_name(struct usb_dev_handle *handle, int x, gchar *name) +void set_preset_name(int x, gchar *name) { - static char set_name[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x29, 0x00, 0x04, 0x01, 0x00 /* preset no */, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + /* static char set_name[] = {0x04, 0xF0, 0x00, 0x00, 0x04, 0x10, 0x00, 0x5E, 0x04, 0x02, 0x29, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - int write; /* number of bytes to write */ + int write; // number of bytes to write set_name[14] = x; @@ -1107,54 +1020,17 @@ void set_preset_name(struct usb_dev_handle *handle, int x, gchar *name) int i; i = usb_bulk_write(handle, 4, set_name, write, TIMEOUT); - printf("wrote: %d\n", i); + printf("wrote: %d\n", i);*/ } int main(int argc, char **argv) { gtk_init(&argc, &argv); - struct usb_bus *busses; + create_window(); + gtk_main(); - usb_init(); - usb_find_busses(); - usb_find_devices(); - - busses = usb_get_busses(); - - struct usb_bus *bus; - - for (bus = busses; bus; bus = bus->next) { - int result; - gboolean found = FALSE; - - for (dev = bus->devices; dev && !found; dev = dev->next) { - if (dev->descriptor.idVendor == 0x1210) { - found = TRUE; - handle = usb_open(dev); - - result = usb_get_string_simple(handle, dev->descriptor.iProduct, buf, sizeof(buf)); - printf("%d %s\n", result, buf); - - result = usb_claim_interface(handle, 0); - if (result == 0) printf ("claim resulted with %d\n", result); - - /*int i = usb_bulk_write(handle, 4, presets_system, sizeof(presets_system), TIMEOUT); - printf("wrote: %d\n", i);*/ - /* now have to read from device, - first packet appears to be smaller, - then are 12 bytes long packets, - last one is smaller */ - } - } - } - - if (handle != NULL) { - create_window(); - gtk_main(); - - if (usb_close(handle)) - printf("Error closing usb handle!"); - } + if (output != NULL) + snd_rawmidi_close(output); return 0; } diff --git a/gdigi.h b/gdigi.h index b7b1c4d..d10e1cd 100644 --- a/gdigi.h +++ b/gdigi.h @@ -17,8 +17,6 @@ #include #include -extern struct usb_dev_handle *handle; - enum { WAH_TYPE_CRY = 0, WAH_TYPE_FULLRANGE, @@ -344,53 +342,53 @@ enum { #define EMT240_PLATE_LIVELINESS 0x0D #define EMT240_PLATE_LEVEL 0x05 -void set_wah_min(struct usb_dev_handle *handle, int level); -void set_wah_max(struct usb_dev_handle *handle, int level); -void set_wah_level(struct usb_dev_handle *handle, int level); -void set_wah_type(struct usb_dev_handle *handle, int type); -void set_wah_on_off(struct usb_dev_handle *handle, gboolean val); -void set_comp_sustain(struct usb_dev_handle *handle, int level); -void set_comp_tone(struct usb_dev_handle *handle, int level); -void set_comp_attack(struct usb_dev_handle *handle, int level); -void set_comp_level(struct usb_dev_handle *handle, int level); -void set_comp_type(struct usb_dev_handle *handle, int type); -void set_comp_on_off(struct usb_dev_handle *handle, gboolean val); -void switch_user_preset(struct usb_dev_handle *handle, int x); -void switch_system_preset(struct usb_dev_handle *handle, int x); -void set_pickup_type(struct usb_dev_handle *handle, int type); -void set_pickup_on_off(struct usb_dev_handle *handle, gboolean val); -void set_dist_type(struct usb_dev_handle *handle, int type); -void set_dist_option(struct usb_dev_handle *handle, char option, int value); -void set_dist_on_off(struct usb_dev_handle *handle, gboolean val); -void set_preset_level(struct usb_dev_handle *handle, int level); -void set_eq_type(struct usb_dev_handle *handle, int type); -void set_eq_gain(struct usb_dev_handle *handle, int x); -void set_eq_level(struct usb_dev_handle *handle, int x); -void set_eq_bass(struct usb_dev_handle *handle, int x); -void set_eq_mid(struct usb_dev_handle *handle, int x); -void set_eq_mid_hz(struct usb_dev_handle *handle, int x); -void set_eq_treble(struct usb_dev_handle *handle, int x); -void set_eq_treb_hz(struct usb_dev_handle *handle, int x); -void set_eq_on_off(struct usb_dev_handle *handle, gboolean val); -void set_noisegate_type(struct usb_dev_handle *handle, int type); -void set_gate_option(struct usb_dev_handle *handle, char option, int x); -void set_noisegate_on_off(struct usb_dev_handle *handle, gboolean val); -void set_chorusfx_option(struct usb_dev_handle *handle, char option, int x); -void set_flanger_option(struct usb_dev_handle *handle, char option, int x); -void set_vibrato_option(struct usb_dev_handle *handle, char option, int x); -void set_tremolo_option(struct usb_dev_handle *handle, char option, int x); -void set_envelope_option(struct usb_dev_handle *handle, char option, int x); -void set_ya_option(struct usb_dev_handle *handle, char option, int x); -void set_filter_option(struct usb_dev_handle *handle, char option, int x); -void set_whammy_option(struct usb_dev_handle *handle, char option, int x); -void set_pitch_option(struct usb_dev_handle *handle, char option, int x); -void set_ips_option(struct usb_dev_handle *handle, char option, int x); -void set_chorusfx_type(struct usb_dev_handle *handle, int type); -void set_chorusfx_on_off(struct usb_dev_handle *handle, gboolean val); -void set_delay_time(struct usb_dev_handle *handle, int x); -void set_delay_type(struct usb_dev_handle *handle, int type); -void set_delay_option(struct usb_dev_handle *handle, char option, int x); -void set_delay_on_off(struct usb_dev_handle *handle, gboolean val); -void set_reverb_option(struct usb_dev_handle *handle, char option, int x); -void set_reverb_type(struct usb_dev_handle *handle, int type); -void set_reverb_on_off(struct usb_dev_handle *handle, gboolean val); +void set_wah_min(int level); +void set_wah_max(int level); +void set_wah_level(int level); +void set_wah_type(int type); +void set_wah_on_off(gboolean val); +void set_comp_sustain(int level); +void set_comp_tone(int level); +void set_comp_attack(int level); +void set_comp_level(int level); +void set_comp_type(int type); +void set_comp_on_off(gboolean val); +void switch_user_preset(int x); +void switch_system_preset(int x); +void set_pickup_type(int type); +void set_pickup_on_off(gboolean val); +void set_dist_type(int type); +void set_dist_option(char option, int value); +void set_dist_on_off(gboolean val); +void set_preset_level(int level); +void set_eq_type(int type); +void set_eq_gain(int x); +void set_eq_level(int x); +void set_eq_bass(int x); +void set_eq_mid(int x); +void set_eq_mid_hz(int x); +void set_eq_treble(int x); +void set_eq_treb_hz(int x); +void set_eq_on_off(gboolean val); +void set_noisegate_type(int type); +void set_gate_option(char option, int x); +void set_noisegate_on_off(gboolean val); +void set_chorusfx_option(char option, int x); +void set_flanger_option(char option, int x); +void set_vibrato_option(char option, int x); +void set_tremolo_option(char option, int x); +void set_envelope_option(char option, int x); +void set_ya_option(char option, int x); +void set_filter_option(char option, int x); +void set_whammy_option(char option, int x); +void set_pitch_option(char option, int x); +void set_ips_option(char option, int x); +void set_chorusfx_type(int type); +void set_chorusfx_on_off(gboolean val); +void set_delay_time(int x); +void set_delay_type(int type); +void set_delay_option(char option, int x); +void set_delay_on_off(gboolean val); +void set_reverb_option(char option, int x); +void set_reverb_type(int type); +void set_reverb_on_off(gboolean val); diff --git a/gui.c b/gui.c index dc2e53b..2562068 100644 --- a/gui.c +++ b/gui.c @@ -17,29 +17,29 @@ #include #include "gdigi.h" -void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, int)) +void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(int)) { int val = gtk_spin_button_get_value_as_int(spinbutton); - callback(handle, val); + callback(val); } -void value_changed_option_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, char, int)) +void value_changed_option_cb(GtkSpinButton *spinbutton, void (*callback)(char, int)) { int val = gtk_spin_button_get_value_as_int(spinbutton); gint option = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(spinbutton), "option_id")); - callback(handle, (char)option, val); + callback((char)option, val); } -void toggled_cb(GtkToggleButton *button, void (*callback)(struct usb_dev_handle*, gboolean)) +void toggled_cb(GtkToggleButton *button, void (*callback)(gboolean)) { gboolean val = gtk_toggle_button_get_active(button); - callback(handle, val); + callback(val); } typedef struct { char *label; - void (*callback)(struct usb_dev_handle*, int); - void (*callback_with_option)(struct usb_dev_handle*, char, int); + void (*callback)(int); + void (*callback_with_option)(char, int); gdouble min; gdouble max; gint option; @@ -416,7 +416,7 @@ GtkWidget *create_table(SettingsWidget *widgets, gint amt) return table; } -GtkWidget *create_on_off_button(const gchar *label, gboolean state, void (*callback)(struct usb_dev_handle*, int)) +GtkWidget *create_on_off_button(const gchar *label, gboolean state, void (*callback)(int)) { GtkWidget *button = gtk_toggle_button_new_with_label(label); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), state); @@ -427,7 +427,7 @@ GtkWidget *create_on_off_button(const gchar *label, gboolean state, void (*callb typedef struct { gint id; gchar *label; - void (*callback)(struct usb_dev_handle*, int); + void (*callback)(int); SettingsWidget *widgets; gint widgets_amt; GtkWidget *child; /* child widget - set inside create_widget_container */ @@ -521,7 +521,7 @@ void combo_box_changed_cb(GtkComboBox *widget, WidgetContainer *widgets) vbox = g_object_get_data(G_OBJECT(widget), "vbox"); if (x != -1) { - widgets[x].callback(handle, widgets[x].id); + widgets[x].callback(widgets[x].id); child = g_object_get_data(G_OBJECT(widget), "active_child"); if (child != NULL) { gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), child); @@ -565,7 +565,7 @@ GtkWidget *create_widget_container(WidgetContainer *widgets, gint amt) typedef struct { char *label; gboolean value; - void (*callback)(struct usb_dev_handle*, gboolean); + void (*callback)(gboolean); WidgetContainer *widgets; gint widgets_amt; } VBoxWidget; diff --git a/tests.c b/tests.c index e8750b5..80cbe5c 100644 --- a/tests.c +++ b/tests.c @@ -16,620 +16,620 @@ #include "gdigi.h" -void test_wah(struct usb_dev_handle *handle) +void test_wah() { int x; - set_wah_type(handle, WAH_TYPE_CRY); + set_wah_type(WAH_TYPE_CRY); for (x=0; x<=99; x++) - set_wah_min(handle, x); + set_wah_min(x); for (x=0; x<=99; x++) - set_wah_max(handle, x); + set_wah_max(x); for (x=0; x<=12; x++) - set_wah_level(handle, x); + set_wah_level(x); - set_wah_type(handle, WAH_TYPE_FULLRANGE); + set_wah_type(WAH_TYPE_FULLRANGE); for (x=0; x<=99; x++) - set_wah_min(handle, x); + set_wah_min(x); for (x=0; x<=99; x++) - set_wah_max(handle, x); + set_wah_max(x); for (x=0; x<=12; x++) - set_wah_level(handle, x); + set_wah_level(x); - set_wah_type(handle, WAH_TYPE_CLYDE); + set_wah_type(WAH_TYPE_CLYDE); for (x=0; x<=99; x++) - set_wah_min(handle, x); + set_wah_min(x); for (x=0; x<=99; x++) - set_wah_max(handle, x); + set_wah_max(x); for (x=0; x<=12; x++) - set_wah_level(handle, x); + set_wah_level(x); - set_wah_on_off(handle, TRUE); - set_wah_on_off(handle, FALSE); + set_wah_on_off(TRUE); + set_wah_on_off(FALSE); } -void test_compressor(struct usb_dev_handle *handle) +void test_compressor() { int x; - set_comp_type(handle, COMP_TYPE_DIGI); + set_comp_type(COMP_TYPE_DIGI); for (x=0; x<=99; x++) - set_comp_sustain(handle, x); + set_comp_sustain(x); for (x=0; x<=99; x++) - set_comp_tone(handle, x); + set_comp_tone(x); for (x=0; x<=99; x++) - set_comp_attack(handle, x); + set_comp_attack(x); for (x=0; x<=99; x++) - set_comp_level(handle, x); + set_comp_level(x); - set_comp_type(handle, COMP_TYPE_CS); + set_comp_type(COMP_TYPE_CS); for (x=0; x<=99; x++) - set_comp_sustain(handle, x); + set_comp_sustain(x); for (x=0; x<=99; x++) - set_comp_attack(handle, x); + set_comp_attack(x); for (x=0; x<=99; x++) - set_comp_level(handle, x); + set_comp_level(x); - set_comp_on_off(handle, TRUE); - set_comp_on_off(handle, FALSE); + set_comp_on_off(TRUE); + set_comp_on_off(FALSE); } -void test_dist(struct usb_dev_handle *handle) +void test_dist() { int x; - set_dist_type(handle, DIST_TYPE_SCREAMER); + set_dist_type(DIST_TYPE_SCREAMER); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_SCREAMER_DRIVE, x); + set_dist_option(DIST_SCREAMER_DRIVE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_SCREAMER_TONE, x); + set_dist_option(DIST_SCREAMER_TONE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_SCREAMER_LVL, x); + set_dist_option(DIST_SCREAMER_LVL, x); - set_dist_type(handle, DIST_TYPE_808); + set_dist_type(DIST_TYPE_808); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_808_OVERDRIVE, x); + set_dist_option(DIST_808_OVERDRIVE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_808_TONE, x); + set_dist_option(DIST_808_TONE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_808_LVL, x); + set_dist_option(DIST_808_LVL, x); - set_dist_type(handle, DIST_TYPE_GUYOD); + set_dist_type(DIST_TYPE_GUYOD); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GUYOD_DRIVE, x); + set_dist_option(DIST_GUYOD_DRIVE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GUYOD_LVL, x); + set_dist_option(DIST_GUYOD_LVL, x); - set_dist_type(handle, DIST_TYPE_DOD250); + set_dist_type(DIST_TYPE_DOD250); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DOD250_GAIN, x); + set_dist_option(DIST_DOD250_GAIN, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DOD250_LVL, x); + set_dist_option(DIST_DOD250_LVL, x); - set_dist_type(handle, DIST_TYPE_RODENT); + set_dist_type(DIST_TYPE_RODENT); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_RODENT_DIST, x); + set_dist_option(DIST_RODENT_DIST, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_RODENT_FILTER, x); + set_dist_option(DIST_RODENT_FILTER, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_RODENT_LVL, x); + set_dist_option(DIST_RODENT_LVL, x); - set_dist_type(handle, DIST_TYPE_MX); + set_dist_type(DIST_TYPE_MX); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_MX_DIST, x); + set_dist_option(DIST_MX_DIST, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_MX_OUTPUT, x); + set_dist_option(DIST_MX_OUTPUT, x); - set_dist_type(handle, DIST_TYPE_DS); + set_dist_type(DIST_TYPE_DS); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DS_GAIN, x); + set_dist_option(DIST_DS_GAIN, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DS_TONE, x); + set_dist_option(DIST_DS_TONE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DS_LVL, x); + set_dist_option(DIST_DS_LVL, x); - set_dist_type(handle, DIST_TYPE_GRUNGE); + set_dist_type(DIST_TYPE_GRUNGE); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GRUNGE_GRUNGE, x); + set_dist_option(DIST_GRUNGE_GRUNGE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GRUNGE_FACE, x); + set_dist_option(DIST_GRUNGE_FACE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GRUNGE_LOUD, x); + set_dist_option(DIST_GRUNGE_LOUD, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GRUNGE_BUTT, x); + set_dist_option(DIST_GRUNGE_BUTT, x); - set_dist_type(handle, DIST_TYPE_ZONE); + set_dist_type(DIST_TYPE_ZONE); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_GAIN, x); + set_dist_option(DIST_ZONE_GAIN, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_LOW, x); + set_dist_option(DIST_ZONE_LOW, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_MID_LVL, x); + set_dist_option(DIST_ZONE_MID_LVL, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_MID_FREQ, x); + set_dist_option(DIST_ZONE_MID_FREQ, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_HIGH, x); + set_dist_option(DIST_ZONE_HIGH, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_ZONE_LEVEL, x); + set_dist_option(DIST_ZONE_LEVEL, x); - set_dist_type(handle, DIST_TYPE_DEATH); + set_dist_type(DIST_TYPE_DEATH); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DEATH_LOW, x); + set_dist_option(DIST_DEATH_LOW, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DEATH_MID, x); + set_dist_option(DIST_DEATH_MID, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DEATH_HIGH, x); + set_dist_option(DIST_DEATH_HIGH, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_DEATH_LVL, x); + set_dist_option(DIST_DEATH_LVL, x); - set_dist_type(handle, DIST_TYPE_GONK); + set_dist_type(DIST_TYPE_GONK); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GONK_GONK, x); + set_dist_option(DIST_GONK_GONK, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GONK_SMEAR, x); + set_dist_option(DIST_GONK_SMEAR, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GONK_SUCK, x); + set_dist_option(DIST_GONK_SUCK, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_GONK_HEAVE, x); + set_dist_option(DIST_GONK_HEAVE, x); - set_dist_type(handle, DIST_TYPE_FUZZY); + set_dist_type(DIST_TYPE_FUZZY); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_FUZZY_FUZZ, x); + set_dist_option(DIST_FUZZY_FUZZ, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_FUZZY_VOLUME, x); + set_dist_option(DIST_FUZZY_VOLUME, x); - set_dist_type(handle, DIST_TYPE_MP); + set_dist_type(DIST_TYPE_MP); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_MP_SUSTAIN, x); + set_dist_option(DIST_MP_SUSTAIN, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_MP_TONE, x); + set_dist_option(DIST_MP_TONE, x); for (x=0; x<=99; x++) - set_dist_option(handle, DIST_MP_VOLUME, x); + set_dist_option(DIST_MP_VOLUME, x); - set_dist_on_off(handle, TRUE); - set_dist_on_off(handle, FALSE); + set_dist_on_off(TRUE); + set_dist_on_off(FALSE); } -void test_presets(struct usb_dev_handle *handle) +void test_presets() { int x; for (x=0; x<=60; x++) - switch_user_preset(handle, x); + switch_user_preset(x); for (x=0; x<=60; x++) - switch_system_preset(handle, x); + switch_system_preset(x); for (x=0; x<=99; x++) - set_preset_level(handle, x); + set_preset_level(x); } -void test_pickups(struct usb_dev_handle *handle) +void test_pickups() { - set_pickup_type(handle, PICKUP_TYPE_HB_SC); - set_pickup_type(handle, PICKUP_TYPE_SC_HB); + set_pickup_type(PICKUP_TYPE_HB_SC); + set_pickup_type(PICKUP_TYPE_SC_HB); - set_pickup_on_off(handle, TRUE); - set_pickup_on_off(handle, FALSE); + set_pickup_on_off(TRUE); + set_pickup_on_off(FALSE); } -void test_eq(struct usb_dev_handle *handle) +void test_eq() { int x; - set_eq_type(handle, EQ_TYPE_BRIGHT); - set_eq_type(handle, EQ_TYPE_MIDBOOST); - set_eq_type(handle, EQ_TYPE_SCOOP); - set_eq_type(handle, EQ_TYPE_WARM); + set_eq_type(EQ_TYPE_BRIGHT); + set_eq_type(EQ_TYPE_MIDBOOST); + set_eq_type(EQ_TYPE_SCOOP); + set_eq_type(EQ_TYPE_WARM); for (x=0; x<=99; x++) - set_eq_gain(handle, x); + set_eq_gain(x); for (x=0; x<=99; x++) - set_eq_level(handle, x); + set_eq_level(x); for (x=0; x<=0x18; x++) - set_eq_bass(handle, x); + set_eq_bass(x); for (x=0; x<=0x18; x++) - set_eq_mid(handle, x); + set_eq_mid(x); for (x=0; x<=4700; x++) - set_eq_mid_hz(handle, x); + set_eq_mid_hz(x); for (x=0; x<=0x18; x++) - set_eq_treble(handle, x); + set_eq_treble(x); for (x=0; x<=7500; x++) - set_eq_treb_hz(handle, x); + set_eq_treb_hz(x); - set_eq_on_off(handle, TRUE); - set_eq_on_off(handle, FALSE); + set_eq_on_off(TRUE); + set_eq_on_off(FALSE); } -void test_noisegate(struct usb_dev_handle *handle) +void test_noisegate() { int x; - set_noisegate_type(handle, NOISEGATE_GATE); + set_noisegate_type(NOISEGATE_GATE); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_GATE_TRESHOLD, x); + set_gate_option(NOISEGATE_GATE_TRESHOLD, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_ATTACK, x); + set_gate_option(NOISEGATE_ATTACK, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_RELEASE, x); + set_gate_option(NOISEGATE_RELEASE, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_ATTN, x); + set_gate_option(NOISEGATE_ATTN, x); - set_noisegate_type(handle, NOISEGATE_SWELL); + set_noisegate_type(NOISEGATE_SWELL); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_SWELL_SENS, x); + set_gate_option(NOISEGATE_SWELL_SENS, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_ATTACK, x); + set_gate_option(NOISEGATE_ATTACK, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_RELEASE, x); + set_gate_option(NOISEGATE_RELEASE, x); for (x=0; x<=99; x++) - set_gate_option(handle, NOISEGATE_ATTN, x); + set_gate_option(NOISEGATE_ATTN, x); - set_noisegate_on_off(handle, TRUE); - set_noisegate_on_off(handle, FALSE); + set_noisegate_on_off(TRUE); + set_noisegate_on_off(FALSE); } -void test_chorusfx(struct usb_dev_handle *handle) +void test_chorusfx() { int x; - set_chorusfx_type(handle, CHORUS_TYPE_CE); + set_chorusfx_type(CHORUS_TYPE_CE); for (x=0; x<=99; x++) - set_chorusfx_option(handle, CE_CHORUS_SPEED, x); + set_chorusfx_option(CE_CHORUS_SPEED, x); for (x=0; x<=99; x++) - set_chorusfx_option(handle, CE_CHORUS_DEPTH, x); + set_chorusfx_option(CE_CHORUS_DEPTH, x); - set_chorusfx_type(handle, CHORUS_TYPE_DUAL); + set_chorusfx_type(CHORUS_TYPE_DUAL); for (x=0; x<=99; x++) - set_chorusfx_option(handle, DUAL_CHORUS_SPEED, x); + set_chorusfx_option(DUAL_CHORUS_SPEED, x); for (x=0; x<=99; x++) - set_chorusfx_option(handle, DUAL_CHORUS_DEPTH, x); + set_chorusfx_option(DUAL_CHORUS_DEPTH, x); for (x=0; x<=99; x++) - set_chorusfx_option(handle, DUAL_CHORUS_LEVEL, x); - set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_TRI); - set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_SINE); - set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_SQUARE); + set_chorusfx_option(DUAL_CHORUS_LEVEL, x); + set_chorusfx_option(DUAL_CHORUS_WAVE, WAVE_TRI); + set_chorusfx_option(DUAL_CHORUS_WAVE, WAVE_SINE); + set_chorusfx_option(DUAL_CHORUS_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_MULTI); + set_chorusfx_type(CHORUS_TYPE_MULTI); for (x=0; x<=99; x++) - set_chorusfx_option(handle, MULTI_CHORUS_SPEED, x); + set_chorusfx_option(MULTI_CHORUS_SPEED, x); for (x=0; x<=99; x++) - set_chorusfx_option(handle, MULTI_CHORUS_DEPTH, x); + set_chorusfx_option(MULTI_CHORUS_DEPTH, x); for (x=0; x<=99; x++) - set_chorusfx_option(handle, MULTI_CHORUS_LEVEL, x); - set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_TRI); - set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_SINE); - set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_SQUARE); + set_chorusfx_option(MULTI_CHORUS_LEVEL, x); + set_chorusfx_option(MULTI_CHORUS_WAVE, WAVE_TRI); + set_chorusfx_option(MULTI_CHORUS_WAVE, WAVE_SINE); + set_chorusfx_option(MULTI_CHORUS_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_FLANGER); + set_chorusfx_type(CHORUS_TYPE_FLANGER); for (x=0; x<=99; x++) - set_flanger_option(handle, FLANGER_SPEED, x); + set_flanger_option(FLANGER_SPEED, x); for (x=0; x<=99; x++) - set_flanger_option(handle, FLANGER_DEPTH, x); + set_flanger_option(FLANGER_DEPTH, x); for (x=0; x<=99; x++) - set_flanger_option(handle, FLANGER_REGEN, x); + set_flanger_option(FLANGER_REGEN, x); for (x=0; x<=99; x++) - set_flanger_option(handle, FLANGER_LEVEL, x); - set_flanger_option(handle, FLANGER_WAVE, WAVE_TRI); - set_flanger_option(handle, FLANGER_WAVE, WAVE_SINE); - set_flanger_option(handle, FLANGER_WAVE, WAVE_SQUARE); + set_flanger_option(FLANGER_LEVEL, x); + set_flanger_option(FLANGER_WAVE, WAVE_TRI); + set_flanger_option(FLANGER_WAVE, WAVE_SINE); + set_flanger_option(FLANGER_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_MXR_FLANGER); + set_chorusfx_type(CHORUS_TYPE_MXR_FLANGER); for (x=0; x<=99; x++) - set_flanger_option(handle, MXR_FLANGER_SPEED, x); + set_flanger_option(MXR_FLANGER_SPEED, x); for (x=0; x<=99; x++) - set_flanger_option(handle, MXR_FLANGER_WIDTH, x); + set_flanger_option(MXR_FLANGER_WIDTH, x); for (x=0; x<=99; x++) - set_flanger_option(handle, MXR_FLANGER_REGEN, x); + set_flanger_option(MXR_FLANGER_REGEN, x); for (x=0; x<=99; x++) - set_flanger_option(handle, MXR_FLANGER_MANUAL, x); + set_flanger_option(MXR_FLANGER_MANUAL, x); - set_chorusfx_type(handle, CHORUS_TYPE_PHASER); + set_chorusfx_type(CHORUS_TYPE_PHASER); for (x=0; x<=99; x++) - set_flanger_option(handle, PHASER_SPEED, x); + set_flanger_option(PHASER_SPEED, x); for (x=0; x<=99; x++) - set_flanger_option(handle, PHASER_DEPTH, x); + set_flanger_option(PHASER_DEPTH, x); for (x=0; x<=99; x++) - set_flanger_option(handle, PHASER_REGEN, x); + set_flanger_option(PHASER_REGEN, x); for (x=0; x<=99; x++) - set_flanger_option(handle, PHASER_LEVEL, x); - set_flanger_option(handle, PHASER_WAVE, WAVE_TRI); - set_flanger_option(handle, PHASER_WAVE, WAVE_SINE); - set_flanger_option(handle, PHASER_WAVE, WAVE_SQUARE); + set_flanger_option(PHASER_LEVEL, x); + set_flanger_option(PHASER_WAVE, WAVE_TRI); + set_flanger_option(PHASER_WAVE, WAVE_SINE); + set_flanger_option(PHASER_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_VIBRATO); + set_chorusfx_type(CHORUS_TYPE_VIBRATO); for (x=0; x<=99; x++) - set_vibrato_option(handle, VIBRATO_SPEED, x); + set_vibrato_option(VIBRATO_SPEED, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, VIBRATO_DEPTH, x); + set_vibrato_option(VIBRATO_DEPTH, x); - set_chorusfx_type(handle, CHORUS_TYPE_ROTARY); + set_chorusfx_type(CHORUS_TYPE_ROTARY); for (x=0; x<=99; x++) - set_vibrato_option(handle, ROTARY_SPEED, x); + set_vibrato_option(ROTARY_SPEED, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, ROTARY_INTENSITY, x); + set_vibrato_option(ROTARY_INTENSITY, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, ROTARY_DOPPLER, x); + set_vibrato_option(ROTARY_DOPPLER, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, ROTARY_CROSSOVER, x); + set_vibrato_option(ROTARY_CROSSOVER, x); - set_chorusfx_type(handle, CHORUS_TYPE_VIBROPAN); + set_chorusfx_type(CHORUS_TYPE_VIBROPAN); for (x=0; x<=99; x++) - set_vibrato_option(handle, VIBROPAN_SPEED, x); + set_vibrato_option(VIBROPAN_SPEED, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, VIBROPAN_DEPTH, x); + set_vibrato_option(VIBROPAN_DEPTH, x); for (x=0; x<=99; x++) - set_vibrato_option(handle, VIBROPAN_VIBRA, x); - set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_TRI); - set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_SINE); - set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_SQUARE); + set_vibrato_option(VIBROPAN_VIBRA, x); + set_vibrato_option(VIBROPAN_WAVE, WAVE_TRI); + set_vibrato_option(VIBROPAN_WAVE, WAVE_SINE); + set_vibrato_option(VIBROPAN_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_TREMOLO); + set_chorusfx_type(CHORUS_TYPE_TREMOLO); for (x=0; x<=99; x++) - set_tremolo_option(handle, TREMOLO_SPEED, x); + set_tremolo_option(TREMOLO_SPEED, x); for (x=0; x<=99; x++) - set_tremolo_option(handle, TREMOLO_DEPTH, x); - set_tremolo_option(handle, TREMOLO_WAVE, WAVE_TRI); - set_tremolo_option(handle, TREMOLO_WAVE, WAVE_SINE); - set_tremolo_option(handle, TREMOLO_WAVE, WAVE_SQUARE); + set_tremolo_option(TREMOLO_DEPTH, x); + set_tremolo_option(TREMOLO_WAVE, WAVE_TRI); + set_tremolo_option(TREMOLO_WAVE, WAVE_SINE); + set_tremolo_option(TREMOLO_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_PANNER); + set_chorusfx_type(CHORUS_TYPE_PANNER); for (x=0; x<=99; x++) - set_tremolo_option(handle, PANNER_SPEED, x); + set_tremolo_option(PANNER_SPEED, x); for (x=0; x<=99; x++) - set_tremolo_option(handle, PANNER_DEPTH, x); - set_tremolo_option(handle, PANNER_WAVE, WAVE_TRI); - set_tremolo_option(handle, PANNER_WAVE, WAVE_SINE); - set_tremolo_option(handle, PANNER_WAVE, WAVE_SQUARE); + set_tremolo_option(PANNER_DEPTH, x); + set_tremolo_option(PANNER_WAVE, WAVE_TRI); + set_tremolo_option(PANNER_WAVE, WAVE_SINE); + set_tremolo_option(PANNER_WAVE, WAVE_SQUARE); - set_chorusfx_type(handle, CHORUS_TYPE_ENVELOPE); + set_chorusfx_type(CHORUS_TYPE_ENVELOPE); for (x=0; x<=99; x++) - set_envelope_option(handle, ENVELOPE_SENSITIVITY, x); + set_envelope_option(ENVELOPE_SENSITIVITY, x); for (x=0; x<=99; x++) - set_envelope_option(handle, ENVELOPE_RANGE, x); + set_envelope_option(ENVELOPE_RANGE, x); - set_chorusfx_type(handle, CHORUS_TYPE_AUTOYA); + set_chorusfx_type(CHORUS_TYPE_AUTOYA); for (x=0; x<=99; x++) - set_ya_option(handle, AUTOYA_SPEED, x); + set_ya_option(AUTOYA_SPEED, x); for (x=0; x<=99; x++) - set_ya_option(handle, AUTOYA_INTENSITY, x); + set_ya_option(AUTOYA_INTENSITY, x); for (x=0; x<=0x31; x++) - set_ya_option(handle, AUTOYA_RANGE, x); + set_ya_option(AUTOYA_RANGE, x); - set_chorusfx_type(handle, CHORUS_TYPE_YAYA); + set_chorusfx_type(CHORUS_TYPE_YAYA); for (x=0; x<=99; x++) - set_ya_option(handle, YAYA_PEDAL, x); + set_ya_option(YAYA_PEDAL, x); for (x=0; x<=99; x++) - set_ya_option(handle, YAYA_INTENSITY, x); + set_ya_option(YAYA_INTENSITY, x); for (x=0; x<=0x31; x++) - set_ya_option(handle, YAYA_RANGE, x); + set_ya_option(YAYA_RANGE, x); - set_chorusfx_type(handle, CHORUS_TYPE_STEP_FILTER); + set_chorusfx_type(CHORUS_TYPE_STEP_FILTER); for (x=0; x<=99; x++) - set_filter_option(handle, STEP_FILTER_SPEED, x); + set_filter_option(STEP_FILTER_SPEED, x); for (x=0; x<=99; x++) - set_filter_option(handle, STEP_FILTER_INTENSITY, x); + set_filter_option(STEP_FILTER_INTENSITY, x); - set_chorusfx_type(handle, CHORUS_TYPE_WHAMMY); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_UP); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2OCT_UP); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2ND_DN); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_RV_2ND); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_4TH_DN); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_DN); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2OCT_DN); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_DIV_BMB); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_M3_MA); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2ND_MA3); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_3RD_4TH); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_4TH_5TH); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_5TH_OCT); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_HOCT_UP); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_HOCT_DN); - set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_UD); + set_chorusfx_type(CHORUS_TYPE_WHAMMY); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_OCT_UP); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_2OCT_UP); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_2ND_DN); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_RV_2ND); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_4TH_DN); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_OCT_DN); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_2OCT_DN); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_DIV_BMB); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_M3_MA); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_2ND_MA3); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_3RD_4TH); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_4TH_5TH); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_5TH_OCT); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_HOCT_UP); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_HOCT_DN); + set_whammy_option(WHAMMY_AMOUNT, WHAMMY_OCT_UD); for (x=0; x<=99; x++) - set_whammy_option(handle, WHAMMY_PEDAL, x); + set_whammy_option(WHAMMY_PEDAL, x); for (x=0; x<=99; x++) - set_whammy_option(handle, WHAMMY_MIX, x); + set_whammy_option(WHAMMY_MIX, x); - set_chorusfx_type(handle, CHORUS_TYPE_PITCH_SHIFT); + set_chorusfx_type(CHORUS_TYPE_PITCH_SHIFT); for (x=0; x<=0x30; x++) - set_pitch_option(handle, PITCH_AMOUNT, x); + set_pitch_option(PITCH_AMOUNT, x); for (x=0; x<=99; x++) - set_pitch_option(handle, PITCH_MIX, x); + set_pitch_option(PITCH_MIX, x); - set_chorusfx_type(handle, CHORUS_TYPE_DETUNE); + set_chorusfx_type(CHORUS_TYPE_DETUNE); for (x=0; x<=0x30; x++) - set_pitch_option(handle, DETUNE_AMOUNT, x); + set_pitch_option(DETUNE_AMOUNT, x); for (x=0; x<=99; x++) - set_pitch_option(handle, DETUNE_LEVEL, x); + set_pitch_option(DETUNE_LEVEL, x); - set_chorusfx_type(handle, CHORUS_TYPE_IPS); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_OCT_D); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_7TH_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_6TH_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_5TH_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_4TH_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_3RD_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_2ND_DN); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_2ND_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_3RD_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_4TH_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_5TH_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_6TH_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_7TH_UP); - set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_OCT_U); - set_ips_option(handle, IPS_KEY, IPS_E); - set_ips_option(handle, IPS_KEY, IPS_F); - set_ips_option(handle, IPS_KEY, IPS_GB); - set_ips_option(handle, IPS_KEY, IPS_G); - set_ips_option(handle, IPS_KEY, IPS_AB); - set_ips_option(handle, IPS_KEY, IPS_A); - set_ips_option(handle, IPS_KEY, IPS_BB); - set_ips_option(handle, IPS_KEY, IPS_B); - set_ips_option(handle, IPS_KEY, IPS_C); - set_ips_option(handle, IPS_KEY, IPS_DD); - set_ips_option(handle, IPS_KEY, IPS_D); - set_ips_option(handle, IPS_KEY, IPS_EB); - set_ips_option(handle, IPS_SCALE, IPS_MAJOR); - set_ips_option(handle, IPS_SCALE, IPS_MINOR); - set_ips_option(handle, IPS_SCALE, IPS_DORIA); - set_ips_option(handle, IPS_SCALE, IPS_MIXLYD); - set_ips_option(handle, IPS_SCALE, IPS_LYDIAN); - set_ips_option(handle, IPS_SCALE, IPS_HMINO); + set_chorusfx_type(CHORUS_TYPE_IPS); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_OCT_D); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_7TH_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_6TH_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_5TH_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_4TH_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_3RD_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_2ND_DN); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_2ND_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_3RD_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_4TH_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_5TH_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_6TH_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_7TH_UP); + set_ips_option(IPS_SHIFT_AMOUNT, IPS_OCT_U); + set_ips_option(IPS_KEY, IPS_E); + set_ips_option(IPS_KEY, IPS_F); + set_ips_option(IPS_KEY, IPS_GB); + set_ips_option(IPS_KEY, IPS_G); + set_ips_option(IPS_KEY, IPS_AB); + set_ips_option(IPS_KEY, IPS_A); + set_ips_option(IPS_KEY, IPS_BB); + set_ips_option(IPS_KEY, IPS_B); + set_ips_option(IPS_KEY, IPS_C); + set_ips_option(IPS_KEY, IPS_DD); + set_ips_option(IPS_KEY, IPS_D); + set_ips_option(IPS_KEY, IPS_EB); + set_ips_option(IPS_SCALE, IPS_MAJOR); + set_ips_option(IPS_SCALE, IPS_MINOR); + set_ips_option(IPS_SCALE, IPS_DORIA); + set_ips_option(IPS_SCALE, IPS_MIXLYD); + set_ips_option(IPS_SCALE, IPS_LYDIAN); + set_ips_option(IPS_SCALE, IPS_HMINO); for (x=0; x<=99; x++) - set_ips_option(handle, IPS_LEVEL, x); + set_ips_option(IPS_LEVEL, x); - set_chorusfx_on_off(handle, TRUE); - set_chorusfx_on_off(handle, FALSE); + set_chorusfx_on_off(TRUE); + set_chorusfx_on_off(FALSE); } -void test_delay(struct usb_dev_handle *handle) +void test_delay() { int x; - set_delay_type(handle, DELAY_TYPE_ANALOG); + set_delay_type(DELAY_TYPE_ANALOG); for (x=0; x<=139; x++) - set_delay_time(handle, x); + set_delay_time(x); for (x=0; x<=99; x++) - set_delay_option(handle, ANALOG_LEVEL, x); + set_delay_option(ANALOG_LEVEL, x); for (x=0; x<=100; x++) - set_delay_option(handle, ANALOG_REPEATS, x); + set_delay_option(ANALOG_REPEATS, x); - set_delay_type(handle, DELAY_TYPE_DIGITAL); + set_delay_type(DELAY_TYPE_DIGITAL); for (x=0; x<=139; x++) - set_delay_time(handle, x); + set_delay_time(x); for (x=0; x<=99; x++) - set_delay_option(handle, DIGITAL_LEVEL, x); + set_delay_option(DIGITAL_LEVEL, x); for (x=0; x<=100; x++) - set_delay_option(handle, DIGITAL_REPEATS, x); + set_delay_option(DIGITAL_REPEATS, x); for (x=0; x<=99; x++) - set_delay_option(handle, DIGITAL_DUCKER_THRESH, x); + set_delay_option(DIGITAL_DUCKER_THRESH, x); for (x=0; x<=99; x++) - set_delay_option(handle, DIGITAL_DUCKER_LEVEL, x); + set_delay_option(DIGITAL_DUCKER_LEVEL, x); - set_delay_type(handle, DELAY_TYPE_MODULATED); + set_delay_type(DELAY_TYPE_MODULATED); for (x=0; x<=139; x++) - set_delay_time(handle, x); + set_delay_time(x); for (x=0; x<=99; x++) - set_delay_option(handle, MODULATED_LEVEL, x); + set_delay_option(MODULATED_LEVEL, x); for (x=0; x<=100; x++) - set_delay_option(handle, MODULATED_REPEATS, x); + set_delay_option(MODULATED_REPEATS, x); for (x=0; x<=99; x++) - set_delay_option(handle, MODULATED_DEPTH, x); + set_delay_option(MODULATED_DEPTH, x); - set_delay_type(handle, DELAY_TYPE_PONG); + set_delay_type(DELAY_TYPE_PONG); for (x=0; x<=139; x++) - set_delay_time(handle, x); + set_delay_time(x); for (x=0; x<=99; x++) - set_delay_option(handle, PONG_LEVEL, x); + set_delay_option(PONG_LEVEL, x); for (x=0; x<=100; x++) - set_delay_option(handle, PONG_REPEATS, x); + set_delay_option(PONG_REPEATS, x); for (x=0; x<=99; x++) - set_delay_option(handle, PONG_DUCKER_THRESH, x); + set_delay_option(PONG_DUCKER_THRESH, x); for (x=0; x<=99; x++) - set_delay_option(handle, PONG_DUCKER_LEVEL, x); + set_delay_option(PONG_DUCKER_LEVEL, x); - set_delay_type(handle, DELAY_TYPE_TAPE); + set_delay_type(DELAY_TYPE_TAPE); for (x=0; x<=139; x++) - set_delay_time(handle, x); + set_delay_time(x); for (x=0; x<=99; x++) - set_delay_option(handle, TAPE_LEVEL, x); + set_delay_option(TAPE_LEVEL, x); for (x=0; x<=100; x++) - set_delay_option(handle, TAPE_REPEATS, x); + set_delay_option(TAPE_REPEATS, x); for (x=0; x<=99; x++) - set_delay_option(handle, TAPE_WOW, x); + set_delay_option(TAPE_WOW, x); for (x=0; x<=99; x++) - set_delay_option(handle, TAPE_FLUTTER, x); + set_delay_option(TAPE_FLUTTER, x); - set_delay_on_off(handle, TRUE); - set_delay_on_off(handle, FALSE); + set_delay_on_off(TRUE); + set_delay_on_off(FALSE); } -void test_reverb(struct usb_dev_handle *handle) +void test_reverb() { int x; - set_reverb_type(handle, REVERB_TYPE_TWIN); + set_reverb_type(REVERB_TYPE_TWIN); for (x=0; x<=99; x++) - set_reverb_option(handle, TWIN_REVERB, x); + set_reverb_option(TWIN_REVERB, x); - set_reverb_type(handle, REVERB_TYPE_LEX_AMBIENCE); + set_reverb_type(REVERB_TYPE_LEX_AMBIENCE); for (x=0; x<=15; x++) - set_reverb_option(handle, LEX_AMBIENCE_PREDELAY, x); + set_reverb_option(LEX_AMBIENCE_PREDELAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_AMBIENCE_DECAY, x); + set_reverb_option(LEX_AMBIENCE_DECAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_AMBIENCE_LIVELINESS, x); + set_reverb_option(LEX_AMBIENCE_LIVELINESS, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_AMBIENCE_LEVEL, x); + set_reverb_option(LEX_AMBIENCE_LEVEL, x); - set_reverb_type(handle, REVERB_TYPE_LEX_STUDIO); + set_reverb_type(REVERB_TYPE_LEX_STUDIO); for (x=0; x<=15; x++) - set_reverb_option(handle, LEX_STUDIO_PREDELAY, x); + set_reverb_option(LEX_STUDIO_PREDELAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_STUDIO_DECAY, x); + set_reverb_option(LEX_STUDIO_DECAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_STUDIO_LIVELINESS, x); + set_reverb_option(LEX_STUDIO_LIVELINESS, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_STUDIO_LEVEL, x); + set_reverb_option(LEX_STUDIO_LEVEL, x); - set_reverb_type(handle, REVERB_TYPE_LEX_ROOM); + set_reverb_type(REVERB_TYPE_LEX_ROOM); for (x=0; x<=15; x++) - set_reverb_option(handle, LEX_ROOM_PREDELAY, x); + set_reverb_option(LEX_ROOM_PREDELAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_ROOM_DECAY, x); + set_reverb_option(LEX_ROOM_DECAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_ROOM_LIVELINESS, x); + set_reverb_option(LEX_ROOM_LIVELINESS, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_ROOM_LEVEL, x); + set_reverb_option(LEX_ROOM_LEVEL, x); - set_reverb_type(handle, REVERB_TYPE_LEX_HALL); + set_reverb_type(REVERB_TYPE_LEX_HALL); for (x=0; x<=15; x++) - set_reverb_option(handle, LEX_HALL_PREDELAY, x); + set_reverb_option(LEX_HALL_PREDELAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_HALL_DECAY, x); + set_reverb_option(LEX_HALL_DECAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_HALL_LIVELINESS, x); + set_reverb_option(LEX_HALL_LIVELINESS, x); for (x=0; x<=99; x++) - set_reverb_option(handle, LEX_HALL_LEVEL, x); + set_reverb_option(LEX_HALL_LEVEL, x); - set_reverb_type(handle, REVERB_TYPE_EMT240_PLATE); + set_reverb_type(REVERB_TYPE_EMT240_PLATE); for (x=0; x<=15; x++) - set_reverb_option(handle, EMT240_PLATE_PREDELAY, x); + set_reverb_option(EMT240_PLATE_PREDELAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, EMT240_PLATE_DECAY, x); + set_reverb_option(EMT240_PLATE_DECAY, x); for (x=0; x<=99; x++) - set_reverb_option(handle, EMT240_PLATE_LIVELINESS, x); + set_reverb_option(EMT240_PLATE_LIVELINESS, x); for (x=0; x<=99; x++) - set_reverb_option(handle, EMT240_PLATE_LEVEL, x); + set_reverb_option(EMT240_PLATE_LEVEL, x); - set_reverb_on_off(handle, TRUE); - set_reverb_on_off(handle, FALSE); + set_reverb_on_off(TRUE); + set_reverb_on_off(FALSE); } -void test_all(struct usb_dev_handle *handle) +void test_all() { - test_wah(handle); - test_compressor(handle); - test_dist(handle); - test_presets(handle); - test_pickups(handle); - test_eq(handle); - test_noisegate(handle); - test_chorusfx(handle); - test_delay(handle); - test_reverb(handle); + test_wah(); + test_compressor(); + test_dist(); + test_presets(); + test_pickups(); + test_eq(); + test_noisegate(); + test_chorusfx(); + test_delay(); + test_reverb(); } diff --git a/tests.h b/tests.h index ff7fbd6..f111c9d 100644 --- a/tests.h +++ b/tests.h @@ -16,14 +16,14 @@ #include "gdigi.h" -void test_wah(struct usb_dev_handle *handle); -void test_compressor(struct usb_dev_handle *handle); -void test_dist(struct usb_dev_handle *handle); -void test_presets(struct usb_dev_handle *handle); -void test_pickups(struct usb_dev_handle *handle); -void test_eq(struct usb_dev_handle *handle); -void test_noisegate(struct usb_dev_handle *handle); -void test_chorusfx(struct usb_dev_handle *handle); -void test_delay(struct usb_dev_handle *handle); -void test_reverb(struct usb_dev_handle *handle); -void test_all(struct usb_dev_handle *handle); +void test_wah(); +void test_compressor(); +void test_dist(); +void test_presets(); +void test_pickups(); +void test_eq(); +void test_noisegate(); +void test_chorusfx(); +void test_delay(); +void test_reverb(); +void test_all();