|
|
|
@ -61,32 +61,34 @@ AudioConnection patchCord3(delay_l, 0, delay_fb_mixer_l, 1); // feedba |
|
|
|
|
AudioConnection patchCord4(delay_fb_mixer_l, 0, master_mixer_l, DELAY); |
|
|
|
|
AudioMixer4 chorus_send_mixer_l; |
|
|
|
|
AudioEffectModulatedDelay modchorus_l; |
|
|
|
|
AudioConnection patchCord5(chorus_modulator, 0, modchorus_l, 1); |
|
|
|
|
AudioConnection patchCord5(chorus_send_mixer_l, modchorus_l); |
|
|
|
|
AudioConnection patchCord6(chorus_modulator, 0, modchorus_l, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioFilterBiquad modchorus_filter_l; |
|
|
|
|
AudioConnection patchCord6(modchorus_l, modchorus_filter_l); |
|
|
|
|
AudioConnection patchCord7(modchorus_filter_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord8(modchorus_inverter_l, 0, master_mixer_l, CHORUS ); |
|
|
|
|
AudioConnection patchCord7(modchorus_l, modchorus_filter_l); |
|
|
|
|
AudioConnection patchCord8(modchorus_filter_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord9(modchorus_inverter_l, 0, master_mixer_l, CHORUS ); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord9(modchorus_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord10(modchorus_inverter, 0, master_mixer_l, CHORUS); |
|
|
|
|
AudioConnection patchCord7(modchorus_l, modchorus_inverter); |
|
|
|
|
AudioConnection patchCord8(modchorus_inverter, 0, master_mixer_l, CHORUS); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioMixer4 reverb_send_mixer_l; |
|
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
|
AudioConnection patchCord11(reverb_send_mixer_l, freeverb_l); |
|
|
|
|
AudioConnection patchCord12(freeverb_l, 0, master_mixer_r, REVERB); |
|
|
|
|
AudioConnection patchCord10(reverb_send_mixer_l, freeverb_l); |
|
|
|
|
AudioConnection patchCord11(freeverb_l, 0, master_mixer_r, REVERB); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// FX chain right
|
|
|
|
|
AudioMixer4 delay_send_mixer_r; |
|
|
|
|
AudioMixer4 delay_fb_mixer_r; |
|
|
|
|
AudioEffectDelay delay_r; |
|
|
|
|
AudioConnection patchCord13(delay_send_mixer_r, 0, delay_fb_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord14(delay_fb_mixer_r, delay_r); |
|
|
|
|
AudioConnection patchCord15(delay_r, 0, delay_fb_mixer_r, 1); // feedback-loop
|
|
|
|
|
AudioConnection patchCord16(delay_fb_mixer_r, 0, master_mixer_r, DELAY); |
|
|
|
|
AudioConnection patchCord12(delay_send_mixer_r, 0, delay_fb_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord13(delay_fb_mixer_r, delay_r); |
|
|
|
|
AudioConnection patchCord14(delay_r, 0, delay_fb_mixer_r, 1); // feedback-loop
|
|
|
|
|
AudioConnection patchCord15(delay_fb_mixer_r, 0, master_mixer_r, DELAY); |
|
|
|
|
AudioMixer4 chorus_send_mixer_r; |
|
|
|
|
AudioConnection patchCord16(chorus_send_mixer_r, modchorus_r); |
|
|
|
|
AudioEffectModulatedDelay modchorus_r; |
|
|
|
|
AudioConnection patchCord17(chorus_modulator, 0, modchorus_r, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
@ -94,13 +96,13 @@ AudioFilterBiquad modchorus_filter_r; |
|
|
|
|
AudioConnection patchCord18(modchorus_r, modchorus_filter_r); |
|
|
|
|
AudioConnection patchCord19(modchorus_filter_r, 0, master_mixer_r, CHORUS ); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord20(modchorus_r, 0, master_mixer_r, CHORUS); |
|
|
|
|
AudioConnection patchCord18(modchorus_r, 0, master_mixer_r, CHORUS); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioMixer4 reverb_send_mixer_r; |
|
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
|
AudioConnection patchCord21(reverb_send_mixer_r, freeverb_r); |
|
|
|
|
AudioConnection patchCord22(freeverb_r, 0, master_mixer_r, REVERB); |
|
|
|
|
AudioConnection patchCord20(reverb_send_mixer_r, freeverb_r); |
|
|
|
|
AudioConnection patchCord21(freeverb_r, 0, master_mixer_r, REVERB); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// FX chain tail
|
|
|
|
@ -113,50 +115,50 @@ AudioAmplifier volume_l; |
|
|
|
|
AudioEffectStereoMono stereo2mono; |
|
|
|
|
AudioAnalyzePeak master_peak_r; |
|
|
|
|
AudioAnalyzePeak master_peak_l; |
|
|
|
|
AudioConnection patchCord23(dexed_mixer_r, 0, master_mixer_r, DEXED); |
|
|
|
|
AudioConnection patchCord24(dexed_mixer_l, 0, master_mixer_l, DEXED); |
|
|
|
|
AudioConnection patchCord25(master_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord26(master_mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord27(volume_r, 0, stereo2mono, 0); |
|
|
|
|
AudioConnection patchCord28(volume_l, 0, stereo2mono, 1); |
|
|
|
|
AudioConnection patchCord29(volume_r, master_peak_r); |
|
|
|
|
AudioConnection patchCord30(volume_l, master_peak_l); |
|
|
|
|
AudioConnection patchCord31(microdexed_peak_mixer, microdexed_peak); |
|
|
|
|
AudioConnection patchCord22(dexed_mixer_r, 0, master_mixer_r, DEXED); |
|
|
|
|
AudioConnection patchCord23(dexed_mixer_l, 0, master_mixer_l, DEXED); |
|
|
|
|
AudioConnection patchCord24(master_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord25(master_mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord26(volume_r, 0, stereo2mono, 0); |
|
|
|
|
AudioConnection patchCord27(volume_l, 0, stereo2mono, 1); |
|
|
|
|
AudioConnection patchCord28(volume_r, master_peak_r); |
|
|
|
|
AudioConnection patchCord29(volume_l, master_peak_l); |
|
|
|
|
AudioConnection patchCord30(microdexed_peak_mixer, microdexed_peak); |
|
|
|
|
|
|
|
|
|
// Outputs
|
|
|
|
|
#ifdef AUDIO_DEVICE_USB |
|
|
|
|
AudioOutputUSB usb1; |
|
|
|
|
AudioConnection patchCord32(stereo2mono, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 1, usb1, 1); |
|
|
|
|
AudioConnection patchCord31(stereo2mono, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord32(stereo2mono, 1, usb1, 1); |
|
|
|
|
#endif |
|
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord35(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
|
#elif defined (I2S_AUDIO_ONLY) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord36(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord37(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, i2s1, 1); |
|
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord38(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord39(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, i2s1, 1); |
|
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
|
#elif defined(PT8211_AUDIO) |
|
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
|
AudioConnection patchCord40(stereo2mono, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord41(stereo2mono, 1, pt8211_1, 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, pt8211_1, 1); |
|
|
|
|
#elif defined(TEENSY_DAC_SYMMETRIC) |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioMixer4 invMixer; |
|
|
|
|
AudioConnection patchCord42(stereo2mono, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord43(stereo2mono, 1, invMixer, 0); |
|
|
|
|
AudioConnection patchCord44(invMixer, 0, dacOut , 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, invMixer, 0); |
|
|
|
|
AudioConnection patchCord35(invMixer, 0, dacOut , 1); |
|
|
|
|
#else |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioConnection patchCord45(stereo2mono, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord46(stereo2mono, 1, dacOut, 1); |
|
|
|
|
AudioConnection patchCord33(stereo2mono, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord34(stereo2mono, 1, dacOut, 1); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
@ -198,7 +200,7 @@ uint16_t midi_timing_quarter = 0; |
|
|
|
|
elapsedMillis long_button_pressed; |
|
|
|
|
//elapsedMicros fill_audio_buffer;
|
|
|
|
|
elapsedMillis control_rate; |
|
|
|
|
uint8_t active_voices = 0; |
|
|
|
|
uint8_t active_voices[NUM_DEXED]; |
|
|
|
|
#ifdef SHOW_CPU_LOAD_MSEC |
|
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
|
#endif |
|
|
|
@ -301,7 +303,8 @@ void setup() |
|
|
|
|
lcd.print(F("EEPROM")); |
|
|
|
|
initial_values_from_eeprom(true); |
|
|
|
|
} |
|
|
|
|
else*/ |
|
|
|
|
else |
|
|
|
|
initial_values_from_eeprom(false); */ |
|
|
|
|
initial_values_from_eeprom(false); |
|
|
|
|
|
|
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
@ -348,6 +351,9 @@ void setup() |
|
|
|
|
Serial.println(F("Internal DAC enabled.")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Load values from EEPROM
|
|
|
|
|
//initial_values_from_eeprom(false);
|
|
|
|
|
|
|
|
|
|
// start SD card
|
|
|
|
|
#ifndef TEENSY4 |
|
|
|
|
SPI.setMOSI(SDCARD_MOSI_PIN); |
|
|
|
@ -420,8 +426,7 @@ void setup() |
|
|
|
|
Serial.println(F(" samples")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
master_mixer_r.gain(DEXED, 1.0); |
|
|
|
|
master_mixer_l.gain(DEXED, 1.0); |
|
|
|
|
set_master_mixer_gain(DEXED, 1.0); |
|
|
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
@ -429,22 +434,22 @@ void setup() |
|
|
|
|
microdexed_peak_mixer.gain(instance_id, 1.0); |
|
|
|
|
|
|
|
|
|
// INIT DEXED MIXER
|
|
|
|
|
dexed_mixer_r.gain(instance_id, 0.5); |
|
|
|
|
dexed_mixer_l.gain(instance_id, 0.5); |
|
|
|
|
dexed_mixer_r.gain(instance_id, 1.0); |
|
|
|
|
dexed_mixer_l.gain(instance_id, 1.0); |
|
|
|
|
|
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
// INIT REVERB
|
|
|
|
|
reverb_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
reverb_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
reverb_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
reverb_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// INIT DELAY
|
|
|
|
|
delay_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
delay_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
delay_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
delay_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
|
|
|
|
|
// INIT CHORUS
|
|
|
|
|
chorus_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 0.5)); |
|
|
|
|
chorus_send_mixer_r.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
chorus_send_mixer_l.gain(instance_id, mapfloat(configuration.dexed[instance_id].chorus_send, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 0.0, 1.0)); |
|
|
|
|
|
|
|
|
|
// DEXED FILTER
|
|
|
|
|
MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); |
|
|
|
@ -456,17 +461,8 @@ void setup() |
|
|
|
|
pan[instance_id]->amplitude(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// REVERB
|
|
|
|
|
master_mixer_r.gain(REVERB, 0.0); |
|
|
|
|
master_mixer_l.gain(REVERB, 0.0); |
|
|
|
|
freeverb_r.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_r.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_l.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_l.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); |
|
|
|
|
|
|
|
|
|
// DELAY
|
|
|
|
|
master_mixer_r.gain(DELAY, 0.0); |
|
|
|
|
master_mixer_l.gain(DELAY, 0.0); |
|
|
|
|
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0); |
|
|
|
|
delay_r.delay(0, mapfloat(configuration.delay_time * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); |
|
|
|
|
delay_l.delay(0, mapfloat(configuration.delay_time * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); |
|
|
|
|
// delay_fb_mixer is the feedback-adding mixer
|
|
|
|
@ -474,8 +470,7 @@ void setup() |
|
|
|
|
delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
|
|
|
|
|
// CHORUS
|
|
|
|
|
master_mixer_r.gain(CHORUS, 0.0); |
|
|
|
|
master_mixer_l.gain(CHORUS, 0.0); |
|
|
|
|
set_master_mixer_gain(CHORUS, configuration.chorus_level / 100.0); |
|
|
|
|
switch (configuration.chorus_waveform) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
@ -507,6 +502,15 @@ void setup() |
|
|
|
|
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
// REVERB
|
|
|
|
|
set_master_mixer_gain(REVERB, configuration.reverb_level / 100.0); |
|
|
|
|
freeverb_r.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_r.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_l.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); |
|
|
|
|
freeverb_l.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// MONO/STEREO
|
|
|
|
|
if (configuration.mono == 0) |
|
|
|
|
modchorus_inverter.gain(-1.0); // stereo mode
|
|
|
|
@ -522,17 +526,17 @@ void setup() |
|
|
|
|
AudioMemoryUsageMaxReset(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Bank/Voice from EEPROM [")); |
|
|
|
|
Serial.print(configuration.dexed[instance_id].bank, DEC); |
|
|
|
|
Serial.print(F("/")); |
|
|
|
|
Serial.print(configuration.dexed[instance_id].voice, DEC); |
|
|
|
|
Serial.println(F("]")); |
|
|
|
|
show_patch(instance_id); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
Serial.print(F("AUDIO_BLOCK_SAMPLES=")); |
|
|
|
|
Serial.print(AUDIO_BLOCK_SAMPLES); |
|
|
|
@ -605,7 +609,6 @@ void loop() |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// EEPROM update handling
|
|
|
|
|
//if (autostore >= AUTOSTORE_MS && active_voices == 0 && eeprom_update_flag == true)
|
|
|
|
|
if (autostore >= AUTOSTORE_MS && eeprom_update_flag == true) |
|
|
|
|
{ |
|
|
|
|
// only store configuration data to EEPROM when AUTOSTORE_MS is reached and no voices are activated anymore
|
|
|
|
@ -615,7 +618,7 @@ void loop() |
|
|
|
|
// check for value changes and unused voices
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
active_voices = MicroDexed[instance_id]->getNumNotesPlaying(); |
|
|
|
|
active_voices[instance_id] = MicroDexed[instance_id]->getNumNotesPlaying(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -784,8 +787,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
|
break; |
|
|
|
|
case 107: // CC 107: delay volume
|
|
|
|
|
configuration.dexed[instance_id].delay_send = map(inValue, 0, 0x7f, DELAY_SEND_MIN, DELAY_SEND_MAX); |
|
|
|
|
master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_send / 200.0); |
|
|
|
|
master_mixer_l.gain(DELAY, configuration.dexed[instance_id].delay_send / 200.0); |
|
|
|
|
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0); |
|
|
|
|
eeprom_write(); |
|
|
|
|
break; |
|
|
|
|
case 120: |
|
|
|
@ -1204,8 +1206,8 @@ void set_volume(uint8_t v, uint8_t m) |
|
|
|
|
Serial.println(v, DEC); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
volume_r.gain(v); |
|
|
|
|
volume_l.gain(v); |
|
|
|
|
volume_r.gain(v / 100.0); |
|
|
|
|
volume_l.gain(v / 100.0); |
|
|
|
|
|
|
|
|
|
switch (m) |
|
|
|
|
{ |
|
|
|
@ -1244,12 +1246,6 @@ void set_volume(uint8_t v, uint8_t m) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// https://www.dr-lex.be/info-stuff/volumecontrols.html#table1
|
|
|
|
|
inline float logvol(float x) |
|
|
|
|
{ |
|
|
|
|
return (0.001 * expf(6.908 * x)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
EEPROM HELPER |
|
|
|
|
******************************************************************************/ |
|
|
|
@ -1283,6 +1279,7 @@ void initial_values_from_eeprom(bool init) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
EEPROM.get(EEPROM_START_ADDRESS, configuration); |
|
|
|
|
check_configuration(); |
|
|
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
@ -1293,19 +1290,37 @@ void initial_values_from_eeprom(bool init) |
|
|
|
|
MicroDexed[instance_id]->setATController(configuration.dexed[instance_id].at_range, configuration.dexed[instance_id].at_assign); |
|
|
|
|
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); |
|
|
|
|
MicroDexed[instance_id]->doRefreshVoice(); |
|
|
|
|
|
|
|
|
|
chorus_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].chorus_send / 200.0); |
|
|
|
|
chorus_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].chorus_send / 200.0); |
|
|
|
|
delay_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].delay_send / 200.0); |
|
|
|
|
delay_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].delay_send / 200.0); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
reverb_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].reverb_send / 200.0); |
|
|
|
|
reverb_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].reverb_send / 200.0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); |
|
|
|
|
|
|
|
|
|
MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0; |
|
|
|
|
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); |
|
|
|
|
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Serial.println(F("OK, loaded!")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
check_configuration(); |
|
|
|
|
set_master_mixer_gain(CHORUS, configuration.chorus_level / 100.0); |
|
|
|
|
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
set_master_mixer_gain(REVERB, configuration.reverb_level / 100.0); |
|
|
|
|
#endif |
|
|
|
|
set_master_mixer_gain(DEXED, 1.0); |
|
|
|
|
|
|
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
show_configuration(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (configuration.vol > 100) |
|
|
|
|
configuration.vol = 100; // just to be sure ;-)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void check_configuration(void) |
|
|
|
@ -1322,7 +1337,7 @@ void check_configuration(void) |
|
|
|
|
configuration.chorus_waveform = constrain(configuration.chorus_waveform, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX); |
|
|
|
|
configuration.chorus_depth = constrain(configuration.chorus_depth, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX); |
|
|
|
|
configuration.chorus_level = constrain(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); |
|
|
|
|
configuration.delay_time = constrain(configuration.delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX); |
|
|
|
|
configuration.delay_time = constrain(configuration.delay_time, DELAY_TIME_MIN / 10, DELAY_TIME_MAX / 10); |
|
|
|
|
configuration.delay_feedback = constrain(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); |
|
|
|
|
configuration.delay_level = constrain(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
@ -1357,12 +1372,6 @@ void check_configuration(void) |
|
|
|
|
configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); |
|
|
|
|
configuration.dexed[instance_id].op_enabled = constrain(configuration.dexed[instance_id].op_enabled, OP_ENABLED_MIN, OP_ENABLED_MAX); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set_master_mixer_gain(CHORUS, configuration.chorus_level / 100.0); |
|
|
|
|
set_master_mixer_gain(DELAY, configuration.delay_level / 100.0); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
set_master_mixer_gain(REVERB, configuration.reverb_level / 100.0); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void init_configuration(void) |
|
|
|
@ -1384,7 +1393,7 @@ void init_configuration(void) |
|
|
|
|
configuration.chorus_waveform = CHORUS_WAVEFORM_DEFAULT; |
|
|
|
|
configuration.chorus_depth = CHORUS_DEPTH_DEFAULT; |
|
|
|
|
configuration.chorus_level = CHORUS_LEVEL_DEFAULT; |
|
|
|
|
configuration.delay_time = DELAY_TIME_DEFAULT; |
|
|
|
|
configuration.delay_time = DELAY_TIME_DEFAULT / 10; |
|
|
|
|
configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT; |
|
|
|
|
configuration.delay_level = DELAY_LEVEL_DEFAULT; |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
@ -1493,7 +1502,11 @@ void set_master_mixer_gain(uint8_t type, float level) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Volumes for master_mixer: DEXED=")); |
|
|
|
|
Serial.print(F("Volumes for master_mixer(type=")); |
|
|
|
|
Serial.print(type, DEC); |
|
|
|
|
Serial.print(F(",level=")); |
|
|
|
|
Serial.print(level, 2); |
|
|
|
|
Serial.print(F("): DEXED=")); |
|
|
|
|
Serial.print(new_level[DEXED], 2); |
|
|
|
|
Serial.print(F(" CHORUS=")); |
|
|
|
|
Serial.print(new_level[CHORUS], 2); |
|
|
|
@ -1551,7 +1564,14 @@ void show_cpu_and_mem_usage(void) |
|
|
|
|
Serial.print(F("|BLOCKSIZE:")); |
|
|
|
|
Serial.print(AUDIO_BLOCK_SAMPLES, DEC); |
|
|
|
|
Serial.print(F("|ACTVOICES:")); |
|
|
|
|
Serial.print(active_voices, DEC); |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
Serial.print(instance_id, DEC); |
|
|
|
|
Serial.print(F("=")); |
|
|
|
|
Serial.print(active_voices[instance_id], DEC); |
|
|
|
|
if (instance_id != NUM_DEXED - 1) |
|
|
|
|
Serial.print(F(",")); |
|
|
|
|
} |
|
|
|
|
Serial.println(); |
|
|
|
|
Serial.flush(); |
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
|