From 8ac058fa60652c3396c2a45427f6cbf40612e24c Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 26 Nov 2021 14:42:15 +0100 Subject: [PATCH] Fixes for stereo panner. Small fixes for E-Piano. --- MicroDexed.ino | 18 +++++++----------- UI.hpp | 12 ++++++------ config.h | 5 ++--- dexed_sd.cpp | 2 ++ effect_stereo_panorama.cpp | 15 +++++++++------ third-party/Synth_MDA_EPiano/src/mdaEPiano.cpp | 3 +++ 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 3aa449f..2cc1545 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -249,19 +249,13 @@ AudioConnection patchCord[] = { #endif #if defined(USE_EPIANO) - //{ep, 0, ep_stereo_panorama , 0}, - //{ep, 1, ep_stereo_panorama , 1}, {ep, 0, ep_stereo_panorama , 0}, {ep, 1, ep_stereo_panorama , 1}, #if defined(USE_FX) - //{ep_stereo_panorama, 0, ep_chorus_mixer_r, 0}, - //{ep_stereo_panorama, 1, ep_chorus_mixer_l, 0}, - //{ep_stereo_panorama, 0, ep_modchorus_r, 0}, - //{ep_stereo_panorama, 1, ep_modchorus_l, 0}, - {ep, 0, ep_chorus_mixer_r, 0}, - {ep, 1, ep_chorus_mixer_l, 0}, - {ep, 0, ep_modchorus_r, 0}, - {ep, 1, ep_modchorus_l, 0}, + {ep_stereo_panorama, 0, ep_chorus_mixer_r, 0}, + {ep_stereo_panorama, 1, ep_chorus_mixer_l, 0}, + {ep_stereo_panorama, 0, ep_modchorus_r, 0}, + {ep_stereo_panorama, 1, ep_modchorus_l, 0}, #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT {ep_chorus_modulator, 0, ep_modchorus_filter, 0}, {ep_modchorus_filter, 0, ep_modchorus_r, 1}, @@ -1065,7 +1059,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) { - ep.noteOn(inNumber + configuration.epiano.transpose, inVelocity); + ep.noteOn(inNumber + configuration.epiano.transpose - 12, inVelocity); #ifdef DEBUG char note_name[4]; getNoteName(note_name, inNumber); @@ -2346,6 +2340,7 @@ void init_configuration(void) MicroDexed[instance_id]->ControllersRefresh(); } +#if defined(USE_EPIANO) configuration.epiano.decay = EP_DECAY_DEFAULT; configuration.epiano.release = EP_RELEASE_DEFAULT; configuration.epiano.hardness = EP_HARDNESS_DEFAULT; @@ -2365,6 +2360,7 @@ void init_configuration(void) configuration.epiano.pan = EP_PANORAMA_DEFAULT; configuration.epiano.velocity_sense = EP_VELOCITY_SENSE_DEFAULT; configuration.epiano.midi_channel = EP_MIDI_CHANNEL_DEFAULT; +#endif eeprom_update(); } diff --git a/UI.hpp b/UI.hpp index fc60ad2..c62c124 100644 --- a/UI.hpp +++ b/UI.hpp @@ -2421,7 +2421,7 @@ void UI_func_epiano_sound_intensity(uint8_t param) lcd_special_chars(BLOCKBAR); #if defined(USE_EPIANO) - lcd_display_bar_int("EP Level", configuration.epiano.sound_intensity, 1.0, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 3, false, false, true); # + lcd_display_bar_int("EP Level", configuration.epiano.sound_intensity, 1.0, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 3, false, false, true); #else lcd.clear(); lcd.print("EP Disabled"); @@ -2558,7 +2558,7 @@ void UI_func_epiano_release(uint8_t param) if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { encoderDir[ENC_R].reset(); @@ -2568,7 +2568,7 @@ void UI_func_epiano_release(uint8_t param) } else if (LCDML.BT_checkUp()) { - configuration.epiano.decay = constrain(configuration.epiano.decay - ENCODER[ENC_R].speed(), EP_DECAY_MIN, EP_DECAY_MAX); + configuration.epiano.release = constrain(configuration.epiano.release - ENCODER[ENC_R].speed(), EP_RELEASE_MIN, EP_RELEASE_MAX); } } @@ -2939,7 +2939,7 @@ void UI_func_epiano_polyphony(uint8_t param) if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { @@ -2947,8 +2947,8 @@ void UI_func_epiano_polyphony(uint8_t param) } else if (LCDML.BT_checkUp()) { - if (configuration.epiano.polyphony - 1 < 0) - configuration.epiano.polyphony = 0; + if (configuration.epiano.polyphony - 1 < 1) + configuration.epiano.polyphony = 1; else { configuration.epiano.polyphony = constrain(configuration.epiano.polyphony - 1, EP_POLYPHONY_MIN, EP_POLYPHONY_MAX); diff --git a/config.h b/config.h index b036a70..11554c1 100644 --- a/config.h +++ b/config.h @@ -135,11 +135,10 @@ #endif // EPIANO -//#define USE_EPIANO +#define USE_EPIANO #ifdef USE_EPIANO #define NUM_EPIANO_VOICES 16 -//#define DEFAULT_EP_MIDI_CHANNEL 3 -#define DEFAULT_EP_MIDI_CHANNEL 1 +#define DEFAULT_EP_MIDI_CHANNEL 3 #endif // CHORUS parameters diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 1a1b7e1..729703c 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -1359,6 +1359,8 @@ bool save_sd_performance_json(uint8_t number) AudioNoInterrupts(); + check_performance_directory(number); + save_sd_seq_sub_vel_json(number); save_sd_seq_sub_patterns_json(number); diff --git a/effect_stereo_panorama.cpp b/effect_stereo_panorama.cpp index dc10651..11c3841 100644 --- a/effect_stereo_panorama.cpp +++ b/effect_stereo_panorama.cpp @@ -51,6 +51,9 @@ static const audio_block_t zeroblock = { #endif #if AUDIO_BLOCK_SAMPLES > 112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 128 +#error AUDIO_BLOCK_SAMPLES > 128 is a problem for this class #endif } }; @@ -93,12 +96,12 @@ void AudioEffectStereoPanorama::update(void) float fcos = arm_cos_f32(pan * PI / 2.0); int16_t* out_p[2] = {&out[0]->data[0], &out[1]->data[0]}; - for (uint8_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++) + for (uint16_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++) { - *out_p[0]++ = int16_t(in_f[0][n] * _pseudo_log * fsin * SHRT_MAX); - *out_p[0]++ = int16_t(in_f[0][n] * _pseudo_log * fcos * SHRT_MAX); - *out_p[1]++ = int16_t(in_f[1][n] * _pseudo_log * fcos * SHRT_MAX); - *out_p[1]++ = int16_t(in_f[1][n] * _pseudo_log * fsin * SHRT_MAX); + out_p[0][n] = int16_t(in_f[0][n] * _pseudo_log * fsin * SHRT_MAX); + out_p[1][n] = int16_t(in_f[1][n] * _pseudo_log * fcos * SHRT_MAX); + out_p[0][n] = int16_t(in_f[0][n] * _pseudo_log * fcos * SHRT_MAX); + out_p[1][n] = int16_t(in_f[1][n] * _pseudo_log * fsin * SHRT_MAX); } } @@ -110,7 +113,7 @@ void AudioEffectStereoPanorama::update(void) { release(in[1]); } - + if (out[0]) { transmit(out[0], 0); diff --git a/third-party/Synth_MDA_EPiano/src/mdaEPiano.cpp b/third-party/Synth_MDA_EPiano/src/mdaEPiano.cpp index a1d0f2d..e84c206 100644 --- a/third-party/Synth_MDA_EPiano/src/mdaEPiano.cpp +++ b/third-party/Synth_MDA_EPiano/src/mdaEPiano.cpp @@ -284,10 +284,13 @@ void mdaEPiano::setPolyphony(uint8_t value) if (value <= 0) value = 1; + resetVoices(); + if(voice) delete(voice); voice=new VOICE[value]; + resetVoices(); max_polyphony = value; }