Several fixes (especially for paramter changing).

master
Holger Wirtz 6 years ago
parent ca47f6852a
commit a41fc72926
  1. 20
      MicroMDAEPiano.ino
  2. 65
      UI.hpp
  3. 18
      config.h
  4. 10
      mdaEPiano.cpp
  5. 4
      mdaEPiano.h

@ -166,6 +166,7 @@ void setup()
// create EPiano object
ep = new mdaEPiano();
set_complete_configuration();
// read initial EEPROM variables
initial_values_from_eeprom();
@ -179,31 +180,14 @@ void setup()
sgtl5000_1.enable();
sgtl5000_1.dacVolumeRamp();
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);
sgtl5000_1.audioPostProcessorEnable();
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.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).
/* The cutoff frequency is specified as follows:
value frequency
0 80Hz
1 100Hz
2 125Hz
3 150Hz
4 175Hz
5 200Hz
6 225Hz
*/
//sgtl5000_1.eqBands(bass, mid_bass, midrange, mid_treble, treble);
Serial.println(F("Teensy-Audio-Board enabled."));
#elif defined(TGA_AUDIO_BOARD)
wm8731_1.enable();
@ -227,7 +211,7 @@ void setup()
Serial.print(audio_block_time_us);
Serial.println(F("ms)"));
set_complete_configuration();
AudioInterrupts();

@ -107,9 +107,9 @@ extern float _loudness;
/******************************************
TEXT GETTER FUCTIONS
******************************************/
const char comp_gain_value_text1[] PROGMEM = " 0 dB";
const char comp_gain_value_text2[] PROGMEM = "+ 6 dB";
const char comp_gain_value_text3[] PROGMEM = "+12 dB";
char comp_gain_value_text1[] = " 0 dB";
char comp_gain_value_text2[] = "+ 6 dB";
char comp_gain_value_text3[] = "+12 dB";
char* get_comp_gain_value_text(void)
{
switch (configuration.comp_gain)
@ -127,10 +127,10 @@ char* get_comp_gain_value_text(void)
return ('\0');
}
const char comp_response_value_text1[] PROGMEM = " 0 ms";
const char comp_response_value_text2[] PROGMEM = " 25 ms";
const char comp_response_value_text3[] PROGMEM = " 50 ms";
const char comp_response_value_text4[] PROGMEM = "100 ms";
char comp_response_value_text1[] = " 0 ms";
char comp_response_value_text2[] = " 25 ms";
char comp_response_value_text3[] = " 50 ms";
char comp_response_value_text4[] = "100 ms";
char* get_comp_response_value_text(void)
{
switch (configuration.comp_response)
@ -151,20 +151,14 @@ char* get_comp_response_value_text(void)
return ('\0');
}
const char comp_limit_value_text1[] PROGMEM = "soft Knee";
const char comp_limit_value_text2[] PROGMEM = "hard Knee";
char comp_limit_value_text1[] = "soft Knee";
char comp_limit_value_text2[] = "hard Knee";
char* get_comp_limit_value_text(void)
{
switch (configuration.comp_limit)
{
case false:
return (comp_limit_value_text1);
break;
case true:
return (comp_limit_value_text2);
break;
}
return ('\0');
if (configuration.comp_limit == false)
return (comp_limit_value_text1);
else
return (comp_limit_value_text2);
}
char comp_threshold_value_text1[] = " ";
@ -1813,7 +1807,7 @@ void set_comp_gain(uint8_t value)
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, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(tmp, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack / 10, (float)configuration.comp_decay / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_gain = value;
}
@ -1824,7 +1818,7 @@ void set_comp_response(uint8_t value)
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, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(configuration.comp_gain, tmp, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack / 10, (float)configuration.comp_decay / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_response = value;
}
@ -1835,7 +1829,7 @@ void set_comp_limit(uint8_t value)
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, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, tmp, (float)configuration.comp_threshold, (float)configuration.comp_attack / 10, (float)configuration.comp_decay / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_limit = value;
}
@ -1846,7 +1840,7 @@ void set_comp_threshold(uint8_t value)
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, (float)value, (float)configuration.comp_attack, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)value, (float)configuration.comp_attack / 10, (float)configuration.comp_decay / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_threshold = value;
}
@ -1857,7 +1851,7 @@ void set_comp_attack(uint8_t value)
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, (float)configuration.comp_threshold, (float)value / 10, (float)configuration.comp_decay); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)value / 10, (float)configuration.comp_decay / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_attack = value;
}
@ -1868,7 +1862,7 @@ void set_comp_decay(uint8_t value)
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, (float)configuration.comp_threshold, (float)configuration.comp_attack, (float)value / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
sgtl5000_1.autoVolumeControl(configuration.comp_gain, configuration.comp_response, configuration.comp_limit, (float)configuration.comp_threshold, (float)configuration.comp_attack / 10, (float)value / 10); // maxGain, response, hardLimit, threshold, attack, decay, e.g.: 1, 1, 1, 0.9, 0.01, 0.05
configuration.comp_decay = value;
}
@ -1951,19 +1945,22 @@ void set_bass_lr_level(uint8_t value)
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);
float tmp1 = mapfloat(float(value), ENC_BASS_LR_LEVEL_MIN, ENC_BASS_LR_LEVEL_MAX, 0.0, 1.0);
float tmp2 = mapfloat(float(configuration.bass_mono_level), ENC_BASS_MONO_LEVEL_MIN, ENC_BASS_MONO_LEVEL_MAX, 0.0, 1.0);
sgtl5000_1.enhanceBass(tmp1, tmp2);
configuration.bass_lr_level = value;
}
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);
float tmp1 = mapfloat(float(configuration.bass_lr_level), ENC_BASS_LR_LEVEL_MIN, ENC_BASS_LR_LEVEL_MAX, 0.0, 1.0);
float tmp2 = mapfloat(float(value), ENC_BASS_MONO_LEVEL_MIN, ENC_BASS_MONO_LEVEL_MAX, 0.0, 1.0);
sgtl5000_1.enhanceBass(tmp1, tmp2);
configuration.bass_mono_level = value;
}
@ -1973,8 +1970,9 @@ void set_eq_bass(uint8_t value)
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);
float tmp1 = mapfloat(float(value), ENC_EQ_BASS_MIN, ENC_EQ_BASS_MAX, -1.0, 1.0);
float tmp2 = mapfloat(float(configuration.eq_treble), ENC_EQ_TREBLE_MIN, ENC_EQ_TREBLE_MAX, -1.0, 1.0);
sgtl5000_1.eqBands(tmp1, tmp2);
configuration.eq_bass = value;
}
@ -1984,8 +1982,9 @@ void set_eq_treble(uint8_t value)
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);
float tmp1 = mapfloat(float(configuration.eq_bass), ENC_EQ_BASS_MIN, ENC_EQ_BASS_MAX, -1.0, 1.0);
float tmp2 = mapfloat(float(value), ENC_EQ_TREBLE_MIN, ENC_EQ_TREBLE_MAX, -1.0, 1.0);
sgtl5000_1.eqBands(tmp1, tmp2);
configuration.eq_treble = value;
}

@ -240,13 +240,13 @@
#define ENC_BASS_MONO_LEVEL_MAX 99
#define ENC_BASS_MONO_LEVEL_DEFAULT 0
//
#define ENC_EQ_BASS_MIN 0
#define ENC_EQ_BASS_MAX 99
#define ENC_EQ_BASS_DEFAULT 50
#define ENC_EQ_BASS_MIN -50
#define ENC_EQ_BASS_MAX 50
#define ENC_EQ_BASS_DEFAULT 0
//
#define ENC_EQ_TREBLE_MIN 0
#define ENC_EQ_TREBLE_MAX 99
#define ENC_EQ_TREBLE_DEFAULT 50
#define ENC_EQ_TREBLE_MIN -50
#define ENC_EQ_TREBLE_MAX 50
#define ENC_EQ_TREBLE_DEFAULT 0
//
#define ENC_LOUDNESS_MIN 0
#define ENC_LOUDNESS_MAX 99
@ -335,11 +335,11 @@ struct config_t {
uint8_t chorus_level;
uint8_t bass_lr_level;
uint8_t bass_mono_level;
uint8_t eq_bass;
uint8_t eq_treble;
int8_t eq_bass;
int8_t eq_treble;
uint8_t loudness;
uint8_t midi_channel;
uint8_t midi_soft_thru;
bool midi_soft_thru;
uint8_t max_poly;
int8_t pan;
};

@ -53,6 +53,7 @@ mdaEPiano::mdaEPiano() // mdaEPiano::mdaEPiano(audioMasterCallback audioMaster)
setProgram(0);
}
*/
fillpatch(0, "Default", 0.500f, 0.500f, 0.500f, 0.500f, 0.500f, 0.650f, 0.250f, 0.500f, 1.0f, 0.500f, 0.146f, 0.000f);
waves = (short*)epianoDataXfade;
@ -181,10 +182,10 @@ void mdaEPiano::setParameter(int32_t index, float value)
update();
}
/*
void mdaEPiano::fillpatch(int32_t p, char *name, float p0, float p1, float p2, float p3, float p4,
void mdaEPiano::fillpatch(int32_t p, char *name, float p0, float p1, float p2, float p3, float p4,
float p5, float p6, float p7, float p8, float p9, float p10, float p11)
{
{
strcpy(programs[p].name, name);
programs[p].param[0] = p0; programs[p].param[1] = p1;
programs[p].param[2] = p2; programs[p].param[3] = p3;
@ -192,8 +193,9 @@ void mdaEPiano::setParameter(int32_t index, float value)
programs[p].param[6] = p6; programs[p].param[7] = p7;
programs[p].param[8] = p8; programs[p].param[9] = p9;
programs[p].param[10] = p10; programs[p].param[11] = p11;
}
}
/*
float mdaEPiano::getParameter(int32_t index) {
return programs[curProgram].param[index];
}

@ -94,8 +94,8 @@ class mdaEPiano
private:
void update(); //my parameter update
/* void fillpatch(int32_t p, char *name, float p0, float p1, float p2, float p3, float p4,
float p5, float p6, float p7, float p8, float p9, float p10, float p11); */
void fillpatch(int32_t p, char *name, float p0, float p1, float p2, float p3, float p4,
float p5, float p6, float p7, float p8, float p9, float p10, float p11);
mdaEPianoProgram* programs;
float Fs, iFs;

Loading…
Cancel
Save