|
|
|
@ -56,6 +56,7 @@ AudioAmplifier volume_l; |
|
|
|
|
AudioEffectStereoMono stereo2mono; |
|
|
|
|
AudioAnalyzePeak master_peak_r; |
|
|
|
|
AudioAnalyzePeak master_peak_l; |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
AudioMixer4 delay_send_mixer_r; |
|
|
|
|
AudioMixer4 delay_send_mixer_l; |
|
|
|
|
AudioMixer4 delay_fb_mixer_r; |
|
|
|
@ -70,13 +71,13 @@ AudioEffectModulatedDelay modchorus_l; |
|
|
|
|
AudioFilterBiquad modchorus_filter_r; |
|
|
|
|
AudioFilterBiquad modchorus_filter_l; |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioMixer4 reverb_send_mixer_r; |
|
|
|
|
AudioMixer4 reverb_send_mixer_l; |
|
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// FX chain left
|
|
|
|
|
AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0); |
|
|
|
|
AudioConnection patchCord2(delay_fb_mixer_l, delay_l); |
|
|
|
@ -89,9 +90,7 @@ AudioConnection patchCord7(modchorus_filter_l, modchorus_inverter); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord6(modchorus_l, modchorus_inverter); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioConnection patchCord8(reverb_send_mixer_l, freeverb_l); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// FX chain right
|
|
|
|
|
AudioConnection patchCord9(delay_send_mixer_r, 0, delay_fb_mixer_r, 0); |
|
|
|
@ -102,10 +101,10 @@ AudioConnection patchCord13(chorus_modulator, 0, modchorus_r, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection patchCord14(modchorus_r, modchorus_filter_r); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioConnection patchCord15(reverb_send_mixer_r, freeverb_r); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// FX chain tail
|
|
|
|
|
AudioConnection patchCord16(delay_fb_mixer_r, 0, master_mixer_r, DELAY); |
|
|
|
|
AudioConnection patchCord17(delay_fb_mixer_l, 0, master_mixer_l, DELAY); |
|
|
|
@ -116,7 +115,6 @@ AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHO |
|
|
|
|
AudioConnection patchCord18(modchorus_r, 0, master_mixer_r, CHORUS); |
|
|
|
|
AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHORUS); |
|
|
|
|
#endif |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
AudioConnection patchCord20(freeverb_r, 0, master_mixer_r, REVERB); |
|
|
|
|
AudioConnection patchCord21(freeverb_l, 0, master_mixer_l, REVERB); |
|
|
|
|
#endif |
|
|
|
@ -170,10 +168,10 @@ AudioConnection patchCord34(stereo2mono, 1, dacOut, 1); |
|
|
|
|
// Dynamic patching of MicroDexed objects
|
|
|
|
|
//
|
|
|
|
|
uint8_t nDynamic = 0; |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 10]; |
|
|
|
|
#else |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 8]; |
|
|
|
|
AudioConnection * dynamicConnections[NUM_DEXED * 4]; |
|
|
|
|
#endif |
|
|
|
|
void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStereo &mono2stereo, uint8_t instance_id) |
|
|
|
|
{ |
|
|
|
@ -181,11 +179,11 @@ void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStere |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id); |
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
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, 0, delay_send_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, delay_send_mixer_l, instance_id); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id); |
|
|
|
|
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, reverb_send_mixer_l, instance_id); |
|
|
|
|
#endif |
|
|
|
@ -218,15 +216,12 @@ uint32_t peak_l = 0; |
|
|
|
|
bool eeprom_update_flag = false; |
|
|
|
|
config_t configuration; |
|
|
|
|
uint8_t selected_dexed_instance = 0; |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
float master_mixer_level[4] = {1.0, 0.0, 0.0, 0.0}; |
|
|
|
|
#else |
|
|
|
|
float master_mixer_level[3] = {1.0, 0.0, 0.0}; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// Allocate the delay lines for chorus
|
|
|
|
|
int16_t delayline_r[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
int16_t delayline_l[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
|
/***********************************************************************
|
|
|
|
@ -416,6 +411,8 @@ void setup() |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(true); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// Init effects
|
|
|
|
|
memset(delayline_r, 0, sizeof(delayline_r)); |
|
|
|
|
if (!modchorus_r.begin(delayline_r, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
@ -431,6 +428,7 @@ void setup() |
|
|
|
|
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER=")); |
|
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
|
|
Serial.println(F(" samples")); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
master_mixer_r.gain(DEXED, 1.0); |
|
|
|
@ -439,10 +437,8 @@ void setup() |
|
|
|
|
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
@ -453,11 +449,9 @@ void setup() |
|
|
|
|
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, 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, 1.0)); |
|
|
|
@ -477,6 +471,7 @@ void setup() |
|
|
|
|
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// DELAY
|
|
|
|
|
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))); |
|
|
|
@ -518,7 +513,6 @@ void setup() |
|
|
|
|
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
// REVERB
|
|
|
|
|
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)); |
|
|
|
@ -1300,10 +1294,8 @@ void initial_values_from_eeprom(bool init) |
|
|
|
|
delay_fb_mixer_r.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
delay_fb_mixer_l.gain(0, 1.0); // original signal
|
|
|
|
|
delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
reverb_send_mixer_r.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0); |
|
|
|
|
reverb_send_mixer_l.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); |
|
|
|
|
|
|
|
|
@ -1320,10 +1312,8 @@ void initial_values_from_eeprom(bool init) |
|
|
|
|
master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
set_volume(configuration.vol, configuration.mono); |
|
|
|
|
} |
|
|
|
@ -1387,10 +1377,8 @@ void check_configuration(void) |
|
|
|
|
master_mixer_l.gain(CHORUS, mapfloat(configuration.delay_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#if defined(USE_REVERB) |
|
|
|
|
master_mixer_r.gain(REVERB, mapfloat(configuration.delay_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
master_mixer_l.gain(REVERB, mapfloat(configuration.delay_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void init_configuration(void) |
|
|
|
|