|
|
@ -177,25 +177,17 @@ AudioConnection * dynamicConnections[NUM_DEXED * 8]; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStereo &mono2stereo, uint8_t instance_id) |
|
|
|
void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStereo &mono2stereo, uint8_t instance_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Serial.print(F("Connecting Dexed ")); |
|
|
|
|
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
|
|
|
|
Serial.println(F(":")); |
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, microdexed_peak_mixer, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, microdexed_peak_mixer, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0); |
|
|
|
Serial.println(F(" -> Peakmeter")); |
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id); |
|
|
|
Serial.println(F(" -> Dexed mixer")); |
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, chorus_send_mixer_l, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, chorus_send_mixer_l, instance_id); |
|
|
|
Serial.println(F(" -> Chorus send")); |
|
|
|
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, delay_send_mixer_l, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, delay_send_mixer_l, instance_id); |
|
|
|
Serial.println(F(" -> Delay send")); |
|
|
|
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
#if defined(USE_REVERB) |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, reverb_send_mixer_l, instance_id); |
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, reverb_send_mixer_l, instance_id); |
|
|
|
Serial.println(F(" -> Reverb send")); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -217,6 +209,7 @@ uint8_t active_voices[NUM_DEXED]; |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
uint32_t cpumax = 0; |
|
|
|
uint32_t cpumax = 0; |
|
|
|
|
|
|
|
elapsedMillis cpu_overload_throttle_timer; |
|
|
|
uint32_t peak_dexed = 0; |
|
|
|
uint32_t peak_dexed = 0; |
|
|
|
float peak_dexed_value = 0.0; |
|
|
|
float peak_dexed_value = 0.0; |
|
|
|
uint32_t peak_r = 0; |
|
|
|
uint32_t peak_r = 0; |
|
|
@ -538,23 +531,26 @@ void setup() |
|
|
|
// set initial volume
|
|
|
|
// set initial volume
|
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Serial.print(F("Dexed instance ")); |
|
|
|
|
|
|
|
Serial.print(instance_id); |
|
|
|
|
|
|
|
Serial.println(F(":")); |
|
|
|
Serial.print(F("Bank/Voice from EEPROM [")); |
|
|
|
Serial.print(F("Bank/Voice from EEPROM [")); |
|
|
|
Serial.print(configuration.dexed[instance_id].bank, DEC); |
|
|
|
Serial.print(configuration.dexed[instance_id].bank, DEC); |
|
|
|
Serial.print(F("/")); |
|
|
|
Serial.print(F("/")); |
|
|
|
Serial.print(configuration.dexed[instance_id].voice, DEC); |
|
|
|
Serial.print(configuration.dexed[instance_id].voice, DEC); |
|
|
|
Serial.println(F("]")); |
|
|
|
Serial.println(F("]")); |
|
|
|
|
|
|
|
Serial.print(F("Polyphony: ")); |
|
|
|
|
|
|
|
Serial.println(configuration.dexed[instance_id].polyphony, DEC); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
show_patch(instance_id); |
|
|
|
show_patch(instance_id); |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Serial.print(F("AUDIO_BLOCK_SAMPLES=")); |
|
|
|
Serial.print(F("AUDIO_BLOCK_SAMPLES=")); |
|
|
|
Serial.print(AUDIO_BLOCK_SAMPLES); |
|
|
|
Serial.print(AUDIO_BLOCK_SAMPLES); |
|
|
@ -604,16 +600,19 @@ void loop() |
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
active_voices[instance_id] = MicroDexed[instance_id]->getNumNotesPlaying(); |
|
|
|
active_voices[instance_id] = MicroDexed[instance_id]->getNumNotesPlaying(); |
|
|
|
#ifdef CPU_OVERLOAD_THROTTLE |
|
|
|
#if defined(CPU_OVERLOAD_THROTTLE) |
|
|
|
if (AudioProcessorUsageMax() > 99.9) |
|
|
|
if (AudioProcessorUsageMax() > CPU_OVERLOAD_THROTTLE && cpu_overload_throttle_timer >= CPU_OVERLOAD_THROTTLE_TIMER) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
cpu_overload_throttle_timer = 0; |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
MicroDexed[instance_id]->keyup(-1); // kills the oldest note and decreases max_notes
|
|
|
|
MicroDexed[instance_id]->keyup(-1); // kills the oldest note and decreases max_notes
|
|
|
|
Serial.print(F("!!!CPU overload!!! Automatic throttling max_notes to ")); |
|
|
|
Serial.print(F("!!!CPU overload!!! Automatic throttling polyphony down to ")); |
|
|
|
Serial.print(MicroDexed[instance_id]->getMaxNotes(), DEC); |
|
|
|
Serial.print(MicroDexed[instance_id]->getMaxNotes(), DEC); |
|
|
|
Serial.print(F(" for instance ")); |
|
|
|
Serial.print(F(" for instance ")); |
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
Serial.println(F(".")); |
|
|
|
Serial.println(F(".")); |
|
|
|
|
|
|
|
configuration.dexed[instance_id].polyphony = MicroDexed[instance_id]->getMaxNotes(); |
|
|
|
|
|
|
|
eeprom_update(); // useful to do this???
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -1258,21 +1257,19 @@ void initial_values_from_eeprom(bool init) |
|
|
|
init_configuration(); |
|
|
|
init_configuration(); |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Serial.println(F("Loading inital data from EEPROM.")); |
|
|
|
|
|
|
|
|
|
|
|
EEPROM.get(EEPROM_START_ADDRESS, tmp_conf); |
|
|
|
EEPROM.get(EEPROM_START_ADDRESS, tmp_conf); |
|
|
|
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); |
|
|
|
checksum = crc32((byte*)&tmp_conf + 4, sizeof(tmp_conf) - 4); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("EEPROM checksum: 0x")); |
|
|
|
Serial.print(F("EEPROM checksum: 0x")); |
|
|
|
Serial.print(tmp_conf.checksum, HEX); |
|
|
|
Serial.print(tmp_conf.checksum, HEX); |
|
|
|
Serial.print(F(" / 0x")); |
|
|
|
Serial.print(F(" / 0x")); |
|
|
|
Serial.println(checksum, HEX); |
|
|
|
Serial.println(checksum, HEX); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (checksum != tmp_conf.checksum) |
|
|
|
if (checksum != tmp_conf.checksum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Checksum mismatch -> initializing EEPROM!")); |
|
|
|
Serial.println(F("Checksum mismatch -> initializing EEPROM!")); |
|
|
|
#endif |
|
|
|
|
|
|
|
init_configuration(); |
|
|
|
init_configuration(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|