From 0249043ff269e37f804e608427d56b7cbf70998e Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 7 May 2020 09:59:50 +0200 Subject: [PATCH] Fixes for new fx-chain. --- MicroDexed.ino | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 82b1cf7..56006b5 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -127,9 +127,9 @@ AudioConnection patchCord13(stereo2mono, 1, dacOut, 1); // uint8_t nDynamic = 0; #if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT -AudioConnection * dynamicConnections[NUM_DEXED * 19]; -#elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT AudioConnection * dynamicConnections[NUM_DEXED * 17]; +#elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT +AudioConnection * dynamicConnections[NUM_DEXED * 16]; #else AudioConnection * dynamicConnections[NUM_DEXED * 5]; #endif @@ -171,8 +171,10 @@ void create_audio_engine_chain(uint8_t instance_id) dynamicConnections[nDynamic++] = new AudioConnection(*delay_mixer[instance_id], 0, *delay_fb_mixer[instance_id], 1); dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, reverb_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, reverb_mixer_l, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, master_mixer_r, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, master_mixer_l, instance_id); #else - dynamicConnections[nDynamic++] = new AudioConnection(*dexed_level[instance_id], 0, mono2stereo[instance_id], 0); + dynamicConnections[nDynamic++] = new AudioConnection(*dexed_level[instance_id], 0, *mono2stereo[instance_id], 0); dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 0, master_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(*mono2stereo[instance_id], 1, master_mixer_l, instance_id); #endif @@ -397,9 +399,6 @@ void setup() #endif #endif - master_mixer_r.gain(0, 1.0); - master_mixer_l.gain(0, 1.0); - set_fx_params(); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -412,7 +411,12 @@ void setup() // INIT DEXED VOICE CONFIG set_voiceconfig_params(instance_id); + + master_mixer_r.gain(instance_id, 1.0); + master_mixer_l.gain(instance_id, 1.0); } + master_mixer_r.gain(3, 1.0); + master_mixer_l.gain(3, 1.0); set_sys_params(); @@ -703,7 +707,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) } case 106: // CC 106: delay feedback configuration.fx.delay_feedback[instance_id] = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); - delay_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback + delay_fb_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback)) { LCDML.OTHER_updateFunc(); @@ -1351,9 +1355,11 @@ void initial_values_from_eeprom(bool init) #if defined(USE_FX) chorus_mixer[instance_id]->gain(0, 1.0); - chorus_mixer[instance_id]->gain(1, configuration.fx.chorus_level[instance_id] / 100.0); + chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); delay_mixer[instance_id]->gain(0, 1.0); - delay_mixer[instance_id]->gain(0, configuration.fx.delay_level[instance_id] / 100.0); + delay_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); + delay_fb_mixer[instance_id]->gain(0, 1.0); + delay_fb_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0; MicroDexed[instance_id]->fx.Gain = 1.0; @@ -1646,6 +1652,8 @@ void set_fx_params(void) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { // CHORUS + chorus_mixer[instance_id]->gain(0, 1.0); + chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); switch (configuration.fx.chorus_waveform[instance_id]) { case 0: @@ -1673,9 +1681,9 @@ void set_fx_params(void) #endif // DELAY - delay_fx[instance_id]->delay(0, mapfloat(configuration.fx.delay_time[instance_id] * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); delay_mixer[instance_id]->gain(0, 1.0); delay_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); + delay_fx[instance_id]->delay(0, mapfloat(configuration.fx.delay_time[instance_id] * 10, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); delay_fb_mixer[instance_id]->gain(0, 1.0); delay_fb_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0));