|
|
@ -130,7 +130,7 @@ config_t configuration = { |
|
|
|
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
|
|
|
|
ENC_REVERB_LEVEL_DEFAULT, // reverb_level
|
|
|
|
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
|
|
|
|
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
|
|
|
|
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
|
|
|
|
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_CHORUS_LEVEL_DEFAULT, // chorus_level
|
|
|
|
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
|
|
|
|
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
|
|
|
|
ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level
|
|
|
|
ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level
|
|
|
@ -140,7 +140,7 @@ config_t configuration = { |
|
|
|
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
|
|
|
|
ENC_MIDI_CHANNEL_DEFAULT, // midi_channel
|
|
|
|
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
|
|
|
|
ENC_MIDI_SOFT_THRU_DEFAULT, // midi_soft_thru
|
|
|
|
ENC_MAX_POLY_DEFAULT, // max_poly
|
|
|
|
ENC_MAX_POLY_DEFAULT, // max_poly
|
|
|
|
0 // pan
|
|
|
|
ENC_MASTER_PAN_DEFAULT // pan
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
uint8_t master_volume = ENC_MASTER_VOLUME_DEFAULT; |
|
|
|
uint8_t master_volume = ENC_MASTER_VOLUME_DEFAULT; |
|
|
@ -183,7 +183,7 @@ void setup() |
|
|
|
// create EPiano object
|
|
|
|
// create EPiano object
|
|
|
|
ep = new mdaEPiano(); |
|
|
|
ep = new mdaEPiano(); |
|
|
|
|
|
|
|
|
|
|
|
set_complete_configuration(); |
|
|
|
//set_complete_configuration();
|
|
|
|
initial_values_from_eeprom(); |
|
|
|
initial_values_from_eeprom(); |
|
|
|
|
|
|
|
|
|
|
|
setup_midi_devices(); |
|
|
|
setup_midi_devices(); |
|
|
@ -215,11 +215,11 @@ void setup() |
|
|
|
|
|
|
|
|
|
|
|
// set master volume
|
|
|
|
// set master volume
|
|
|
|
set_master_volume(master_volume); |
|
|
|
set_master_volume(master_volume); |
|
|
|
|
|
|
|
|
|
|
|
// internal mixing of original signal(0), reverb(1) and chorus(2)
|
|
|
|
// internal mixing of original signal(0), reverb(1) and chorus(2)
|
|
|
|
mixer_r.gain(0, 1.0); |
|
|
|
mixer_r.gain(0, 1.0); |
|
|
|
mixer_l.gain(0, 1.0); |
|
|
|
mixer_l.gain(0, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
// Initialize processor and memory measurements
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
@ -543,57 +543,24 @@ void config_from_eeprom(void) |
|
|
|
if (checksum == tmp_conf.checksum) |
|
|
|
if (checksum == tmp_conf.checksum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); |
|
|
|
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); |
|
|
|
Serial.print(sound, DEC); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
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(); |
|
|
|
show_sound(); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void initial_values_from_eeprom(void) |
|
|
|
void initial_values_from_eeprom(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t checksum; |
|
|
|
master_volume = EEPROM.read(EEPROM_MASTER_VOLUME); |
|
|
|
config_t tmp_conf; |
|
|
|
sound = EEPROM.read(EEPROM_SOUND); |
|
|
|
|
|
|
|
load_sound(); |
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void eeprom_config_write(uint8_t value) |
|
|
|
void eeprom_config_write(uint8_t value) |
|
|
@ -726,7 +693,7 @@ void show_sound(void) |
|
|
|
Serial.println(configuration.reverb_damping, DEC); |
|
|
|
Serial.println(configuration.reverb_damping, DEC); |
|
|
|
Serial.print(F("Reverb Level: ")); |
|
|
|
Serial.print(F("Reverb Level: ")); |
|
|
|
Serial.println(configuration.reverb_level, DEC); |
|
|
|
Serial.println(configuration.reverb_level, DEC); |
|
|
|
Serial.print(F("CHorus Frequency: ")); |
|
|
|
Serial.print(F("Chorus Frequency: ")); |
|
|
|
Serial.println(configuration.chorus_frequency, DEC); |
|
|
|
Serial.println(configuration.chorus_frequency, DEC); |
|
|
|
Serial.print(F("Chorus Delay: ")); |
|
|
|
Serial.print(F("Chorus Delay: ")); |
|
|
|
Serial.println(configuration.chorus_delay, DEC); |
|
|
|
Serial.println(configuration.chorus_delay, DEC); |
|
|
|