Merge pull request #1 from tlaberge/master
Refine debug/logging infrastructure
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
*.[om]
|
||||
*.rp355p
|
||||
cscope.*
|
||||
tags
|
||||
gdigi
|
||||
*.orig
|
||||
*.swp
|
||||
207
effects.c
207
effects.c
@@ -579,73 +579,74 @@ static EffectValues values_loose_tight = {
|
||||
};
|
||||
|
||||
static EffectValues values_pickup_type = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 65.0, .max = 66.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
.labels = pickup_type_labels,
|
||||
};
|
||||
|
||||
static EffectValues values_comp_type = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 195.0, .max = 197.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_dist_type = {
|
||||
.min = 0.0, .max = 24.0,
|
||||
.min = 1280.0, .max = 1302.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_amp_type = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 307.0, .max = 351.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_cab_type = {
|
||||
.min = 0.0, .max = 19.0,
|
||||
.min = 570.0, .max = 627.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_gate_type = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 768.0, .max = 769.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_mod_type = {
|
||||
.min = 0.0, .max = 19.0,
|
||||
.min = 862.0, .max = 1347.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_pre_post = {
|
||||
.min = 0.0, .max = 15.0,
|
||||
.min = 1543.0, .max = 1544.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_delay_type = {
|
||||
.min = 0.0, .max = 15.0,
|
||||
.min = 1027.0, .max = 1066.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_reverb_type = {
|
||||
.min = 0.0, .max = 14.0,
|
||||
.min = 1107.0, .max = 1151.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_wah_type = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 129.0, .max = 134.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
// 4259839 is 0x40 FFFF, i.e. 0x<pos> <val>.
|
||||
static EffectValues values_exp_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 0.0, .max = 4259839.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_vswitch_pedal_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 0.0, .max = 4259839.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_vswitch_assign = {
|
||||
.min = 0.0, .max = 1.0,
|
||||
.min = 0.0, .max = 4259839.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
@@ -678,7 +679,7 @@ static EffectValues values_lfo_speed = {
|
||||
};
|
||||
|
||||
static EffectValues values_eq_type = {
|
||||
.min = 0.0, .max = 3.0,
|
||||
.min = 1472.0, .max = 1475.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
@@ -688,12 +689,12 @@ static EffectValues values_lfo_waveform = {
|
||||
};
|
||||
|
||||
static EffectValues values_tone_lib_type= {
|
||||
.min = 0.0, .max = 31.0,
|
||||
.min = 1792.0, .max = 1822.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
static EffectValues values_fx_lib_type= {
|
||||
.min = 0.0, .max = 31.0,
|
||||
.min = 1856.0, .max = 1866.0,
|
||||
.type = VALUE_TYPE_LABEL,
|
||||
};
|
||||
|
||||
@@ -709,8 +710,8 @@ static EffectValues values_rp_mix = {
|
||||
};
|
||||
|
||||
static EffectSettings usb_settings[] = {
|
||||
{"USB/RP Mix", USB_AUDIO_PLAYBACK_MIX, USB_POSITION, &values_rp_mix},
|
||||
{"USB Level", USB_AUDIO_LEVEL, USB_POSITION, &values_m12_to_24},
|
||||
{"USB/RP Mix", USB_AUDIO_PLAYBACK_MIX, GLOBAL_POSITION, &values_rp_mix},
|
||||
{"USB Level", USB_AUDIO_LEVEL, GLOBAL_POSITION, &values_m12_to_24},
|
||||
};
|
||||
|
||||
static EffectSettings misc_settings[] = {
|
||||
@@ -942,17 +943,17 @@ static EffectSettings dist_mp_settings[] = {
|
||||
};
|
||||
|
||||
static EffectSettings rp250_amp_settings[] = {
|
||||
{"Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings rp250_amp_settings2[] = {
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings rp355_amp_settings_A[] = {
|
||||
{"Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings rp355_amp_settings_B[] = {
|
||||
@@ -961,7 +962,7 @@ static EffectSettings rp355_amp_settings_B[] = {
|
||||
};
|
||||
|
||||
static EffectSettings rp355_amp_settings2_A[] = {
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings rp355_amp_settings2_B[] = {
|
||||
@@ -969,22 +970,22 @@ static EffectSettings rp355_amp_settings2_B[] = {
|
||||
};
|
||||
|
||||
static EffectSettings rp500_amp_settings[] = {
|
||||
{"Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Bass", AMP_BASS, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Mid", AMP_MID, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Treble", AMP_TREBLE, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Bass", AMP_BASS, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Mid", AMP_MID, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Treble", AMP_TREBLE, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
};
|
||||
|
||||
static EffectSettings rp500_amp_settings2[] = {
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Bass", AMP_BASS, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Mid", AMP_MID, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Treble", AMP_TREBLE, AMP_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Bass", AMP_BASS, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Mid", AMP_MID, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
{"Treble", AMP_TREBLE, AMP_A_POSITION, &values_1_to_10_step_0p1},
|
||||
};
|
||||
|
||||
static EffectSettings rp500_amp_settings3[] = {
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings gnx3k_ch1_cab_tuning_settings[] = {
|
||||
@@ -996,15 +997,15 @@ static EffectSettings gnx3k_ch2_cab_tuning_settings[] = {
|
||||
};
|
||||
|
||||
static EffectSettings gnx3k_ch1_amp_eq_settings[] = {
|
||||
{"Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Bass Freq", AMP_BASS_FREQ, AMP_POSITION, &values_eq_bass_hz},
|
||||
{"Bass Level", AMP_BASS_LEVEL, AMP_POSITION, &values_eq_db},
|
||||
{"Mid Freq", AMP_MID_FREQ, AMP_POSITION, &values_eq_mid_hz},
|
||||
{"Mid Level", AMP_MID_LEVEL, AMP_POSITION, &values_eq_db},
|
||||
{"Treb Freq", AMP_TREBLE_FREQ, AMP_POSITION, &values_eq_treb_hz},
|
||||
{"Treb Level", AMP_TREBLE_LEVEL, AMP_POSITION, &values_eq_db},
|
||||
{"Presence", AMP_PRESENCE, AMP_POSITION, &values_eq_db},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Bass Freq", AMP_BASS_FREQ, AMP_A_POSITION, &values_eq_bass_hz},
|
||||
{"Bass Level", AMP_BASS_LEVEL, AMP_A_POSITION, &values_eq_db},
|
||||
{"Mid Freq", AMP_MID_FREQ, AMP_A_POSITION, &values_eq_mid_hz},
|
||||
{"Mid Level", AMP_MID_LEVEL, AMP_A_POSITION, &values_eq_db},
|
||||
{"Treb Freq", AMP_TREBLE_FREQ, AMP_A_POSITION, &values_eq_treb_hz},
|
||||
{"Treb Level", AMP_TREBLE_LEVEL, AMP_A_POSITION, &values_eq_db},
|
||||
{"Presence", AMP_PRESENCE, AMP_A_POSITION, &values_eq_db},
|
||||
{"Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings gnx3k_ch2_amp_eq_settings[] = {
|
||||
@@ -1031,18 +1032,18 @@ static EffectSettings rp355_eq_settings_A[] = {
|
||||
{"Bass", EQ_BASS, EQ_A_POSITION, &values_eq_db},
|
||||
{"Mid", EQ_MID, EQ_A_POSITION, &values_eq_db},
|
||||
{"Treble", EQ_TREB, EQ_A_POSITION, &values_eq_db},
|
||||
{"Presence", EQ_PRESENCE, EQ_A_POSITION, &values_eq_db},
|
||||
{"Mid Hz", EQ_MID_FREQ, EQ_A_POSITION, &values_eq_mid_hz},
|
||||
{"Treb Hz", EQ_TREB_FREQ, EQ_A_POSITION, &values_eq_treb_hz},
|
||||
{"Presence", EQ_PRESENCE, EQ_A_POSITION, &values_eq_db},
|
||||
};
|
||||
|
||||
static EffectSettings rp355_eq_settings_B[] = {
|
||||
{"Bass", EQ_BASS, EQ_B_POSITION, &values_eq_db},
|
||||
{"Mid", EQ_MID, EQ_B_POSITION, &values_eq_db},
|
||||
{"Treble", EQ_TREB, EQ_B_POSITION, &values_eq_db},
|
||||
{"Presence", EQ_PRESENCE, EQ_B_POSITION, &values_eq_db},
|
||||
{"Mid Hz", EQ_MID_FREQ, EQ_B_POSITION, &values_eq_mid_hz},
|
||||
{"Treb Hz", EQ_TREB_FREQ, EQ_B_POSITION, &values_eq_treb_hz},
|
||||
{"Presence", EQ_PRESENCE, EQ_B_POSITION, &values_eq_db},
|
||||
};
|
||||
|
||||
static EffectSettings rp500_eq_settings[] = {
|
||||
@@ -2823,23 +2824,23 @@ static Effect reverb_effect[] = {
|
||||
};
|
||||
|
||||
static Effect rp150_amp_effect[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp150_amp_group, G_N_ELEMENTS(rp150_amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp150_amp_group, G_N_ELEMENTS(rp150_amp_group)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp150_amp_cab_group, G_N_ELEMENTS(rp150_amp_cab_group)},
|
||||
};
|
||||
|
||||
static Effect rp155_amp_effect[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp155_amp_group, G_N_ELEMENTS(rp155_amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp155_amp_group, G_N_ELEMENTS(rp155_amp_group)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp150_amp_cab_group, G_N_ELEMENTS(rp150_amp_cab_group)},
|
||||
};
|
||||
|
||||
static Effect rp250_amp_effect[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp250_amp_group, G_N_ELEMENTS(rp250_amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp250_amp_group, G_N_ELEMENTS(rp250_amp_group)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp250_amp_cab_group, G_N_ELEMENTS(rp250_amp_cab_group)},
|
||||
};
|
||||
|
||||
/* same cabs as rp250, but 3 new amp models */
|
||||
static Effect rp255_amp_effect[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp255_amp_group, G_N_ELEMENTS(rp255_amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp255_amp_group, G_N_ELEMENTS(rp255_amp_group)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp250_amp_cab_group, G_N_ELEMENTS(rp250_amp_cab_group)},
|
||||
};
|
||||
|
||||
@@ -2848,7 +2849,7 @@ static Effect rp355_select_amp_effect[] = {
|
||||
};
|
||||
|
||||
static Effect rp355_amp_effect_A[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp355_amp_group_A, G_N_ELEMENTS(rp355_amp_group_A)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp355_amp_group_A, G_N_ELEMENTS(rp355_amp_group_A)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp355_amp_cab_group, G_N_ELEMENTS(rp355_amp_cab_group)},
|
||||
};
|
||||
|
||||
@@ -2858,19 +2859,19 @@ static Effect rp355_amp_effect_B[] = {
|
||||
};
|
||||
|
||||
static Effect rp500_amp_effect[] = {
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_POSITION, rp500_amp_group, G_N_ELEMENTS(rp500_amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_TYPE, AMP_A_POSITION, rp500_amp_group, G_N_ELEMENTS(rp500_amp_group)},
|
||||
{"Cabinet", -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp500_amp_cab_group, G_N_ELEMENTS(rp500_amp_cab_group)},
|
||||
};
|
||||
|
||||
static Effect rp1000_amp_effect[] = {
|
||||
{"Amp Loop", AMP_LOOP_ON_OFF, -1, AMP_LOOP_POSITION, NULL, -1},
|
||||
{"Amp/Cab Bypass", AMP_BYPASS_ON_OFF, -1, AMP_BYPASS_POSITION, NULL, -1},
|
||||
{NULL, -1, AMP_TYPE, AMP_POSITION, rp1000_amp_group, G_N_ELEMENTS(rp1000_amp_group)},
|
||||
{NULL, -1, AMP_TYPE, AMP_A_POSITION, rp1000_amp_group, G_N_ELEMENTS(rp1000_amp_group)},
|
||||
{NULL, -1, AMP_CAB_TYPE, AMP_CAB_POSITION, rp1000_amp_cab_group, G_N_ELEMENTS(rp1000_amp_cab_group)},
|
||||
};
|
||||
|
||||
static Effect gnx3k_channel_1_effect[] = {
|
||||
{"EQ Enable", AMP_EQ_ON_OFF, AMP_TYPE, AMP_POSITION, gnx3k_amp_group, G_N_ELEMENTS(gnx3k_amp_group)},
|
||||
{"EQ Enable", AMP_EQ_ON_OFF, AMP_TYPE, AMP_A_POSITION, gnx3k_amp_group, G_N_ELEMENTS(gnx3k_amp_group)},
|
||||
{NULL, -1, AMP_CAB_TYPE, AMP_CAB_POSITION, gnx3k_amp_cab_group, G_N_ELEMENTS(gnx3k_amp_cab_group)},
|
||||
{NULL, -1, -1, -1, gnx3k_ch1_cab_tuning_group, G_N_ELEMENTS(gnx3k_ch1_cab_tuning_group)},
|
||||
{NULL, -1, -1, -1, gnx3k_ch1_amp_eq_group, G_N_ELEMENTS(gnx3k_ch1_amp_eq_group)},
|
||||
@@ -3259,13 +3260,22 @@ static Modifier modifiers[] = {
|
||||
{"Dist Sustain", DIST_MP_SUSTAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Dist Tone", DIST_MP_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Dist Volume", DIST_MP_VOLUME, DIST_POSITION, &values_0_to_99},
|
||||
{"Amp Channel Enable", AMP_ON_OFF, AMP_POSITION, &values_on_off},
|
||||
{"Amp Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Amp Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Amp Channel Enable", AMP_ON_OFF, AMP_A_POSITION, &values_on_off},
|
||||
{"Amp Gain", AMP_GAIN, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Amp Level", AMP_LEVEL, AMP_A_POSITION, &values_0_to_99},
|
||||
{"Amp Channel Enable", AMP_ON_OFF, AMP_B_POSITION, &values_on_off},
|
||||
{"Amp Gain", AMP_GAIN, AMP_B_POSITION, &values_0_to_99},
|
||||
{"Amp Level", AMP_LEVEL, AMP_B_POSITION, &values_0_to_99},
|
||||
{"EQ Enable", EQ_ENABLE, EQ_A_POSITION, &values_on_off},
|
||||
{"EQ Bass", EQ_BASS, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Mid", EQ_MID, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_TREB, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_PRESENCE, EQ_A_POSITION, &values_eq_db},
|
||||
{"EQ Enable", EQ_ENABLE, EQ_B_POSITION, &values_on_off},
|
||||
{"EQ Bass", EQ_BASS, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Mid", EQ_MID, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_TREB, EQ_B_POSITION, &values_eq_db},
|
||||
{"EQ Treb", EQ_PRESENCE, EQ_B_POSITION, &values_eq_db},
|
||||
{"Gate Enable", NOISEGATE_ON_OFF, NOISEGATE_POSITION, &values_on_off},
|
||||
{"Gate Pluck Sens", NOISEGATE_SWELL_SENS, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Gate Threshold", NOISEGATE_GATE_TRESHOLD, NOISEGATE_POSITION, &values_0_to_99},
|
||||
@@ -3853,10 +3863,10 @@ XmlSettings xml_settings[] = {
|
||||
|
||||
{AMP_CHANNEL, AMP_CHANNEL_POSITION, "Amp Channel", &values_a_b, xml_amp_channel_labels, G_N_ELEMENTS(xml_amp_channel_labels)},
|
||||
|
||||
{AMP_TYPE, AMP_POSITION, "Amp A Type", &values_amp_type, xml_amp_labels, G_N_ELEMENTS(xml_amp_labels)},
|
||||
{AMP_ON_OFF, AMP_POSITION, "Amp A Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
{AMP_GAIN, AMP_POSITION, "Amp A Gain", &values_0_to_99,},
|
||||
{AMP_LEVEL, AMP_POSITION, "Amp A Level", &values_0_to_99,},
|
||||
{AMP_TYPE, AMP_A_POSITION, "Amp A Type", &values_amp_type, xml_amp_labels, G_N_ELEMENTS(xml_amp_labels)},
|
||||
{AMP_ON_OFF, AMP_A_POSITION, "Amp A Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
{AMP_GAIN, AMP_A_POSITION, "Amp A Gain", &values_0_to_99,},
|
||||
{AMP_LEVEL, AMP_A_POSITION, "Amp A Level", &values_0_to_99,},
|
||||
|
||||
{AMP_TYPE, AMP_B_POSITION, "Amp B Type", &values_amp_type, xml_amp_labels, G_N_ELEMENTS(xml_amp_labels)},
|
||||
{AMP_ON_OFF, AMP_B_POSITION, "Amp B Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
@@ -3936,6 +3946,13 @@ XmlSettings xml_settings[] = {
|
||||
{IPS_SCALE, CHORUSFX_POSITION, "IPS Scale", &values_ips_scale, xml_ips_scale_labels, G_N_ELEMENTS(xml_ips_scale_labels)},
|
||||
{IPS_LEVEL, CHORUSFX_POSITION, "IPS Level", &values_0_to_99,},
|
||||
|
||||
{SYNTH_TALK_ATTACK, CHORUSFX_POSITION, "Synth Talk Attack", &values_0_to_99,},
|
||||
{GNX3K_SYNTH_TALK_RELEASE, CHORUSFX_POSITION, "Synth Talk Release", &values_0_to_99,},
|
||||
{SYNTH_TALK_RELEASE, CHORUSFX_POSITION, "Synth Talk Release", &values_0_to_99,},
|
||||
{SYNTH_TALK_SENS, CHORUSFX_POSITION, "Synth Talk Sens", &values_0_to_99,},
|
||||
{SYNTH_TALK_VOX, CHORUSFX_POSITION, "Synth Talk Vox", &values_0_to_99,},
|
||||
{SYNTH_TALK_BALANCE, CHORUSFX_POSITION, "Synth Talk Balance", &values_0_to_99,},
|
||||
|
||||
{DELAY_TYPE, DELAY_POSITION, "Delay Type", &values_delay_type, xml_delay_labels, G_N_ELEMENTS(xml_delay_labels)},
|
||||
{DELAY_ON_OFF, DELAY_POSITION, "Delay Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
{DELAY_TIME, DELAY_POSITION, "Delay Time", &values_delay_time,},
|
||||
@@ -3961,7 +3978,6 @@ XmlSettings xml_settings[] = {
|
||||
{WAH_ON_OFF, WAH_POSITION, "Wah Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
{WAH_PEDAL_POSITION, WAH_POSITION, "Wah Position", &values_0_to_99,},
|
||||
{WAH_VOLUME_BOOST, WAH_POSITION, "Wah Vol. Boost", &values_db_boost,},
|
||||
{MOD_TYPE, MOD_POSITION, "Mod Type", &values_0_to_99,}, // ???
|
||||
|
||||
{PRESET_LEVEL, PRESET_POSITION, "Preset Level", &values_0_to_99,},
|
||||
|
||||
@@ -3996,8 +4012,8 @@ XmlSettings xml_settings[] = {
|
||||
{EQ_BASS, EQ_A_POSITION, "EQ A Bass", &values_eq_db,},
|
||||
{EQ_MID, EQ_A_POSITION, "EQ A Mid", &values_eq_db,},
|
||||
{EQ_TREB, EQ_A_POSITION, "EQ A Treb", &values_eq_db,},
|
||||
{EQ_MID_FREQ, EQ_A_POSITION, "EQ A Mid Freq", &values_eq_mid_hz,},
|
||||
{EQ_PRESENCE, EQ_A_POSITION, "EQ A Presence", &values_eq_db,},
|
||||
{EQ_MID_FREQ, EQ_A_POSITION, "EQ A Mid Freq", &values_eq_mid_hz,},
|
||||
{EQ_TREB_FREQ, EQ_A_POSITION, "EQ A Treb Freq", &values_eq_treb_hz,},
|
||||
|
||||
{EQ_ENABLE, EQ_B_POSITION, "EQ B Enable", &values_on_off, xml_on_off_labels, G_N_ELEMENTS(xml_on_off_labels)},
|
||||
@@ -4005,8 +4021,8 @@ XmlSettings xml_settings[] = {
|
||||
{EQ_BASS, EQ_B_POSITION, "EQ B Bass", &values_eq_db,},
|
||||
{EQ_MID, EQ_B_POSITION, "EQ B Mid", &values_eq_db,},
|
||||
{EQ_TREB, EQ_B_POSITION, "EQ B Treb", &values_eq_db,},
|
||||
{EQ_MID_FREQ, EQ_B_POSITION, "EQ B Mid Freq", &values_eq_mid_hz,},
|
||||
{EQ_PRESENCE, EQ_B_POSITION, "EQ B Presence", &values_eq_db,},
|
||||
{EQ_MID_FREQ, EQ_B_POSITION, "EQ B Mid Freq", &values_eq_mid_hz,},
|
||||
{EQ_TREB_FREQ, EQ_B_POSITION, "EQ B Treb Freq", &values_eq_treb_hz,},
|
||||
|
||||
{TONE_LIB_TYPE, LIB_POSITION, "Tone Lib Type", &values_tone_lib_type, xml_tone_lib_labels, G_N_ELEMENTS(xml_tone_lib_labels)},
|
||||
@@ -4015,10 +4031,61 @@ XmlSettings xml_settings[] = {
|
||||
{FX_LIB_LEVEL_MAX1, LIB_POSITION, "FxLibLvlMax1", &values_0_to_99,},
|
||||
{FX_LIB_LEVEL_MAX2, LIB_POSITION, "FxLibLvlMax2", &values_0_to_99,},
|
||||
{FX_LIB_LEVEL_MAX3, LIB_POSITION, "FxLibLvlMax3", &values_0_to_99,},
|
||||
|
||||
// Global settings, not part of presets or standard XML.
|
||||
{TUNING_REFERENCE, GLOBAL_POSITION, "Tuning Reference", &values_0_to_99,},
|
||||
{USB_AUDIO_PLAYBACK_MIX, GLOBAL_POSITION, "USB Audio Playback Mix", &values_0_to_99,},
|
||||
{USB_AUDIO_LEVEL, GLOBAL_POSITION, "USB Audio Level", &values_0_to_99,},
|
||||
{GUI_MODE_ON_OFF, GLOBAL_POSITION, "GUI Mode", &values_0_to_99,},
|
||||
{EXP_PEDAL_LEVEL, GLOBAL_POSITION, "EXP Pedal Level", &values_0_to_99,},
|
||||
{STOMP_MODE, GLOBAL_POSITION, "Stomp Mode", &values_0_to_99,},
|
||||
};
|
||||
|
||||
|
||||
guint n_xml_settings = G_N_ELEMENTS(xml_settings);
|
||||
|
||||
gchar *Positions[] = {
|
||||
[ GLOBAL_POSITION ] = "Global",
|
||||
[ PICKUP_POSITION ] = "Pickup",
|
||||
[ WAH_POSITION ] = "Wah",
|
||||
[ COMP_POSITION ] = "Compressor",
|
||||
[ GNX3K_WHAM_POSITION ] = "Gnx3K Wham",
|
||||
[ DIST_POSITION ] = "Distortion",
|
||||
[ AMP_CHANNEL_POSITION ] = "Amp Channel",
|
||||
[ GNX_CHANNEL_POSITION ] = "Gnx Channel",
|
||||
[ AMP_A_POSITION ] = "Amp A",
|
||||
[ AMP_CAB_POSITION ] = "Amp Cab A",
|
||||
[ AMP_B_POSITION ] = "Amp B",
|
||||
[ AMP_CAB_B_POSITION ] = "Amp Cab B",
|
||||
[ NOISEGATE_POSITION ] = "Noise Gate",
|
||||
[ VOLUME_PRE_FX_POSITION ] = "Volume Pre Fx",
|
||||
[ CHORUSFX_POSITION ] = "Chorus Fx",
|
||||
[ DELAY_POSITION ] = "Delay",
|
||||
[ REVERB_POSITION ] = "Reverb",
|
||||
[ VOLUME_POST_FX_POSITION ] = "Volume Post Fx",
|
||||
[ PRESET_POSITION ] = "Preset",
|
||||
[ EXP_POSITION ] = "Expression",
|
||||
[ WAH_POSITION_MIN_MAX ] = "Wah Min Max",
|
||||
[ VSWITCH_ASSIGN_POSITION ] = "Vswitch",
|
||||
[ LFO1_POSITION ] = "LFO 1",
|
||||
[ LFO2_POSITION ] = "LFO 2",
|
||||
[ EQ_A_POSITION ] = "EQ A",
|
||||
[ EQ_B_POSITION ] = "EQ B",
|
||||
[ LIB_POSITION ] = "Library",
|
||||
[ AMP_LOOP_POSITION ] = "Amp Loop",
|
||||
};
|
||||
|
||||
guint max_position = G_N_ELEMENTS(Positions);
|
||||
|
||||
gchar *
|
||||
get_position (guint position)
|
||||
{
|
||||
if (position > max_position) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return Positions[position];
|
||||
}
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**
|
||||
@@ -4102,7 +4169,10 @@ ModifierGroup *modifier_linkable_list()
|
||||
modifier_group->type = EXP_TYPE;
|
||||
modifier_group->position = EXP_POSITION;
|
||||
|
||||
g_message("Group %d count %d", group_id, count);
|
||||
debug_msg(DEBUG_MSG2HOST|DEBUG_GROUP,
|
||||
"RECEIVE_MODIFIER_LINKABLE_LIST: Group %d count %d",
|
||||
group_id, count);
|
||||
|
||||
EffectGroup *group = g_slice_alloc(count * sizeof(EffectGroup));
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
@@ -4124,7 +4194,9 @@ ModifierGroup *modifier_linkable_list()
|
||||
if (group[i].settings == NULL)
|
||||
group[i].settings_amt = 0;
|
||||
|
||||
g_message("ID: %d Position: %d Label: %s", id, position, modifier ? modifier->label : NULL);
|
||||
debug_msg(DEBUG_MSG2HOST|DEBUG_GROUP,
|
||||
"ID: %4d Position: %2d: %s",
|
||||
id, position, modifier ? modifier->label : NULL);
|
||||
}
|
||||
|
||||
modifier_group->group = group;
|
||||
@@ -4192,6 +4264,7 @@ gboolean get_device_info(unsigned char device_id, unsigned char family_id,
|
||||
for (x = 0; x < G_N_ELEMENTS(supported_devices); x++) {
|
||||
if (supported_devices[x]->product_id == product_id && supported_devices[x]->family_id == family_id) {
|
||||
*device = supported_devices[x];
|
||||
debug_msg(DEBUG_STARTUP, "Device name %s.", (*device)->name);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ typedef struct {
|
||||
gint n_banks;
|
||||
} Device;
|
||||
|
||||
gchar *get_position(guint position);
|
||||
ModifierGroup *modifier_linkable_list();
|
||||
void modifier_group_free(ModifierGroup *modifier_group);
|
||||
void get_values_info(EffectValues *values,
|
||||
|
||||
385
gdigi.c
385
gdigi.c
@@ -21,6 +21,7 @@
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <alloca.h>
|
||||
#include "gdigi.h"
|
||||
#include "gdigi_xml.h"
|
||||
#include "gui.h"
|
||||
|
||||
static unsigned char device_id = 0x7F;
|
||||
@@ -35,6 +36,169 @@ static GQueue *message_queue = NULL;
|
||||
static GMutex *message_queue_mutex = NULL;
|
||||
static GCond *message_queue_cond = NULL;
|
||||
|
||||
static guint DebugFlags;
|
||||
|
||||
gboolean
|
||||
debug_flag_is_set (debug_flags_t flags)
|
||||
{
|
||||
if (DebugFlags & flags) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean set_debug_flags (const gchar *option_name, const gchar *value,
|
||||
gpointer data, GError **error)
|
||||
{
|
||||
if (strchr(value, 'd')) {
|
||||
DebugFlags |= DEBUG_MSG2DEV;
|
||||
}
|
||||
if (strchr(value, 'h')) {
|
||||
DebugFlags |= DEBUG_MSG2HOST;
|
||||
}
|
||||
if (strchr(value, 'm')) {
|
||||
DebugFlags |= DEBUG_MSG2DEV|DEBUG_MSG2HOST|DEBUG_GROUP;
|
||||
}
|
||||
if (strchr(value, 's')) {
|
||||
DebugFlags |= DEBUG_STARTUP;
|
||||
}
|
||||
if (strchr(value, 'H')) {
|
||||
DebugFlags |= DEBUG_HEX;
|
||||
}
|
||||
if (strchr(value, 'g')) {
|
||||
DebugFlags |= DEBUG_GROUP;
|
||||
}
|
||||
if (strchr(value, 'x')) {
|
||||
DebugFlags |= DEBUG_XML;
|
||||
}
|
||||
if (strchr(value, 'v')) {
|
||||
DebugFlags |= DEBUG_VERBOSE;
|
||||
}
|
||||
if (strchr(value, 'a')) {
|
||||
DebugFlags = -1;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
debug_msg (debug_flags_t flags, char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
if (flags & DebugFlags) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, 1024, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "%s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Format a value according to the xml setting.
|
||||
* Returns an allocated buffer that must be freed by the caller.
|
||||
*/
|
||||
GString *
|
||||
format_value (XmlSettings *xml, gint value)
|
||||
{
|
||||
GString *buf = g_string_sized_new(1);
|
||||
EffectValues *values = NULL;
|
||||
ValueType vtype;
|
||||
gchar *suffix = "";
|
||||
gdouble step = 1.0;
|
||||
gint offset = 0;
|
||||
gboolean decimal = FALSE;
|
||||
|
||||
values = xml->values;
|
||||
vtype = values->type;
|
||||
while ((vtype & VALUE_TYPE_EXTRA) && value_is_extra(values, value)) {
|
||||
values = values->extra;
|
||||
vtype = values->type;
|
||||
}
|
||||
vtype &= ~VALUE_TYPE_EXTRA;
|
||||
|
||||
if (vtype & VALUE_TYPE_OFFSET) {
|
||||
offset = values->offset;
|
||||
vtype &= ~VALUE_TYPE_OFFSET;
|
||||
}
|
||||
|
||||
if (vtype & VALUE_TYPE_STEP) {
|
||||
step = values->step;
|
||||
vtype &= ~VALUE_TYPE_STEP;
|
||||
}
|
||||
|
||||
if (vtype & VALUE_TYPE_SUFFIX) {
|
||||
suffix = values->suffix;
|
||||
vtype &= ~VALUE_TYPE_SUFFIX;
|
||||
}
|
||||
|
||||
if (vtype & VALUE_TYPE_DECIMAL) {
|
||||
decimal = TRUE;
|
||||
vtype &= ~VALUE_TYPE_DECIMAL;
|
||||
}
|
||||
|
||||
switch (vtype) {
|
||||
case VALUE_TYPE_LABEL:
|
||||
{
|
||||
char *textp = map_xml_value(xml, value);
|
||||
if (!textp) {
|
||||
g_warning("Unable to map %s value %d for id %d position %d",
|
||||
xml->label, value, xml->id, xml->position);
|
||||
textp = "";
|
||||
}
|
||||
g_string_printf(buf, "%s", textp);
|
||||
break;
|
||||
}
|
||||
case VALUE_TYPE_PLAIN:
|
||||
{
|
||||
if (decimal) {
|
||||
double dvalue = (value + offset) * step;
|
||||
g_string_printf(buf, "%0.2f%s", dvalue, suffix);
|
||||
} else {
|
||||
gint ivalue = (value + offset) * step;
|
||||
g_string_printf(buf, "%d%s", ivalue, suffix);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VALUE_TYPE_NONE:
|
||||
g_string_printf(buf, "%s", "");
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning("Unhandled value type %d", vtype);
|
||||
break;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
GString *
|
||||
format_ipv (guint id, guint pos, guint val)
|
||||
{
|
||||
GString *buf = g_string_sized_new(1);
|
||||
GString *vec_buf = g_string_sized_new(1);
|
||||
XmlSettings *xml = get_xml_settings(id, pos);
|
||||
GString *val_buf;
|
||||
|
||||
if (!xml) {
|
||||
g_warning("Failed to find xml settings for position %d id %d.",
|
||||
id, pos);
|
||||
g_string_printf(buf, "%s", "error");
|
||||
return buf;
|
||||
}
|
||||
val_buf = format_value(xml, val);
|
||||
|
||||
g_string_printf(vec_buf, "(%2d, %4d, %d)", pos, id, val);
|
||||
g_string_printf(buf, "%-16s %s: %s: %s",
|
||||
vec_buf->str,
|
||||
get_position(pos), xml->label, val_buf->str);
|
||||
g_string_free(vec_buf, TRUE);
|
||||
g_string_free(val_buf, TRUE);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an error quark for gdigi if necessary.
|
||||
*
|
||||
@@ -218,33 +382,55 @@ MessageID get_message_id(GString *msg)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define HEX_WIDTH 26
|
||||
|
||||
void push_message(GString *msg)
|
||||
{
|
||||
if (((unsigned char)msg->str[0] == 0xF0) && ((unsigned char)msg->str[msg->len-1] == 0xF7))
|
||||
g_message("Pushing correct message!");
|
||||
else
|
||||
MessageID msgid = get_message_id(msg);
|
||||
if (((unsigned char)msg->str[0] == 0xF0) &&
|
||||
((unsigned char)msg->str[msg->len-1] == 0xF7)) {
|
||||
debug_msg(DEBUG_VERBOSE, "Pushing correct message!");
|
||||
} else {
|
||||
g_warning("Pushing incorrect message!");
|
||||
}
|
||||
|
||||
int x;
|
||||
for (x = 0; x<msg->len; x++)
|
||||
printf("%02x ", (unsigned char)msg->str[x]);
|
||||
printf("\n");
|
||||
if (debug_flag_is_set(DEBUG_HEX)) {
|
||||
for (x = 0; x<msg->len; x++) {
|
||||
if (x && (x % HEX_WIDTH) == 0) {
|
||||
printf("\n");
|
||||
}
|
||||
printf("%02x ", (unsigned char)msg->str[x]);
|
||||
}
|
||||
if (x % HEX_WIDTH) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
debug_msg(DEBUG_VERBOSE, "Received %s", get_message_name(msgid));
|
||||
|
||||
switch (get_message_id(msg)) {
|
||||
SettingParam *param;
|
||||
switch (msgid) {
|
||||
case ACK:
|
||||
g_message("Received ACK");
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
|
||||
case NACK:
|
||||
g_message("Received NACK");
|
||||
g_warning("Received NACK!");
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
|
||||
case RECEIVE_PARAMETER_VALUE:
|
||||
{
|
||||
unpack_message(msg);
|
||||
SettingParam *param = setting_param_new_from_data(&msg->str[8], NULL);
|
||||
g_message("Received parameter change ID: %d Position: %d Value: %d", param->id, param->position, param->value);
|
||||
param = setting_param_new_from_data(&msg->str[8], NULL);
|
||||
if (debug_flag_is_set(DEBUG_MSG2HOST)) {
|
||||
GString *ipv = format_ipv(param->id,
|
||||
param->position,
|
||||
param->value);
|
||||
debug_msg(DEBUG_MSG2HOST, "Receive RECEIVE_PARAMETER_VALUE: %s",
|
||||
ipv->str);
|
||||
g_string_free(ipv, TRUE);
|
||||
}
|
||||
|
||||
GDK_THREADS_ENTER();
|
||||
apply_setting_param_to_gui(param);
|
||||
@@ -253,32 +439,113 @@ void push_message(GString *msg)
|
||||
setting_param_free(param);
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
case RECEIVE_DEVICE_NOTIFICATION:
|
||||
unpack_message(msg);
|
||||
{
|
||||
unsigned char *str = (unsigned char*)msg->str;
|
||||
switch (str[8]) {
|
||||
case NOTIFY_PRESET_MOVED:
|
||||
if (str[11] == PRESETS_EDIT_BUFFER && str[12] == 0) {
|
||||
g_message("Loaded preset %d from bank %d", str[10], str[9]);
|
||||
|
||||
GDK_THREADS_ENTER();
|
||||
g_timeout_add(0, apply_current_preset_to_gui, NULL);
|
||||
GDK_THREADS_LEAVE();
|
||||
} else {
|
||||
g_message("%d %d moved to %d %d", str[9], str[10], str[11], str[12]);
|
||||
unpack_message(msg);
|
||||
switch (str[8]) {
|
||||
case NOTIFY_PRESET_MOVED:
|
||||
if (str[11] == PRESETS_EDIT_BUFFER && str[12] == 0) {
|
||||
|
||||
GDK_THREADS_ENTER();
|
||||
g_timeout_add(0, apply_current_preset_to_gui, NULL);
|
||||
GDK_THREADS_LEAVE();
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"Receive RECEIVE_DEVICE_NOTIFICATION: Loaded preset "
|
||||
"%d from bank %d",
|
||||
str[10], str[9]);
|
||||
} else {
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"Receive RECEIVE_DEVICE_NOTIFICATION: %d %d moved to "
|
||||
"%d %d",
|
||||
str[9], str[10],
|
||||
str[11], str[12]);
|
||||
}
|
||||
break;
|
||||
|
||||
case NOTIFY_MODIFIER_GROUP_CHANGED:
|
||||
{
|
||||
int i;
|
||||
if (debug_flag_is_set(DEBUG_HEX)) {
|
||||
printf("\n");
|
||||
for (i = 0; i < msg->len; i++) {
|
||||
printf(" %02x", (unsigned char) str[i]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_message("Received unhandled device notification 0x%x", str[11]);
|
||||
printf("\n");
|
||||
}
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"Receive NOTIFY_MODIFIER_GROUP_CHANGED: Modifier group "
|
||||
"id %d changed",
|
||||
(str[9] << 8) | (str[10]));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
g_warning("Received unhandled device notification 0x%x", str[11]);
|
||||
break;
|
||||
}
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
case RECEIVE_GLOBAL_PARAMETERS:
|
||||
{
|
||||
gint tot, n, x;
|
||||
|
||||
unpack_message(msg);
|
||||
tot = (unsigned char)msg->str[9];
|
||||
if (debug_flag_is_set(DEBUG_HEX)) {
|
||||
for (n = 0; n < msg->len; n++) {
|
||||
printf("%02x ",(unsigned char) msg->str[n]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
n = 0;
|
||||
x = 10;
|
||||
do {
|
||||
param = setting_param_new_from_data(&msg->str[x], &x);
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"Receive RECEIVE_GLOBAL_PARAMETERS ID: %5d "
|
||||
"Position: %2.1d Value: %6.1d: %s",
|
||||
param->id,
|
||||
param->position, param->value, "XXX");
|
||||
setting_param_free(param);
|
||||
} while ( (x < msg->len) && n < tot);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
case RECEIVE_MODIFIER_LINKABLE_LIST:
|
||||
{
|
||||
gint tot, n;
|
||||
|
||||
unpack_message(msg);
|
||||
tot = (unsigned char)msg->str[9];
|
||||
|
||||
if (debug_flag_is_set(DEBUG_HEX)) {
|
||||
for (n = 0; n < msg->len; n++) {
|
||||
printf("%02x ",(unsigned char) msg->str[n]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
modifier_linkable_list(msg);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
g_mutex_lock(message_queue_mutex);
|
||||
g_queue_push_tail(message_queue, msg);
|
||||
g_cond_signal(message_queue_cond);
|
||||
g_mutex_unlock(message_queue_mutex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +568,8 @@ gpointer read_data_thread(gboolean *stop)
|
||||
unsigned short revents;
|
||||
|
||||
/* SysEx messages can't contain bytes with 8th bit set.
|
||||
memset our buffer to 0xFF, so if for some reason we'll get out of reply bounds, we'll catch it */
|
||||
memset our buffer to 0xFF, so if for some reason we'll
|
||||
get out of reply bounds, we'll catch it */
|
||||
memset(buf, '\0', sizeof(buf));
|
||||
|
||||
err = poll(pfds, npfds, 200);
|
||||
@@ -400,6 +668,9 @@ void send_message(gint procedure, gchar *data, gint len)
|
||||
g_string_append_printf(msg, "%c\xF7",
|
||||
calculate_checksum(&msg->str[1], msg->len - 1));
|
||||
|
||||
debug_msg(DEBUG_VERBOSE, "Sending %s len %d",
|
||||
get_message_name(procedure), len);
|
||||
|
||||
send_data(msg->str, msg->len);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
@@ -620,12 +891,30 @@ SectionID get_genetx_section_id(gint version, gint type)
|
||||
}
|
||||
}
|
||||
|
||||
g_message("This version of gdigi don't know what to do with this "
|
||||
g_warning("This version of gdigi don't know what to do with this "
|
||||
"GeNetX version (%d) and type (%d)", version, type);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param id Parameter ID
|
||||
* \param position Parameter position
|
||||
* \param value Parameter value
|
||||
*
|
||||
* Forms SysEx message to request parameter then sends it to device.
|
||||
**/
|
||||
void get_option(guint id, guint position)
|
||||
{
|
||||
GString *msg = g_string_sized_new(9);
|
||||
debug_msg(DEBUG_MSG2DEV, "REQUEST_PARAMETER_VALUE: id %d position %d",
|
||||
id, position);
|
||||
g_string_append_printf(msg, "%c%c%c",
|
||||
((id & 0xFF00) >> 8), (id & 0xFF),
|
||||
position);
|
||||
send_message(REQUEST_PARAMETER_VALUE, msg->str, msg->len);
|
||||
g_string_free(msg, TRUE);
|
||||
}
|
||||
/**
|
||||
* \param id Parameter ID
|
||||
* \param position Parameter position
|
||||
@@ -640,6 +929,11 @@ void set_option(guint id, guint position, guint value)
|
||||
((id & 0xFF00) >> 8), (id & 0xFF),
|
||||
position);
|
||||
append_value(msg, value);
|
||||
if (debug_flag_is_set(DEBUG_MSG2DEV)) {
|
||||
GString *ipv = format_ipv(id, position, value);
|
||||
debug_msg(DEBUG_MSG2DEV, "Send RECEIVE_PARAMETER_VALUE: %s", ipv->str);
|
||||
g_string_free(ipv, TRUE);
|
||||
}
|
||||
send_message(RECEIVE_PARAMETER_VALUE, msg->str, msg->len);
|
||||
g_string_free(msg, TRUE);
|
||||
}
|
||||
@@ -850,7 +1144,7 @@ GList *get_message_list(MessageID id)
|
||||
}
|
||||
|
||||
while (amt) {
|
||||
g_message("%d messages left", amt);
|
||||
debug_msg(DEBUG_VERBOSE, "%d messages left", amt);
|
||||
data = g_queue_pop_nth(message_queue, x);
|
||||
if (data == NULL) {
|
||||
g_cond_wait(message_queue_cond, message_queue_mutex);
|
||||
@@ -1058,8 +1352,10 @@ static gboolean request_who_am_i(unsigned char *device_id, unsigned char *family
|
||||
*device_id = data->str[8];
|
||||
*family_id = data->str[9];
|
||||
*product_id = data->str[10];
|
||||
g_message("I am device id %d family %d product id %d.",
|
||||
*device_id, *family_id, *product_id);
|
||||
debug_msg(DEBUG_STARTUP, "Found device id %d family %d product id %d.",
|
||||
*device_id,
|
||||
*family_id,
|
||||
*product_id);
|
||||
g_string_free(data, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1107,6 +1403,25 @@ static void request_device_configuration()
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{"device", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device_port, "MIDI device port to use", NULL},
|
||||
{"debug-flags <flags>", 'D', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, set_debug_flags,
|
||||
"<flags> any of a, d, g, h, m, s, x, v:\n"
|
||||
" "
|
||||
"a: Everything.\n"
|
||||
" "
|
||||
"d: Messages to the device.\n"
|
||||
" "
|
||||
"g: Group messages.\n"
|
||||
" "
|
||||
"h: Dump message contents in hex.\n"
|
||||
" "
|
||||
"m: All messages.\n"
|
||||
" "
|
||||
"s: Startup.\n"
|
||||
" "
|
||||
"x: Debug xml parsing/writing.\n"
|
||||
" "
|
||||
"v: Additional verbosity.\n" ,
|
||||
NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -1151,7 +1466,7 @@ int main(int argc, char *argv[]) {
|
||||
g_option_context_add_group(context, gtk_get_option_group(TRUE));
|
||||
|
||||
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
||||
g_message("option parsing failed: %s\n", error->message);
|
||||
g_warning("option parsing failed: %s\n", error->message);
|
||||
g_error_free(error);
|
||||
g_option_context_free(context);
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -1178,9 +1493,9 @@ int main(int argc, char *argv[]) {
|
||||
device_port = g_strdup_printf("hw:%d,0,0",
|
||||
GPOINTER_TO_INT(device->data));
|
||||
g_list_free(devices);
|
||||
g_message("Found device %s", device_port);
|
||||
debug_msg(DEBUG_STARTUP, "Found device %s.", device_port);
|
||||
} else {
|
||||
g_message("Using device %s", device_port);
|
||||
debug_msg(DEBUG_STARTUP, "Using device %s.", device_port);
|
||||
}
|
||||
|
||||
g_option_context_free(context);
|
||||
@@ -1208,14 +1523,14 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (device != NULL) {
|
||||
/* enable GUI mode */
|
||||
set_option(GUI_MODE_ON_OFF, USB_POSITION, 1);
|
||||
set_option(GUI_MODE_ON_OFF, GLOBAL_POSITION, 1);
|
||||
|
||||
gui_create(device);
|
||||
gtk_main();
|
||||
gui_free();
|
||||
|
||||
/* disable GUI mode */
|
||||
set_option(GUI_MODE_ON_OFF, USB_POSITION, 0);
|
||||
set_option(GUI_MODE_ON_OFF, GLOBAL_POSITION, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1545,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (message_queue != NULL) {
|
||||
g_message("%d unread messages in queue",
|
||||
g_warning("%d unread messages in queue",
|
||||
g_queue_get_length(message_queue));
|
||||
g_queue_foreach(message_queue, (GFunc) message_free_func, NULL);
|
||||
g_queue_free(message_queue);
|
||||
|
||||
33
gdigi.h
33
gdigi.h
@@ -22,6 +22,19 @@
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
typedef enum {
|
||||
DEBUG_MSG2DEV = (1 << 0), // Device bound messages.
|
||||
DEBUG_MSG2HOST = (1 << 1), // Host bound messages.
|
||||
DEBUG_STARTUP = (1 << 2),
|
||||
DEBUG_GROUP = (1 << 3), // Modifier group
|
||||
DEBUG_HEX = (1 << 4), // Dump message contents in hex.
|
||||
DEBUG_XML = (1 << 5),
|
||||
DEBUG_VERBOSE = (1 << 6),
|
||||
} debug_flags_t;
|
||||
|
||||
void debug_msg (debug_flags_t, char *fmt, ...);
|
||||
gboolean debug_flag_is_set (debug_flags_t flag);
|
||||
|
||||
#define GNX_CHANNEL_POSITION 7
|
||||
#define GNX_CHANNEL_AMP 260
|
||||
#define GNX_WARP 261
|
||||
@@ -315,7 +328,7 @@ enum {
|
||||
|
||||
#define AMP_TYPE 2496
|
||||
#define AMP_ON_OFF 265
|
||||
#define AMP_POSITION 8
|
||||
#define AMP_A_POSITION 8
|
||||
#define AMP_B_POSITION 10
|
||||
|
||||
#define AMP_LOOP_ON_OFF 3649
|
||||
@@ -427,7 +440,6 @@ enum {
|
||||
#define EQ_TREB_FREQ 3211
|
||||
#define EQ_ENABLE 3212
|
||||
|
||||
|
||||
#define EQ_LOW_FREQ 3213
|
||||
#define EQ_MID_FREQ_XXX 3214
|
||||
#define EQ_HIGH_FREQ 3215
|
||||
@@ -518,7 +530,6 @@ enum {
|
||||
};
|
||||
|
||||
#define MOD_TYPE 768
|
||||
#define MOD_POSITION 768
|
||||
#define MOD_PRE_POST 1798
|
||||
|
||||
#define CHORUSFX_TYPE 768
|
||||
@@ -881,12 +892,14 @@ enum {
|
||||
#define LIBRARY_EFFECTS 8705
|
||||
#define EFFECTS_LEVEL 8706
|
||||
|
||||
#define LIBRARY_POSITION 25
|
||||
#define LIB_POSITION 26
|
||||
|
||||
#define TONE_LIB_TYPE 8704
|
||||
#define FX_LIB_TYPE 8705
|
||||
#define FX_LIB_LEVEL 8706
|
||||
#define FX_LIB_LEVEL 8706 // This influences pitch shift mix, delay level,
|
||||
// and reverb level, in proportion, as
|
||||
// specified by FX_LIB_LEVEL_MAX1,2,3.
|
||||
//
|
||||
#define FX_LIB_LEVEL_MAX1 8708
|
||||
#define FX_LIB_LEVEL_MAX2 8710
|
||||
#define FX_LIB_LEVEL_MAX3 8712
|
||||
@@ -963,12 +976,18 @@ enum {
|
||||
EFFECTS_LIB_CUSTOM = 1856
|
||||
};
|
||||
|
||||
#define USB_POSITION 0
|
||||
#define GLOBAL_POSITION 0
|
||||
|
||||
#define TUNING_REFERENCE 12288
|
||||
|
||||
#define USB_AUDIO_PLAYBACK_MIX 12297
|
||||
#define USB_AUDIO_LEVEL 12307
|
||||
|
||||
#define GUI_MODE_ON_OFF 12298
|
||||
|
||||
#define EXP_PEDAL_LEVEL 12300
|
||||
#define STOMP_MODE 12370
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
typedef enum {
|
||||
@@ -1114,6 +1133,7 @@ void setting_genetx_free(SettingGenetx *genetx);
|
||||
void setting_param_free(SettingParam *param);
|
||||
SectionID get_genetx_section_id(gint version, gint type);
|
||||
void set_option(guint id, guint position, guint value);
|
||||
void get_option(guint id, guint position);
|
||||
void send_object(SectionID section, guint bank, guint index,
|
||||
gchar *name, GString *data);
|
||||
void send_preset_parameters(GList *params);
|
||||
@@ -1123,5 +1143,6 @@ void set_preset_level(int level);
|
||||
GStrv query_preset_names(gchar bank);
|
||||
void message_list_free(GList *list);
|
||||
GList *get_current_preset();
|
||||
GString *format_ipv(guint id, guint pos, guint val);
|
||||
|
||||
#endif /* GDIGI_H */
|
||||
|
||||
@@ -33,7 +33,8 @@ typedef struct {
|
||||
guint xml_labels_amt;
|
||||
} XmlSettings;
|
||||
|
||||
// XmlSettings *get_xml_settings(guint id, guint position);
|
||||
// gchar *get_xml_label(guint id, guint position, gint type);
|
||||
XmlSettings *get_xml_settings(guint id, guint position);
|
||||
gboolean value_is_extra(EffectValues *val, int value);
|
||||
gchar * map_xml_value(XmlSettings *xml, gint value);
|
||||
|
||||
#endif /* GDIGI_XML_H */
|
||||
|
||||
75
gui.c
75
gui.c
@@ -24,6 +24,71 @@
|
||||
#include "preset.h"
|
||||
#include "gtkknob.h"
|
||||
|
||||
|
||||
static gchar* MessageID_names[] = {
|
||||
[REQUEST_WHO_AM_I] = "REQUEST_WHO_AM_I",
|
||||
[RECEIVE_WHO_AM_I] = "RECEIVE_WHO_AM_I",
|
||||
|
||||
[REQUEST_DEVICE_CONFIGURATION] = "REQUEST_DEVICE_CONFIGURATION",
|
||||
[RECEIVE_DEVICE_CONFIGURATION] = "RECEIVE_DEVICE_CONFIGURATION",
|
||||
|
||||
[REQUEST_GLOBAL_PARAMETERS] = "REQUEST_GLOBAL_PARAMETERS",
|
||||
[RECEIVE_GLOBAL_PARAMETERS] = "RECEIVE_GLOBAL_PARAMETERS",
|
||||
|
||||
[REQUEST_BULK_DUMP] = "REQUEST_BULK_DUMP",
|
||||
[RECEIVE_BULK_DUMP_START] = "RECEIVE_BULK_DUMP_START",
|
||||
[RECEIVE_BULK_DUMP_END] = "RECEIVE_BULK_DUMP_END",
|
||||
|
||||
[REQUEST_PRESET_NAMES] = "REQUEST_PRESET_NAMES",
|
||||
[RECEIVE_PRESET_NAMES] = "RECEIVE_PRESET_NAMES",
|
||||
|
||||
[REQUEST_PRESET_NAME] = "REQUEST_PRESET_NAME",
|
||||
[RECEIVE_PRESET_NAME] = "RECEIVE_PRESET_NAME",
|
||||
|
||||
[REQUEST_PRESET] = "REQUEST_PRESET",
|
||||
[RECEIVE_PRESET_START] = "RECEIVE_PRESET_START",
|
||||
[RECEIVE_PRESET_END] = "RECEIVE_PRESET_END",
|
||||
[RECEIVE_PRESET_PARAMETERS] = "RECEIVE_PRESET_PARAMETERS",
|
||||
|
||||
[LOAD_EDIT_BUFFER_PRESET] = "LOAD_EDIT_BUFFER_PRESET",
|
||||
|
||||
[MOVE_PRESET] = "MOVE_PRESET",
|
||||
|
||||
[REQUEST_MODIFIER_LINKABLE_LIST] = "REQUEST_MODIFIER_LINKABLE_LIST",
|
||||
[RECEIVE_MODIFIER_LINKABLE_LIST] = "RECEIVE_MODIFIER_LINKABLE_LIST",
|
||||
|
||||
[REQUEST_PARAMETER_VALUE] = "REQUEST_PARAMETER_VALUE",
|
||||
[RECEIVE_PARAMETER_VALUE] = "RECEIVE_PARAMETER_VALUE",
|
||||
|
||||
/* version 1 and later */
|
||||
[REQUEST_OBJECT_NAMES] = "REQUEST_OBJECT_NAMES",
|
||||
[RECEIVE_OBJECT_NAMES] = "RECEIVE_OBJECT_NAMES",
|
||||
[REQUEST_OBJECT_NAME] = "REQUEST_OBJECT_NAME",
|
||||
[RECEIVE_OBJECT_NAME] = "RECEIVE_OBJECT_NAME",
|
||||
[REQUEST_OBJECT] = "REQUEST_OBJECT",
|
||||
[RECEIVE_OBJECT] = "RECEIVE_OBJECT",
|
||||
[MOVE_OBJECT] = "MOVE_OBJECT",
|
||||
[DELETE_OBJECT] = "DELETE_OBJECT",
|
||||
[REQUEST_TABLE] = "REQUEST_TABLE",
|
||||
[RECEIVE_TABLE] = "RECEIVE_TABLE",
|
||||
|
||||
[RECEIVE_DEVICE_NOTIFICATION] = "RECEIVE_DEVICE_NOTIFICATION",
|
||||
|
||||
[ACK] = "ACK",
|
||||
[NACK] = "NACK",
|
||||
};
|
||||
|
||||
const gchar*
|
||||
get_message_name(MessageID msgid)
|
||||
{
|
||||
if (MessageID_names[msgid]) {
|
||||
return MessageID_names[msgid];
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GObject *widget;
|
||||
|
||||
@@ -184,7 +249,7 @@ static gboolean custom_value_output_cb(GtkSpinButton *spin, EffectValues *values
|
||||
if (values->type & VALUE_TYPE_EXTRA) {
|
||||
values = values->extra;
|
||||
} else {
|
||||
g_message("custom_value_output_cb called with out of bounds value");
|
||||
g_warning("custom_value_output_cb called with out of bounds value");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -928,7 +993,7 @@ static void action_open_preset_cb(GtkAction *action)
|
||||
for (x=0; x<n_file_types; x++) {
|
||||
GtkFileFilter *current_filter = gtk_file_filter_new();
|
||||
if (file_types[x].name == NULL) {
|
||||
g_message("Skipping NULL array entry");
|
||||
g_warning("Skipping NULL array entry");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1190,7 +1255,7 @@ static void add_menubar(GtkWidget *window, GtkWidget *vbox)
|
||||
gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(ui));
|
||||
|
||||
if (!gtk_ui_manager_add_ui_from_string(ui, menu_info, -1, &error)) {
|
||||
g_message("building menus failed: %s", error->message);
|
||||
g_warning("building menus failed: %s", error->message);
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
@@ -1287,6 +1352,7 @@ void gui_create(Device *device)
|
||||
gtk_widget_show_all(window);
|
||||
|
||||
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1345,7 +1411,8 @@ gboolean unsupported_device_dialog(Device **device)
|
||||
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||
gint number = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
|
||||
if (number != -1 && number <n_supported_devices) {
|
||||
g_message("Starting %s compability mode", supported_devices[number]->name);
|
||||
g_message("Starting %s compability mode",
|
||||
supported_devices[number]->name);
|
||||
*device = supported_devices[number];
|
||||
gtk_widget_destroy(dialog);
|
||||
return TRUE;
|
||||
|
||||
1
gui.h
1
gui.h
@@ -29,5 +29,6 @@ void gui_create(Device *device);
|
||||
void gui_free();
|
||||
gboolean unsupported_device_dialog(Device **device);
|
||||
gint select_device_dialog (GList *devices);
|
||||
const gchar* get_message_name(MessageID msgid);
|
||||
|
||||
#endif /* GDIGI_GUI_H */
|
||||
|
||||
33
preset.c
33
preset.c
@@ -69,7 +69,7 @@ static void XMLCALL start(void *data, const char *el, const char **attr) {
|
||||
if (g_strcmp0(el, "Params") == 0) {
|
||||
ad->section = SECTION_PARAMS;
|
||||
if (ad->preset->params != NULL)
|
||||
g_message("Params aleady exists!");
|
||||
g_warning("Params aleady exists!");
|
||||
} else if (g_strcmp0(el, "Param") == 0) {
|
||||
SettingParam *param = setting_param_new();
|
||||
ad->preset->params = g_list_prepend(ad->preset->params, param);
|
||||
@@ -84,7 +84,7 @@ static void XMLCALL start(void *data, const char *el, const char **attr) {
|
||||
} else if (g_strcmp0(el, "Genetx") == 0) {
|
||||
ad->section = SECTION_GENETX;
|
||||
if (ad->preset->genetxs != NULL)
|
||||
g_message("Genetx already exists!");
|
||||
g_warning("Genetx already exists!");
|
||||
} else if (g_strcmp0(el, "GenetxModel") == 0) {
|
||||
SettingGenetx *genetx = setting_genetx_new();
|
||||
ad->preset->genetxs = g_list_prepend(ad->preset->genetxs, genetx);
|
||||
@@ -160,7 +160,7 @@ static void XMLCALL text_cb(void *data, const char* text, int len)
|
||||
} else if (g_strcmp0(value, "Version2") == 0) {
|
||||
genetx->version = GENETX_VERSION_2;
|
||||
} else {
|
||||
g_message("Unknown GeNetX version: %s", value);
|
||||
g_warning("Unknown GeNetX version: %s", value);
|
||||
}
|
||||
break;
|
||||
case PARSER_TYPE_GENETX_TYPE:
|
||||
@@ -169,7 +169,7 @@ static void XMLCALL text_cb(void *data, const char* text, int len)
|
||||
} else if (g_strcmp0(value, "Cabinet") == 0) {
|
||||
genetx->type = GENETX_TYPE_CABINET;
|
||||
} else {
|
||||
g_message("Unknown GeNetX type: %s", value);
|
||||
g_warning("Unknown GeNetX type: %s", value);
|
||||
}
|
||||
break;
|
||||
case PARSER_TYPE_GENETX_CHANNEL:
|
||||
@@ -178,7 +178,7 @@ static void XMLCALL text_cb(void *data, const char* text, int len)
|
||||
} else if (g_strcmp0(value, "Channel2") == 0) {
|
||||
genetx->channel = GENETX_CHANNEL2;
|
||||
} else {
|
||||
g_message("Unknown GeNetX channel: %s", value);
|
||||
g_warning("Unknown GeNetX channel: %s", value);
|
||||
}
|
||||
break;
|
||||
case PARSER_TYPE_GENETX_NAME:
|
||||
@@ -219,7 +219,7 @@ Preset *create_preset_from_xml_file(gchar *filename, GError **error)
|
||||
gchar *contents;
|
||||
|
||||
if (g_file_get_contents(filename, &contents, NULL, &err) == FALSE) {
|
||||
g_message("Failed to get %s contents: %s", filename, err->message);
|
||||
g_warning("Failed to get %s contents: %s", filename, err->message);
|
||||
*error = g_error_copy(err);
|
||||
g_error_free(err);
|
||||
return NULL;
|
||||
@@ -308,12 +308,16 @@ Preset *create_preset_from_data(GList *list)
|
||||
modified = (unsigned char)data->str[11+strlen(name)];
|
||||
|
||||
if ((bank == PRESETS_EDIT_BUFFER) && (number == 0)) {
|
||||
g_message("Received current edit buffer");
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"RECEIVE_PRESET_START: current edit buffer");
|
||||
} else {
|
||||
g_message("Received preset %d from bank %d", number, bank);
|
||||
debug_msg(DEBUG_MSG2HOST,
|
||||
"RECEIVE_PRESET_START: preset %d from bank %d",
|
||||
number, bank);
|
||||
}
|
||||
|
||||
g_message("Modified flag: %d Name: %s", modified, name);
|
||||
debug_msg(DEBUG_MSG2HOST, "Name: %s, %sodified",
|
||||
name, modified ? "M" : "Not m");
|
||||
preset->name = name;
|
||||
break;
|
||||
case RECEIVE_PRESET_PARAMETERS:
|
||||
@@ -326,15 +330,20 @@ Preset *create_preset_from_data(GList *list)
|
||||
SettingParam *param = setting_param_new_from_data(&data->str[x], &x);
|
||||
n++;
|
||||
preset->params = g_list_prepend(preset->params, param);
|
||||
g_message("%d ID %d Position %d Value %d", n, param->id, param->position, param->value);
|
||||
if (debug_flag_is_set(DEBUG_MSG2HOST)) {
|
||||
GString *ipv = format_ipv(param->id, param->position, param->value);
|
||||
debug_msg(DEBUG_MSG2HOST, "%3d %s", n, ipv->str);
|
||||
g_string_free(ipv, TRUE);
|
||||
}
|
||||
} while ((x < data->len) && n<total);
|
||||
g_message("TOTAL %d", total);
|
||||
debug_msg(DEBUG_MSG2HOST, "TOTAL %d", total);
|
||||
preset->params = g_list_sort(preset->params, params_cmp);
|
||||
break;
|
||||
case RECEIVE_PRESET_END:
|
||||
break;
|
||||
default:
|
||||
g_message("Unhandled message in preset messages list");
|
||||
g_warning("Unhandled message 0x%x in preset messages list",
|
||||
get_message_id(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
preset_xml.c
28
preset_xml.c
@@ -52,16 +52,17 @@ XmlSettings *get_xml_settings (guint id, guint position)
|
||||
}
|
||||
|
||||
gchar *
|
||||
map_xml_value(XmlSettings *xml, gint value)
|
||||
map_xml_value (XmlSettings *xml, gint value)
|
||||
{
|
||||
switch (xml->values->type) {
|
||||
case VALUE_TYPE_LABEL:
|
||||
if ((xml->values == &values_on_off) && (value > 1)) {
|
||||
g_message("Skipping modifier->label %s\n", xml->label);
|
||||
g_warning("Skipping modifier->label %s\n", xml->label);
|
||||
return NULL;
|
||||
}
|
||||
if (value > xml->values->max || value < xml->values->min) {
|
||||
g_message("%s value %d out of range %0.1f %0.1f", xml->label, value, xml->values->min, xml->values->max);
|
||||
g_warning("%s value %d out of range %0.1f %0.1f",
|
||||
xml->label, value, xml->values->min, xml->values->max);
|
||||
}
|
||||
{
|
||||
XmlLabel *labels = xml->xml_labels;
|
||||
@@ -83,10 +84,9 @@ map_xml_value(XmlSettings *xml, gint value)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
gboolean value_is_extra (EffectValues *val, SettingParam *param)
|
||||
gboolean value_is_extra (EffectValues *val, int value)
|
||||
{
|
||||
if ((param->value < val->min) || (param->value > val->max)) {
|
||||
if ((value < val->min) || (value > val->max)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -96,7 +96,6 @@ gboolean value_is_extra (EffectValues *val, SettingParam *param)
|
||||
void
|
||||
write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
{
|
||||
|
||||
int rc;
|
||||
xmlTextWriterPtr writer;
|
||||
GList *iter_params = preset->params;
|
||||
@@ -144,7 +143,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
SettingParam *param = (SettingParam *) iter_params->data;
|
||||
|
||||
if (param->id == last_id && param->position == last_position) {
|
||||
g_message("Skipping duplicate parameter id %d position %d",
|
||||
g_warning("Skipping duplicate parameter id %d position %d",
|
||||
last_id, last_position);
|
||||
iter_params = iter_params->next;
|
||||
continue;
|
||||
@@ -177,7 +176,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
BAD_CAST xml->label);
|
||||
values = xml->values;
|
||||
type = values->type;
|
||||
while ((type & VALUE_TYPE_EXTRA) && value_is_extra(values, param)) {
|
||||
while ((type & VALUE_TYPE_EXTRA) && value_is_extra(values, param->value)) {
|
||||
values = values->extra;
|
||||
type = values->type;
|
||||
}
|
||||
@@ -208,8 +207,9 @@ write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
{
|
||||
char *textp = map_xml_value(xml, param->value);
|
||||
if (!textp) {
|
||||
g_message("Unable to map %s value %d for id %d position %d",
|
||||
xml->label, param->value, param->id, param->position);
|
||||
g_warning("Unable to map %s value %d for id %d position %d",
|
||||
xml->label, param->value, param->id,
|
||||
param->position);
|
||||
textp = "";
|
||||
}
|
||||
rc = xmlTextWriterWriteElement(writer, BAD_CAST "Text",
|
||||
@@ -237,7 +237,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message("Unhandled value type %d", type);
|
||||
g_warning("Unhandled value type %d", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -247,10 +247,6 @@ write_preset_to_xml(Preset *preset, gchar *filename)
|
||||
iter_params = iter_params->next;
|
||||
}
|
||||
|
||||
/* Here we could close the elements ORDER and EXAMPLE using the
|
||||
* function xmlTextWriterEndElement, but since we do not want to
|
||||
* write any other elements, we simply call xmlTextWriterEndDocument,
|
||||
* which will do all the work. */
|
||||
rc = xmlTextWriterEndDocument(writer);
|
||||
if (rc < 0) {
|
||||
printf("testXmlwriterFilename: Error at xmlTextWriterEndDocument\n");
|
||||
|
||||
Reference in New Issue
Block a user