From 2f473b441535a228e18220f9d97c74c3fe8fabf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Sun, 1 Feb 2009 14:55:26 +0100 Subject: [PATCH] code splitting --- Makefile | 8 +- TODO | 1 + gdigi.c | 951 +------------------------------------------------------ gdigi.h | 386 ++++++++++++++++++++++ gui.c | 116 +++++++ gui.h | 17 + tests.c | 626 ++++++++++++++++++++++++++++++++++++ tests.h | 29 ++ 8 files changed, 1183 insertions(+), 951 deletions(-) create mode 100644 gdigi.h create mode 100644 gui.c create mode 100644 gui.h create mode 100644 tests.c create mode 100644 tests.h diff --git a/Makefile b/Makefile index ef9dcc9..e173a1b 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,15 @@ LIBS = `pkg-config --libs glib-2.0 gtk+-2.0 libusb` all: gdigi -gdigi: gdigi.o - $(CC) $(LIBS) $(OFLAG) gdigi gdigi.o +gdigi: gdigi.o tests.o gui.o + $(CC) $(LIBS) $(OFLAG) gdigi gdigi.o tests.o gui.o gdigi.o: gdigi.c +tests.o: tests.c + +gui.o: gui.c + clean: rm *.o diff --git a/TODO b/TODO index 8f61811..e0699b3 100644 --- a/TODO +++ b/TODO @@ -9,3 +9,4 @@ -effects library -effects level -handling presets (loading, saving, exporting/importing to/from xml patches) +-buildsystem diff --git a/gdigi.c b/gdigi.c index 7b0fd8b..ae9e57d 100644 --- a/gdigi.c +++ b/gdigi.c @@ -14,10 +14,9 @@ * along with this program. If not, see . */ -#include #include -#include -#include +#include "gdigi.h" +#include "gui.h" #define TIMEOUT 1000 @@ -162,12 +161,6 @@ void set_wah_level(struct usb_dev_handle *handle, int level) printf("wrote: %d\n", i); } -enum { - WAH_TYPE_CRY = 0, - WAH_TYPE_FULLRANGE, - WAH_TYPE_CLYDE -}; - void set_wah_type(struct usb_dev_handle *handle, 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}; @@ -253,11 +246,6 @@ void set_comp_level(struct usb_dev_handle *handle, int level) printf("wrote: %d\n", i); } -enum { - COMP_TYPE_DIGI = 0, - COMP_TYPE_CS -}; - void set_comp_type(struct usb_dev_handle *handle, 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}; @@ -327,11 +315,6 @@ void switch_system_preset(struct usb_dev_handle *handle, int x) printf("wrote: %d\n", i); } -enum { - PICKUP_TYPE_HB_SC = 0, - PICKUP_TYPE_SC_HB -}; - void set_pickup_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7}; @@ -364,22 +347,6 @@ void set_pickup_on_off(struct usb_dev_handle *handle, gboolean val) printf("wrote: %d\n", i); } -enum { - DIST_TYPE_SCREAMER = 0, - DIST_TYPE_808, - DIST_TYPE_GUYOD, - DIST_TYPE_DOD250, - DIST_TYPE_RODENT, - DIST_TYPE_MX, - DIST_TYPE_DS, - DIST_TYPE_GRUNGE, - DIST_TYPE_ZONE, - DIST_TYPE_DEATH, - DIST_TYPE_GONK, - DIST_TYPE_FUZZY, - DIST_TYPE_MP -}; - void set_dist_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7, 0x00}; @@ -406,48 +373,6 @@ void set_dist_type(struct usb_dev_handle *handle, int type) printf("wrote: %d\n", i); } -#define DIST_SCREAMER_DRIVE 0x02 -#define DIST_SCREAMER_TONE 0x03 -#define DIST_SCREAMER_LVL 0x04 -#define DIST_808_OVERDRIVE 0x29 -#define DIST_808_TONE 0x2A -#define DIST_808_LVL 0x2B -#define DIST_GUYOD_DRIVE 0x10 -#define DIST_GUYOD_LVL 0x11 -#define DIST_DOD250_GAIN 0x0B -#define DIST_DOD250_LVL 0x0C -#define DIST_RODENT_DIST 0x05 -#define DIST_RODENT_FILTER 0x06 -#define DIST_RODENT_LVL 0x07 -#define DIST_MX_DIST 0x24 -#define DIST_MX_OUTPUT 0x25 -#define DIST_DS_GAIN 0x08 -#define DIST_DS_TONE 0x09 -#define DIST_DS_LVL 0x0A -#define DIST_GRUNGE_GRUNGE 0x16 -#define DIST_GRUNGE_FACE 0x18 -#define DIST_GRUNGE_LOUD 0x19 -#define DIST_GRUNGE_BUTT 0x17 -#define DIST_ZONE_GAIN 0x1C -#define DIST_ZONE_LOW 0x1F -#define DIST_ZONE_MID_LVL 0x1E -#define DIST_ZONE_MID_FREQ 0x1D -#define DIST_ZONE_HIGH 0x20 -#define DIST_ZONE_LEVEL 0x21 -#define DIST_DEATH_LOW 0x2D -#define DIST_DEATH_MID 0x2C -#define DIST_DEATH_HIGH 0x2F -#define DIST_DEATH_LVL 0x2E -#define DIST_GONK_GONK 0x30 -#define DIST_GONK_SMEAR 0x27 -#define DIST_GONK_SUCK 0x26 -#define DIST_GONK_HEAVE 0x28 -#define DIST_FUZZY_FUZZ 0x1A -#define DIST_FUZZY_VOLUME 0x1B -#define DIST_MP_SUSTAIN 0x0D -#define DIST_MP_TONE 0x0E -#define DIST_MP_VOLUME 0x0F - void set_dist_option(struct usb_dev_handle *handle, 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}; @@ -573,11 +498,6 @@ void set_eq_on_off(struct usb_dev_handle *handle, gboolean val) printf("wrote: %d\n", i); } -enum { - NOISEGATE_GATE = 0, - NOISEGATE_SWELL -}; - void set_noisegate_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7, 0x00}; @@ -593,15 +513,6 @@ void set_noisegate_type(struct usb_dev_handle *handle, int type) printf("wrote: %d\n", i); } -/* available only in Gate mode */ -#define NOISEGATE_GATE_TRESHOLD 0x46 -/* available only in Swell mode */ -#define NOISEGATE_SWELL_SENS 0x47 -/* available in both Gate and Swell modes */ -#define NOISEGATE_ATTACK 0x48 -#define NOISEGATE_RELEASE 0x49 -#define NOISEGATE_ATTN 0x4A - /* x = 0 to 99 */ void set_gate_option(struct usb_dev_handle *handle, char option, int x) { @@ -633,144 +544,6 @@ void set_noisegate_on_off(struct usb_dev_handle *handle, gboolean val) printf("wrote: %d\n", i); } -#define CE_CHORUS_SPEED 0x45 -#define CE_CHORUS_DEPTH 0x46 -#define DUAL_CHORUS_SPEED 0x45 -#define DUAL_CHORUS_DEPTH 0x46 -#define DUAL_CHORUS_LEVEL 0x44 -#define DUAL_CHORUS_WAVE 0x48 -/* DUAL_CHORUS_WAVE, MULTI_CHORUS_WAVE, FLANGER_WAVE, PHASER_WAVE and VIBROPAN_WAVE valid values */ -#define WAVE_TRI 0x00 -#define WAVE_SINE 0x01 -#define WAVE_SQUARE 0x02 - -#define MULTI_CHORUS_SPEED 0x45 -#define MULTI_CHORUS_DEPTH 0x46 -#define MULTI_CHORUS_WAVE 0x48 -#define MULTI_CHORUS_LEVEL 0x44 - -#define FLANGER_SPEED 0x06 -#define FLANGER_DEPTH 0x07 -#define FLANGER_REGEN 0x08 -#define FLANGER_LEVEL 0x05 -#define FLANGER_WAVE 0x09 - -#define MXR_FLANGER_SPEED 0x06 -#define MXR_FLANGER_WIDTH 0x12 -#define MXR_FLANGER_REGEN 0x08 -#define MXR_FLANGER_MANUAL 0x15 - -#define PHASER_SPEED 0x42 -#define PHASER_DEPTH 0x43 -#define PHASER_REGEN 0x46 -#define PHASER_LEVEL 0x45 -#define PHASER_WAVE 0x47 - -#define VIBRATO_SPEED 0x04 -#define VIBRATO_DEPTH 0x05 - -#define ROTARY_SPEED 0x42 -#define ROTARY_INTENSITY 0x44 -#define ROTARY_DOPPLER 0x46 -#define ROTARY_CROSSOVER 0x47 - -#define VIBROPAN_SPEED 0x22 -#define VIBROPAN_DEPTH 0x23 -#define VIBROPAN_VIBRA 0x24 -#define VIBROPAN_WAVE 0x25 - -#define TREMOLO_SPEED 0x04 -#define TREMOLO_DEPTH 0x03 -#define TREMOLO_WAVE 0x05 - -#define PANNER_SPEED 0x44 -#define PANNER_DEPTH 0x43 -#define PANNER_WAVE 0x45 - -#define ENVELOPE_SENSITIVITY 0x46 -#define ENVELOPE_RANGE 0x45 - -#define AUTOYA_SPEED 0x46 -#define AUTOYA_INTENSITY 0x4A -#define AUTOYA_RANGE 0x4B - -#define YAYA_PEDAL 0x02 -#define YAYA_INTENSITY 0x09 -#define YAYA_RANGE 0x0A - -#define STEP_FILTER_SPEED 0x42 -#define STEP_FILTER_INTENSITY 0x43 - -#define WHAMMY_AMOUNT 0x05 -#define WHAMMY_PEDAL 0x03 -#define WHAMMY_MIX 0x04 -/* WHAMMY_AMOUNT valid values */ -#define WHAMMY_OCT_UP 0x00 -#define WHAMMY_2OCT_UP 0x01 -#define WHAMMY_2ND_DN 0x02 -#define WHAMMY_RV_2ND 0x03 -#define WHAMMY_4TH_DN 0x04 -#define WHAMMY_OCT_DN 0x05 -#define WHAMMY_2OCT_DN 0x06 -#define WHAMMY_DIV_BMB 0x07 -#define WHAMMY_M3_MA 0x08 -#define WHAMMY_2ND_MA3 0x09 -#define WHAMMY_3RD_4TH 0x0A -#define WHAMMY_4TH_5TH 0x0B -#define WHAMMY_5TH_OCT 0x0C -#define WHAMMY_HOCT_UP 0x0D -#define WHAMMY_HOCT_DN 0x0E -#define WHAMMY_OCT_UD 0x0F - -#define PITCH_AMOUNT 0x42 -#define PITCH_MIX 0x51 - -#define DETUNE_AMOUNT 0x04 -#define DETUNE_LEVEL 0x03 - -#define IPS_SHIFT_AMOUNT 0x42 -#define IPS_KEY 0x44 -#define IPS_SCALE 0x43 -#define IPS_LEVEL 0x45 - -/* IPS_SHIFT_AMOUNT valid values */ -#define IPS_OCT_D 0x00 -#define IPS_7TH_DN 0x01 -#define IPS_6TH_DN 0x02 -#define IPS_5TH_DN 0x03 -#define IPS_4TH_DN 0x04 -#define IPS_3RD_DN 0x05 -#define IPS_2ND_DN 0x06 -#define IPS_2ND_UP 0x07 -#define IPS_3RD_UP 0x08 -#define IPS_4TH_UP 0x09 -#define IPS_5TH_UP 0x0A -#define IPS_6TH_UP 0x0B -#define IPS_7TH_UP 0x0C -#define IPS_OCT_U 0x0D - -/* IPS_KEY valid values */ -#define IPS_E 0x00 -#define IPS_F 0x01 -#define IPS_GB 0x02 -#define IPS_G 0x03 -#define IPS_AB 0x04 -#define IPS_A 0x05 -#define IPS_BB 0x06 -#define IPS_B 0x07 -#define IPS_C 0x08 -#define IPS_DD 0x09 -#define IPS_D 0x0A -#define IPS_EB 0x0B - -/* IPS_SCALE valid values */ -#define IPS_MAJOR 0x00 -#define IPS_MINOR 0x01 -#define IPS_DORIA 0x02 -#define IPS_MIXLYD 0x03 -#define IPS_LYDIAN 0x04 -#define IPS_HMINO 0x05 - void set_chorusfx_option(struct usb_dev_handle *handle, 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}; @@ -901,28 +674,6 @@ void set_ips_option(struct usb_dev_handle *handle, char option, int x) printf("wrote: %d\n", i); } -enum { - CHORUS_TYPE_CE = 0, - CHORUS_TYPE_DUAL, - CHORUS_TYPE_MULTI, - CHORUS_TYPE_FLANGER, - CHORUS_TYPE_MXR_FLANGER, - CHORUS_TYPE_PHASER, - CHORUS_TYPE_VIBRATO, - CHORUS_TYPE_ROTARY, - CHORUS_TYPE_VIBROPAN, - CHORUS_TYPE_TREMOLO, - CHORUS_TYPE_PANNER, - CHORUS_TYPE_ENVELOPE, - CHORUS_TYPE_AUTOYA, - CHORUS_TYPE_YAYA, - CHORUS_TYPE_STEP_FILTER, - CHORUS_TYPE_WHAMMY, - CHORUS_TYPE_PITCH_SHIFT, - CHORUS_TYPE_DETUNE, - CHORUS_TYPE_IPS -}; - void set_chorusfx_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7, 0x00}; @@ -995,14 +746,6 @@ void set_delay_time(struct usb_dev_handle *handle, int x) printf("wrote: %d\n", i); } -enum { - DELAY_TYPE_ANALOG = 0, - DELAY_TYPE_DIGITAL, - DELAY_TYPE_MODULATED, - DELAY_TYPE_PONG, - DELAY_TYPE_TAPE -}; - void set_delay_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7, 0x00}; @@ -1021,24 +764,6 @@ void set_delay_type(struct usb_dev_handle *handle, int type) printf("wrote: %d\n", i); } -#define ANALOG_LEVEL 0x44 -#define ANALOG_REPEATS 0x47 -#define DIGITAL_LEVEL 0x44 -#define DIGITAL_REPEATS 0x47 -#define DIGITAL_DUCKER_THRESH 0x61 -#define DIGITAL_DUCKER_LEVEL 0x62 -#define MODULATED_LEVEL 0x44 -#define MODULATED_REPEATS 0x47 -#define MODULATED_DEPTH 0x51 -#define PONG_LEVEL 0x44 -#define PONG_REPEATS 0x47 -#define PONG_DUCKER_THRESH 0x61 -#define PONG_DUCKER_LEVEL 0x62 -#define TAPE_LEVEL 0x44 -#define TAPE_REPEATS 0x47 -#define TAPE_WOW 0x63 -#define TAPE_FLUTTER 0x64 - void set_delay_option(struct usb_dev_handle *handle, 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}; @@ -1069,28 +794,6 @@ void set_delay_on_off(struct usb_dev_handle *handle, gboolean val) printf("wrote: %d\n", i); } -#define TWIN_REVERB 0x05 -#define LEX_AMBIENCE_PREDELAY 0x02 -#define LEX_AMBIENCE_DECAY 0x07 -#define LEX_AMBIENCE_LIVELINESS 0x0D -#define LEX_AMBIENCE_LEVEL 0x05 -#define LEX_STUDIO_PREDELAY 0x02 -#define LEX_STUDIO_DECAY 0x07 -#define LEX_STUDIO_LIVELINESS 0x0D -#define LEX_STUDIO_LEVEL 0x05 -#define LEX_ROOM_PREDELAY 0x02 -#define LEX_ROOM_DECAY 0x07 -#define LEX_ROOM_LIVELINESS 0x0D -#define LEX_ROOM_LEVEL 0x05 -#define LEX_HALL_PREDELAY 0x02 -#define LEX_HALL_DECAY 0x07 -#define LEX_HALL_LIVELINESS 0x0D -#define LEX_HALL_LEVEL 0x05 -#define EMT240_PLATE_PREDELAY 0x02 -#define EMT240_PLATE_DECAY 0x07 -#define EMT240_PLATE_LIVELINESS 0x0D -#define EMT240_PLATE_LEVEL 0x05 - /* x = 0 to 15 (predelay), otherwise 0 to 99 */ void set_reverb_option(struct usb_dev_handle *handle, char option, int x) { @@ -1105,15 +808,6 @@ void set_reverb_option(struct usb_dev_handle *handle, char option, int x) printf("wrote: %d\n", i); } -enum { - REVERB_TYPE_TWIN = 0, - REVERB_TYPE_LEX_AMBIENCE, - REVERB_TYPE_LEX_STUDIO, - REVERB_TYPE_LEX_ROOM, - REVERB_TYPE_LEX_HALL, - REVERB_TYPE_EMT240_PLATE -}; - void set_reverb_type(struct usb_dev_handle *handle, 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 /* type2 */, 0xF7, 0x00}; @@ -1150,647 +844,6 @@ void set_reverb_on_off(struct usb_dev_handle *handle, gboolean val) printf("wrote: %d\n", i); } -void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, int)) -{ - int val = gtk_spin_button_get_value_as_int(spinbutton); - callback(handle, val); -} - -void toggled_cb(GtkToggleButton *button, void (*callback)(struct usb_dev_handle*, gboolean)) -{ - gboolean val = gtk_toggle_button_get_active(button); - callback(handle, val); -} - -typedef struct { - char *label; - void (*callback)(struct usb_dev_handle*, int); - gdouble min; - gdouble max; -} SettingsWidget; - -static SettingsWidget wah_widgets[] = { - {"Wah min", set_wah_min, 0.0, 99.0}, - {"Wah max", set_wah_max, 0.0, 99.0}, - {"Wah level", set_wah_level, 0.0, 12.0}, -}; - -static SettingsWidget comp_widgets[] = { - {"Compressor sustain", set_comp_sustain, 0.0, 99.0}, - {"Compressor tone (digi only!)", set_comp_tone, 0.0, 99.0}, - {"Compressor attack", set_comp_attack, 0.0, 99.0}, - {"Compressor level", set_comp_level, 0.0, 99.0}, -}; - -GtkWidget *create_table(SettingsWidget *widgets, gint amt) -{ - GtkWidget *table, *label, *widget; - GtkObject *adj; - int x; - - table = gtk_table_new(2, amt, FALSE); - - for (x = 0; x + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +extern struct usb_dev_handle *handle; + +enum { + WAH_TYPE_CRY = 0, + WAH_TYPE_FULLRANGE, + WAH_TYPE_CLYDE +}; + +enum { + COMP_TYPE_DIGI = 0, + COMP_TYPE_CS +}; + +enum { + PICKUP_TYPE_HB_SC = 0, + PICKUP_TYPE_SC_HB +}; + +enum { + DIST_TYPE_SCREAMER = 0, + DIST_TYPE_808, + DIST_TYPE_GUYOD, + DIST_TYPE_DOD250, + DIST_TYPE_RODENT, + DIST_TYPE_MX, + DIST_TYPE_DS, + DIST_TYPE_GRUNGE, + DIST_TYPE_ZONE, + DIST_TYPE_DEATH, + DIST_TYPE_GONK, + DIST_TYPE_FUZZY, + DIST_TYPE_MP +}; + +#define DIST_SCREAMER_DRIVE 0x02 +#define DIST_SCREAMER_TONE 0x03 +#define DIST_SCREAMER_LVL 0x04 +#define DIST_808_OVERDRIVE 0x29 +#define DIST_808_TONE 0x2A +#define DIST_808_LVL 0x2B +#define DIST_GUYOD_DRIVE 0x10 +#define DIST_GUYOD_LVL 0x11 +#define DIST_DOD250_GAIN 0x0B +#define DIST_DOD250_LVL 0x0C +#define DIST_RODENT_DIST 0x05 +#define DIST_RODENT_FILTER 0x06 +#define DIST_RODENT_LVL 0x07 +#define DIST_MX_DIST 0x24 +#define DIST_MX_OUTPUT 0x25 +#define DIST_DS_GAIN 0x08 +#define DIST_DS_TONE 0x09 +#define DIST_DS_LVL 0x0A +#define DIST_GRUNGE_GRUNGE 0x16 +#define DIST_GRUNGE_FACE 0x18 +#define DIST_GRUNGE_LOUD 0x19 +#define DIST_GRUNGE_BUTT 0x17 +#define DIST_ZONE_GAIN 0x1C +#define DIST_ZONE_LOW 0x1F +#define DIST_ZONE_MID_LVL 0x1E +#define DIST_ZONE_MID_FREQ 0x1D +#define DIST_ZONE_HIGH 0x20 +#define DIST_ZONE_LEVEL 0x21 +#define DIST_DEATH_LOW 0x2D +#define DIST_DEATH_MID 0x2C +#define DIST_DEATH_HIGH 0x2F +#define DIST_DEATH_LVL 0x2E +#define DIST_GONK_GONK 0x30 +#define DIST_GONK_SMEAR 0x27 +#define DIST_GONK_SUCK 0x26 +#define DIST_GONK_HEAVE 0x28 +#define DIST_FUZZY_FUZZ 0x1A +#define DIST_FUZZY_VOLUME 0x1B +#define DIST_MP_SUSTAIN 0x0D +#define DIST_MP_TONE 0x0E +#define DIST_MP_VOLUME 0x0F + +enum { + NOISEGATE_GATE = 0, + NOISEGATE_SWELL +}; + +/* available only in Gate mode */ +#define NOISEGATE_GATE_TRESHOLD 0x46 +/* available only in Swell mode */ +#define NOISEGATE_SWELL_SENS 0x47 +/* available in both Gate and Swell modes */ +#define NOISEGATE_ATTACK 0x48 +#define NOISEGATE_RELEASE 0x49 +#define NOISEGATE_ATTN 0x4A + +enum { + CHORUS_TYPE_CE = 0, + CHORUS_TYPE_DUAL, + CHORUS_TYPE_MULTI, + CHORUS_TYPE_FLANGER, + CHORUS_TYPE_MXR_FLANGER, + CHORUS_TYPE_PHASER, + CHORUS_TYPE_VIBRATO, + CHORUS_TYPE_ROTARY, + CHORUS_TYPE_VIBROPAN, + CHORUS_TYPE_TREMOLO, + CHORUS_TYPE_PANNER, + CHORUS_TYPE_ENVELOPE, + CHORUS_TYPE_AUTOYA, + CHORUS_TYPE_YAYA, + CHORUS_TYPE_STEP_FILTER, + CHORUS_TYPE_WHAMMY, + CHORUS_TYPE_PITCH_SHIFT, + CHORUS_TYPE_DETUNE, + CHORUS_TYPE_IPS +}; + +#define CE_CHORUS_SPEED 0x45 +#define CE_CHORUS_DEPTH 0x46 + +#define DUAL_CHORUS_SPEED 0x45 +#define DUAL_CHORUS_DEPTH 0x46 +#define DUAL_CHORUS_LEVEL 0x44 +#define DUAL_CHORUS_WAVE 0x48 + +#define MULTI_CHORUS_SPEED 0x45 +#define MULTI_CHORUS_DEPTH 0x46 +#define MULTI_CHORUS_WAVE 0x48 +#define MULTI_CHORUS_LEVEL 0x44 + +#define FLANGER_SPEED 0x06 +#define FLANGER_DEPTH 0x07 +#define FLANGER_REGEN 0x08 +#define FLANGER_LEVEL 0x05 +#define FLANGER_WAVE 0x09 + +#define MXR_FLANGER_SPEED 0x06 +#define MXR_FLANGER_WIDTH 0x12 +#define MXR_FLANGER_REGEN 0x08 +#define MXR_FLANGER_MANUAL 0x15 + +#define PHASER_SPEED 0x42 +#define PHASER_DEPTH 0x43 +#define PHASER_REGEN 0x46 +#define PHASER_LEVEL 0x45 +#define PHASER_WAVE 0x47 + +#define VIBRATO_SPEED 0x04 +#define VIBRATO_DEPTH 0x05 + +#define ROTARY_SPEED 0x42 +#define ROTARY_INTENSITY 0x44 +#define ROTARY_DOPPLER 0x46 +#define ROTARY_CROSSOVER 0x47 + +#define VIBROPAN_SPEED 0x22 +#define VIBROPAN_DEPTH 0x23 +#define VIBROPAN_VIBRA 0x24 +#define VIBROPAN_WAVE 0x25 + +#define TREMOLO_SPEED 0x04 +#define TREMOLO_DEPTH 0x03 +#define TREMOLO_WAVE 0x05 + +#define PANNER_SPEED 0x44 +#define PANNER_DEPTH 0x43 +#define PANNER_WAVE 0x45 + +#define ENVELOPE_SENSITIVITY 0x46 +#define ENVELOPE_RANGE 0x45 + +#define AUTOYA_SPEED 0x46 +#define AUTOYA_INTENSITY 0x4A +#define AUTOYA_RANGE 0x4B + +#define YAYA_PEDAL 0x02 +#define YAYA_INTENSITY 0x09 +#define YAYA_RANGE 0x0A + +#define STEP_FILTER_SPEED 0x42 +#define STEP_FILTER_INTENSITY 0x43 + +#define WHAMMY_AMOUNT 0x05 +#define WHAMMY_PEDAL 0x03 +#define WHAMMY_MIX 0x04 + +#define PITCH_AMOUNT 0x42 +#define PITCH_MIX 0x51 + +#define DETUNE_AMOUNT 0x04 +#define DETUNE_LEVEL 0x03 + +#define IPS_SHIFT_AMOUNT 0x42 +#define IPS_KEY 0x44 +#define IPS_SCALE 0x43 +#define IPS_LEVEL 0x45 + +/* DUAL_CHORUS_WAVE, MULTI_CHORUS_WAVE, FLANGER_WAVE, PHASER_WAVE, + VIBROPAN_WAVE, TREMOLO_WAVE, PANNER_WAVE valid values */ +#define WAVE_TRI 0x00 +#define WAVE_SINE 0x01 +#define WAVE_SQUARE 0x02 + +/* WHAMMY_AMOUNT valid values */ +#define WHAMMY_OCT_UP 0x00 +#define WHAMMY_2OCT_UP 0x01 +#define WHAMMY_2ND_DN 0x02 +#define WHAMMY_RV_2ND 0x03 +#define WHAMMY_4TH_DN 0x04 +#define WHAMMY_OCT_DN 0x05 +#define WHAMMY_2OCT_DN 0x06 +#define WHAMMY_DIV_BMB 0x07 +#define WHAMMY_M3_MA 0x08 +#define WHAMMY_2ND_MA3 0x09 +#define WHAMMY_3RD_4TH 0x0A +#define WHAMMY_4TH_5TH 0x0B +#define WHAMMY_5TH_OCT 0x0C +#define WHAMMY_HOCT_UP 0x0D +#define WHAMMY_HOCT_DN 0x0E +#define WHAMMY_OCT_UD 0x0F + +/* IPS_SHIFT_AMOUNT valid values */ +#define IPS_OCT_D 0x00 +#define IPS_7TH_DN 0x01 +#define IPS_6TH_DN 0x02 +#define IPS_5TH_DN 0x03 +#define IPS_4TH_DN 0x04 +#define IPS_3RD_DN 0x05 +#define IPS_2ND_DN 0x06 +#define IPS_2ND_UP 0x07 +#define IPS_3RD_UP 0x08 +#define IPS_4TH_UP 0x09 +#define IPS_5TH_UP 0x0A +#define IPS_6TH_UP 0x0B +#define IPS_7TH_UP 0x0C +#define IPS_OCT_U 0x0D + +/* IPS_KEY valid values */ +#define IPS_E 0x00 +#define IPS_F 0x01 +#define IPS_GB 0x02 +#define IPS_G 0x03 +#define IPS_AB 0x04 +#define IPS_A 0x05 +#define IPS_BB 0x06 +#define IPS_B 0x07 +#define IPS_C 0x08 +#define IPS_DD 0x09 +#define IPS_D 0x0A +#define IPS_EB 0x0B + +/* IPS_SCALE valid values */ +#define IPS_MAJOR 0x00 +#define IPS_MINOR 0x01 +#define IPS_DORIA 0x02 +#define IPS_MIXLYD 0x03 +#define IPS_LYDIAN 0x04 +#define IPS_HMINO 0x05 + +enum { + DELAY_TYPE_ANALOG = 0, + DELAY_TYPE_DIGITAL, + DELAY_TYPE_MODULATED, + DELAY_TYPE_PONG, + DELAY_TYPE_TAPE +}; + +#define ANALOG_LEVEL 0x44 +#define ANALOG_REPEATS 0x47 + +#define DIGITAL_LEVEL 0x44 +#define DIGITAL_REPEATS 0x47 +#define DIGITAL_DUCKER_THRESH 0x61 +#define DIGITAL_DUCKER_LEVEL 0x62 + +#define MODULATED_LEVEL 0x44 +#define MODULATED_REPEATS 0x47 +#define MODULATED_DEPTH 0x51 + +#define PONG_LEVEL 0x44 +#define PONG_REPEATS 0x47 +#define PONG_DUCKER_THRESH 0x61 +#define PONG_DUCKER_LEVEL 0x62 + +#define TAPE_LEVEL 0x44 +#define TAPE_REPEATS 0x47 +#define TAPE_WOW 0x63 +#define TAPE_FLUTTER 0x64 + +enum { + REVERB_TYPE_TWIN = 0, + REVERB_TYPE_LEX_AMBIENCE, + REVERB_TYPE_LEX_STUDIO, + REVERB_TYPE_LEX_ROOM, + REVERB_TYPE_LEX_HALL, + REVERB_TYPE_EMT240_PLATE +}; + +#define TWIN_REVERB 0x05 + +#define LEX_AMBIENCE_PREDELAY 0x02 +#define LEX_AMBIENCE_DECAY 0x07 +#define LEX_AMBIENCE_LIVELINESS 0x0D +#define LEX_AMBIENCE_LEVEL 0x05 + +#define LEX_STUDIO_PREDELAY 0x02 +#define LEX_STUDIO_DECAY 0x07 +#define LEX_STUDIO_LIVELINESS 0x0D +#define LEX_STUDIO_LEVEL 0x05 + +#define LEX_ROOM_PREDELAY 0x02 +#define LEX_ROOM_DECAY 0x07 +#define LEX_ROOM_LIVELINESS 0x0D +#define LEX_ROOM_LEVEL 0x05 + +#define LEX_HALL_PREDELAY 0x02 +#define LEX_HALL_DECAY 0x07 +#define LEX_HALL_LIVELINESS 0x0D +#define LEX_HALL_LEVEL 0x05 + +#define EMT240_PLATE_PREDELAY 0x02 +#define EMT240_PLATE_DECAY 0x07 +#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_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_treble(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); diff --git a/gui.c b/gui.c new file mode 100644 index 0000000..4bbee06 --- /dev/null +++ b/gui.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2009 Tomasz Moń + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include "gdigi.h" + +void value_changed_cb(GtkSpinButton *spinbutton, void (*callback)(struct usb_dev_handle*, int)) +{ + int val = gtk_spin_button_get_value_as_int(spinbutton); + callback(handle, val); +} + +void toggled_cb(GtkToggleButton *button, void (*callback)(struct usb_dev_handle*, gboolean)) +{ + gboolean val = gtk_toggle_button_get_active(button); + callback(handle, val); +} + +typedef struct { + char *label; + void (*callback)(struct usb_dev_handle*, int); + gdouble min; + gdouble max; +} SettingsWidget; + +static SettingsWidget wah_widgets[] = { + {"Wah min", set_wah_min, 0.0, 99.0}, + {"Wah max", set_wah_max, 0.0, 99.0}, + {"Wah level", set_wah_level, 0.0, 12.0}, +}; + +static SettingsWidget comp_widgets[] = { + {"Compressor sustain", set_comp_sustain, 0.0, 99.0}, + {"Compressor tone (digi only!)", set_comp_tone, 0.0, 99.0}, + {"Compressor attack", set_comp_attack, 0.0, 99.0}, + {"Compressor level", set_comp_level, 0.0, 99.0}, +}; + +GtkWidget *create_table(SettingsWidget *widgets, gint amt) +{ + GtkWidget *table, *label, *widget; + GtkObject *adj; + int x; + + table = gtk_table_new(2, amt, FALSE); + + for (x = 0; x + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +void create_window(); diff --git a/tests.c b/tests.c new file mode 100644 index 0000000..a264bf0 --- /dev/null +++ b/tests.c @@ -0,0 +1,626 @@ +/* + * Copyright (c) 2009 Tomasz Moń + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gdigi.h" + +void test_wah(struct usb_dev_handle *handle) +{ + int x; + + set_wah_type(handle, WAH_TYPE_CRY); + for (x=0; x<=99; x++) + set_wah_min(handle, x); + + for (x=0; x<=99; x++) + set_wah_max(handle, x); + + for (x=0; x<=12; x++) + set_wah_level(handle, x); + + set_wah_type(handle, WAH_TYPE_FULLRANGE); + for (x=0; x<=99; x++) + set_wah_min(handle, x); + + for (x=0; x<=99; x++) + set_wah_max(handle, x); + + for (x=0; x<=12; x++) + set_wah_level(handle, x); + + set_wah_type(handle, WAH_TYPE_CLYDE); + for (x=0; x<=99; x++) + set_wah_min(handle, x); + + for (x=0; x<=99; x++) + set_wah_max(handle, x); + + for (x=0; x<=12; x++) + set_wah_level(handle, x); + + set_wah_on_off(handle, TRUE); + set_wah_on_off(handle, FALSE); +} + +void test_compressor(struct usb_dev_handle *handle) +{ + int x; + + set_comp_type(handle, COMP_TYPE_DIGI); + for (x=0; x<=99; x++) + set_comp_sustain(handle, x); + + for (x=0; x<=99; x++) + set_comp_tone(handle, x); + + for (x=0; x<=99; x++) + set_comp_attack(handle, x); + + for (x=0; x<=99; x++) + set_comp_level(handle, x); + + set_comp_type(handle, COMP_TYPE_CS); + for (x=0; x<=99; x++) + set_comp_sustain(handle, x); + + for (x=0; x<=99; x++) + set_comp_attack(handle, x); + + for (x=0; x<=99; x++) + set_comp_level(handle, x); + + set_comp_on_off(handle, TRUE); + set_comp_on_off(handle, FALSE); +} + +void test_dist(struct usb_dev_handle *handle) +{ + int x; + + set_dist_type(handle, DIST_TYPE_SCREAMER); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_SCREAMER_DRIVE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_SCREAMER_TONE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_SCREAMER_LVL, x); + + set_dist_type(handle, DIST_TYPE_808); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_808_OVERDRIVE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_808_TONE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_808_LVL, x); + + set_dist_type(handle, DIST_TYPE_GUYOD); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GUYOD_DRIVE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GUYOD_LVL, x); + + set_dist_type(handle, DIST_TYPE_DOD250); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DOD250_GAIN, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DOD250_LVL, x); + + set_dist_type(handle, DIST_TYPE_RODENT); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_RODENT_DIST, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_RODENT_FILTER, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_RODENT_LVL, x); + + set_dist_type(handle, DIST_TYPE_MX); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_MX_DIST, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_MX_OUTPUT, x); + + set_dist_type(handle, DIST_TYPE_DS); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DS_GAIN, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DS_TONE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DS_LVL, x); + + set_dist_type(handle, DIST_TYPE_GRUNGE); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GRUNGE_GRUNGE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GRUNGE_FACE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GRUNGE_LOUD, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GRUNGE_BUTT, x); + + set_dist_type(handle, DIST_TYPE_ZONE); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_GAIN, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_LOW, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_MID_LVL, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_MID_FREQ, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_HIGH, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_ZONE_LEVEL, x); + + set_dist_type(handle, DIST_TYPE_DEATH); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DEATH_LOW, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DEATH_MID, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DEATH_HIGH, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_DEATH_LVL, x); + + set_dist_type(handle, DIST_TYPE_GONK); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GONK_GONK, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GONK_SMEAR, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GONK_SUCK, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_GONK_HEAVE, x); + + set_dist_type(handle, DIST_TYPE_FUZZY); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_FUZZY_FUZZ, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_FUZZY_VOLUME, x); + + set_dist_type(handle, DIST_TYPE_MP); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_MP_SUSTAIN, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_MP_TONE, x); + for (x=0; x<=99; x++) + set_dist_option(handle, DIST_MP_VOLUME, x); + + set_dist_on_off(handle, TRUE); + set_dist_on_off(handle, FALSE); +} + +void test_presets(struct usb_dev_handle *handle) +{ + int x; + + for (x=0; x<=60; x++) + switch_user_preset(handle, x); + + for (x=0; x<=60; x++) + switch_system_preset(handle, x); + + for (x=0; x<=99; x++) + set_preset_level(handle, x); +} + +void test_pickups(struct usb_dev_handle *handle) +{ + set_pickup_type(handle, PICKUP_TYPE_HB_SC); + set_pickup_type(handle, PICKUP_TYPE_SC_HB); + + set_pickup_on_off(handle, TRUE); + set_pickup_on_off(handle, FALSE); +} + +void test_eq(struct usb_dev_handle *handle) +{ + int x; + + for (x=0; x<=99; x++) + set_eq_gain(handle, x); + for (x=0; x<=99; x++) + set_eq_level(handle, x); + + for (x=0; x<=0x18; x++) + set_eq_bass(handle, x); + for (x=0; x<=0x18; x++) + set_eq_mid(handle, x); + for (x=0; x<=0x18; x++) + set_eq_treble(handle, x); + + set_eq_on_off(handle, TRUE); + set_eq_on_off(handle, FALSE); +} + +void test_noisegate(struct usb_dev_handle *handle) +{ + int x; + + set_noisegate_type(handle, NOISEGATE_GATE); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_GATE_TRESHOLD, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_ATTACK, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_RELEASE, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_ATTN, x); + + set_noisegate_type(handle, NOISEGATE_SWELL); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_SWELL_SENS, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_ATTACK, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_RELEASE, x); + for (x=0; x<=99; x++) + set_gate_option(handle, NOISEGATE_ATTN, x); + + set_noisegate_on_off(handle, TRUE); + set_noisegate_on_off(handle, FALSE); +} + +void test_chorusfx(struct usb_dev_handle *handle) +{ + int x; + + set_chorusfx_type(handle, CHORUS_TYPE_CE); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, CE_CHORUS_SPEED, x); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, CE_CHORUS_DEPTH, x); + + set_chorusfx_type(handle, CHORUS_TYPE_DUAL); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, DUAL_CHORUS_SPEED, x); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, 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_type(handle, CHORUS_TYPE_MULTI); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, MULTI_CHORUS_SPEED, x); + for (x=0; x<=99; x++) + set_chorusfx_option(handle, 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_type(handle, CHORUS_TYPE_FLANGER); + for (x=0; x<=99; x++) + set_flanger_option(handle, FLANGER_SPEED, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, FLANGER_DEPTH, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, 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_chorusfx_type(handle, CHORUS_TYPE_MXR_FLANGER); + for (x=0; x<=99; x++) + set_flanger_option(handle, MXR_FLANGER_SPEED, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, MXR_FLANGER_WIDTH, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, MXR_FLANGER_REGEN, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, MXR_FLANGER_MANUAL, x); + + set_chorusfx_type(handle, CHORUS_TYPE_PHASER); + for (x=0; x<=99; x++) + set_flanger_option(handle, PHASER_SPEED, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, PHASER_DEPTH, x); + for (x=0; x<=99; x++) + set_flanger_option(handle, 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_chorusfx_type(handle, CHORUS_TYPE_VIBRATO); + for (x=0; x<=99; x++) + set_vibrato_option(handle, VIBRATO_SPEED, x); + for (x=0; x<=99; x++) + set_vibrato_option(handle, VIBRATO_DEPTH, x); + + set_chorusfx_type(handle, CHORUS_TYPE_ROTARY); + for (x=0; x<=99; x++) + set_vibrato_option(handle, ROTARY_SPEED, x); + for (x=0; x<=99; x++) + set_vibrato_option(handle, ROTARY_INTENSITY, x); + for (x=0; x<=99; x++) + set_vibrato_option(handle, ROTARY_DOPPLER, x); + for (x=0; x<=99; x++) + set_vibrato_option(handle, ROTARY_CROSSOVER, x); + + set_chorusfx_type(handle, CHORUS_TYPE_VIBROPAN); + for (x=0; x<=99; x++) + set_vibrato_option(handle, VIBROPAN_SPEED, x); + for (x=0; x<=99; x++) + set_vibrato_option(handle, 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_chorusfx_type(handle, CHORUS_TYPE_TREMOLO); + for (x=0; x<=99; x++) + set_tremolo_option(handle, 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_chorusfx_type(handle, CHORUS_TYPE_PANNER); + for (x=0; x<=99; x++) + set_tremolo_option(handle, 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_chorusfx_type(handle, CHORUS_TYPE_ENVELOPE); + for (x=0; x<=99; x++) + set_envelope_option(handle, ENVELOPE_SENSITIVITY, x); + for (x=0; x<=99; x++) + set_envelope_option(handle, ENVELOPE_RANGE, x); + + set_chorusfx_type(handle, CHORUS_TYPE_AUTOYA); + for (x=0; x<=99; x++) + set_ya_option(handle, AUTOYA_SPEED, x); + for (x=0; x<=99; x++) + set_ya_option(handle, AUTOYA_INTENSITY, x); + for (x=0; x<=0x31; x++) + set_ya_option(handle, AUTOYA_RANGE, x); + + set_chorusfx_type(handle, CHORUS_TYPE_YAYA); + for (x=0; x<=99; x++) + set_ya_option(handle, YAYA_PEDAL, x); + for (x=0; x<=99; x++) + set_ya_option(handle, YAYA_INTENSITY, x); + for (x=0; x<=0x31; x++) + set_ya_option(handle, YAYA_RANGE, x); + + set_chorusfx_type(handle, CHORUS_TYPE_STEP_FILTER); + for (x=0; x<=99; x++) + set_filter_option(handle, STEP_FILTER_SPEED, x); + for (x=0; x<=99; x++) + set_filter_option(handle, 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); + for (x=0; x<=99; x++) + set_whammy_option(handle, WHAMMY_PEDAL, x); + for (x=0; x<=99; x++) + set_whammy_option(handle, WHAMMY_MIX, x); + + set_chorusfx_type(handle, CHORUS_TYPE_PITCH_SHIFT); + for (x=0; x<=0x30; x++) + set_pitch_option(handle, PITCH_AMOUNT, x); + for (x=0; x<=99; x++) + set_pitch_option(handle, PITCH_MIX, x); + + set_chorusfx_type(handle, CHORUS_TYPE_DETUNE); + for (x=0; x<=0x30; x++) + set_pitch_option(handle, DETUNE_AMOUNT, x); + for (x=0; x<=99; x++) + set_pitch_option(handle, 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); + for (x=0; x<=99; x++) + set_ips_option(handle, IPS_LEVEL, x); + + set_chorusfx_on_off(handle, TRUE); + set_chorusfx_on_off(handle, FALSE); +} + +void test_delay(struct usb_dev_handle *handle) +{ + int x; + + set_delay_type(handle, DELAY_TYPE_ANALOG); + for (x=0; x<=139; x++) + set_delay_time(handle, x); + for (x=0; x<=99; x++) + set_delay_option(handle, ANALOG_LEVEL, x); + for (x=0; x<=100; x++) + set_delay_option(handle, ANALOG_REPEATS, x); + + set_delay_type(handle, DELAY_TYPE_DIGITAL); + for (x=0; x<=139; x++) + set_delay_time(handle, x); + for (x=0; x<=99; x++) + set_delay_option(handle, DIGITAL_LEVEL, x); + for (x=0; x<=100; x++) + set_delay_option(handle, DIGITAL_REPEATS, x); + for (x=0; x<=99; x++) + set_delay_option(handle, DIGITAL_DUCKER_THRESH, x); + for (x=0; x<=99; x++) + set_delay_option(handle, DIGITAL_DUCKER_LEVEL, x); + + set_delay_type(handle, DELAY_TYPE_MODULATED); + for (x=0; x<=139; x++) + set_delay_time(handle, x); + for (x=0; x<=99; x++) + set_delay_option(handle, MODULATED_LEVEL, x); + for (x=0; x<=100; x++) + set_delay_option(handle, MODULATED_REPEATS, x); + for (x=0; x<=99; x++) + set_delay_option(handle, MODULATED_DEPTH, x); + + set_delay_type(handle, DELAY_TYPE_PONG); + for (x=0; x<=139; x++) + set_delay_time(handle, x); + for (x=0; x<=99; x++) + set_delay_option(handle, PONG_LEVEL, x); + for (x=0; x<=100; x++) + set_delay_option(handle, PONG_REPEATS, x); + for (x=0; x<=99; x++) + set_delay_option(handle, PONG_DUCKER_THRESH, x); + for (x=0; x<=99; x++) + set_delay_option(handle, PONG_DUCKER_LEVEL, x); + + set_delay_type(handle, DELAY_TYPE_TAPE); + for (x=0; x<=139; x++) + set_delay_time(handle, x); + for (x=0; x<=99; x++) + set_delay_option(handle, TAPE_LEVEL, x); + for (x=0; x<=100; x++) + set_delay_option(handle, TAPE_REPEATS, x); + for (x=0; x<=99; x++) + set_delay_option(handle, TAPE_WOW, x); + for (x=0; x<=99; x++) + set_delay_option(handle, TAPE_FLUTTER, x); + + set_delay_on_off(handle, TRUE); + set_delay_on_off(handle, FALSE); +} + +void test_reverb(struct usb_dev_handle *handle) +{ + int x; + + set_reverb_type(handle, REVERB_TYPE_TWIN); + for (x=0; x<=99; x++) + set_reverb_option(handle, TWIN_REVERB, x); + + set_reverb_type(handle, REVERB_TYPE_LEX_AMBIENCE); + for (x=0; x<=15; x++) + set_reverb_option(handle, LEX_AMBIENCE_PREDELAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_AMBIENCE_DECAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_AMBIENCE_LIVELINESS, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_AMBIENCE_LEVEL, x); + + set_reverb_type(handle, REVERB_TYPE_LEX_STUDIO); + for (x=0; x<=15; x++) + set_reverb_option(handle, LEX_STUDIO_PREDELAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_STUDIO_DECAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_STUDIO_LIVELINESS, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_STUDIO_LEVEL, x); + + set_reverb_type(handle, REVERB_TYPE_LEX_ROOM); + for (x=0; x<=15; x++) + set_reverb_option(handle, LEX_ROOM_PREDELAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_ROOM_DECAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_ROOM_LIVELINESS, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_ROOM_LEVEL, x); + + set_reverb_type(handle, REVERB_TYPE_LEX_HALL); + for (x=0; x<=15; x++) + set_reverb_option(handle, LEX_HALL_PREDELAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_HALL_DECAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_HALL_LIVELINESS, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, LEX_HALL_LEVEL, x); + + set_reverb_type(handle, REVERB_TYPE_EMT240_PLATE); + for (x=0; x<=15; x++) + set_reverb_option(handle, EMT240_PLATE_PREDELAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, EMT240_PLATE_DECAY, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, EMT240_PLATE_LIVELINESS, x); + for (x=0; x<=99; x++) + set_reverb_option(handle, EMT240_PLATE_LEVEL, x); + + set_reverb_on_off(handle, TRUE); + set_reverb_on_off(handle, FALSE); +} + +void test_all(struct usb_dev_handle *handle) +{ + 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); +} diff --git a/tests.h b/tests.h new file mode 100644 index 0000000..ff7fbd6 --- /dev/null +++ b/tests.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Tomasz Moń + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#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);