From 223a7eb3d2bb7dd2e598b3dbfe8aaf5b8e27eada Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 17 May 2019 18:28:27 +0200 Subject: [PATCH] Several fixes. --- MicroMDAEPiano.ino | 3 --- UI.hpp | 6 +++--- config.h | 27 ++++++++++++++------------- mdaEPiano.cpp | 4 ++-- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index f304fc6..7fa53a6 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -181,8 +181,6 @@ void setup() sgtl5000_1.unmuteHeadphone(); sgtl5000_1.unmuteLineout(); //sgtl5000_1.autoVolumeDisable(); // turn off AGC - sgtl5000_1.unmuteHeadphone(); - sgtl5000_1.volume(0.5, 0.5); // Headphone volume sgtl5000_1.lineOutLevel(SGTL5000_LINEOUT_LEVEL); sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.eqSelect(TONE_CONTROLS); @@ -212,7 +210,6 @@ void setup() Serial.println(F("PT8211 enabled.")); #endif - //set_volume(vol, vol_left, vol_right); set_master_volume(master_volume); #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) diff --git a/UI.hpp b/UI.hpp index 640741d..0110446 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1796,9 +1796,9 @@ void set_loudness(uint8_t value) Serial.print(F("Set LOUDNESS ")); Serial.println(value); #endif - float tmp = mapfloat(float(value), ENC_LOUDNESS_MIN, ENC_LOUDNESS_MAX, 0.0, 1.0); - volume_r.gain(tmp); - volume_l.gain(tmp); + configuration._loudness = mapfloat(float(value), ENC_LOUDNESS_MIN, ENC_LOUDNESS_MAX, 0.0, 1.0); + //volume_r.gain(tmp); + //volume_l.gain(tmp); } void set_complete_configuration(void) diff --git a/config.h b/config.h index c0312fd..a6e7b28 100644 --- a/config.h +++ b/config.h @@ -139,9 +139,9 @@ #define ENC_TRANSPOSE_MAX 24 #define ENC_TRANSPOSE_DEFAULT 0 // -#define ENC_TUNE_MIN 0 -#define ENC_TUNE_MAX 99 -#define ENC_TUNE_DEFAULT 49 +#define ENC_TUNE_MIN -50 +#define ENC_TUNE_MAX 50 +#define ENC_TUNE_DEFAULT 0 // #define ENC_DETUNE_MIN 0 #define ENC_DETUNE_MAX 99 @@ -164,28 +164,28 @@ #define ENC_OVERDRIVE_DEFAULT 50 // #define ENC_COMP_GAIN_MIN 0 -#define ENC_COMP_GAIN_MAX 99 -#define ENC_COMP_GAIN_DEFAULT 99 +#define ENC_COMP_GAIN_MAX 2 +#define ENC_COMP_GAIN_DEFAULT 0 // #define ENC_COMP_RESPONSE_MIN 0 -#define ENC_COMP_RESPONSE_MAX 99 -#define ENC_COMP_RESPONSE_DEFAULT 99 +#define ENC_COMP_RESPONSE_MAX 3 +#define ENC_COMP_RESPONSE_DEFAULT 1 // #define ENC_COMP_LIMIT_MIN 0 -#define ENC_COMP_LIMIT_MAX 99 -#define ENC_COMP_LIMIT_DEFAULT 99 +#define ENC_COMP_LIMIT_MAX 1 +#define ENC_COMP_LIMIT_DEFAULT 1 // #define ENC_COMP_THRESHOLD_MIN 0 -#define ENC_COMP_THRESHOLD_MAX 99 -#define ENC_COMP_THRESHOLD_DEFAULT 90 +#define ENC_COMP_THRESHOLD_MAX 96 +#define ENC_COMP_THRESHOLD_DEFAULT 18 // #define ENC_COMP_ATTACK_MIN 0 #define ENC_COMP_ATTACK_MAX 99 -#define ENC_COMP_ATTACK_DEFAULT 1 +#define ENC_COMP_ATTACK_DEFAULT 20 // #define ENC_COMP_DECAY_MIN 0 #define ENC_COMP_DECAY_MAX 99 -#define ENC_COMP_DECAY_DEFAULT 5 +#define ENC_COMP_DECAY_DEFAULT 40 // #define ENC_REVERB_ROOMSIZE_MIN 0 #define ENC_REVERB_ROOMSIZE_MAX 99 @@ -317,6 +317,7 @@ struct config_t { uint8_t eq_bass; uint8_t eq_treble; uint8_t loudness; + float _loudness; uint8_t midi_channel; uint8_t midi_soft_thru; uint8_t max_poly; diff --git a/mdaEPiano.cpp b/mdaEPiano.cpp index 019ec42..d4a565c 100644 --- a/mdaEPiano.cpp +++ b/mdaEPiano.cpp @@ -240,8 +240,8 @@ void mdaEPiano::process(int16_t* outputs_r, int16_t* outputs_l) l = 1.0; else if (l < -1.0) l = -1.0; - outputs_l[frame] = static_cast(l * configuration.loudness * 0x7fff) >> REDUCE_LOUDNESS; - outputs_r[frame] = static_cast(r * configuration.loudness * 0x7fff) >> REDUCE_LOUDNESS; + outputs_l[frame] = static_cast(l * configuration._loudness * 0x7fff) >> REDUCE_LOUDNESS; + outputs_r[frame] = static_cast(r * configuration._loudness * 0x7fff) >> REDUCE_LOUDNESS; } if (fabs(tl) < 1.0e-10) tl = 0.0f; //anti-denormal