diff --git a/MicroDexed.ino b/MicroDexed.ino index f924509..08ef37b 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -55,7 +55,7 @@ using namespace TeensyTimerTool; #ifdef SGTL5000_AUDIO_ENHANCE #include "control_sgtl5000plus.h" #endif -#if NUM_EPIANO_VOICES > 0 +#if defined (USE_EPIANO) #include "synth_mda_epiano.h" #endif @@ -109,7 +109,7 @@ AudioEffectFreeverbStereoFloat freeverb; #endif #endif -#if defined(USE_EPIANO) +#if defined(USE_FX) && defined(USE_EPIANO) AudioMixer<5> master_mixer_r; AudioMixer<5> master_mixer_l; #else @@ -122,8 +122,8 @@ AudioEffectStereoMono stereo2mono; AudioAnalyzePeak master_peak_r; AudioAnalyzePeak master_peak_l; #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) -AudioMixer<4> audio_thru_mixer_r; -AudioMixer<4> audio_thru_mixer_l; +AudioMixer<2> audio_thru_mixer_r; +AudioMixer<2> audio_thru_mixer_l; #endif // Drumset @@ -181,13 +181,13 @@ AudioConnection patchCord[] = { #ifdef USE_PLATEREVERB {reverb_mixer_r, 0, reverb, 0}, {reverb_mixer_l, 0, reverb, 1}, - {reverb, 0, master_mixer_r, CH_REVERB}, - {reverb, 1, master_mixer_l, CH_REVERB}, + {reverb, 0, master_mixer_r, MASTER_MIX_CH_REVERB}, + {reverb, 1, master_mixer_l, MASTER_MIX_CH_REVERB}, #else {reverb_mixer_r, 0, freeverb, 0}, {reverb_mixer_l, 0, freeverb, 1}, - {freeverb, 0, master_mixer_r, CH_REVERB}, - {freeverb, 1, master_mixer_l, CH_REVERB}, + {freeverb, 0, master_mixer_r, MASTER_MIX_CH_REVERB}, + {freeverb, 1, master_mixer_l, MASTER_MIX_CH_REVERB}, #endif #endif {master_mixer_r, volume_r}, @@ -236,13 +236,13 @@ AudioConnection patchCord[] = { #if NUM_DRUMS > 0 #ifdef USE_FX - {drum_reverb_send_mixer_r, 0, reverb_mixer_r, 2}, - {drum_reverb_send_mixer_l, 0, reverb_mixer_l, 2}, - {drum_mixer_r, 0, master_mixer_r, CH_DRUMS}, - {drum_mixer_l, 0, master_mixer_l, CH_DRUMS}, + {drum_reverb_send_mixer_r, 0, reverb_mixer_r, REVERB_MIX_CH_DRUMS}, + {drum_reverb_send_mixer_l, 0, reverb_mixer_l, REVERB_MIX_CH_DRUMS}, + {drum_mixer_r, 0, master_mixer_r, MASTER_MIX_CH_DRUMS}, + {drum_mixer_l, 0, master_mixer_l, MASTER_MIX_CH_DRUMS}, #else - {drum_mixer_r, 0, master_mixer_r, CH_DRUMS}, - {drum_mixer_l, 0, master_mixer_l, CH_DRUMS}, + {drum_mixer_r, 0, master_mixer_r, MASTER_MIX_CH_DRUMS}, + {drum_mixer_l, 0, master_mixer_l, MASTER_MIX_CH_DRUMS}, #endif #endif @@ -263,11 +263,13 @@ AudioConnection patchCord[] = { {ep_chorus_inverter, 0, ep_modchorus_l, 1}, {ep_modchorus_r, 0, ep_chorus_mixer_r, 1}, {ep_modchorus_l, 0, ep_chorus_mixer_l, 1}, - {ep_chorus_mixer_r, 0, reverb_mixer_r, 3}, - {ep_chorus_mixer_l, 0, reverb_mixer_l, 3}, + {ep_chorus_mixer_r, 0, reverb_mixer_r, REVERB_MIX_CH_EPIANO}, + {ep_chorus_mixer_l, 0, reverb_mixer_l, REVERB_MIX_CH_EPIANO}, + {ep, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, + {ep, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, #else - {ep, 0, master_mixer_r, CH_EPIANO}, - {ep, 1, master_mixer_l, CH_EPIANO}, + {ep, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, + {ep, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, #endif #endif }; @@ -715,24 +717,24 @@ void setup() master_mixer_l.gain(instance_id, VOL_MAX_FLOAT); } #else - master_mixer_r.gain(CH_DEXED1, VOL_MAX_FLOAT); - master_mixer_l.gain(CH_DEXED1, VOL_MAX_FLOAT); - master_mixer_r.gain(CH_DEXED2, 0.0); - master_mixer_l.gain(CH_DEXED2, 0.0); + master_mixer_r.gain(MASTER_MIX_CH_DEXED1, VOL_MAX_FLOAT); + master_mixer_l.gain(MASTER_MIX_CH_DEXED1, VOL_MAX_FLOAT); + master_mixer_r.gain(MASTER_MIX_CH_DEXED2, 0.0); + master_mixer_l.gain(MASTER_MIX_CH_DEXED2, 0.0); #endif - master_mixer_r.gain(CH_REVERB, VOL_MAX_FLOAT); - master_mixer_l.gain(CH_REVERB, VOL_MAX_FLOAT); + master_mixer_r.gain(MASTER_MIX_CH_REVERB, VOL_MAX_FLOAT); + master_mixer_l.gain(MASTER_MIX_CH_REVERB, VOL_MAX_FLOAT); #if NUM_DRUMS > 0 - master_mixer_r.gain(CH_DRUMS, VOL_MAX_FLOAT); - master_mixer_l.gain(CH_DRUMS, VOL_MAX_FLOAT); + master_mixer_r.gain(MASTER_MIX_CH_DRUMS, VOL_MAX_FLOAT); + master_mixer_l.gain(MASTER_MIX_CH_DRUMS, VOL_MAX_FLOAT); seq.drums_volume = VOL_MAX_FLOAT; #else - master_mixer_r.gain(CH_DRUMS, 0.0); - master_mixer_l.gain(CH_DRUMS, 0.0); + master_mixer_r.gain(MASTER_MIX_CH_DRUMS, 0.0); + master_mixer_l.gain(MASTER_MIX_CH_DRUMS, 0.0); #endif #if defined(USE_EPIANO) - master_mixer_r.gain(CH_EPIANO, VOL_MAX_FLOAT); - master_mixer_l.gain(CH_EPIANO, VOL_MAX_FLOAT); + master_mixer_r.gain(MASTER_MIX_CH_EPIANO, VOL_MAX_FLOAT); + master_mixer_l.gain(MASTER_MIX_CH_EPIANO, VOL_MAX_FLOAT); #endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) @@ -761,8 +763,8 @@ void setup() void loop() { - master_mixer_r.gain(CH_EPIANO, VOL_MAX_FLOAT); - master_mixer_l.gain(CH_EPIANO, VOL_MAX_FLOAT); + master_mixer_r.gain(MASTER_MIX_CH_EPIANO, VOL_MAX_FLOAT); + master_mixer_l.gain(MASTER_MIX_CH_EPIANO, VOL_MAX_FLOAT); // MIDI input handling check_midi_devices(); @@ -2015,8 +2017,8 @@ void init_MIDI_send_CC(void) void set_drums_volume(float vol) { - master_mixer_r.gain(CH_DRUMS, vol); - master_mixer_l.gain(CH_DRUMS, vol); + master_mixer_r.gain(MASTER_MIX_CH_DRUMS, vol); + master_mixer_l.gain(MASTER_MIX_CH_DRUMS, vol); } void set_volume(uint8_t v, uint8_t m) { @@ -2564,8 +2566,8 @@ void set_fx_params(void) ep_chorus_inverter.gain(-1.0); #endif - master_mixer_r.gain(CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); - master_mixer_l.gain(CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); + master_mixer_r.gain(MASTER_MIX_CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); + master_mixer_l.gain(MASTER_MIX_CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); #endif #ifdef SGTL5000_AUDIO_ENHANCE diff --git a/UI.hpp b/UI.hpp index 2022651..36d6697 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1305,10 +1305,10 @@ void UI_func_reverb_level(uint8_t param) lcd_display_bar_int("Reverb Level", configuration.fx.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, true); - //master_mixer_r.gain(CH_REVERB, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); - //master_mixer_l.gain(CH_REVERB, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); - master_mixer_r.gain(CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); - master_mixer_l.gain(CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); + //master_mixer_r.gain(MASTER_MIX_CH_REVERB, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); + //master_mixer_l.gain(MASTER_MIX_CH_REVERB, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); + master_mixer_r.gain(MASTER_MIX_CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); + master_mixer_l.gain(MASTER_MIX_CH_REVERB, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT))); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -3672,8 +3672,8 @@ void UI_func_drums_main_volume(uint8_t param) lcd.print(displayname); lcd.setCursor(8, 1); lcd.print("/100"); - master_mixer_r.gain (CH_DRUMS, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); - master_mixer_l.gain (CH_DRUMS, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); + master_mixer_r.gain (MASTER_MIX_CH_DRUMS, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); + master_mixer_l.gain (MASTER_MIX_CH_DRUMS, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); seq.drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT); } if (LCDML.FUNC_close()) // ****** STABLE END ********* diff --git a/config.h b/config.h index db94fd3..27c0481 100644 --- a/config.h +++ b/config.h @@ -906,13 +906,19 @@ typedef struct configuration_s { enum master_mixer_ports { - CH_DEXED2, - CH_DEXED1, - CH_REVERB, - CH_DRUMS, - CH_EPIANO + MASTER_MIX_CH_DEXED2, + MASTER_MIX_CH_DEXED1, + MASTER_MIX_CH_REVERB, + MASTER_MIX_CH_DRUMS, + MASTER_MIX_CH_EPIANO }; +enum reverb_mixer_ports { + REVERB_MIX_CH_DEXED2, + REVERB_MIX_CH_DEXED1, + REVERB_MIX_CH_DRUMS, + REVERB_MIX_CH_EPIANO +}; #if !defined(_MAPFLOAT) #define _MAPFLOAT inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)