diff --git a/UI.hpp b/UI.hpp index 12b166a..4376456 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1602,6 +1602,7 @@ void init_menus(void) void load_sound(uint8_t value) { + configuration.sound = value; #ifdef DEBUG Serial.print(F("Load sound ")); Serial.println(value); @@ -1626,6 +1627,7 @@ void set_decay(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_DECAY_MIN, ENC_DECAY_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_DECAY, tmp); + configuration.decay = value; } void set_release(uint8_t value) @@ -1636,6 +1638,7 @@ void set_release(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_RELEASE_MIN, ENC_RELEASE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_RELEASE, tmp); + configuration.release = value; } void set_hardness(uint8_t value) @@ -1646,6 +1649,7 @@ void set_hardness(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_HARDNESS_MIN, ENC_HARDNESS_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_HARDNESS, tmp); + configuration.hardness = value; } void set_treble(uint8_t value) @@ -1656,6 +1660,7 @@ void set_treble(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_TREBLE_MIN, ENC_TREBLE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_TREBLE, tmp); + configuration.treble = value; } void set_stereo(int8_t value) @@ -1666,9 +1671,18 @@ void set_stereo(int8_t value) #endif float tmp = mapfloat(float(value), ENC_STEREO_MIN, ENC_STEREO_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_STEREO, tmp); + configuration.stereo = value; } -// transpose +void set_transpose(int8_t value) +{ +#ifdef DEBUG + Serial.print(F("Set TRANSPOSE ")); + Serial.println(value); +#endif + // Nothing special todo, because value will be added inside NoteOn/NoteOff + configuration.transpose = value; +} void set_tune(int8_t value) { @@ -1678,6 +1692,7 @@ void set_tune(int8_t value) #endif float tmp = mapfloat(float(value), ENC_TUNE_MIN, ENC_TUNE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_TUNE, tmp); + configuration.tune = value; } void set_detune(uint8_t value) @@ -1688,6 +1703,7 @@ void set_detune(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_DETUNE_MIN, ENC_DETUNE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_DETUNE, tmp); + configuration.detune = value; } void set_velocity_sense(uint8_t value) @@ -1698,6 +1714,7 @@ void set_velocity_sense(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_VELOCITY_SENSE_MIN, ENC_VELOCITY_SENSE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_DETUNE, tmp); + configuration.velocity_sense = value; } void set_pan_trem_frequency(uint8_t value) @@ -1708,6 +1725,7 @@ void set_pan_trem_frequency(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_PAN_TREM_FREQUENCY_MIN, ENC_PAN_TREM_FREQUENCY_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_LFO_RATE, tmp); + configuration.pan_trem_frequency = value; } void set_pan_trem_level(uint8_t value) @@ -1718,6 +1736,7 @@ void set_pan_trem_level(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_PAN_TREM_LEVEL_MIN, ENC_PAN_TREM_LEVEL_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_PAN_TREM, tmp); + configuration.pan_trem_level = value; } void set_overdrive(uint8_t value) @@ -1728,6 +1747,7 @@ void set_overdrive(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_OVERDRIVE_MIN, ENC_OVERDRIVE_MAX, 0.0, 1.0); ep->setParameter(MDA_EP_OVERDRIVE, tmp); + configuration.overdrive = value; } void set_comp_gain(uint8_t value) @@ -1738,6 +1758,7 @@ void set_comp_gain(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_COMP_GAIN_MIN, ENC_COMP_GAIN_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(tmp, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_gain = value; } void set_comp_response(uint8_t value) @@ -1748,6 +1769,7 @@ void set_comp_response(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_COMP_RESPONSE_MIN, ENC_COMP_RESPONSE_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(configuration.comp_gain, tmp, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_response = value; } void set_comp_limit(uint8_t value) @@ -1758,6 +1780,7 @@ void set_comp_limit(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_COMP_LIMIT_MIN, ENC_COMP_LIMIT_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, tmp, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_limit = value; } void set_comp_threshold(uint8_t value) @@ -1768,6 +1791,7 @@ void set_comp_threshold(uint8_t value) #endif //float tmp = mapfloat(float(value), ENC_COMP_THRESHOLD_MIN, ENC_COMP_THRESHOLD_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)value, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_threshold = value; } void set_comp_attack(uint8_t value) @@ -1778,6 +1802,7 @@ void set_comp_attack(uint8_t value) #endif //float tmp = mapfloat(float(value), ENC_COMP_ATTACK_MIN, ENC_COMP_ATTACK_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)value, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_attack = value; } void set_comp_decay(uint8_t value) @@ -1788,6 +1813,7 @@ void set_comp_decay(uint8_t value) #endif //float tmp = mapfloat(float(value), ENC_COMP_DECAY_MIN, ENC_COMP_DECAY_MAX, 0.0, 1.0); sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)value); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05 + configuration.comp_decay = value; } void set_reverb_roomsize(uint8_t value) @@ -1799,6 +1825,7 @@ void set_reverb_roomsize(uint8_t value) float tmp = mapfloat(float(value), ENC_REVERB_ROOMSIZE_MIN, ENC_REVERB_ROOMSIZE_MAX, 0.0, 1.0); freeverb_r.roomsize(tmp); freeverb_l.roomsize(tmp); + configuration.reverb_roomsize = value; } void set_reverb_damping(uint8_t value) @@ -1810,6 +1837,7 @@ void set_reverb_damping(uint8_t value) float tmp = mapfloat(float(value), ENC_REVERB_DAMPING_MIN, ENC_REVERB_DAMPING_MAX, 0.0, 1.0); freeverb_r.damping(tmp); freeverb_l.damping(tmp); + configuration.reverb_damping = value; } void set_reverb_level(uint8_t value) @@ -1823,6 +1851,7 @@ void set_reverb_level(uint8_t value) mixer_l.gain(0, 1.0 - tmp); mixer_r.gain(1, tmp); mixer_l.gain(1, tmp); + configuration.reverb_level = value; } void set_chorus_frequency(uint8_t value) @@ -1833,6 +1862,7 @@ void set_chorus_frequency(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_CHORUS_FREQUENCY_MIN, ENC_CHORUS_FREQUENCY_MAX, 0.0, 1.0); // TDB + configuration.chorus_frequency = value; } void set_chorus_delay(uint8_t value) @@ -1843,6 +1873,7 @@ void set_chorus_delay(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_CHORUS_DELAY_MIN, ENC_CHORUS_DELAY_MAX, 0.0, 1.0); // TDB + configuration.chorus_delay = value; } void set_chorus_level(uint8_t value) @@ -1853,6 +1884,7 @@ void set_chorus_level(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_CHORUS_LEVEL_MIN, ENC_CHORUS_LEVEL_MAX, 0.0, 1.0); // TDB + configuration.chorus_level = value; } void set_bass_lr_level(uint8_t value) @@ -1863,6 +1895,7 @@ void set_bass_lr_level(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_BASS_LR_LEVEL_MIN, ENC_BASS_LR_LEVEL_MAX, 0.0, 1.0); sgtl5000_1.enhanceBass(tmp, configuration.bass_mono_level); + configuration.bass_lr_level = value; } void set_bass_mono_level(uint8_t value) @@ -1873,6 +1906,7 @@ void set_bass_mono_level(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_BASS_MONO_LEVEL_MIN, ENC_BASS_MONO_LEVEL_MAX, 0.0, 1.0); sgtl5000_1.enhanceBass(configuration.bass_mono_level, tmp); + configuration.bass_mono_level = value; } void set_eq_bass(uint8_t value) @@ -1883,6 +1917,7 @@ void set_eq_bass(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_EQ_BASS_MIN, ENC_EQ_BASS_MAX, 0.0, 1.0); sgtl5000_1.eqBands(tmp, configuration.eq_treble); + configuration.eq_bass = value; } void set_eq_treble(uint8_t value) @@ -1893,6 +1928,7 @@ void set_eq_treble(uint8_t value) #endif float tmp = mapfloat(float(value), ENC_EQ_TREBLE_MIN, ENC_EQ_TREBLE_MAX, 0.0, 1.0); sgtl5000_1.eqBands(configuration.eq_bass, tmp); + configuration.eq_treble = value; } void set_loudness(uint8_t value) @@ -1904,6 +1940,34 @@ void set_loudness(uint8_t value) configuration._loudness = mapfloat(float(value), ENC_LOUDNESS_MIN, ENC_LOUDNESS_MAX, 0.0, 1.0); //volume_r.gain(tmp); //volume_l.gain(tmp); + configuration.loudness = value; +} + +void set_midi_channel(uint8_t value) +{ +#ifdef DEBUG + Serial.print(F("Set MIDI_CHANNEL ")); + Serial.println(value); +#endif + configuration.midi_channel = value; +} + +void set_midi_soft_thru(uint8_t value) +{ +#ifdef DEBUG + Serial.print(F("Set MIDI_SOFT_THRU ")); + Serial.println(value); +#endif + configuration.midi_soft_thru = value; +} + +void set_max_poly(uint8_t value) +{ +#ifdef DEBUG + Serial.print(F("Set MAX_POLY ")); + Serial.println(value); +#endif + configuration.max_poly = value; } void set_complete_configuration(void) @@ -1969,8 +2033,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.sound = encoder_tmp; - load_sound(configuration.sound); + load_sound(encoder_tmp); menu_system.update(); } } @@ -1979,8 +2042,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.decay = encoder_tmp; - set_decay(configuration.decay); + set_decay(encoder_tmp); menu_system.update(); } } @@ -1989,8 +2051,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.release = encoder_tmp; - set_release(configuration.release); + set_release(encoder_tmp); menu_system.update(); } } @@ -1999,8 +2060,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.hardness = encoder_tmp; - set_hardness(configuration.hardness); + set_hardness(encoder_tmp); menu_system.update(); } } @@ -2009,8 +2069,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.treble = encoder_tmp; - set_treble(configuration.treble); + set_treble(encoder_tmp); menu_system.update(); } } @@ -2019,8 +2078,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.stereo = encoder_tmp; - set_stereo(configuration.stereo); + set_stereo(encoder_tmp); menu_system.update(); } } @@ -2029,8 +2087,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.transpose = encoder_tmp; - // Nothing to do... will be added in handleNoteOn() + set_transpose(encoder_tmp); menu_system.update(); } } @@ -2039,8 +2096,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.tune = encoder_tmp; - set_tune(configuration.tune); + set_tune(encoder_tmp); menu_system.update(); } } @@ -2049,8 +2105,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.detune = encoder_tmp; - set_detune(configuration.detune); + set_detune(encoder_tmp); menu_system.update(); } } @@ -2059,8 +2114,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.velocity_sense = encoder_tmp; - set_velocity_sense(configuration.velocity_sense); + set_velocity_sense(encoder_tmp); menu_system.update(); } } @@ -2069,8 +2123,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.pan_trem_frequency = encoder_tmp; - set_pan_trem_frequency(configuration.pan_trem_frequency); + set_pan_trem_frequency(encoder_tmp); menu_system.update(); } } @@ -2079,8 +2132,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.pan_trem_level = encoder_tmp; - set_pan_trem_level(configuration.pan_trem_level); + set_pan_trem_level(encoder_tmp); menu_system.update(); } } @@ -2089,8 +2141,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.overdrive = encoder_tmp; - set_overdrive(configuration.overdrive); + set_overdrive(encoder_tmp); menu_system.update(); } } @@ -2099,8 +2150,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_gain = encoder_tmp; - set_comp_gain(configuration.comp_gain); + set_comp_gain(encoder_tmp); menu_system.update(); } } @@ -2109,8 +2159,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_response = encoder_tmp; - set_comp_response(configuration.comp_response); + set_comp_response(encoder_tmp); menu_system.update(); } } @@ -2119,8 +2168,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_limit = encoder_tmp; - set_comp_limit(configuration.comp_limit); + set_comp_limit(encoder_tmp); menu_system.update(); } } @@ -2129,8 +2177,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_threshold = encoder_tmp; - set_comp_threshold(configuration.comp_threshold); + set_comp_threshold(encoder_tmp); menu_system.update(); } } @@ -2139,8 +2186,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_attack = encoder_tmp; - set_comp_attack(configuration.comp_attack); + set_comp_attack(encoder_tmp); menu_system.update(); } } @@ -2149,8 +2195,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.comp_decay = encoder_tmp; - set_comp_decay(configuration.comp_decay); + set_comp_decay(encoder_tmp); menu_system.update(); } } @@ -2159,8 +2204,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.reverb_roomsize = encoder_tmp; - set_reverb_roomsize(configuration.reverb_roomsize); + set_reverb_roomsize(encoder_tmp); menu_system.update(); } } @@ -2169,8 +2213,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.reverb_damping = encoder_tmp; - set_reverb_damping(configuration.reverb_damping); + set_reverb_damping(encoder_tmp); menu_system.update(); } } @@ -2179,8 +2222,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.reverb_level = encoder_tmp; - set_reverb_level(configuration.reverb_level); + set_reverb_level(encoder_tmp); menu_system.update(); } } @@ -2189,8 +2231,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.chorus_frequency = encoder_tmp; - set_chorus_frequency(configuration.chorus_frequency); + set_chorus_frequency(encoder_tmp); menu_system.update(); } } @@ -2199,8 +2240,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.chorus_delay = encoder_tmp; - set_chorus_delay(configuration.chorus_delay); + set_chorus_delay(encoder_tmp); menu_system.update(); } } @@ -2209,8 +2249,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.chorus_level = encoder_tmp; - set_chorus_level(configuration.chorus_level); + set_chorus_level(encoder_tmp); menu_system.update(); } } @@ -2219,8 +2258,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.bass_lr_level = encoder_tmp; - set_bass_lr_level(configuration.bass_lr_level); + set_bass_lr_level(encoder_tmp); menu_system.update(); } } @@ -2229,8 +2267,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.bass_mono_level = encoder_tmp; - set_bass_mono_level(configuration.bass_mono_level); + set_bass_mono_level(encoder_tmp); menu_system.update(); } } @@ -2239,8 +2276,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.eq_bass = encoder_tmp; - set_eq_bass(configuration.eq_bass); + set_eq_bass(encoder_tmp); menu_system.update(); } } @@ -2249,8 +2285,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.eq_treble = encoder_tmp; - set_eq_treble(configuration.eq_treble); + set_eq_treble(encoder_tmp); menu_system.update(); } } @@ -2259,8 +2294,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.sound = encoder_tmp; - save_sound(configuration.sound); + save_sound(encoder_tmp); menu_system.update(); } } @@ -2269,8 +2303,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.loudness = encoder_tmp; - set_loudness(configuration.loudness); + set_loudness(encoder_tmp); menu_system.update(); } } @@ -2279,7 +2312,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.midi_channel = encoder_tmp; + set_midi_channel(encoder_tmp); menu_system.update(); } } @@ -2288,7 +2321,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.midi_soft_thru = encoder_tmp; + set_midi_soft_thru(encoder_tmp); menu_system.update(); } } @@ -2297,7 +2330,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - configuration.max_poly = encoder_tmp; + set_max_poly(encoder_tmp); menu_system.update(); } }