Fixes for volume handling.

pull/32/head
Holger Wirtz 5 years ago
parent 953f4ac3eb
commit 37fb256774
  1. 20
      MicroDexed.ino
  2. 6
      UI.hpp
  3. 2
      config.h

@ -321,6 +321,7 @@ void setup()
#if defined(TEENSY_AUDIO_BOARD) #if defined(TEENSY_AUDIO_BOARD)
sgtl5000_1.enable(); sgtl5000_1.enable();
sgtl5000_1.dacVolumeRamp(); sgtl5000_1.dacVolumeRamp();
sgtl5000_1.dacVolume(1.0);
//sgtl5000_1.dacVolumeRampLinear(); //sgtl5000_1.dacVolumeRampLinear();
//sgtl5000_1.dacVolumeRampDisable(); //sgtl5000_1.dacVolumeRampDisable();
sgtl5000_1.unmuteHeadphone(); sgtl5000_1.unmuteHeadphone();
@ -330,10 +331,13 @@ void setup()
sgtl5000_1.lineOutLevel(sgtl5000_level); sgtl5000_1.lineOutLevel(sgtl5000_level);
sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.audioPostProcessorEnable();
sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05); sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05);
sgtl5000_1.autoVolumeEnable(); //sgtl5000_1.autoVolumeEnable();
sgtl5000_1.surroundSoundEnable(); sgtl5000_1.autoVolumeDisable();
//sgtl5000_1.surroundSoundEnable();
sgtl5000_1.surroundSoundDisable();
sgtl5000_1.surroundSound(7, 2); // Configures virtual surround width from 0 (mono) to 7 (widest). select may be set to 1 (disable), 2 (mono input) or 3 (stereo input). sgtl5000_1.surroundSound(7, 2); // Configures virtual surround width from 0 (mono) to 7 (widest). select may be set to 1 (disable), 2 (mono input) or 3 (stereo input).
sgtl5000_1.enhanceBassEnable(); //sgtl5000_1.enhanceBassEnable();
sgtl5000_1.enhanceBassDisable();
sgtl5000_1.enhanceBass(1.0, 0.2, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). sgtl5000_1.enhanceBass(1.0, 0.2, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1).
/* The cutoff frequency is specified as follows: /* The cutoff frequency is specified as follows:
value frequency value frequency
@ -469,7 +473,7 @@ void setup()
chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0)); chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0));
// DEXED FILTER // DEXED FILTER
//MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); //MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX/100.0);
MicroDexed[instance_id]->fx.Gain = 1.0; MicroDexed[instance_id]->fx.Gain = 1.0;
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_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); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
@ -477,7 +481,7 @@ void setup()
#endif #endif
// Dexed output level // Dexed output level
dexed_level[instance_id]->gain(1.0); dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0));
// PANORAMA // PANORAMA
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
@ -735,9 +739,9 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#endif #endif
configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX);
#ifdef USE_FX #ifdef USE_FX
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0);
#else #else
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 2.0)); dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0));
#endif #endif
eeprom_write(); eeprom_write();
break; break;
@ -1321,7 +1325,7 @@ 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);
#endif #endif
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled);
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 2.0)); dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0));
} }
} }
Serial.println(F("OK, loaded!")); Serial.println(F("OK, loaded!"));

@ -1713,7 +1713,7 @@ void UI_func_sound_intensity(uint8_t param)
} }
//MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0; //MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0;
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 2.0)); dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_MAX / 100.0));
} }
lcd_display_bar_int("Sound Intens.", configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, false); lcd_display_bar_int("Sound Intens.", configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, false);
@ -2995,7 +2995,7 @@ void UI_func_output_level(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
// setup function // setup function
sgtl5000_level = EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS]; EEPROM.get(EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS, sgtl5000_level);
lcd_special_chars(BLOCKBAR); 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); lcd_display_bar_int("Output Level", sgtl5000_level, SGTL5000_LINEOUT_LEVEL_MIN, SGTL5000_LINEOUT_LEVEL_MAX, 2, false, false, false, true);
} }
@ -3032,7 +3032,7 @@ void UI_func_output_level(uint8_t param)
{ {
// you can here reset some global vars or do nothing // you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR); lcd_special_chars(SCROLLBAR);
EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS] = sgtl5000_level; EEPROM.put(EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS, sgtl5000_level);
} }
} }
#endif #endif

@ -387,7 +387,7 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define TUNE_DEFAULT 100 #define TUNE_DEFAULT 100
#define SOUND_INTENSITY_MIN 0 #define SOUND_INTENSITY_MIN 0
#define SOUND_INTENSITY_MAX 200 #define SOUND_INTENSITY_MAX 255
#define SOUND_INTENSITY_DEFAULT 100 #define SOUND_INTENSITY_DEFAULT 100
#define POLYPHONY_MIN 1 #define POLYPHONY_MIN 1

Loading…
Cancel
Save