|
|
|
@ -130,7 +130,7 @@ config_t configuration = { |
|
|
|
|
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
|
|
|
|
|
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
|
|
|
|
|
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
|
|
|
|
|
ENC_CHORUS_INTENSITY_DEFAULT, // chorus_intensity
|
|
|
|
|
ENC_CHORUS_INTENSITY_DEFAULT, // chorus_intensity
|
|
|
|
|
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
|
|
|
|
|
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
|
|
|
|
|
ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level
|
|
|
|
@ -140,7 +140,7 @@ config_t configuration = { |
|
|
|
|
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
|
|
|
|
|
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
|
|
|
|
|
ENC_MAX_POLY_DEFAULT, // max_poly
|
|
|
|
|
0 // pan
|
|
|
|
|
ENC_MASTER_PAN_DEFAULT // pan
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
uint8_t master_volume = ENC_MASTER_VOLUME_DEFAULT; |
|
|
|
@ -183,7 +183,7 @@ void setup() |
|
|
|
|
// create EPiano object
|
|
|
|
|
ep = new mdaEPiano(); |
|
|
|
|
|
|
|
|
|
set_complete_configuration(); |
|
|
|
|
//set_complete_configuration();
|
|
|
|
|
initial_values_from_eeprom(); |
|
|
|
|
|
|
|
|
|
setup_midi_devices(); |
|
|
|
@ -215,11 +215,11 @@ void setup() |
|
|
|
|
|
|
|
|
|
// set master volume
|
|
|
|
|
set_master_volume(master_volume); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// internal mixing of original signal(0), reverb(1) and chorus(2)
|
|
|
|
|
mixer_r.gain(0, 1.0); |
|
|
|
|
mixer_l.gain(0, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
@ -543,57 +543,24 @@ void config_from_eeprom(void) |
|
|
|
|
if (checksum == tmp_conf.checksum) |
|
|
|
|
{ |
|
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); |
|
|
|
|
Serial.print(F(" - OK, loading config ")); |
|
|
|
|
Serial.print(F(" - OK -> loading sound.")); |
|
|
|
|
Serial.print(sound, DEC); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
{ |
|
|
|
|
Serial.println(F(" - mismatch (or force) -> nothing done!")); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F(" - mismatch -> loading initial configuration.")); |
|
|
|
|
#endif |
|
|
|
|
set_complete_configuration(); |
|
|
|
|
} |
|
|
|
|
show_sound(); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void initial_values_from_eeprom(void) |
|
|
|
|
{ |
|
|
|
|
uint32_t checksum; |
|
|
|
|
config_t tmp_conf; |
|
|
|
|
|
|
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), tmp_conf); |
|
|
|
|
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("EEPROM checksum: 0x")); |
|
|
|
|
Serial.print(tmp_conf.checksum, HEX); |
|
|
|
|
Serial.print(F(" / 0x")); |
|
|
|
|
Serial.print(checksum, HEX); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (checksum != tmp_conf.checksum || (but[0].read() == LOW && but[1].read() == LOW)) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F(" - mismatch (or force) -> initializing EEPROM!")); |
|
|
|
|
#endif |
|
|
|
|
eeprom_config_update_flag = sound; |
|
|
|
|
eeprom_config_update(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
sound = EEPROM.read(EEPROM_SOUND); |
|
|
|
|
master_volume = EEPROM.read(EEPROM_MASTER_VOLUME); |
|
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); |
|
|
|
|
Serial.print(F(" - OK, loading")); |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F(" - Master volume: ")); |
|
|
|
|
Serial.print(master_volume, DEC); |
|
|
|
|
Serial.print(F(" - Sound: ")); |
|
|
|
|
Serial.println(sound, DEC); |
|
|
|
|
Serial.print(F("Max configs in EEPROM: ")); |
|
|
|
|
Serial.println(MAX_SOUNDS); |
|
|
|
|
show_sound(); |
|
|
|
|
#endif |
|
|
|
|
master_volume = EEPROM.read(EEPROM_MASTER_VOLUME); |
|
|
|
|
sound = EEPROM.read(EEPROM_SOUND); |
|
|
|
|
load_sound(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void eeprom_config_write(uint8_t value) |
|
|
|
@ -726,7 +693,7 @@ void show_sound(void) |
|
|
|
|
Serial.println(configuration.reverb_damping, DEC); |
|
|
|
|
Serial.print(F("Reverb Level: ")); |
|
|
|
|
Serial.println(configuration.reverb_level, DEC); |
|
|
|
|
Serial.print(F("CHorus Frequency: ")); |
|
|
|
|
Serial.print(F("Chorus Frequency: ")); |
|
|
|
|
Serial.println(configuration.chorus_frequency, DEC); |
|
|
|
|
Serial.print(F("Chorus Delay: ")); |
|
|
|
|
Serial.println(configuration.chorus_delay, DEC); |
|
|
|
|