Added all set_* functions.

dev
Holger Wirtz 6 years ago
parent db367c9f97
commit 665411a98a
  1. BIN
      .swp
  2. 28
      MicroMDAEPiano.ino
  3. 239
      UI.hpp
  4. 12
      config.h

BIN
.swp

Binary file not shown.

@ -51,6 +51,8 @@ AudioEffectFreeverb freeverb_r;
AudioEffectFreeverb freeverb_l;
AudioMixer4 mixer_r;
AudioMixer4 mixer_l;
AudioAmplifier volume_r;
AudioAmplifier volume_l;
AudioConnection patchCord0(queue_r, peak_r);
AudioConnection patchCord1(queue_l, peak_l);
AudioConnection patchCord4(queue_r, freeverb_r);
@ -59,26 +61,20 @@ AudioConnection patchCord6(queue_r, 0, mixer_r, 0);
AudioConnection patchCord7(queue_l, 0, mixer_l, 0);
AudioConnection patchCord8(freeverb_r, 0, mixer_r, 1);
AudioConnection patchCord9(freeverb_l, 0, mixer_l, 1);
AudioConnection patchCord10(mixer_r, volume_r);
AudioConnection patchCord11(mixer_l, volume_l);
#if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioConnection patchCord110(mixer_r, 0, i2s1, 0);
AudioConnection patchCord111(mixer_l, 0, i2s1, 1);
AudioConnection patchCord12(volume_r, 0, i2s1, 0);
AudioConnection patchCord13(volume_l, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioAmplifier volume_r;
AudioAmplifier volume_l;
AudioConnection patchCord10(mixer_r, volume_r);
AudioConnection patchCord11(mixer_l, volume_l);
AudioConnection patchCord12(volume_r, 0, i2s1, 1);
AudioConnection patchCord13(volume_l, 0, i2s1, 0);
AudioControlWM8731master wm8731_1;
#else
AudioOutputPT8211 pt8211_1;
AudioAmplifier volume_r;
AudioAmplifier volume_l;
AudioConnection patchCord10(mixer_r, volume_r);
AudioConnection patchCord11(mixer_l, volume_l);
AudioConnection patchCord12(volume_r, 0, pt8211_1, 1);
AudioConnection patchCord13(volume_l, 0, pt8211_1, 0);
#endif
@ -151,6 +147,7 @@ void setup()
pinMode(BUT_R_PIN, INPUT_PULLUP);
init_menus();
set_complete_configuration();
Serial.begin(SERIAL_SPEED);
delay(500);
@ -184,17 +181,18 @@ void setup()
//sgtl5000_1.dacVolumeRampLinear();
sgtl5000_1.unmuteHeadphone();
sgtl5000_1.unmuteLineout();
sgtl5000_1.autoVolumeDisable(); // turn off AGC
//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.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05);
sgtl5000_1.eqSelect(TONE_CONTROLS);
//sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05);
sgtl5000_1.autoVolumeEnable();
sgtl5000_1.surroundSoundEnable();
sgtl5000_1.surroundSound(7, 3); // 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.surroundSoundEnable();
//sgtl5000_1.surroundSound(7, 3); // 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.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:
value frequency
0 80Hz

239
UI.hpp

@ -94,6 +94,13 @@ int8_t menu_position[NUM_MENUS];
extern mdaEPiano* ep;
extern void set_volume(float v, float p);
extern AudioControlSGTL5000 sgtl5000_1;
extern AudioEffectFreeverb freeverb_r;
extern AudioEffectFreeverb freeverb_l;
extern AudioMixer4 mixer_r;
extern AudioMixer4 mixer_l;
extern AudioAmplifier volume_r;
extern AudioAmplifier volume_l;
/******************************************
MAIN MENU
@ -1049,7 +1056,7 @@ void callback_max_poly_function()
#endif
menu_system.change_menu(max_poly_menu);
menu_position[SYSTEM] = encoder_value[RIGHT_ENCODER];
encoder_value[RIGHT_ENCODER] =configuration. max_poly;
encoder_value[RIGHT_ENCODER] = configuration. max_poly;
enc[RIGHT_ENCODER].write(configuration.max_poly, 1, 32);
menu_system.update();
}
@ -1618,6 +1625,214 @@ void set_overdrive(uint8_t value)
ep->setParameter(MDA_EP_OVERDRIVE, tmp);
}
void set_comp_gain(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_GAIN "));
Serial.println(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, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_response(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_RESPONSE "));
Serial.println(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, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_limit(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_LIMIT "));
Serial.println(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, configuration.comp_threshold, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_threshold(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_THRESHOLD "));
Serial.println(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, tmp, configuration.comp_attack, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_attack(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_ATTACK "));
Serial.println(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, configuration.comp_threshold, tmp, configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_comp_decay(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set COMP_DECAY "));
Serial.println(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, configuration.comp_threshold, configuration.comp_attack, tmp); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
}
void set_reverb_roomsize(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set REVERB_ROOMSIZE "));
Serial.println(value);
#endif
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);
}
void set_reverb_damping(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set REVERB_DAMPING "));
Serial.println(value);
#endif
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);
}
void set_reverb_level(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set REVERB_LEVEL "));
Serial.println(value);
#endif
float tmp = mapfloat(float(value), ENC_REVERB_DAMPING_MIN, ENC_REVERB_DAMPING_MAX, 0.0, 1.0);
mixer_r.gain(0, 1.0 - tmp);
mixer_l.gain(0, 1.0 - tmp);
mixer_r.gain(1, tmp);
mixer_l.gain(1, tmp);
}
void set_chorus_frequency(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set CHORUS_FREQUENCY "));
Serial.println(value);
#endif
float tmp = mapfloat(float(value), ENC_CHORUS_FREQUENCY_MIN, ENC_CHORUS_FREQUENCY_MAX, 0.0, 1.0);
// TDB
}
void set_chorus_delay(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set CHORUS_DELAY "));
Serial.println(value);
#endif
float tmp = mapfloat(float(value), ENC_CHORUS_DELAY_MIN, ENC_CHORUS_DELAY_MAX, 0.0, 1.0);
// TDB
}
void set_chorus_level(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set CHORUS_LEVEL "));
Serial.println(value);
#endif
float tmp = mapfloat(float(value), ENC_CHORUS_LEVEL_MIN, ENC_CHORUS_LEVEL_MAX, 0.0, 1.0);
// TDB
}
void set_bass_lr_level(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set BASS_LR_LEVEL "));
Serial.println(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);
}
void set_bass_mono_level(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set BASS_MONO_LEVEL "));
Serial.println(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);
}
void set_eq_bass(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set EQ_BASS "));
Serial.println(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);
}
void set_eq_treble(uint8_t value)
{
#ifdef DEBUG
Serial.print(F("Set EQ_TREBLE "));
Serial.println(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);
}
void set_loudness(uint8_t value)
{
#ifdef DEBUG
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);
}
void set_complete_configuration(void)
{
set_decay(configuration.decay);
set_release(configuration.release);
set_hardness(configuration.hardness);
set_treble(configuration.treble);
set_stereo(configuration.stereo);
set_tune(configuration.tune);
set_detune(configuration.detune);
set_velocity_sense(configuration.velocity_sense);
set_pan_trem_frequency(configuration.pan_trem_frequency);
set_pan_trem_level(configuration.pan_trem_level);
set_overdrive(configuration.overdrive);
set_comp_gain(configuration.comp_gain);
set_comp_response(configuration.comp_response);
set_comp_limit(configuration.comp_limit);
set_comp_threshold(configuration.comp_threshold);
set_comp_attack(configuration.comp_attack);
set_comp_decay(configuration.comp_decay);
set_reverb_roomsize(configuration.reverb_roomsize);
set_reverb_damping(configuration.reverb_damping);
set_reverb_level(configuration.reverb_level);
set_chorus_frequency(configuration.chorus_frequency);
set_chorus_delay(configuration.chorus_delay);
set_chorus_level(configuration.chorus_level);
set_bass_lr_level(configuration.bass_lr_level);
set_bass_mono_level(configuration.bass_mono_level);
set_eq_bass(configuration.eq_bass);
set_eq_treble(configuration.eq_treble);
set_loudness(configuration.loudness);
}
//********************************************************************************************+
void handle_ui(void)
{
@ -1780,6 +1995,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_gain = encoder_tmp;
set_comp_gain(configuration.comp_gain);
menu_system.update();
}
}
@ -1789,6 +2005,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_response = encoder_tmp;
set_comp_response(configuration.comp_response);
menu_system.update();
}
}
@ -1798,6 +2015,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_limit = encoder_tmp;
set_comp_limit(configuration.comp_limit);
menu_system.update();
}
}
@ -1807,6 +2025,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_threshold = encoder_tmp;
set_comp_threshold(configuration.comp_threshold);
menu_system.update();
}
}
@ -1816,6 +2035,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_attack = encoder_tmp;
set_comp_attack(configuration.comp_attack);
menu_system.update();
}
}
@ -1825,6 +2045,7 @@ void handle_ui(void)
{
// value up/down
configuration.comp_decay = encoder_tmp;
set_comp_decay(configuration.comp_decay);
menu_system.update();
}
}
@ -1834,6 +2055,7 @@ void handle_ui(void)
{
// value up/down
configuration.reverb_roomsize = encoder_tmp;
set_reverb_roomsize(configuration.reverb_roomsize);
menu_system.update();
}
}
@ -1843,6 +2065,7 @@ void handle_ui(void)
{
// value up/down
configuration.reverb_damping = encoder_tmp;
set_reverb_damping(configuration.reverb_damping);
menu_system.update();
}
}
@ -1852,6 +2075,7 @@ void handle_ui(void)
{
// value up/down
configuration.reverb_level = encoder_tmp;
set_reverb_level(configuration.reverb_level);
menu_system.update();
}
}
@ -1861,6 +2085,7 @@ void handle_ui(void)
{
// value up/down
configuration.chorus_frequency = encoder_tmp;
set_chorus_frequency(configuration.chorus_frequency);
menu_system.update();
}
}
@ -1870,6 +2095,7 @@ void handle_ui(void)
{
// value up/down
configuration.chorus_delay = encoder_tmp;
set_chorus_delay(configuration.chorus_delay);
menu_system.update();
}
}
@ -1879,6 +2105,7 @@ void handle_ui(void)
{
// value up/down
configuration.chorus_level = encoder_tmp;
set_chorus_level(configuration.chorus_level);
menu_system.update();
}
}
@ -1888,6 +2115,7 @@ void handle_ui(void)
{
// value up/down
configuration.bass_lr_level = encoder_tmp;
set_bass_lr_level(configuration.bass_lr_level);
menu_system.update();
}
}
@ -1897,6 +2125,7 @@ void handle_ui(void)
{
// value up/down
configuration.bass_mono_level = encoder_tmp;
set_bass_mono_level(configuration.bass_mono_level);
menu_system.update();
}
}
@ -1906,6 +2135,7 @@ void handle_ui(void)
{
// value up/down
configuration.eq_bass = encoder_tmp;
set_eq_bass(configuration.eq_bass);
menu_system.update();
}
}
@ -1915,6 +2145,7 @@ void handle_ui(void)
{
// value up/down
configuration.eq_treble = encoder_tmp;
set_eq_treble(configuration.eq_treble);
menu_system.update();
}
}
@ -1924,6 +2155,7 @@ void handle_ui(void)
{
// value up/down
configuration.sound = encoder_tmp;
save_sound(configuration.sound);
menu_system.update();
}
}
@ -1933,6 +2165,7 @@ void handle_ui(void)
{
// value up/down
configuration.loudness = encoder_tmp;
set_loudness(configuration.loudness);
menu_system.update();
}
}
@ -2003,7 +2236,7 @@ void handle_ui(void)
Serial.print("Load sound ");
Serial.println(configuration.sound);
#endif
; // TODO
load_sound(configuration.sound);
}
else if (menu_system.get_currentScreen() == &save_sound_screen)
{
@ -2012,7 +2245,7 @@ void handle_ui(void)
Serial.print("Save sound ");
Serial.println(configuration.sound);
#endif
; // TODO
save_sound(configuration.sound);
}
else
{

@ -165,27 +165,27 @@
//
#define ENC_COMP_GAIN_MIN 0
#define ENC_COMP_GAIN_MAX 99
#define ENC_COMP_GAIN_DEFAULT 50
#define ENC_COMP_GAIN_DEFAULT 99
//
#define ENC_COMP_RESPONSE_MIN 0
#define ENC_COMP_RESPONSE_MAX 99
#define ENC_COMP_RESPONSE_DEFAULT 50
#define ENC_COMP_RESPONSE_DEFAULT 99
//
#define ENC_COMP_LIMIT_MIN 0
#define ENC_COMP_LIMIT_MAX 99
#define ENC_COMP_LIMIT_DEFAULT 50
#define ENC_COMP_LIMIT_DEFAULT 99
//
#define ENC_COMP_THRESHOLD_MIN 0
#define ENC_COMP_THRESHOLD_MAX 99
#define ENC_COMP_THRESHOLD_DEFAULT 50
#define ENC_COMP_THRESHOLD_DEFAULT 90
//
#define ENC_COMP_ATTACK_MIN 0
#define ENC_COMP_ATTACK_MAX 99
#define ENC_COMP_ATTACK_DEFAULT 50
#define ENC_COMP_ATTACK_DEFAULT 1
//
#define ENC_COMP_DECAY_MIN 0
#define ENC_COMP_DECAY_MAX 99
#define ENC_COMP_DECAY_DEFAULT 50
#define ENC_COMP_DECAY_DEFAULT 5
//
#define ENC_REVERB_ROOMSIZE_MIN 0
#define ENC_REVERB_ROOMSIZE_MAX 99

Loading…
Cancel
Save