introduce set_option

This commit is contained in:
Tomasz Moń
2009-02-22 16:06:30 +01:00
parent f95804026c
commit e7ce11164b
2 changed files with 93 additions and 71 deletions

40
gdigi.c
View File

@@ -140,6 +140,35 @@ void check_preset(struct usb_dev_handle *handle)
} while (i > 0);*/ } 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 */ /* level = 0 to 99 */
void set_wah_min(int level) 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) 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(option, CHORUSFX_POSITION, x);
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));
} }
void set_chorusfx_type(int type) void set_chorusfx_type(int type)

124
gdigi.h
View File

@@ -134,85 +134,87 @@ enum {
CHORUS_TYPE_IPS CHORUS_TYPE_IPS
}; };
#define CE_CHORUS_SPEED 0x000345 #define CHORUSFX_POSITION 14
#define CE_CHORUS_DEPTH 0x000346
#define DUAL_CHORUS_SPEED 0x000345 #define CE_CHORUS_SPEED 837
#define DUAL_CHORUS_DEPTH 0x000346 #define CE_CHORUS_DEPTH 838
#define DUAL_CHORUS_LEVEL 0x000344
#define DUAL_CHORUS_WAVE 0x000348
#define MULTI_CHORUS_SPEED 0x000345 #define DUAL_CHORUS_SPEED 837
#define MULTI_CHORUS_DEPTH 0x000346 #define DUAL_CHORUS_DEPTH 838
#define MULTI_CHORUS_WAVE 0x000348 #define DUAL_CHORUS_LEVEL 836
#define MULTI_CHORUS_LEVEL 0x000344 #define DUAL_CHORUS_WAVE 840
#define FLANGER_SPEED 0x200306 #define MULTI_CHORUS_SPEED 837
#define FLANGER_DEPTH 0x200307 #define MULTI_CHORUS_DEPTH 838
#define FLANGER_REGEN 0x200308 #define MULTI_CHORUS_WAVE 840
#define FLANGER_LEVEL 0x200305 #define MULTI_CHORUS_LEVEL 836
#define FLANGER_WAVE 0x200309
#define MXR_FLANGER_SPEED 0x200306 #define FLANGER_SPEED 902
#define MXR_FLANGER_WIDTH 0x200312 #define FLANGER_DEPTH 903
#define MXR_FLANGER_REGEN 0x200308 #define FLANGER_REGEN 904
#define MXR_FLANGER_MANUAL 0x200315 #define FLANGER_LEVEL 901
#define FLANGER_WAVE 905
#define PHASER_SPEED 0x200342 #define MXR_FLANGER_SPEED 902
#define PHASER_DEPTH 0x200343 #define MXR_FLANGER_WIDTH 914
#define PHASER_REGEN 0x200346 #define MXR_FLANGER_REGEN 904
#define PHASER_LEVEL 0x200345 #define MXR_FLANGER_MANUAL 917
#define PHASER_WAVE 0x200347
#define VIBRATO_SPEED 0x000504 #define PHASER_SPEED 962
#define VIBRATO_DEPTH 0x000505 #define PHASER_DEPTH 963
#define PHASER_REGEN 966
#define PHASER_LEVEL 965
#define PHASER_WAVE 967
#define ROTARY_SPEED 0x000542 #define VIBRATO_SPEED 1284
#define ROTARY_INTENSITY 0x000544 #define VIBRATO_DEPTH 1285
#define ROTARY_DOPPLER 0x000546
#define ROTARY_CROSSOVER 0x000547
#define VIBROPAN_SPEED 0x000522 #define ROTARY_SPEED 1346
#define VIBROPAN_DEPTH 0x000523 #define ROTARY_INTENSITY 1348
#define VIBROPAN_VIBRA 0x000524 #define ROTARY_DOPPLER 1350
#define VIBROPAN_WAVE 0x000525 #define ROTARY_CROSSOVER 1351
#define TREMOLO_SPEED 0x200404 #define VIBROPAN_SPEED 1314
#define TREMOLO_DEPTH 0x200403 #define VIBROPAN_DEPTH 1315
#define TREMOLO_WAVE 0x200405 #define VIBROPAN_VIBRA 1316
#define VIBROPAN_WAVE 1317
#define PANNER_SPEED 0x200444 #define TREMOLO_SPEED 1156
#define PANNER_DEPTH 0x200443 #define TREMOLO_DEPTH 1155
#define PANNER_WAVE 0x200445 #define TREMOLO_WAVE 1157
#define ENVELOPE_SENSITIVITY 0x000646 #define PANNER_SPEED 1220
#define ENVELOPE_RANGE 0x000645 #define PANNER_DEPTH 1219
#define PANNER_WAVE 1221
#define AUTOYA_SPEED 0x200546 #define ENVELOPE_SENSITIVITY 1606
#define AUTOYA_INTENSITY 0x20054A #define ENVELOPE_RANGE 1605
#define AUTOYA_RANGE 0x20054B
#define YAYA_PEDAL 0x200502 #define AUTOYA_SPEED 1478
#define YAYA_INTENSITY 0x200509 #define AUTOYA_INTENSITY 1482
#define YAYA_RANGE 0x20050A #define AUTOYA_RANGE 1483
#define STEP_FILTER_SPEED 0x200B42 #define YAYA_PEDAL 1410
#define STEP_FILTER_INTENSITY 0x200B43 #define YAYA_INTENSITY 1417
#define YAYA_RANGE 1418
#define WHAMMY_AMOUNT 0x000705 #define STEP_FILTER_SPEED 3010
#define WHAMMY_PEDAL 0x000703 #define STEP_FILTER_INTENSITY 3011
#define WHAMMY_MIX 0x000704
#define PITCH_AMOUNT 0x200642 #define WHAMMY_AMOUNT 1797
#define PITCH_MIX 0x200651 #define WHAMMY_PEDAL 1795
#define WHAMMY_MIX 1796
#define DETUNE_AMOUNT 0x200604 #define PITCH_AMOUNT 1730
#define DETUNE_LEVEL 0x200603 #define PITCH_MIX 1745
#define IPS_SHIFT_AMOUNT 0x200A42 #define DETUNE_AMOUNT 1668
#define IPS_KEY 0x200A44 #define DETUNE_LEVEL 1667
#define IPS_SCALE 0x200A43
#define IPS_LEVEL 0x200A45 #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, /* DUAL_CHORUS_WAVE, MULTI_CHORUS_WAVE, FLANGER_WAVE, PHASER_WAVE,
VIBROPAN_WAVE, TREMOLO_WAVE, PANNER_WAVE valid values */ VIBROPAN_WAVE, TREMOLO_WAVE, PANNER_WAVE valid values */