|
|
@ -302,6 +302,7 @@ int16_t _midi_bpm = -1; |
|
|
|
elapsedMillis midi_bpm_timer; |
|
|
|
elapsedMillis midi_bpm_timer; |
|
|
|
elapsedMillis long_button_pressed; |
|
|
|
elapsedMillis long_button_pressed; |
|
|
|
elapsedMillis control_rate; |
|
|
|
elapsedMillis control_rate; |
|
|
|
|
|
|
|
elapsedMillis save_sys; |
|
|
|
uint8_t active_voices[NUM_DEXED]; |
|
|
|
uint8_t active_voices[NUM_DEXED]; |
|
|
|
uint8_t midi_voices[NUM_DEXED]; |
|
|
|
uint8_t midi_voices[NUM_DEXED]; |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
@ -562,7 +563,7 @@ void setup() |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2, false); |
|
|
|
timer1.begin(sequencer, seq_tempo_ms / 2, false); |
|
|
|
|
|
|
|
|
|
|
|
// Load initial Performance or the last used one
|
|
|
|
// Load initial Performance or the last used one
|
|
|
|
initial_values_from_eeprom(false); |
|
|
|
initial_values(false); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
change_disp_sd(true); |
|
|
|
change_disp_sd(true); |
|
|
@ -689,6 +690,7 @@ void loop() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CONTROL-RATE-EVENT-HANDLING
|
|
|
|
// CONTROL-RATE-EVENT-HANDLING
|
|
|
|
if (control_rate > CONTROL_RATE_MS) |
|
|
|
if (control_rate > CONTROL_RATE_MS) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -747,6 +749,43 @@ void loop() |
|
|
|
else |
|
|
|
else |
|
|
|
yield(); |
|
|
|
yield(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SAVE-SYS-EVENT-HANDLING
|
|
|
|
|
|
|
|
if (save_sys > SAVE_SYS_MS) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Check if we can save configuration.sys")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
bool instance_is_playing = false; |
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (active_voices[instance_id] > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
instance_is_playing = true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (instance_is_playing == false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DRUMS; instance_id++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (Drum[instance_id]->isPlaying()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
instance_is_playing = true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (instance_is_playing == false) |
|
|
|
|
|
|
|
save_sd_sys_json(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("System is playing, next try...")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
save_sys = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) |
|
|
|
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1867,7 +1906,7 @@ void set_volume(uint8_t v, uint8_t m) |
|
|
|
EEPROM HELPER |
|
|
|
EEPROM HELPER |
|
|
|
******************************************************************************/ |
|
|
|
******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
void initial_values_from_eeprom(bool init) |
|
|
|
void initial_values(bool init) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint16_t _m_; |
|
|
|
uint16_t _m_; |
|
|
|
|
|
|
|
|
|
|
|