Added peak-to-peak output voltage configuration menu for SGTL5000 (Teensy-

Audio-sield).
Fixed some minor problems.
pull/32/head
Holger Wirtz 5 years ago
parent bcebb3f29a
commit 78733b8ff3
  1. 16
      MicroDexed.ino
  2. 62
      UI.hpp
  3. 6
      UI_1.h
  4. 6
      UI_1_FX.h
  5. 6
      UI_2.h
  6. 6
      UI_2_FX.h
  7. 5
      config.h

@ -216,6 +216,9 @@ uint32_t peak_l = 0;
bool eeprom_update_flag = false; bool eeprom_update_flag = false;
config_t configuration; config_t configuration;
uint8_t selected_dexed_instance = 0; uint8_t selected_dexed_instance = 0;
#if defined(TEENSY_AUDIO_BOARD)
uint8_t sgtl5000_level = SGTL5000_LINEOUT_LEVEL_DEFAULT;
#endif
#if defined(USE_FX) #if defined(USE_FX)
// Allocate the delay lines for chorus // Allocate the delay lines for chorus
@ -1309,6 +1312,18 @@ void initial_values_from_eeprom(bool init)
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
} }
} }
#if defined(TEENSY_AUDIO_BOARD)
// Special handling for SGTL5000 volume setting
uint8_t sgtl5000_level = EEPROM[4095];
if (sgtl5000_level >= SGTL5000_LINEOUT_LEVEL_MIN || sgtl5000_level <= SGTL5000_LINEOUT_LEVEL_MAX)
{
sgtl5000_level = SGTL5000_LINEOUT_LEVEL_DEFAULT;
EEPROM[4095] = SGTL5000_LINEOUT_LEVEL_DEFAULT;
}
Serial.print(F("SGTL5000 output level: "));
Serial.println(sgtl5000_level);
#endif
Serial.println(F("OK, loaded!")); Serial.println(F("OK, loaded!"));
master_mixer_r.gain(DEXED, 1.0); master_mixer_r.gain(DEXED, 1.0);
@ -1407,6 +1422,7 @@ void init_configuration(void)
configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT; configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT;
configuration.delay_level = DELAY_LEVEL_DEFAULT; configuration.delay_level = DELAY_LEVEL_DEFAULT;
configuration.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT; configuration.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT;
strcpy(configuration.config_name, "INITCONFIG");
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;

@ -87,6 +87,7 @@ extern AudioSourceMicroDexed* MicroDexed[NUM_DEXED];
extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED];
extern AudioSynthWaveformDc* pan[NUM_DEXED]; extern AudioSynthWaveformDc* pan[NUM_DEXED];
extern uint8_t selected_dexed_instance; extern uint8_t selected_dexed_instance;
extern uint8_t sgtl5000_level;
/*********************************************************************** /***********************************************************************
GLOBAL GLOBAL
@ -198,6 +199,9 @@ void UI_func_volume(uint8_t param);
void UI_func_load(uint8_t param); void UI_func_load(uint8_t param);
void UI_func_save(uint8_t param); void UI_func_save(uint8_t param);
void UI_func_midi_soft_thru(uint8_t param); void UI_func_midi_soft_thru(uint8_t param);
#if defined(TEENSY_AUDIO_BOARD)
void UI_func_output_level(uint8_t param);
#endif
void UI_function_not_enabled(void); void UI_function_not_enabled(void);
void UI_function_not_implemented(uint8_t param); void UI_function_not_implemented(uint8_t param);
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign);
@ -309,7 +313,7 @@ void lcdml_menu_control(void)
{ {
if (!button[ENC_R]) if (!button[ENC_R])
{ {
LCDML.BT_left(); LCDML.BT_right();
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = -1; g_LCDML_CONTROL_button_press_time[ENC_R] = -1;
} }
@ -439,7 +443,7 @@ void encoder_right_up(void)
break; break;
case MENU_VOICE: case MENU_VOICE:
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("State: MENU_VOICE, Encoder left up")); Serial.println(F("State: MENU_VOICE, Encoder right up"));
#endif #endif
switch (menu_voice) switch (menu_voice)
{ {
@ -500,7 +504,7 @@ void encoder_right_down(void)
break; break;
case MENU_VOICE: case MENU_VOICE:
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("State: MENU_VOICE, Encoder left down")); Serial.println(F("State: MENU_VOICE, Encoder right down"));
#endif #endif
switch (menu_voice) switch (menu_voice)
{ {
@ -2983,6 +2987,54 @@ void UI_func_midi_soft_thru(uint8_t param)
} }
} }
#if defined(TEENSY_AUDIO_BOARD)
void UI_func_output_level(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
sgtl5000_level = EEPROM[4095];
lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Output Level", sgtl5000_level, SGTL5000_LINEOUT_LEVEL_MIN, SGTL5000_LINEOUT_LEVEL_MAX, 2, false, false, false, true);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
else if (LCDML.BT_checkDown() || LCDML.BT_checkUp())
{
if (LCDML.BT_checkDown())
{
if (sgtl5000_level < SGTL5000_LINEOUT_LEVEL_MAX)
{
sgtl5000_level += 1;
}
}
else if (LCDML.BT_checkUp())
{
if (sgtl5000_level > SGTL5000_LINEOUT_LEVEL_MIN)
{
sgtl5000_level -= 1;
}
}
}
sgtl5000_1.lineOutLevel(sgtl5000_level);
lcd_display_bar_int("Output Level", sgtl5000_level, SGTL5000_LINEOUT_LEVEL_MIN, SGTL5000_LINEOUT_LEVEL_MAX, 2, false, false, false, false);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
EEPROM[4095] = sgtl5000_level;
}
}
#endif
void UI_func_voice_selection(uint8_t param) void UI_func_voice_selection(uint8_t param)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -3306,7 +3358,7 @@ void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bo
void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init) void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value, uint32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init)
{ {
float _v = float(value * LCD_cols) / (max_value - min_value); float _v = float((value - min_value) * LCD_cols) / (max_value - min_value);
float _vi = 0.0; float _vi = 0.0;
uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0 + 0.5); uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0 + 0.5);
uint8_t vi = uint8_t(_vi + 0.5); uint8_t vi = uint8_t(_vi + 0.5);
@ -3345,7 +3397,7 @@ void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value,
else else
{ {
// show only changed value and changed part of the bar // show only changed value and changed part of the bar
uint8_t ca = float(LCD_cols - 1) / float(max_value - min_value) + 1; uint8_t ca = float(LCD_cols - 1) / float(max_value) + 1;
lcd.setCursor(LCD_cols - (size + 1) + 1, 0); lcd.setCursor(LCD_cols - (size + 1) + 1, 0);
lcd_display_int(value, size, zeros, brackets, sign); lcd_display_int(value, size, zeros, brackets, sign);

@ -66,8 +66,14 @@ LCDML_add(37, LCDML_0_2, 2, "Save", UI_func_save);
LCDML_add(38, LCDML_0, 3, "System", NULL); LCDML_add(38, LCDML_0, 3, "System", NULL);
LCDML_add(39, LCDML_0_3, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(39, LCDML_0_3, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(40, LCDML_0_3, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(40, LCDML_0_3, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
#if defined(TEENSY_AUDIO_BOARD)
LCDML_add(41, LCDML_0_3, 3, "Output Level", UI_func_output_level);
LCDML_add(42, LCDML_0, 4, "Info", UI_func_information);
#define _LCDML_DISP_cnt 42
#else
LCDML_add(41, LCDML_0, 4, "Info", UI_func_information); LCDML_add(41, LCDML_0, 4, "Info", UI_func_information);
#define _LCDML_DISP_cnt 41 #define _LCDML_DISP_cnt 41
#endif
#define MENU_ID_OF_INSTANCE_2 35 #define MENU_ID_OF_INSTANCE_2 35
#endif #endif

@ -86,8 +86,14 @@ LCDML_add(57, LCDML_0_3, 2, "Save", UI_func_save);
LCDML_add(58, LCDML_0, 4, "System", NULL); LCDML_add(58, LCDML_0, 4, "System", NULL);
LCDML_add(59, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(59, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(60, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(60, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
#if defined(TEENSY_AUDIO_BOARD)
LCDML_add(61, LCDML_0_4, 3, "Output Level", UI_func_output_level);
LCDML_add(62, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 62
#else
LCDML_add(61, LCDML_0, 5, "Info", UI_func_information); LCDML_add(61, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 61 #define _LCDML_DISP_cnt 61
#endif
#define MENU_ID_OF_INSTANCE_2 41 #define MENU_ID_OF_INSTANCE_2 41
#endif #endif

@ -102,8 +102,14 @@ LCDML_add(73, LCDML_0_3, 2, "Save", UI_func_save);
LCDML_add(74, LCDML_0, 4, "System", NULL); LCDML_add(74, LCDML_0, 4, "System", NULL);
LCDML_add(74, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(74, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(75, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(75, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
#if defined(TEENSY_AUDIO_BOARD)
LCDML_add(76, LCDML_0_4, 3, "Output Level", UI_func_output_level);
LCDML_add(77, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 77
#else
LCDML_add(76, LCDML_0, 5, "Info", UI_func_information); LCDML_add(76, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 76 #define _LCDML_DISP_cnt 76
#endif
#define MENU_ID_OF_INSTANCE_2 36 #define MENU_ID_OF_INSTANCE_2 36
#endif #endif

@ -128,8 +128,14 @@ LCDML_add(99, LCDML_0_3, 2, "Save", UI_func_save);
LCDML_add(100, LCDML_0, 4, "System", NULL); LCDML_add(100, LCDML_0, 4, "System", NULL);
LCDML_add(101, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(101, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(102, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(102, LCDML_0_4, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
#if defined(TEENSY_AUDIO_BOARD)
LCDML_add(103, LCDML_0_4, 3, "Output Level", UI_func_output_level);
LCDML_add(104, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 104
#else
LCDML_add(103, LCDML_0, 5, "Info", UI_func_information); LCDML_add(103, LCDML_0, 5, "Info", UI_func_information);
#define _LCDML_DISP_cnt 103 #define _LCDML_DISP_cnt 103
#endif
#define MENU_ID_OF_INSTANCE_2 42 #define MENU_ID_OF_INSTANCE_2 42
#endif #endif

@ -471,6 +471,10 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define SOFT_MIDI_THRU_MAX 1 #define SOFT_MIDI_THRU_MAX 1
#define SOFT_MIDI_THRU_DEFAULT 1 #define SOFT_MIDI_THRU_DEFAULT 1
#define SGTL5000_LINEOUT_LEVEL_MIN 13
#define SGTL5000_LINEOUT_LEVEL_MAX 31
#define SGTL5000_LINEOUT_LEVEL_DEFAULT SGTL5000_LINEOUT_LEVEL
// //
typedef struct { typedef struct {
uint8_t midi_channel; uint8_t midi_channel;
@ -524,6 +528,7 @@ typedef struct {
uint8_t delay_level; uint8_t delay_level;
uint8_t soft_midi_thru; uint8_t soft_midi_thru;
dexed_t dexed[NUM_DEXED]; dexed_t dexed[NUM_DEXED];
char config_name[11];
} config_t; } config_t;
#if !defined(_MAPFLOAT) #if !defined(_MAPFLOAT)

Loading…
Cancel
Save