diff --git a/MicroDexed.ino b/MicroDexed.ino index 44a5b5d..7e3f236 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -41,99 +41,105 @@ #include "source_microdexed.h" // Audio engines -AudioAnalyzePeak peak1; -AudioSourceMicroDexed* MicroDexed[NUM_DEXED]; -AudioEffectDelay delay1; -AudioEffectModulatedDelay modchorus; -AudioSynthWaveform modulator; -AudioMixer4 delay_fb_mixer; -AudioMixer4 master_mixer_r; -AudioMixer4 master_mixer_l; -AudioAmplifier volume_r; -AudioAmplifier volume_l; -AudioAmplifier modchorus_inverter; +AudioAnalyzePeak peak1; +AudioSourceMicroDexed* MicroDexed[NUM_DEXED]; +AudioEffectDelay delay1; +AudioEffectModulatedDelay modchorus; +AudioSynthWaveform modulator; +AudioMixer4 chorus_mixer; +AudioMixer4 delay_mixer; +AudioMixer4 delay_fb_mixer; +AudioMixer4 master_mixer_r; +AudioMixer4 master_mixer_l; +AudioAmplifier volume_r; +AudioAmplifier volume_l; +AudioAmplifier modchorus_inverter; #if defined(AUDIO_DEVICE_USB) -AudioOutputUSB usb1; +AudioOutputUSB usb1; #endif -AudioEffectStereoMono stereomono1; +AudioEffectStereoMono stereomono1; + +uint8_t nDynamic = 0; +#ifdef USE_REVERB +AudioConnection * dynamicConnections[NUM_DEXED * 7]; +#else +AudioConnection * dynamicConnections[NUM_DEXED * 6]; +#endif +void create_audio_connections(AudioSourceMicroDexed &d, uint8_t instance_id) +{ + dynamicConnections[nDynamic++] = new AudioConnection(d, peak1); +#if defined(USE_REVERB) + dynamicConnections[nDynamic++] = new AudioConnection(d, 0, reverb_mixer, instance_id); +#endif + dynamicConnections[nDynamic++] = new AudioConnection(d, 0, delay_mixer, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(d, 0, chorus_mixer, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_r, 0); + dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_l, 0); +} // Audio connections AudioConnection patchCord1(modulator, 0, modchorus, 1); +AudioConnection patchCord2(chorus_mixer, 0, modchorus, 0); +AudioConnection patchCord3(delay_mixer, 0, delay_fb_mixer, 0); +AudioConnection patchCord4(delay_fb_mixer, delay1); +AudioConnection patchCord5(delay1, 0, delay_fb_mixer, 1); +AudioConnection patchCord6(delay_mixer, 0, master_mixer_r, 2); +AudioConnection patchCord7(delay_mixer, 0, master_mixer_l, 2); +AudioConnection patchCord8(master_mixer_r, volume_r); +AudioConnection patchCord9(master_mixer_l, volume_l); +AudioConnection patchCord10(volume_r, 0, stereomono1, 0); +AudioConnection patchCord11(volume_l, 0, stereomono1, 1); #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT AudioFilterBiquad modchorus_filter; -AudioConnection patchCord2(modchorus, modchorus_filter); -AudioConnection patchCord3(modchorus_filter, 0, master_mixer_r, 3); -AudioConnection patchCord4(modchorus_filter, modchorus_inverter); -AudioConnection patchCord5(modchorus_inverter, 0, master_mixer_l, 3); +AudioConnection patchCord12(modchorus, modchorus_filter); +AudioConnection patchCord13(modchorus_filter, 0, master_mixer_r, 3); +AudioConnection patchCord14(modchorus_filter, modchorus_inverter); +AudioConnection patchCord15(modchorus_inverter, 0, master_mixer_l, 3); #else -AudioConnection patchCord6(modchorus, 0, master_mixer_r, 3); -AudioConnection patchCord7(modchorus, modchorus_inverter); -AudioConnection patchCord8(modchorus_inverter, 0, master_mixer_l, 3); +AudioConnection patchCord16(modchorus, 0, master_mixer_r, 3); +AudioConnection patchCord17(modchorus, modchorus_inverter); +AudioConnection patchCord18(modchorus_inverter, 0, master_mixer_l, 3); #endif #if defined(USE_REVERB) +AudioMixer4 reverb_mixer; AudioEffectFreeverbStereo freeverbs1; -AudioConnection patchCord9(freeverbs1, 0, master_mixer_r, 1); -AudioConnection patchCord10(freeverbs1, 1, master_mixer_l, 1); +AudioConnection patchCord19(reverb_mixer, 0, freeverbs1, 0); +AudioConnection patchCord20(freeverbs1, 0, master_mixer_r, 1); +AudioConnection patchCord21(freeverbs1, 1, master_mixer_l, 1); #endif -AudioConnection patchCord11(delay_fb_mixer, delay1); -AudioConnection patchCord12(delay1, 0, delay_fb_mixer, 1); -AudioConnection patchCord13(delay1, 0, master_mixer_r, 2); -AudioConnection patchCord14(delay1, 0, master_mixer_l, 2); -AudioConnection patchCord15(master_mixer_r, volume_r); -AudioConnection patchCord16(master_mixer_l, volume_l); -AudioConnection patchCord17(volume_r, 0, stereomono1, 0); -AudioConnection patchCord18(volume_l, 0, stereomono1, 1); #ifdef AUDIO_DEVICE_USB -AudioConnection patchCord19(stereomono1, 0, usb1, 0); -AudioConnection patchCord20(stereomono1, 1, usb1, 1); +AudioConnection patchCord22(stereomono1, 0, usb1, 0); +AudioConnection patchCord23(stereomono1, 1, usb1, 1); #endif #if defined(TEENSY_AUDIO_BOARD) AudioOutputI2S i2s1; -AudioConnection patchCord21(stereomono1, 0, i2s1, 0); -AudioConnection patchCord22(stereomono1, 1, i2s1, 1); +AudioConnection patchCord24(stereomono1, 0, i2s1, 0); +AudioConnection patchCord25(stereomono1, 1, i2s1, 1); AudioControlSGTL5000 sgtl5000_1; #elif defined (I2S_AUDIO_ONLY) AudioOutputI2S i2s1; -AudioConnection patchCord23(stereomono1, 0, i2s1, 0); -AudioConnection patchCord24(stereomono1, 1, i2s1, 1); +AudioConnection patchCord26(stereomono1, 0, i2s1, 0); +AudioConnection patchCord27(stereomono1, 1, i2s1, 1); #elif defined(TGA_AUDIO_BOARD) AudioOutputI2S i2s1; -AudioConnection patchCord25(stereomono1, 0, i2s1, 0); -AudioConnection patchCord26(stereomono1, 1, i2s1, 1); +AudioConnection patchCord28(stereomono1, 0, i2s1, 0); +AudioConnection patchCord29(stereomono1, 1, i2s1, 1); AudioControlWM8731master wm8731_1; #elif defined(PT8211_AUDIO) AudioOutputPT8211 pt8211_1; -AudioConnection patchCord27(stereomono1, 0, pt8211_1, 0); -AudioConnection patchCord28(stereomono1, 1, pt8211_1, 1); +AudioConnection patchCord30(stereomono1, 0, pt8211_1, 0); +AudioConnection patchCord31(stereomono1, 1, pt8211_1, 1); #elif defined(TEENSY_DAC_SYMMETRIC) AudioOutputAnalogStereo dacOut; AudioMixer4 invMixer; -AudioConnection patchCord29(stereomono1, 0, dacOut , 0); -AudioConnection patchCord30(stereomono1, 1, invMixer, 0); -AudioConnection patchCord31(invMixer, 0, dacOut , 1); +AudioConnection patchCord32(stereomono1, 0, dacOut , 0); +AudioConnection patchCord33(stereomono1, 1, invMixer, 0); +AudioConnection patchCord34(invMixer, 0, dacOut , 1); #else AudioOutputAnalogStereo dacOut; -AudioConnection patchCord32(stereomono1, 0, dacOut, 0); -AudioConnection patchCord33(stereomono1, 1, dacOut, 1); +AudioConnection patchCord35(stereomono1, 0, dacOut, 0); +AudioConnection patchCord36(stereomono1, 1, dacOut, 1); #endif -#ifdef USE_REVERB -AudioConnection * dynamicConnections[NUM_DEXED * 6]; -#else -AudioConnection * dynamicConnections[NUM_DEXED * 5]; -#endif -int nDynamic = 0; - -void create_audio_connections(AudioSourceMicroDexed &d) -{ - dynamicConnections[nDynamic++] = new AudioConnection(d, peak1); - dynamicConnections[nDynamic++] = new AudioConnection(d, 0, delay_fb_mixer, 0); - dynamicConnections[nDynamic++] = new AudioConnection(d, 0, modchorus, 0); - dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_r, 0); - dynamicConnections[nDynamic++] = new AudioConnection(d, 0 , master_mixer_l, 0); -#if defined(USE_REVERB) - dynamicConnections[nDynamic++] = new AudioConnection(d, 0, freeverbs1, 0); -#endif -} bool sd_card_available = false; uint8_t max_loaded_banks = 0; @@ -217,7 +223,7 @@ void setup() Serial.print(F("Creating MicroDexed instance ")); Serial.print(i, DEC); MicroDexed[i] = new AudioSourceMicroDexed(SAMPLE_RATE); - //create_audio_connections(*MicroDexed[i]); + create_audio_connections(*MicroDexed[i], i); Serial.println(F("... created")); } @@ -350,28 +356,30 @@ void setup() #ifdef USE_REVERB // INIT REVERB + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + reverb_mixer.gain(instance_id, 0.0); + master_mixer_r.gain(REVERB, 1.0); + master_mixer_l.gain(REVERB, 1.0); freeverbs1.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); freeverbs1.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - master_mixer_r.gain(REVERB, mapfloat(configuration.dexed[instance_id].reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(REVERB, mapfloat(configuration.dexed[instance_id].reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); - } #endif // INIT DELAY + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + delay_mixer.gain(instance_id, 0.0); + master_mixer_r.gain(DELAY, 1.0); + master_mixer_l.gain(DELAY, 1.0); delay1.delay(0, mapfloat(configuration.delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX, 0.0, float(DELAY_TIME_MAX))); // delay_fb_mixer is the feedback-adding mixer //delay_fb_mixer.gain(0, 1.0 - (mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // original signal delay_fb_mixer.gain(0, 1.0); // original signal delay_fb_mixer.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - master_mixer_r.gain(DELAY, mapfloat(configuration.dexed[instance_id].delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(DELAY, mapfloat(configuration.dexed[instance_id].delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); - } // INIT CHORUS + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + chorus_mixer.gain(instance_id, 0.0); + master_mixer_r.gain(CHORUS, 1.0); + master_mixer_l.gain(CHORUS, 1.0); switch (configuration.chorus_waveform) { case 0: @@ -402,9 +410,6 @@ void setup() modchorus_inverter.gain(1.0); // mono mode for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - master_mixer_r.gain(CHORUS, mapfloat(configuration.dexed[instance_id].chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(CHORUS, mapfloat(configuration.dexed[instance_id].chorus_level, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); - soften_filter_res[instance_id].init(configuration.dexed[instance_id].filter_resonance); soften_filter_cut[instance_id].init(configuration.dexed[instance_id].filter_cutoff); MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0); @@ -414,10 +419,7 @@ void setup() } // set initial volume and pan (read from EEPROM) - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono); - } + set_volume(configuration.vol, configuration.pan, configuration.mono); soften_volume.init(configuration.vol); #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) @@ -556,10 +558,8 @@ void loop() } if (soften_volume.running()) { - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - set_volume(soften_volume.value(), configuration.dexed[instance_id].pan, configuration.mono); - } + set_volume(soften_volume.value(), configuration.pan, configuration.mono); + #ifdef DEBUG Serial.print(F("Volume: ")); Serial.print(configuration.vol, DEC); @@ -650,8 +650,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) soften_volume.update(configuration.vol, SOFTEN_VALUE_CHANGE_STEPS); break; case 10: // Pan - configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); - set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono); + configuration.pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); + set_volume(configuration.vol, configuration.pan, configuration.mono); break; case 32: // BankSelect LSB configuration.dexed[instance_id].bank = inValue; @@ -684,9 +684,9 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signalbreak; break; case 107: // CC 107: delay volume - configuration.dexed[instance_id].delay_level = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); - master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0); - master_mixer_l.gain(2, configuration.dexed[instance_id].delay_level / 100.0); + 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 / 100.0); + master_mixer_l.gain(2, configuration.dexed[instance_id].delay_send / 100.0); break; case 120: MicroDexed[instance_id]->panic(); @@ -1053,14 +1053,14 @@ void set_volume(uint8_t v, int8_t p, uint8_t m) //configuration.dexed[instance_id].pan = p; // TODO: Fixing pan per Dexed for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - configuration.dexed[instance_id].pan = p; + configuration.pan = p; } configuration.mono = m; uint16_t tmp = v / 100.0 * 1023.0 + 0.5; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - tmp2 = mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); + tmp2 = mapfloat(configuration.pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); } float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); @@ -1094,26 +1094,20 @@ void set_volume(uint8_t v, int8_t p, uint8_t m) stereomono1.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - configuration.dexed[instance_id].pan = 0.5; + configuration.pan = 0.5; } modchorus_inverter.gain(1.0); // stereo mode break; case 2: // mono right volume_l.gain(0.0); stereomono1.stereo(false); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - configuration.dexed[instance_id].pan = 0.5; - } + configuration.pan = 0.5; modchorus_inverter.gain(1.0); // stereo mode break; case 3: // mono left volume_r.gain(0.0); stereomono1.stereo(false); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - configuration.dexed[instance_id].pan = 0.5; - } + configuration.pan = 0.5; modchorus_inverter.gain(1.0); // stereo mode break; } @@ -1177,9 +1171,9 @@ void initial_values_from_eeprom(bool init) configuration.dexed[instance_id].bank %= MAX_BANKS; configuration.dexed[instance_id].voice %= MAX_VOICES; configuration.dexed[instance_id].pan %= PANORAMA_MAX; - configuration.dexed[instance_id].reverb_level %= REVERB_LEVEL_MAX; - configuration.dexed[instance_id].chorus_level %= CHORUS_LEVEL_MAX; - configuration.dexed[instance_id].delay_level %= DELAY_LEVEL_MAX; + configuration.dexed[instance_id].reverb_send %= REVERB_SEND_MAX; + configuration.dexed[instance_id].chorus_send %= CHORUS_SEND_MAX; + configuration.dexed[instance_id].delay_send %= DELAY_SEND_MAX; configuration.dexed[instance_id].filter_cutoff %= FILTER_CUTOFF_MAX; configuration.dexed[instance_id].filter_resonance %= FILTER_RESONANCE_MAX; configuration.dexed[instance_id].loudness %= LOUDNESS_MAX; @@ -1231,6 +1225,7 @@ void init_configuration(void) configuration.instance_mode = INSTANCE_MODE_DEFAULT; configuration.instance_splitpoint = INSTANCE_SPLITPOINT_DEFAULT; configuration.vol = VOLUME_DEFAULT; + configuration.pan = PANORAMA_DEFAULT; configuration.mono = MONO_DEFAULT; configuration.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; configuration.reverb_damping = REVERB_DAMPING_DEFAULT; @@ -1244,10 +1239,9 @@ void init_configuration(void) configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT; configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT; - configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; - configuration.dexed[instance_id].reverb_level = REVERB_LEVEL_DEFAULT; - configuration.dexed[instance_id].chorus_level = CHORUS_LEVEL_DEFAULT; - configuration.dexed[instance_id].delay_level = DELAY_LEVEL_DEFAULT; + configuration.dexed[instance_id].reverb_send = REVERB_SEND_DEFAULT; + configuration.dexed[instance_id].chorus_send = CHORUS_SEND_DEFAULT; + configuration.dexed[instance_id].delay_send = DELAY_SEND_DEFAULT; configuration.dexed[instance_id].filter_cutoff = FILTER_CUTOFF_DEFAULT; configuration.dexed[instance_id].filter_resonance = FILTER_RESONANCE_DEFAULT; configuration.dexed[instance_id].loudness = LOUDNESS_DEFAULT; @@ -1360,6 +1354,7 @@ void show_configuration(void) Serial.print(F("Instance Mode ")); Serial.println(configuration.instance_mode, DEC); Serial.print(F("Instance Splitpoint ")); Serial.println(configuration.instance_splitpoint, DEC); Serial.print(F("Volume ")); Serial.println(configuration.vol, DEC); + Serial.print(F("Panorama ")); Serial.println(configuration.pan, DEC); Serial.print(F("Mono ")); Serial.println(configuration.mono, DEC); Serial.print(F("Reverb Roomsize ")); Serial.println(configuration.reverb_roomsize, DEC); Serial.print(F("Reverb Damping ")); Serial.println(configuration.reverb_damping, DEC); @@ -1377,10 +1372,9 @@ void show_configuration(void) Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC); Serial.print(F(" Bank ")); Serial.println(configuration.dexed[instance_id].bank, DEC); Serial.print(F(" Voice ")); Serial.println(configuration.dexed[instance_id].voice, DEC); - Serial.print(F(" Panorama ")); Serial.println(configuration.dexed[instance_id].pan, DEC); - Serial.print(F(" Reverb Level ")); Serial.println(configuration.dexed[instance_id].reverb_level, DEC); - Serial.print(F(" Chorus Level ")); Serial.println(configuration.dexed[instance_id].chorus_level, DEC); - Serial.print(F(" Delay Level ")); Serial.println(configuration.dexed[instance_id].delay_level, DEC); + Serial.print(F(" Reverb Send ")); Serial.println(configuration.dexed[instance_id].reverb_send, DEC); + Serial.print(F(" Chorus Send ")); Serial.println(configuration.dexed[instance_id].chorus_send, DEC); + Serial.print(F(" Delay Send ")); Serial.println(configuration.dexed[instance_id].delay_send, DEC); Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.dexed[instance_id].filter_cutoff, DEC); Serial.print(F(" Filter Resonance ")); Serial.println(configuration.dexed[instance_id].filter_resonance, DEC); Serial.print(F(" Loudness ")); Serial.println(configuration.dexed[instance_id].loudness, DEC); diff --git a/UI.hpp b/UI.hpp index ebe7e44..0a0ec8d 100644 --- a/UI.hpp +++ b/UI.hpp @@ -65,9 +65,12 @@ extern SoftenValue soften_filter_cut[NUM_DEXED]; extern AudioEffectDelay delay1; #ifdef USE_REVERB extern AudioEffectFreeverbStereo freeverbs1; +extern AudioMixer4 reverb_mixer; #endif extern AudioEffectModulatedDelay modchorus; extern AudioSynthWaveform modulator; +extern AudioMixer4 chorus_mixer; +extern AudioMixer4 delay_mixer; extern AudioMixer4 delay_fb_mixer; extern AudioMixer4 master_mixer_r; extern AudioMixer4 master_mixer_l; @@ -128,14 +131,14 @@ void lcdml_voice_menu_control(void); void UI_func_sound(uint8_t param); void UI_func_reverb_roomsize(uint8_t param); void UI_func_reverb_damping(uint8_t param); -void UI_func_reverb_level(uint8_t param); +void UI_func_reverb_send(uint8_t param); void UI_func_chorus_frequency(uint8_t param); void UI_func_chorus_waveform(uint8_t param); void UI_func_chorus_depth(uint8_t param); -void UI_func_chorus_level(uint8_t param); +void UI_func_chorus_send(uint8_t param); void UI_func_delay_time(uint8_t param); void UI_func_delay_feedback(uint8_t param); -void UI_func_delay_level(uint8_t param); +void UI_func_delay_send(uint8_t param); void UI_func_filter_cutoff(uint8_t param); void UI_func_filter_resonance(uint8_t param); void UI_func_midi_channel(uint8_t param); @@ -174,9 +177,9 @@ LCDML_add(1, LCDML_0_1, 1, "Instances", UI_function_not_implemented); LCDML_add(2, LCDML_0_1, 2, "Instance 1", NULL); LCDML_add(3, LCDML_0_1_2, 1, "MIDI Channel 1", UI_func_midi_channel); LCDML_add(4, LCDML_0_1_2, 2, "Loudness 1", UI_func_loudness); -LCDML_add(5, LCDML_0_1_2, 3, "Reverb Level 1", UI_func_reverb_level); -LCDML_add(6, LCDML_0_1_2, 4, "Chorus Level 1", UI_func_chorus_level); -LCDML_add(7, LCDML_0_1_2, 5, "Delay Level 1", UI_func_delay_level); +LCDML_add(5, LCDML_0_1_2, 3, "Reverb Send 1", UI_func_reverb_send); +LCDML_add(6, LCDML_0_1_2, 4, "Chorus Send 1", UI_func_chorus_send); +LCDML_add(7, LCDML_0_1_2, 5, "Delay Send 1", UI_func_delay_send); LCDML_add(8, LCDML_0_1_2, 6, "Panorama 1", UI_func_panorama); LCDML_add(9, LCDML_0_1_2, 7, "Polyphony 1", UI_func_polyphony); LCDML_add(10, LCDML_0_1_2, 8, "Engine 1", UI_func_engine); @@ -210,9 +213,9 @@ LCDML_add(37, LCDML_0_1_2_13, 6, "OP6 1", UI_function_not_implemented); LCDML_add(38, LCDML_0_1, 3, "Instance 2", NULL); LCDML_add(39, LCDML_0_1_3, 1, "MIDI Channel 2", UI_func_midi_channel); LCDML_add(40, LCDML_0_1_3, 2, "Loudness 2", UI_func_loudness); -LCDML_add(41, LCDML_0_1_3, 3, "Reverb Level 2", UI_func_reverb_level); -LCDML_add(42, LCDML_0_1_3, 4, "Chorus Level 2", UI_func_chorus_level); -LCDML_add(43, LCDML_0_1_3, 5, "Delay Level 2", UI_func_delay_level); +LCDML_add(41, LCDML_0_1_3, 3, "Reverb Send 2", UI_func_reverb_send); +LCDML_add(42, LCDML_0_1_3, 4, "Chorus Send 2", UI_func_chorus_send); +LCDML_add(43, LCDML_0_1_3, 5, "Delay Send 2", UI_func_delay_send); LCDML_add(44, LCDML_0_1_3, 6, "Panorama 2", UI_func_panorama); LCDML_add(45, LCDML_0_1_3, 7, "Polyphony 2", UI_func_polyphony); LCDML_add(46, LCDML_0_1_3, 8, "Engine 2", UI_func_engine); @@ -267,9 +270,9 @@ LCDML_add(91, LCDML_0, 5, "Info", UI_func_information); LCDML_add(0, LCDML_0, 1, "Setup", NULL); LCDML_add(1, LCDML_0_1, 1, "MIDI Channel", UI_func_midi_channel); LCDML_add(2, LCDML_0_1, 2, "Loudness", UI_func_loudness); -LCDML_add(3, LCDML_0_1, 3, "Reverb Level", UI_func_reverb_level); -LCDML_add(4, LCDML_0_1, 4, "Chorus Level", UI_func_chorus_level); -LCDML_add(5, LCDML_0_1, 5, "Delay Level", UI_func_delay_level); +LCDML_add(3, LCDML_0_1, 3, "Reverb Send", UI_func_reverb_send); +LCDML_add(4, LCDML_0_1, 4, "Chorus Send", UI_func_chorus_send); +LCDML_add(5, LCDML_0_1, 5, "Delay Send", UI_func_delay_send); LCDML_add(6, LCDML_0_1, 6, "Panorama", UI_func_panorama); LCDML_add(7, LCDML_0_1, 7, "Polyphony", UI_func_polyphony); LCDML_add(8, LCDML_0_1, 8, "Engine", UI_func_engine); @@ -567,7 +570,7 @@ void encoder_right_up(void) #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif - + eeprom_write(); } break; case MENU_VOICE_SOUND: @@ -590,7 +593,6 @@ void encoder_right_up(void) change_disp_sd(true); #endif eeprom_write(); - } UI_func_voice_selection(0); break; @@ -630,7 +632,7 @@ void encoder_right_down(void) #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif - + eeprom_write(); } break; case MENU_VOICE_SOUND: @@ -652,7 +654,6 @@ void encoder_right_down(void) #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif - eeprom_write(); } UI_func_voice_selection(0); @@ -1010,7 +1011,7 @@ void UI_func_reverb_damping(uint8_t param) #endif } -void UI_func_reverb_level(uint8_t param) +void UI_func_reverb_send(uint8_t param) { #ifdef USE_REVERB uint8_t instance_id = 0; @@ -1022,13 +1023,13 @@ void UI_func_reverb_level(uint8_t param) { // setup function lcd.setCursor(0, 0); - lcd.print(F("Reverb Level")); + lcd.print(F("Reverb Send")); #ifdef DEBUG - Serial.println(F("Entering UI_func_reverb_level()")); + Serial.println(F("Entering UI_func_reverb_send()")); Serial.print(F("configuration.dexed[")); Serial.print(instance_id, DEC); - Serial.print(F("].reverb_level=")); - Serial.println(configuration.dexed[instance_id].reverb_level, DEC); + Serial.print(F("].reverb_send=")); + Serial.println(configuration.dexed[instance_id].reverb_send, DEC); #endif } @@ -1040,35 +1041,34 @@ void UI_func_reverb_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.dexed[instance_id].reverb_level < REVERB_LEVEL_MAX) + if (configuration.dexed[instance_id].reverb_send < REVERB_SEND_MAX) { - configuration.dexed[instance_id].reverb_level++; + configuration.dexed[instance_id].reverb_send++; } } else if (LCDML.BT_checkUp()) { - if (configuration.dexed[instance_id].reverb_level > REVERB_LEVEL_MIN) + if (configuration.dexed[instance_id].reverb_send > REVERB_SEND_MIN) { - configuration.dexed[instance_id].reverb_level--; + configuration.dexed[instance_id].reverb_send--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.dexed[instance_id].reverb_level, 3, true, true, false); + lcd_display_int(configuration.dexed[instance_id].reverb_send, 3, true, true, false); - master_mixer_r.gain(REVERB, configuration.dexed[instance_id].reverb_level / 100.0); - master_mixer_l.gain(REVERB, configuration.dexed[instance_id].reverb_level / 100.0); + reverb_mixer.gain(instance_id, configuration.dexed[instance_id].reverb_send / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { #ifdef DEBUG - Serial.println(F("Leaving UI_func_reverb_level()")); + Serial.println(F("Leaving UI_func_reverb_send()")); Serial.print(F("configuration.dexed[")); Serial.print(instance_id, DEC); - Serial.print(F("].reverb_level=")); - Serial.println(configuration.dexed[instance_id].reverb_level, DEC); + Serial.print(F("].reverb_send=")); + Serial.println(configuration.dexed[instance_id].reverb_send, DEC); #endif eeprom_write(); } @@ -1228,7 +1228,7 @@ void UI_func_chorus_depth(uint8_t param) } } -void UI_func_chorus_level(uint8_t param) +void UI_func_chorus_send(uint8_t param) { uint8_t instance_id = 0; @@ -1239,7 +1239,7 @@ void UI_func_chorus_level(uint8_t param) { // setup function lcd.setCursor(0, 0); - lcd.print(F("Chorus Level")); + lcd.print(F("Chorus Send")); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1250,24 +1250,23 @@ void UI_func_chorus_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.dexed[instance_id].chorus_level < CHORUS_LEVEL_MAX) + if (configuration.dexed[instance_id].chorus_send < CHORUS_SEND_MAX) { - configuration.dexed[instance_id].chorus_level++; + configuration.dexed[instance_id].chorus_send++; } } else if (LCDML.BT_checkUp()) { - if (configuration.dexed[instance_id].chorus_level > CHORUS_LEVEL_MIN) + if (configuration.dexed[instance_id].chorus_send > CHORUS_SEND_MIN) { - configuration.dexed[instance_id].chorus_level--; + configuration.dexed[instance_id].chorus_send--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.dexed[instance_id].chorus_level, 3, true, true, false); + lcd_display_int(configuration.dexed[instance_id].chorus_send, 3, true, true, false); - master_mixer_r.gain(CHORUS, configuration.dexed[instance_id].chorus_level / 100.0); - master_mixer_l.gain(CHORUS, configuration.dexed[instance_id].chorus_level / 100.0); + chorus_mixer.gain(instance_id, configuration.dexed[instance_id].chorus_send / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1365,7 +1364,7 @@ void UI_func_delay_feedback(uint8_t param) } } -void UI_func_delay_level(uint8_t param) +void UI_func_delay_send(uint8_t param) { uint8_t instance_id = 0; @@ -1376,7 +1375,7 @@ void UI_func_delay_level(uint8_t param) { // setup function lcd.setCursor(0, 0); - lcd.print(F("Delay Level")); + lcd.print(F("Delay Send")); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1387,24 +1386,23 @@ void UI_func_delay_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.dexed[instance_id].delay_level < DELAY_LEVEL_MAX) + if (configuration.dexed[instance_id].delay_send < DELAY_SEND_MAX) { - configuration.dexed[instance_id].delay_level++; + configuration.dexed[instance_id].delay_send++; } } else if (LCDML.BT_checkUp()) { - if (configuration.dexed[instance_id].delay_level > DELAY_LEVEL_MIN) + if (configuration.dexed[instance_id].delay_send > DELAY_SEND_MIN) { - configuration.dexed[instance_id].delay_level--; + configuration.dexed[instance_id].delay_send--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.dexed[instance_id].delay_level, 3, true, true, false); + lcd_display_int(configuration.dexed[instance_id].delay_send, 3, true, true, false); - master_mixer_r.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0); - master_mixer_l.gain(DELAY, configuration.dexed[instance_id].delay_level / 100.0); + delay_mixer.gain(instance_id, configuration.dexed[instance_id].delay_send / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1617,11 +1615,6 @@ void UI_func_loudness(uint8_t param) void UI_func_panorama(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1642,25 +1635,25 @@ void UI_func_panorama(uint8_t param) } else if (LCDML.BT_checkDown() && configuration.mono == 0) { - if (configuration.dexed[instance_id].pan < PANORAMA_MAX) + if (configuration.pan < PANORAMA_MAX) { - configuration.dexed[instance_id].pan++; + configuration.pan++; } } else if (LCDML.BT_checkUp() && configuration.mono == 0) { - if (configuration.dexed[instance_id].pan > PANORAMA_MIN) + if (configuration.pan > PANORAMA_MIN) { - configuration.dexed[instance_id].pan--; + configuration.pan--; } } if (configuration.mono == 0) { lcd.setCursor(0, 1); - lcd_display_int(configuration.dexed[instance_id].pan, 2, false, true, true); + lcd_display_int(configuration.pan, 2, false, true, true); - set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono); + set_volume(configuration.vol, configuration.pan, configuration.mono); } } @@ -1673,11 +1666,6 @@ void UI_func_panorama(uint8_t param) void UI_func_stereo_mono(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1725,7 +1713,7 @@ void UI_func_stereo_mono(uint8_t param) stereomono1.stereo(false); break; } - set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono); + set_volume(configuration.vol, configuration.pan, configuration.mono); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2586,11 +2574,6 @@ void UI_func_voice_selection(uint8_t param) void UI_func_volume(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - #ifdef DEBUG Serial.println(F("UI_func_volume()")); #endif @@ -2614,7 +2597,7 @@ void UI_func_volume(uint8_t param) else lcd.print(F(" ")); } - set_volume(configuration.vol, configuration.dexed[instance_id].pan, configuration.mono); + set_volume(configuration.vol, configuration.pan, configuration.mono); eeprom_write(); } diff --git a/config.h b/config.h index 91e6f4b..6c31157 100644 --- a/config.h +++ b/config.h @@ -290,9 +290,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define REVERB_DAMPING_MAX 100 #define REVERB_DAMPING_DEFAULT 0 -#define REVERB_LEVEL_MIN 0 -#define REVERB_LEVEL_MAX 100 -#define REVERB_LEVEL_DEFAULT 0 +#define REVERB_SEND_MIN 0 +#define REVERB_SEND_MAX 100 +#define REVERB_SEND_DEFAULT 0 #define CHORUS_FREQUENCY_MIN 0 #define CHORUS_FREQUENCY_MAX 100 @@ -306,9 +306,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define CHORUS_DEPTH_MAX 100 #define CHORUS_DEPTH_DEFAULT 0 -#define CHORUS_LEVEL_MIN 0 -#define CHORUS_LEVEL_MAX 100 -#define CHORUS_LEVEL_DEFAULT 0 +#define CHORUS_SEND_MIN 0 +#define CHORUS_SEND_MAX 100 +#define CHORUS_SEND_DEFAULT 0 #define DELAY_TIME_MIN 0 #define DELAY_TIME_MAX DELAY_MAX_TIME @@ -318,9 +318,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define DELAY_FEEDBACK_MAX 100 #define DELAY_FEEDBACK_DEFAULT 0 -#define DELAY_LEVEL_MIN 0 -#define DELAY_LEVEL_MAX 100 -#define DELAY_LEVEL_DEFAULT 0 +#define DELAY_SEND_MIN 0 +#define DELAY_SEND_MAX 100 +#define DELAY_SEND_DEFAULT 0 #define FILTER_CUTOFF_MIN 0 #define FILTER_CUTOFF_MAX 100 @@ -417,10 +417,9 @@ typedef struct { uint8_t midi_channel; uint8_t bank; uint8_t voice; - int8_t pan; - uint8_t reverb_level; - uint8_t chorus_level; - uint8_t delay_level; + uint8_t reverb_send; + uint8_t chorus_send; + uint8_t delay_send; uint8_t filter_cutoff; uint8_t filter_resonance; uint8_t loudness; @@ -447,6 +446,7 @@ typedef struct { uint8_t instance_mode; uint8_t instance_splitpoint; uint8_t vol; + int8_t pan; uint8_t mono; uint8_t reverb_roomsize; uint8_t reverb_damping;