From e7ce11164b5a3ac1f43aebcde0d30ce81d423aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Sun, 22 Feb 2009 16:06:30 +0100 Subject: [PATCH] introduce set_option --- gdigi.c | 40 +++++++++++++----- gdigi.h | 124 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 93 insertions(+), 71 deletions(-) diff --git a/gdigi.c b/gdigi.c index 4bc1e15..1077e81 100644 --- a/gdigi.c +++ b/gdigi.c @@ -140,6 +140,35 @@ void check_preset(struct usb_dev_handle *handle) } while (i > 0);*/ } +/* + id - ID as found preset file + position - Position as found in preset file + value - Value as found in preset file +*/ +void set_option(guint id, guint position, guint value) +{ + static char option[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, + 0x00, 0x00, 0x00, /* ID */ + 0x00, /* position */ + 0x00, /* value */ + 0x00, /* checksum */ + 0xF7}; + + if (((id & 0x80) >> 7) == 1) /* 8th bit equals 1 */ + option[8] = 0x20; + else /* otherwise */ + option[8] = 0x00; + + option[9] = ((id & 0xFF00) >> 8); + option[10] = ((id & 0x007F)); /* 8th bit has to be zero */ + + option[11] = position; + option[12] = value; + option[13] = calculate_checksum(option, sizeof(option), 13) ^ 0x07; + + send_data(option, sizeof(option)); +} + /* level = 0 to 99 */ void set_wah_min(int level) { @@ -626,16 +655,7 @@ void set_noisegate_on_off(gboolean val) void set_chorusfx_option(guint32 option, int x) { - static char set_option[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x41, 0x00 /* option1 */, 0x00 /* option2 */, 0x00 /* option3 */, 0x0E, 0x00 /* value */, 0x00 /* checksum */, 0xF7}; - - set_option[8] = ((option & 0xFF0000) >> 16); - set_option[9] = ((option & 0x00FF00) >> 8); - set_option[10] = ((option & 0x0000FF)); - - set_option[12] = x; - set_option[13] = calculate_checksum(set_option, sizeof(set_option), 13) ^ 0x07; - - send_data(set_option, sizeof(set_option)); + set_option(option, CHORUSFX_POSITION, x); } void set_chorusfx_type(int type) diff --git a/gdigi.h b/gdigi.h index e9056ad..634c737 100644 --- a/gdigi.h +++ b/gdigi.h @@ -134,85 +134,87 @@ enum { CHORUS_TYPE_IPS }; -#define CE_CHORUS_SPEED 0x000345 -#define CE_CHORUS_DEPTH 0x000346 +#define CHORUSFX_POSITION 14 -#define DUAL_CHORUS_SPEED 0x000345 -#define DUAL_CHORUS_DEPTH 0x000346 -#define DUAL_CHORUS_LEVEL 0x000344 -#define DUAL_CHORUS_WAVE 0x000348 +#define CE_CHORUS_SPEED 837 +#define CE_CHORUS_DEPTH 838 -#define MULTI_CHORUS_SPEED 0x000345 -#define MULTI_CHORUS_DEPTH 0x000346 -#define MULTI_CHORUS_WAVE 0x000348 -#define MULTI_CHORUS_LEVEL 0x000344 +#define DUAL_CHORUS_SPEED 837 +#define DUAL_CHORUS_DEPTH 838 +#define DUAL_CHORUS_LEVEL 836 +#define DUAL_CHORUS_WAVE 840 -#define FLANGER_SPEED 0x200306 -#define FLANGER_DEPTH 0x200307 -#define FLANGER_REGEN 0x200308 -#define FLANGER_LEVEL 0x200305 -#define FLANGER_WAVE 0x200309 +#define MULTI_CHORUS_SPEED 837 +#define MULTI_CHORUS_DEPTH 838 +#define MULTI_CHORUS_WAVE 840 +#define MULTI_CHORUS_LEVEL 836 -#define MXR_FLANGER_SPEED 0x200306 -#define MXR_FLANGER_WIDTH 0x200312 -#define MXR_FLANGER_REGEN 0x200308 -#define MXR_FLANGER_MANUAL 0x200315 +#define FLANGER_SPEED 902 +#define FLANGER_DEPTH 903 +#define FLANGER_REGEN 904 +#define FLANGER_LEVEL 901 +#define FLANGER_WAVE 905 -#define PHASER_SPEED 0x200342 -#define PHASER_DEPTH 0x200343 -#define PHASER_REGEN 0x200346 -#define PHASER_LEVEL 0x200345 -#define PHASER_WAVE 0x200347 +#define MXR_FLANGER_SPEED 902 +#define MXR_FLANGER_WIDTH 914 +#define MXR_FLANGER_REGEN 904 +#define MXR_FLANGER_MANUAL 917 -#define VIBRATO_SPEED 0x000504 -#define VIBRATO_DEPTH 0x000505 +#define PHASER_SPEED 962 +#define PHASER_DEPTH 963 +#define PHASER_REGEN 966 +#define PHASER_LEVEL 965 +#define PHASER_WAVE 967 -#define ROTARY_SPEED 0x000542 -#define ROTARY_INTENSITY 0x000544 -#define ROTARY_DOPPLER 0x000546 -#define ROTARY_CROSSOVER 0x000547 +#define VIBRATO_SPEED 1284 +#define VIBRATO_DEPTH 1285 -#define VIBROPAN_SPEED 0x000522 -#define VIBROPAN_DEPTH 0x000523 -#define VIBROPAN_VIBRA 0x000524 -#define VIBROPAN_WAVE 0x000525 +#define ROTARY_SPEED 1346 +#define ROTARY_INTENSITY 1348 +#define ROTARY_DOPPLER 1350 +#define ROTARY_CROSSOVER 1351 -#define TREMOLO_SPEED 0x200404 -#define TREMOLO_DEPTH 0x200403 -#define TREMOLO_WAVE 0x200405 +#define VIBROPAN_SPEED 1314 +#define VIBROPAN_DEPTH 1315 +#define VIBROPAN_VIBRA 1316 +#define VIBROPAN_WAVE 1317 -#define PANNER_SPEED 0x200444 -#define PANNER_DEPTH 0x200443 -#define PANNER_WAVE 0x200445 +#define TREMOLO_SPEED 1156 +#define TREMOLO_DEPTH 1155 +#define TREMOLO_WAVE 1157 -#define ENVELOPE_SENSITIVITY 0x000646 -#define ENVELOPE_RANGE 0x000645 +#define PANNER_SPEED 1220 +#define PANNER_DEPTH 1219 +#define PANNER_WAVE 1221 -#define AUTOYA_SPEED 0x200546 -#define AUTOYA_INTENSITY 0x20054A -#define AUTOYA_RANGE 0x20054B +#define ENVELOPE_SENSITIVITY 1606 +#define ENVELOPE_RANGE 1605 -#define YAYA_PEDAL 0x200502 -#define YAYA_INTENSITY 0x200509 -#define YAYA_RANGE 0x20050A +#define AUTOYA_SPEED 1478 +#define AUTOYA_INTENSITY 1482 +#define AUTOYA_RANGE 1483 -#define STEP_FILTER_SPEED 0x200B42 -#define STEP_FILTER_INTENSITY 0x200B43 +#define YAYA_PEDAL 1410 +#define YAYA_INTENSITY 1417 +#define YAYA_RANGE 1418 -#define WHAMMY_AMOUNT 0x000705 -#define WHAMMY_PEDAL 0x000703 -#define WHAMMY_MIX 0x000704 +#define STEP_FILTER_SPEED 3010 +#define STEP_FILTER_INTENSITY 3011 -#define PITCH_AMOUNT 0x200642 -#define PITCH_MIX 0x200651 +#define WHAMMY_AMOUNT 1797 +#define WHAMMY_PEDAL 1795 +#define WHAMMY_MIX 1796 -#define DETUNE_AMOUNT 0x200604 -#define DETUNE_LEVEL 0x200603 +#define PITCH_AMOUNT 1730 +#define PITCH_MIX 1745 -#define IPS_SHIFT_AMOUNT 0x200A42 -#define IPS_KEY 0x200A44 -#define IPS_SCALE 0x200A43 -#define IPS_LEVEL 0x200A45 +#define DETUNE_AMOUNT 1668 +#define DETUNE_LEVEL 1667 + +#define IPS_SHIFT_AMOUNT 2754 +#define IPS_KEY 2756 +#define IPS_SCALE 2755 +#define IPS_LEVEL 2757 /* DUAL_CHORUS_WAVE, MULTI_CHORUS_WAVE, FLANGER_WAVE, PHASER_WAVE, VIBROPAN_WAVE, TREMOLO_WAVE, PANNER_WAVE valid values */