From 90da5567fc7f48de37256a8c10a69b3ea9be7d3b Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 20 May 2019 08:49:10 +0200 Subject: [PATCH] Added string getter function as a test for comp_gain. --- MicroMDAEPiano.ino | 1 + UI.hpp | 33 ++++++++++++++++++++++++++++++--- config.h | 23 ++++++++++++++++++++++- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 7fa53a6..d5c31dd 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -179,6 +179,7 @@ void setup() sgtl5000_1.dacVolume(1.0); //sgtl5000_1.dacVolumeRampLinear(); sgtl5000_1.unmuteHeadphone(); + sgtl5000_1.volume(0.5, 0.5); // Headphone volume sgtl5000_1.unmuteLineout(); //sgtl5000_1.autoVolumeDisable(); // turn off AGC sgtl5000_1.lineOutLevel(SGTL5000_LINEOUT_LEVEL); diff --git a/UI.hpp b/UI.hpp index 0110446..76c461f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -102,6 +102,29 @@ extern AudioMixer4 mixer_l; extern AudioAmplifier volume_r; extern AudioAmplifier volume_l; +/****************************************** + TEXT GETTER FUCTIONS + ******************************************/ +const char comp_gain_value_text1[] = " 0 dB"; +const char comp_gain_value_text2[] = "+ 6 dB"; +const char comp_gain_value_text3[] = "+12 dB"; + +char* get_comp_gain_value_text(void) +{ + switch (configuration.comp_gain) + { + case 0: + return (comp_gain_value_text1); + break; + case 1: + return (comp_gain_value_text2); + break; + case 2: + return (comp_gain_value_text3); + break; + } +} + /****************************************** MAIN MENU ******************************************/ @@ -327,7 +350,8 @@ LiquidMenu overdrive_menu(lcd); #define NUM_COMP_GAIN_MENUS 1 const char comp_gain_text1[] PROGMEM = "Comp. Gain"; LiquidLine comp_gain_line1(1, 0, comp_gain_text1); -LiquidLine comp_gain_line2(1, 1, configuration.comp_gain); +//LiquidLine comp_gain_line2(1, 1, configuration.comp_gain); +LiquidLine comp_gain_line2(1, 1, get_comp_gain_value_text); LiquidScreen comp_gain_screen; LiquidMenu comp_gain_menu(lcd); @@ -1075,9 +1099,9 @@ void callback_info_function() } /****************************************** - HELPER FUCTIONS + HELPER MENU FUNCTION ******************************************/ - + float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) // e.g. mapfloat(float(effect_delay_feedback), 0, ENC_DELAY_FB_STEPS, 0.0, 1.0) { @@ -1132,6 +1156,9 @@ void goto_system_menu(void) enc[RIGHT_ENCODER].write(menu_position[SYSTEM], 0, NUM_SYSTEM_MENUS - 1); } +/****************************************** + INIT MENU FUNCTION + ******************************************/ void init_menus(void) { uint8_t i; diff --git a/config.h b/config.h index a6e7b28..5976e48 100644 --- a/config.h +++ b/config.h @@ -76,7 +76,28 @@ //************************************************************************************************* // Teensy Audio Shield: -#define SGTL5000_LINEOUT_LEVEL 29 +/* Values for SGTL5000_LINEOUT_LEVEL + 13: 3.16 Volts p-p + 14: 2.98 Volts p-p + 15: 2.83 Volts p-p + 16: 2.67 Volts p-p + 17: 2.53 Volts p-p + 18: 2.39 Volts p-p + 19: 2.26 Volts p-p + 20: 2.14 Volts p-p + 21: 2.02 Volts p-p + 22: 1.91 Volts p-p + 23: 1.80 Volts p-p + 24: 1.71 Volts p-p + 25: 1.62 Volts p-p + 26: 1.53 Volts p-p + 27: 1.44 Volts p-p + 28: 1.37 Volts p-p + 29: 1.29 Volts p-p (default) + 30: 1.22 Volts p-p + 31: 1.16 Volts p-p +*/ +#define SGTL5000_LINEOUT_LEVEL 24 //#define SDCARD_CS_PIN 10 //#define SDCARD_MOSI_PIN 7 //#define SDCARD_SCK_PIN 14