From 2d2fa02afc4067b0ab247b0abb530e276d1df2ac Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 24 Nov 2021 15:55:53 +0100 Subject: [PATCH] Again: several fixes. --- MicroDexed.ino | 25 +++- UI.hpp | 54 +++++++- UI_FX_T4.h | 255 +++++++++++++++++++------------------ config.h | 41 +++--- dexed_sd.cpp | 90 ++++++------- effect_stereo_panorama.cpp | 124 ++++++++++++++++++ effect_stereo_panorama.h | 52 ++++++++ 7 files changed, 443 insertions(+), 198 deletions(-) create mode 100644 effect_stereo_panorama.cpp create mode 100644 effect_stereo_panorama.h diff --git a/MicroDexed.ino b/MicroDexed.ino index 1fe8ff9..3aa449f 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -57,6 +57,7 @@ using namespace TeensyTimerTool; #endif #if defined (USE_EPIANO) #include "synth_mda_epiano.h" +#include "effect_stereo_panorama.h" #endif // Audio engines @@ -79,6 +80,7 @@ AudioMixer<2>* delay_mixer[NUM_DEXED]; AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; #if defined(USE_FX) && defined(USE_EPIANO) +AudioEffectStereoPanorama ep_stereo_panorama; AudioSynthWaveform ep_chorus_modulator; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT AudioFilterBiquad ep_modchorus_filter; @@ -247,7 +249,15 @@ 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}, @@ -265,11 +275,11 @@ AudioConnection patchCord[] = { {ep_modchorus_l, 0, ep_chorus_mixer_l, 1}, {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}, + {ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, + {ep_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, #else - {ep, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, - {ep, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, + {ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, + {ep_stereo_panorama, 1, master_mixer_l, MASTER_MIX_CH_EPIANO}, #endif #endif }; @@ -617,6 +627,7 @@ void setup() ep_chorus_mixer_r.gain(1, mapfloat(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5)); ep_chorus_mixer_l.gain(1, mapfloat(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5)); ep_chorus_inverter.gain(-1.0); + ep_stereo_panorama.panorama(0.0); #endif #endif @@ -763,8 +774,6 @@ void setup() void loop() { - 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(); @@ -2614,6 +2623,7 @@ void set_voiceconfig_params(uint8_t instance_id) void set_epiano_params(void) { +#if defined(USE_EPIANO) ep.setDecay(mapfloat(configuration.epiano.decay, EP_DECAY_MIN, EP_DECAY_MAX, 0, 1.0)); ep.setRelease(mapfloat(configuration.epiano.release, EP_RELEASE_MIN, EP_RELEASE_MAX, 0, 1.0)); ep.setHardness(mapfloat(configuration.epiano.hardness, EP_HARDNESS_MIN, EP_HARDNESS_MAX, 0, 1.0)); @@ -2627,6 +2637,9 @@ void set_epiano_params(void) ep.setDetune(mapfloat(configuration.epiano.detune, EP_DETUNE_MIN, EP_DETUNE_MAX, 0, 1.0)); ep.setOverdrive(mapfloat(configuration.epiano.overdrive, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 0, 1.0)); ep.setVolume(mapfloat(configuration.epiano.sound_intensity, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 0, 1.0)); +#else + ; +#endif } void set_sys_params(void) diff --git a/UI.hpp b/UI.hpp index 9944d78..fc60ad2 100644 --- a/UI.hpp +++ b/UI.hpp @@ -44,6 +44,7 @@ #include "sequencer.h" #if defined (USE_EPIANO) #include "synth_mda_epiano.h" +#include "effect_stereo_panorama.h" #endif #define _LCDML_DISP_cols LCD_cols @@ -125,6 +126,7 @@ extern AudioEffectFreeverbStereoFloat freeverb; #endif #endif #if defined(USE_FX) && defined(USE_EPIANO) +extern AudioEffectStereoPanorama ep_stereo_panorama; extern AudioSynthWaveform ep_chorus_modulator; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT extern AudioFilterBiquad ep_modchorus_filter; @@ -2418,7 +2420,12 @@ void UI_func_epiano_sound_intensity(uint8_t param) encoderDir[ENC_R].reset(); lcd_special_chars(BLOCKBAR); - lcd_display_bar_int("EP Level", configuration.epiano.sound_intensity, 1.0, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 3, false, false, true); +#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); # +#else + lcd.clear(); + lcd.print("EP Disabled"); +#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -2440,7 +2447,9 @@ void UI_func_epiano_sound_intensity(uint8_t param) } lcd_display_bar_int("EP Level", configuration.epiano.sound_intensity, 1.0, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setVolume(mapfloat(configuration.epiano.sound_intensity, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2485,7 +2494,9 @@ void UI_func_epiano_panorama(uint8_t param) if (configuration.sys.mono == 0) { lcd_display_meter_float("EP Panorama", configuration.epiano.pan, 0.05, -20.0, EP_PANORAMA_MIN, EP_PANORAMA_MAX, 1, 1, false, true, false); - //TODO //mono2stereo[selected_instance_id]->panorama(mapfloat(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); +#if defined(USE_EPIANO) + ep_stereo_panorama.panorama(mapfloat(configuration.epiano.pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); +#endif } } @@ -2523,7 +2534,9 @@ void UI_func_epiano_decay(uint8_t param) } lcd_display_bar_int("EP Decay", configuration.epiano.decay, 1.0, EP_DECAY_MIN, EP_DECAY_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setDecay(mapfloat(configuration.epiano.decay, EP_DECAY_MIN, EP_DECAY_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2560,7 +2573,9 @@ void UI_func_epiano_release(uint8_t param) } lcd_display_bar_int("EP Release", configuration.epiano.release, 1.0, EP_RELEASE_MIN, EP_RELEASE_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setRelease(mapfloat(configuration.epiano.release, EP_RELEASE_MIN, EP_RELEASE_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2597,7 +2612,9 @@ void UI_func_epiano_hardness(uint8_t param) } lcd_display_bar_int("EP Hardness", configuration.epiano.hardness, 1.0, EP_HARDNESS_MIN, EP_HARDNESS_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setHardness(mapfloat(configuration.epiano.hardness, EP_HARDNESS_MIN, EP_HARDNESS_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2634,7 +2651,9 @@ void UI_func_epiano_treble(uint8_t param) } lcd_display_bar_int("EP Treble", configuration.epiano.treble, 1.0, EP_TREBLE_MIN, EP_TREBLE_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setTreble(mapfloat(configuration.epiano.treble, EP_TREBLE_MIN, EP_TREBLE_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2671,7 +2690,9 @@ void UI_func_epiano_stereo(uint8_t param) } lcd_display_bar_int("EP Stereo", configuration.epiano.stereo, 1.0, EP_STEREO_MIN, EP_STEREO_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setStereo(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2708,8 +2729,9 @@ void UI_func_epiano_tune(uint8_t param) } lcd_display_meter_int("EP Tune", configuration.epiano.tune, 1.0, -100.0, EP_TUNE_MIN, EP_TUNE_MAX, 3, false, true, false); - +#if defined(USE_EPIANO) ep.setTune((configuration.epiano.tune - 100) / 100.0); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2746,7 +2768,9 @@ void UI_func_epiano_detune(uint8_t param) } lcd_display_bar_int("EP Detune", configuration.epiano.detune, 1.0, EP_DETUNE_MIN, EP_DETUNE_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setDetune(mapfloat(configuration.epiano.detune, EP_DETUNE_MIN, EP_DETUNE_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2783,7 +2807,9 @@ void UI_func_epiano_pan_tremolo(uint8_t param) } lcd_display_bar_int("EP Trem. Width", configuration.epiano.pan_tremolo, 1.0, EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setPanTremolo(mapfloat(configuration.epiano.pan_tremolo, EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2820,7 +2846,9 @@ void UI_func_epiano_pan_lfo(uint8_t param) } lcd_display_bar_int("EP LFO", configuration.epiano.pan_lfo, 1.0, EP_PAN_LFO_MIN, EP_PAN_LFO_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setPanLFO(mapfloat(configuration.epiano.pan_lfo, EP_PAN_LFO_MIN, EP_PAN_LFO_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2857,7 +2885,9 @@ void UI_func_epiano_overdrive(uint8_t param) } lcd_display_bar_int("EP Overdrive", configuration.epiano.overdrive, 1.0, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setOverdrive(mapfloat(configuration.epiano.overdrive, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2927,7 +2957,9 @@ void UI_func_epiano_polyphony(uint8_t param) } lcd_display_bar_int("EP Polyphony", configuration.epiano.polyphony, 1.0, EP_POLYPHONY_MIN, EP_POLYPHONY_MAX, 2, false, false, false); +#if defined(USE_EPIANO) ep.setPolyphony(configuration.epiano.polyphony); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -2964,7 +2996,9 @@ void UI_func_epiano_velocity_sense(uint8_t param) } lcd_display_bar_int("EP Vel. Sense", configuration.epiano.velocity_sense, 1.0, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep.setVelocitySense(mapfloat(configuration.epiano.velocity_sense, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 0, 1.0)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -3033,8 +3067,9 @@ void UI_func_epiano_chorus_frequency(uint8_t param) configuration.fx.ep_chorus_frequency = constrain(configuration.fx.ep_chorus_frequency - ENCODER[ENC_R].speed(), EP_CHORUS_FREQUENCY_MIN, EP_CHORUS_FREQUENCY_MAX); } lcd_display_bar_float("EP Chorus Frq.", configuration.fx.ep_chorus_frequency, 0.1, EP_CHORUS_FREQUENCY_MIN, EP_CHORUS_FREQUENCY_MAX, 2, 1, false, false, false); - +#if defined(USE_EPIANO) ep_chorus_modulator.frequency(configuration.fx.ep_chorus_frequency / 10.0); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -3065,15 +3100,21 @@ void UI_func_epiano_chorus_waveform(uint8_t param) switch (configuration.fx.ep_chorus_waveform) { case 0: +#if defined(USE_EPIANO) ep_chorus_modulator.begin(WAVEFORM_TRIANGLE); +#endif lcd.print(F("[TRIANGLE]")); break; case 1: +#if defined(USE_EPIANO) ep_chorus_modulator.begin(WAVEFORM_SINE); +#endif lcd.print(F("[SINE ]")); break; default: +#if defined(USE_EPIANO) ep_chorus_modulator.begin(WAVEFORM_TRIANGLE); +#endif lcd.print(F("[TRIANGLE]")); break; } @@ -3107,8 +3148,9 @@ void UI_func_epiano_chorus_depth(uint8_t param) } lcd_display_bar_int("EP Ch. Depth", configuration.fx.ep_chorus_depth, 1.0, EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX, 3, false, false, false); - +#if defined(USE_EPIANO) ep_chorus_modulator.amplitude(configuration.fx.ep_chorus_depth / 100.0); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -3145,8 +3187,10 @@ void UI_func_epiano_chorus_level(uint8_t param) } lcd_display_bar_int("EP Ch. Level", configuration.fx.ep_chorus_level, 1.0, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 3, false, false, false); +#if defined(USE_EPIANO) ep_chorus_mixer_r.gain(1, mapfloat(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5)); ep_chorus_mixer_l.gain(1, mapfloat(configuration.fx.ep_chorus_level, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5)); +#endif } if (LCDML.FUNC_close()) // ****** STABLE END ********* diff --git a/UI_FX_T4.h b/UI_FX_T4.h index eb91ae0..55bdccc 100644 --- a/UI_FX_T4.h +++ b/UI_FX_T4.h @@ -30,7 +30,7 @@ boolean COND_hide() // hide a menu element return false; } -LCDML_add(0, LCDML_0, 1, "Voice", NULL); +LCDML_add(0, LCDML_0, 1, "Dexed", NULL); LCDML_add(1, LCDML_0_1, 1, "Select", UI_func_voice_select); LCDML_add(2, LCDML_0_1, 2, "Audio", NULL); LCDML_add(3, LCDML_0_1_2, 1, "Voice Level", UI_func_sound_intensity); @@ -48,130 +48,131 @@ LCDML_add(14, LCDML_0_1_2_3_2, 3, "Level", UI_func_delay_level); LCDML_add(15, LCDML_0_1_2_3, 3, "Filter", NULL); LCDML_add(16, LCDML_0_1_2_3_3, 1, "Cutoff", UI_func_filter_cutoff); LCDML_add(17, LCDML_0_1_2_3_3, 2, "Resonance", UI_func_filter_resonance); -LCDML_add(18, LCDML_0_1_2_3, 4, "Reverb", NULL); -LCDML_add(19, LCDML_0_1_2_3_4, 1, "Roomsize", UI_func_reverb_roomsize); -LCDML_add(20, LCDML_0_1_2_3_4, 2, "Lowpass", UI_func_reverb_lowpass); -LCDML_add(21, LCDML_0_1_2_3_4, 3, "Lodamp", UI_func_reverb_lodamp); -LCDML_add(22, LCDML_0_1_2_3_4, 4, "Hidamp", UI_func_reverb_hidamp); -LCDML_add(23, LCDML_0_1_2_3_4, 5, "Diffusion", UI_func_reverb_diffusion); -LCDML_add(24, LCDML_0_1_2_3_4, 6, "Level", UI_func_reverb_level); -LCDML_add(25, LCDML_0_1_2_3_4, 7, "Reverb Send", UI_func_reverb_send); -LCDML_add(26, LCDML_0_1_2_3, 5, "EQ", NULL); -LCDML_add(27, LCDML_0_1_2_3_5, 1, "Low-Cut", UI_func_eq_1); -LCDML_add(28, LCDML_0_1_2_3_5, 2, "110Hz", UI_func_eq_2); -LCDML_add(29, LCDML_0_1_2_3_5, 3, "220Hz", UI_func_eq_3); -LCDML_add(30, LCDML_0_1_2_3_5, 4, "1000Hz", UI_func_eq_4); -LCDML_add(31, LCDML_0_1_2_3_5, 5, "2000Hz", UI_func_eq_5); -LCDML_add(32, LCDML_0_1_2_3_5, 6, "7000Hz", UI_func_eq_6); -LCDML_add(33, LCDML_0_1_2_3_5, 7, "High-Cut", UI_func_eq_7); -LCDML_add(34, LCDML_0_1, 3, "Controller", NULL); -LCDML_add(35, LCDML_0_1_3, 1, "Pitchbend", NULL); -LCDML_add(36, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range); -LCDML_add(37, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step); -LCDML_add(38, LCDML_0_1_3, 2, "Mod Wheel", NULL); -LCDML_add(39, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range); -LCDML_add(40, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign); -LCDML_add(41, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode); -LCDML_add(42, LCDML_0_1_3, 3, "Aftertouch", NULL); -LCDML_add(43, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range); -LCDML_add(44, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign); -LCDML_add(45, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode); -LCDML_add(46, LCDML_0_1_3, 4, "Foot Ctrl", NULL); -LCDML_add(47, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range); -LCDML_add(48, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign); -LCDML_add(49, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode); -LCDML_add(50, LCDML_0_1_3, 5, "Breath Ctrl", NULL); -LCDML_add(51, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range); -LCDML_add(52, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign); -LCDML_add(53, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode); -LCDML_add(54, LCDML_0_1, 4, "MIDI", NULL); -LCDML_add(55, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); -LCDML_add(56, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); -LCDML_add(57, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); -LCDML_add(58, LCDML_0_1_4, 4, "MIDI Send Voice", UI_func_sysex_send_voice); -LCDML_add(59, LCDML_0_1, 5, "Setup", NULL); -LCDML_add(60, LCDML_0_1_5, 1, "Portamento", NULL); -LCDML_add(61, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); -LCDML_add(62, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); -LCDML_add(63, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); -LCDML_add(64, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); -LCDML_add(65, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); -LCDML_add(66, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); -LCDML_add(67, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); -LCDML_add(68, LCDML_0_1, 6, "Internal", NULL); -LCDML_add(69, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); -LCDML_add(70, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); -LCDML_add(71, LCDML_0_1, 7, "Operator", UI_handle_OP); -LCDML_add(72, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); -LCDML_add(73, LCDML_0, 2, "Drums", NULL); -LCDML_add(74, LCDML_0_2, 1, "Drums Main Vol", UI_func_drums_main_volume); -LCDML_add(75, LCDML_0_2, 2, "Drum Volumes", UI_func_drum_volume); -LCDML_add(76, LCDML_0_2, 3, "Drum Pan", UI_func_drum_pan); -LCDML_add(77, LCDML_0_2, 4, "Drum Rev.Send", UI_func_drum_reverb_send); -LCDML_add(78, LCDML_0_2, 5, "Drum Pitch", UI_func_drum_pitch); -LCDML_add(79, LCDML_0_2, 6, "Drum Tune", UI_func_drum_tune_offset); -LCDML_add(80, LCDML_0_2, 7, "MIDI Channel", UI_func_drum_midi_channel); -LCDML_add(81, LCDML_0_2, 8, "Smart Filter", UI_func_smart_filter); -LCDML_add(82, LCDML_0, 3, "E-Piano", NULL); -LCDML_add(83, LCDML_0_3, 1, "Voice Level", UI_func_epiano_sound_intensity); -LCDML_add(84, LCDML_0_3, 2, "Panorama", UI_func_epiano_panorama); -LCDML_add(85, LCDML_0_3, 3, "Audio", NULL); -LCDML_add(86, LCDML_0_3_3, 1, "Decay", UI_func_epiano_decay); // uint8_t decay; -LCDML_add(87, LCDML_0_3_3, 2, "Release", UI_func_epiano_release); // uint8_t release; -LCDML_add(88, LCDML_0_3_3, 3, "Hardness", UI_func_epiano_hardness); // uint8_t hardness; -LCDML_add(89, LCDML_0_3_3, 4, "Treble", UI_func_epiano_treble); // uint8_t treble; -LCDML_add(90, LCDML_0_3_3, 5, "Stereo", UI_func_epiano_stereo); // uint8_t stereo; -LCDML_add(91, LCDML_0_3_3, 6, "Tune", UI_func_epiano_tune); // uint8_t tune; -LCDML_add(92, LCDML_0_3_3, 7, "Detune", UI_func_epiano_detune); // uint8_t detune; -LCDML_add(93, LCDML_0_3, 4, "Effects", NULL); -LCDML_add(94, LCDML_0_3_4, 1, "Overdrive", UI_func_epiano_overdrive); // uint8_t overdrive; -LCDML_add(95, LCDML_0_3_4, 2, "Tremolo", NULL); -LCDML_add(96, LCDML_0_3_4_2, 1, "Width", UI_func_epiano_pan_tremolo); // uint8_t pan_tremolo; -LCDML_add(97, LCDML_0_3_4_2, 2, "LFO", UI_func_epiano_pan_lfo); // uint8_t pan_lfo; -LCDML_add(98, LCDML_0_3_4, 3, "Chorus", NULL); -LCDML_add(99, LCDML_0_3_4_3, 1, "Frequency", UI_func_epiano_chorus_frequency); -LCDML_add(100, LCDML_0_3_4_3, 2, "Waveform", UI_func_epiano_chorus_waveform); -LCDML_add(101, LCDML_0_3_4_3, 3, "Depth", UI_func_epiano_chorus_depth); -LCDML_add(102, LCDML_0_3_4_3, 4, "Level", UI_func_epiano_chorus_level); -LCDML_add(103, LCDML_0_3_4, 4, "Reverb Send", UI_func_epiano_reverb_send); -LCDML_add(104, LCDML_0_3, 6, "MIDI", NULL); -LCDML_add(105, LCDML_0_3_6, 1, "MIDI Channel", UI_func_epiano_midi_channel); // uint8_t midi_channel; -LCDML_add(106, LCDML_0_3_6, 2, "Lowest Note", UI_func_epiano_lowest_note); // uint8_t lowest_note; -LCDML_add(107, LCDML_0_3_6, 3, "Highest Note", UI_func_epiano_highest_note); // uint8_t highest_note; -LCDML_add(108, LCDML_0_3, 7, "Setup", NULL); -LCDML_add(109, LCDML_0_3_7, 4, "Transpose", UI_func_epiano_transpose); // uint8_t transpose; -LCDML_add(110, LCDML_0_3_7, 1, "Polyphony", UI_func_epiano_polyphony); // uint8_t polyphony; -LCDML_add(111, LCDML_0_3_7, 2, "Vel. Sense", UI_func_epiano_velocity_sense); // uint8_t velocity_sense; -LCDML_add(112, LCDML_0, 4, "Sequencer", NULL); -LCDML_add(113, LCDML_0_4, 1, "Pattern Editor", UI_func_seq_pattern_editor); -LCDML_add(114, LCDML_0_4, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor); -LCDML_add(115, LCDML_0_4, 3, "Pattern Chain", UI_func_seq_pat_chain); -LCDML_add(116, LCDML_0_4, 4, "Arpeggio", UI_func_arpeggio); -LCDML_add(117, LCDML_0_4, 5, "Mute Matrix", UI_func_seq_mute_matrix); -LCDML_add(118, LCDML_0_4, 6, "Seq. Settings", NULL); -LCDML_add(119, LCDML_0_4_6, 1, "Tempo", UI_func_seq_tempo); -LCDML_add(120, LCDML_0_4_6, 2, "Seq. Length", UI_func_seq_lenght); -LCDML_add(121, LCDML_0_4_6, 3, "Track Setup", UI_func_seq_track_setup); -LCDML_add(122, LCDML_0_4_6, 4, "Seq.Disp.Style", UI_func_seq_display_style); -LCDML_add(123, LCDML_0_4_6, 5, "Dexed Assign", UI_func_dexed_assign); -LCDML_add(124, LCDML_0_4_6, 6, "Shift&Transp.", UI_func_arp_shift); -LCDML_add(125, LCDML_0_4_6, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct); -LCDML_add(126, LCDML_0_4_6, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount); -LCDML_add(127, LCDML_0_4_6, 9, "Smart Filter", UI_func_smart_filter); -LCDML_add(128, LCDML_0, 5, "Load/Save", NULL); -LCDML_add(129, LCDML_0_5, 1, "Load Perf.", UI_func_load_performance); -LCDML_add(130, LCDML_0_5, 2, "Save Perf.", UI_func_save_performance); -LCDML_add(131, LCDML_0_5, 3, "Name Perf.", UI_func_set_performance_name); -LCDML_add(132, LCDML_0_5, 4, "MIDI", NULL); -LCDML_add(133, LCDML_0_5_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); -LCDML_add(134, LCDML_0_5_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); -LCDML_add(135, LCDML_0_5_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(136, LCDML_0, 6, "System", NULL); -LCDML_add(137, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(138, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(139, LCDML_0_6, 3, "Favorites", UI_func_favorites); -LCDML_add(140, LCDML_0_6, 4, "Startup", UI_func_startup); -LCDML_add(141, LCDML_0, 7, "Info", UI_func_information); -LCDML_addAdvanced(142, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 142 +LCDML_add(18, LCDML_0_1, 3, "Controller", NULL); +LCDML_add(19, LCDML_0_1_3, 1, "Pitchbend", NULL); +LCDML_add(20, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range); +LCDML_add(21, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step); +LCDML_add(22, LCDML_0_1_3, 2, "Mod Wheel", NULL); +LCDML_add(23, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range); +LCDML_add(24, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign); +LCDML_add(25, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode); +LCDML_add(26, LCDML_0_1_3, 3, "Aftertouch", NULL); +LCDML_add(27, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range); +LCDML_add(28, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign); +LCDML_add(29, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode); +LCDML_add(30, LCDML_0_1_3, 4, "Foot Ctrl", NULL); +LCDML_add(31, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range); +LCDML_add(32, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign); +LCDML_add(33, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode); +LCDML_add(34, LCDML_0_1_3, 5, "Breath Ctrl", NULL); +LCDML_add(35, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range); +LCDML_add(36, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign); +LCDML_add(37, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode); +LCDML_add(38, LCDML_0_1, 4, "MIDI", NULL); +LCDML_add(39, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); +LCDML_add(40, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); +LCDML_add(41, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); +LCDML_add(42, LCDML_0_1_4, 4, "MIDI Send Voice", UI_func_sysex_send_voice); +LCDML_add(43, LCDML_0_1, 5, "Setup", NULL); +LCDML_add(44, LCDML_0_1_5, 1, "Portamento", NULL); +LCDML_add(45, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); +LCDML_add(46, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); +LCDML_add(47, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); +LCDML_add(48, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); +LCDML_add(49, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); +LCDML_add(50, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); +LCDML_add(51, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); +LCDML_add(52, LCDML_0_1, 6, "Internal", NULL); +LCDML_add(53, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); +LCDML_add(54, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); +LCDML_add(55, LCDML_0_1, 7, "Operator", UI_handle_OP); +LCDML_add(56, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); +LCDML_add(57, LCDML_0, 2, "Drums", NULL); +LCDML_add(58, LCDML_0_2, 1, "Drums Main Vol", UI_func_drums_main_volume); +LCDML_add(59, LCDML_0_2, 2, "Drum Volumes", UI_func_drum_volume); +LCDML_add(60, LCDML_0_2, 3, "Drum Pan", UI_func_drum_pan); +LCDML_add(61, LCDML_0_2, 4, "Drum Rev.Send", UI_func_drum_reverb_send); +LCDML_add(62, LCDML_0_2, 5, "Drum Pitch", UI_func_drum_pitch); +LCDML_add(63, LCDML_0_2, 6, "Drum Tune", UI_func_drum_tune_offset); +LCDML_add(64, LCDML_0_2, 7, "MIDI Channel", UI_func_drum_midi_channel); +LCDML_add(65, LCDML_0_2, 8, "Smart Filter", UI_func_smart_filter); +LCDML_add(66, LCDML_0, 3, "E-Piano", NULL); +LCDML_add(67, LCDML_0_3, 1, "Voice Level", UI_func_epiano_sound_intensity); +LCDML_add(68, LCDML_0_3, 2, "Panorama", UI_func_epiano_panorama); +LCDML_add(69, LCDML_0_3, 3, "Audio", NULL); +LCDML_add(70, LCDML_0_3_3, 1, "Decay", UI_func_epiano_decay); // uint8_t decay; +LCDML_add(71, LCDML_0_3_3, 2, "Release", UI_func_epiano_release); // uint8_t release; +LCDML_add(72, LCDML_0_3_3, 3, "Hardness", UI_func_epiano_hardness); // uint8_t hardness; +LCDML_add(73, LCDML_0_3_3, 4, "Treble", UI_func_epiano_treble); // uint8_t treble; +LCDML_add(74, LCDML_0_3_3, 5, "Stereo", UI_func_epiano_stereo); // uint8_t stereo; +LCDML_add(75, LCDML_0_3_3, 6, "Tune", UI_func_epiano_tune); // uint8_t tune; +LCDML_add(76, LCDML_0_3_3, 7, "Detune", UI_func_epiano_detune); // uint8_t detune; +LCDML_add(77, LCDML_0_3, 4, "Effects", NULL); +LCDML_add(78, LCDML_0_3_4, 1, "Overdrive", UI_func_epiano_overdrive); // uint8_t overdrive; +LCDML_add(79, LCDML_0_3_4, 2, "Tremolo", NULL); +LCDML_add(80, LCDML_0_3_4_2, 1, "Width", UI_func_epiano_pan_tremolo); // uint8_t pan_tremolo; +LCDML_add(81, LCDML_0_3_4_2, 2, "LFO", UI_func_epiano_pan_lfo); // uint8_t pan_lfo; +LCDML_add(82, LCDML_0_3_4, 3, "Chorus", NULL); +LCDML_add(83, LCDML_0_3_4_3, 1, "Frequency", UI_func_epiano_chorus_frequency); +LCDML_add(84, LCDML_0_3_4_3, 2, "Waveform", UI_func_epiano_chorus_waveform); +LCDML_add(85, LCDML_0_3_4_3, 3, "Depth", UI_func_epiano_chorus_depth); +LCDML_add(86, LCDML_0_3_4_3, 4, "Level", UI_func_epiano_chorus_level); +LCDML_add(87, LCDML_0_3_4, 4, "Reverb Send", UI_func_epiano_reverb_send); +LCDML_add(88, LCDML_0_3, 6, "MIDI", NULL); +LCDML_add(89, LCDML_0_3_6, 1, "MIDI Channel", UI_func_epiano_midi_channel); // uint8_t midi_channel; +LCDML_add(90, LCDML_0_3_6, 2, "Lowest Note", UI_func_epiano_lowest_note); // uint8_t lowest_note; +LCDML_add(91, LCDML_0_3_6, 3, "Highest Note", UI_func_epiano_highest_note); // uint8_t highest_note; +LCDML_add(92, LCDML_0_3, 7, "Setup", NULL); +LCDML_add(93, LCDML_0_3_7, 4, "Transpose", UI_func_epiano_transpose); // uint8_t transpose; +LCDML_add(94, LCDML_0_3_7, 1, "Polyphony", UI_func_epiano_polyphony); // uint8_t polyphony; +LCDML_add(95, LCDML_0_3_7, 2, "Vel. Sense", UI_func_epiano_velocity_sense); // uint8_t velocity_sense; +LCDML_add(96, LCDML_0, 4, "Master Effects", NULL); +LCDML_add(97, LCDML_0_4, 1, "Reverb", NULL); +LCDML_add(98, LCDML_0_4_1, 1, "Roomsize", UI_func_reverb_roomsize); +LCDML_add(99, LCDML_0_4_1, 2, "Lowpass", UI_func_reverb_lowpass); +LCDML_add(100, LCDML_0_4_1, 3, "Lodamp", UI_func_reverb_lodamp); +LCDML_add(101, LCDML_0_4_1, 4, "Hidamp", UI_func_reverb_hidamp); +LCDML_add(102, LCDML_0_4_1, 5, "Diffusion", UI_func_reverb_diffusion); +LCDML_add(103, LCDML_0_4_1, 6, "Level", UI_func_reverb_level); +LCDML_add(104, LCDML_0_4_1, 7, "Reverb Send", UI_func_reverb_send); +LCDML_add(105, LCDML_0_4, 2, "EQ", NULL); +LCDML_add(106, LCDML_0_4_2, 1, "Low-Cut", UI_func_eq_1); +LCDML_add(107, LCDML_0_4_2, 2, "110Hz", UI_func_eq_2); +LCDML_add(108, LCDML_0_4_2, 3, "220Hz", UI_func_eq_3); +LCDML_add(109, LCDML_0_4_2, 4, "1000Hz", UI_func_eq_4); +LCDML_add(110, LCDML_0_4_2, 5, "2000Hz", UI_func_eq_5); +LCDML_add(111, LCDML_0_4_2, 6, "7000Hz", UI_func_eq_6); +LCDML_add(112, LCDML_0_4_2, 7, "High-Cut", UI_func_eq_7) +LCDML_add(113, LCDML_0, 5, "Sequencer", NULL); +LCDML_add(114, LCDML_0_5, 1, "Pattern Editor", UI_func_seq_pattern_editor); +LCDML_add(115, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor); +LCDML_add(116, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain); +LCDML_add(117, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio); +LCDML_add(118, LCDML_0_5, 5, "Mute Matrix", UI_func_seq_mute_matrix); +LCDML_add(119, LCDML_0_5, 6, "Seq. Settings", NULL); +LCDML_add(120, LCDML_0_5_6, 1, "Tempo", UI_func_seq_tempo); +LCDML_add(121, LCDML_0_5_6, 2, "Seq. Length", UI_func_seq_lenght); +LCDML_add(122, LCDML_0_5_6, 3, "Track Setup", UI_func_seq_track_setup); +LCDML_add(123, LCDML_0_5_6, 4, "Seq.Disp.Style", UI_func_seq_display_style); +LCDML_add(124, LCDML_0_5_6, 5, "Dexed Assign", UI_func_dexed_assign); +LCDML_add(125, LCDML_0_5_6, 6, "Shift&Transp.", UI_func_arp_shift); +LCDML_add(126, LCDML_0_5_6, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct); +LCDML_add(127, LCDML_0_5_6, 8, "ChordTrack Keys", UI_func_seq_chord_keys_ammount); +LCDML_add(128, LCDML_0_5_6, 9, "Smart Filter", UI_func_smart_filter); +LCDML_add(129, LCDML_0, 6, "Load/Save", NULL); +LCDML_add(130, LCDML_0_6, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(131, LCDML_0_6, 2, "Save Perf.", UI_func_save_performance); +LCDML_add(132, LCDML_0_6, 3, "Name Perf.", UI_func_set_performance_name); +LCDML_add(133, LCDML_0_6, 4, "MIDI", NULL); +LCDML_add(134, LCDML_0_6_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); +LCDML_add(135, LCDML_0_6_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); +LCDML_add(136, LCDML_0_6_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); +LCDML_add(137, LCDML_0, 7, "System", NULL); +LCDML_add(138, LCDML_0_7, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(139, LCDML_0_7, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(140, LCDML_0_7, 3, "Favorites", UI_func_favorites); +LCDML_add(141, LCDML_0_7, 4, "Startup", UI_func_startup); +LCDML_add(142, LCDML_0, 8, "Info", UI_func_information); +LCDML_addAdvanced(143, LCDML_0, 9, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 143 #endif diff --git a/config.h b/config.h index ec99085..b036a70 100644 --- a/config.h +++ b/config.h @@ -54,7 +54,7 @@ // sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy/hardware/teensy/avr/cores/teensy4/usb_midi.h //#define USB_MIDI_SYSEX_MAX 4104 -#define VERSION "1.1.2" +#define VERSION "1.2.0a" //************************************************************************************************* //* DEVICE SETTINGS @@ -135,7 +135,7 @@ #endif // EPIANO -#define USE_EPIANO +//#define USE_EPIANO #ifdef USE_EPIANO #define NUM_EPIANO_VOICES 16 //#define DEFAULT_EP_MIDI_CHANNEL 3 @@ -350,7 +350,7 @@ #define SAVE_SYS_MS 5000 #define VOL_MAX_FLOAT 0.95 -#define EEPROM_MARKER 0x4242 +#define EEPROM_MARKER 0x4243 #ifndef NUM_DRUMS #define NUM_DRUMS 0 @@ -642,21 +642,23 @@ #define PERFORMANCE_NUM_MAX 99 #define PERFORMANCE_NUM_DEFAULT 0 -#define VELOCITY_CONFIG_MIN 0 -#define VELOCITY_CONFIG_MAX 99 -#define VELOCITY_CONFIG_DEFAULT 0 +/* + #define VELOCITY_CONFIG_MIN 0 + #define VELOCITY_CONFIG_MAX 99 + #define VELOCITY_CONFIG_DEFAULT 0 -#define VOICE_CONFIG_MIN 0 -#define VOICE_CONFIG_MAX 99 -#define VOICE_CONFIG_DEFAULT -1 + #define VOICE_CONFIG_MIN 0 + #define VOICE_CONFIG_MAX 99 + #define VOICE_CONFIG_DEFAULT -1 -#define DRUMS_CONFIG_MIN 0 -#define DRUMS_CONFIG_MAX 99 -#define DRUMS_CONFIG_DEFAULT 0 + #define DRUMS_CONFIG_MIN 0 + #define DRUMS_CONFIG_MAX 99 + #define DRUMS_CONFIG_DEFAULT 0 -#define SEQUENCE_CONFIG_MIN 0 -#define SEQUENCE_CONFIG_MAX 99 -#define SEQUENCE_CONFIG_DEFAULT 0 + #define SEQUENCE_CONFIG_MIN 0 + #define SEQUENCE_CONFIG_MAX 99 + #define SEQUENCE_CONFIG_DEFAULT 0 +*/ #define EQ_1_MIN 15 #define EQ_1_MAX 250 @@ -743,8 +745,13 @@ #define EP_STEREO_DEFAULT 50 #define EP_POLYPHONY_MIN 0 +#if defined(USE_EPIANO) #define EP_POLYPHONY_MAX NUM_EPIANO_VOICES #define EP_POLYPHONY_DEFAULT NUM_EPIANO_VOICES +#else +#define EP_POLYPHONY_MAX 16 +#define EP_POLYPHONY_DEFAULT 16 +#endif #define EP_TUNE_MIN 1 #define EP_TUNE_MAX 199 @@ -784,7 +791,11 @@ #define EP_MIDI_CHANNEL_MIN MIDI_CHANNEL_OMNI #define EP_MIDI_CHANNEL_MAX 16 +#if defined(USE_EPIANO) #define EP_MIDI_CHANNEL_DEFAULT DEFAULT_EP_MIDI_CHANNEL +#else +#define EP_MIDI_CHANNEL_DEFAULT 3 +#endif #define FAVORITES_NUM_MIN 0 #define FAVORITES_NUM_MAX 100 diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 48b81c3..1a1b7e1 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -441,7 +441,7 @@ bool load_sd_drumsettings_json(uint8_t number) if (number < 0) return (false); - number = constrain(number, DRUMS_CONFIG_MIN, DRUMS_CONFIG_MAX); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { @@ -512,7 +512,7 @@ bool load_sd_drumsettings_json(uint8_t number) bool save_sd_drumsettings_json(uint8_t number) { char filename[CONFIG_FILENAME_LEN]; - number = constrain(number, 0, 99); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { @@ -592,7 +592,7 @@ bool load_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) { char filename[CONFIG_FILENAME_LEN]; - vc = constrain(vc, VOICE_CONFIG_MIN, VOICE_CONFIG_MAX); + vc = constrain(vc, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { @@ -686,7 +686,7 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id) { char filename[CONFIG_FILENAME_LEN]; - vc = constrain(vc, VOICE_CONFIG_MIN, VOICE_CONFIG_MAX); + vc = constrain(vc, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { @@ -1232,20 +1232,20 @@ bool save_sd_sys_json(void) /****************************************************************************** SD SEQUENCER ******************************************************************************/ -bool save_sd_seq_sub_vel_json(uint8_t seq_number) +bool save_sd_seq_sub_vel_json(uint8_t number) { char filename[CONFIG_FILENAME_LEN]; int count = 0; - seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, VELOCITY_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, VELOCITY_CONFIG_NAME); #ifdef DEBUG Serial.print(F("Saving sequencer velocity ")); - Serial.print(seq_number); + Serial.print(number); Serial.print(F(" to ")); Serial.println(filename); #endif @@ -1288,20 +1288,20 @@ bool save_sd_seq_sub_vel_json(uint8_t seq_number) return (false); } -bool save_sd_seq_sub_patterns_json(uint8_t seq_number) +bool save_sd_seq_sub_patterns_json(uint8_t number) { char filename[CONFIG_FILENAME_LEN]; int count = 0; - seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PATTERN_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PATTERN_CONFIG_NAME); #ifdef DEBUG Serial.print(F("Saving sequencer patterns ")); - Serial.print(seq_number); + Serial.print(number); Serial.print(F(" to ")); Serial.println(filename); #endif @@ -1344,12 +1344,12 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) return (false); } -bool save_sd_performance_json(uint8_t seq_number) +bool save_sd_performance_json(uint8_t number) { char filename[CONFIG_FILENAME_LEN]; int count = 0; bool seq_was_running = false; - seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (seq.seq_running == true ) { seq_was_running = true; @@ -1359,34 +1359,34 @@ bool save_sd_performance_json(uint8_t seq_number) AudioNoInterrupts(); - save_sd_seq_sub_vel_json(seq_number); - save_sd_seq_sub_patterns_json(seq_number); + save_sd_seq_sub_vel_json(number); + save_sd_seq_sub_patterns_json(number); #ifdef DEBUG Serial.print(F("Write performance config ")); - Serial.println(seq_number); + Serial.println(number); #endif - save_sd_fx_json(seq_number); - save_sd_epiano_json(seq_number); + save_sd_fx_json(number); + save_sd_epiano_json(number); for (uint8_t i = 0; i < MAX_DEXED; i++) { - sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, seq_number, VOICE_CONFIG_NAME, i); + sprintf(filename, "/%s/%d/%s%d.json", PERFORMANCE_CONFIG_PATH, number, VOICE_CONFIG_NAME, i); #ifdef DEBUG Serial.print(F("Write Voice-Config for sequencer")); Serial.println(filename); #endif - save_sd_voiceconfig_json(seq_number, i); + save_sd_voiceconfig_json(number, i); } if (sd_card > 0) { File json; StaticJsonDocument data_json; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, SEQUENCER_CONFIG_NAME); #ifdef DEBUG Serial.print(F("Saving sequencer config ")); - Serial.print(seq_number); + Serial.print(number); Serial.print(F(" to ")); Serial.println(filename); #endif @@ -1464,13 +1464,13 @@ bool save_sd_performance_json(uint8_t seq_number) return (false); } -bool check_performance_directory(uint8_t seq_number) +bool check_performance_directory(uint8_t number) { char dir[CONFIG_FILENAME_LEN]; if (sd_card > 0) { - sprintf(dir, "/%s/%d", PERFORMANCE_CONFIG_PATH, seq_number); + sprintf(dir, "/%s/%d", PERFORMANCE_CONFIG_PATH, number); AudioNoInterrupts(); SD.begin(); @@ -1505,9 +1505,9 @@ bool check_performance_directory(uint8_t seq_number) return (false); } -void get_sd_performance_name_json(uint8_t seq_number) +void get_sd_performance_name_json(uint8_t number) { - seq_number = constrain(seq_number, 0, 99); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); memset(seq.seq_name_temp, 0, FILENAME_LEN); if (sd_card > 0) { @@ -1515,7 +1515,7 @@ void get_sd_performance_name_json(uint8_t seq_number) StaticJsonDocument data_json; char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, SEQUENCER_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1541,18 +1541,18 @@ void get_sd_performance_name_json(uint8_t seq_number) } } -bool load_sd_seq_sub_vel_json(uint8_t seq_number) +bool load_sd_seq_sub_vel_json(uint8_t number) { - if (seq_number < 0) + if (number < 0) return (false); - seq_number = constrain(seq_number, SEQUENCE_CONFIG_MIN, SEQUENCE_CONFIG_MAX); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { File json; StaticJsonDocument data_json; char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, VELOCITY_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, VELOCITY_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1609,18 +1609,18 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) return (false); } -bool load_sd_seq_sub_patterns_json(uint8_t seq_number) +bool load_sd_seq_sub_patterns_json(uint8_t number) { - if (seq_number < 0) + if (number < 0) return (false); - seq_number = constrain(seq_number, 0, 99); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); if (sd_card > 0) { File json; StaticJsonDocument data_json; char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, PATTERN_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, PATTERN_CONFIG_NAME); // first check if file exists... AudioNoInterrupts(); @@ -1679,7 +1679,7 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) return (false); } -bool load_sd_performance_json(uint8_t seq_number) +bool load_sd_performance_json(uint8_t number) { #ifdef USE_SEQUENCER bool seq_was_running = false; @@ -1693,19 +1693,19 @@ bool load_sd_performance_json(uint8_t seq_number) dac_mute(); handleStop(); - seq_number = constrain(seq_number, 0, 99); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); AudioNoInterrupts(); - load_sd_seq_sub_patterns_json(seq_number); - load_sd_seq_sub_vel_json(seq_number); - load_sd_fx_json(seq_number); - load_sd_epiano_json(seq_number); + load_sd_seq_sub_patterns_json(number); + load_sd_seq_sub_vel_json(number); + load_sd_fx_json(number); + load_sd_epiano_json(number); if (sd_card > 0) { File json; StaticJsonDocument data_json; char filename[CONFIG_FILENAME_LEN]; - sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, seq_number, SEQUENCER_CONFIG_NAME); + sprintf(filename, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, number, SEQUENCER_CONFIG_NAME); // first check if file exists... if (SD.exists(filename)) { @@ -1780,7 +1780,7 @@ bool load_sd_performance_json(uint8_t seq_number) Serial.print(instance_id + 1); Serial.print(F(" for sequencer")); #endif - load_sd_voiceconfig_json(seq_number, instance_id); + load_sd_voiceconfig_json(number, instance_id); load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127))); MicroDexed[instance_id]->panic(); @@ -1831,7 +1831,7 @@ bool check_sd_performance_exists(uint8_t number) if (number < 0) return (false); - number = constrain(number, 0, 99); + number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); AudioNoInterrupts(); if (sd_card > 0) { diff --git a/effect_stereo_panorama.cpp b/effect_stereo_panorama.cpp new file mode 100644 index 0000000..dc10651 --- /dev/null +++ b/effect_stereo_panorama.cpp @@ -0,0 +1,124 @@ +/* + Copyright (c) 2021 H. Wirtz + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include +#include +#include "limits.h" +#include "effect_stereo_panorama.h" + +// Written by Holger Wirtz +// 20211124 - initial version + +static const audio_block_t zeroblock = { + 0, 0, 0, { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#if AUDIO_BLOCK_SAMPLES > 16 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 32 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 48 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 64 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 80 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 96 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif +#if AUDIO_BLOCK_SAMPLES > 112 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif + } +}; + +#if !defined(_MAPFLOAT) +#define _MAPFLOAT +inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) +{ + return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} +#endif + +void AudioEffectStereoPanorama::panorama(float p) +{ + pan = mapfloat(p, -1.0, 1.0, 1.0, 0.0); +} + +void AudioEffectStereoPanorama::update(void) +{ + audio_block_t *in[2]; + audio_block_t *out[2]; + + in[0] = receiveReadOnly(0); + if (!in[0]) + in[0] = (audio_block_t*)&zeroblock; + + in[1] = receiveReadOnly(1); + if (!in[1]) + in[1] = (audio_block_t*)&zeroblock; + + out[0] = allocate(); + out[1] = allocate(); + + if (in[0] && in[1] && out[0] && out[1]) + { + arm_q15_to_float(in[0]->data, in_f[0], AUDIO_BLOCK_SAMPLES); + arm_q15_to_float(in[1]->data, in_f[1], AUDIO_BLOCK_SAMPLES); + + float fsin = arm_sin_f32(pan * PI / 2.0); + 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++) + { + *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); + } + } + + if (in[0] != (audio_block_t*)&zeroblock) + { + release(in[0]); + } + if (in[1] != (audio_block_t*)&zeroblock) + { + release(in[1]); + } + + if (out[0]) + { + transmit(out[0], 0); + release(out[0]); + } + if (out[1]) + { + transmit(out[1], 1); + release(out[1]); + } +} diff --git a/effect_stereo_panorama.h b/effect_stereo_panorama.h new file mode 100644 index 0000000..2c7d16d --- /dev/null +++ b/effect_stereo_panorama.h @@ -0,0 +1,52 @@ +/* + Copyright (c) 2021 H. Wirtz + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef effect_stereo_panorama_h_ +#define effect_stereo_panorama_h_ + +#include "Arduino.h" +#include "AudioStream.h" + +// Written by Holger Wirtz +// 20211124 - inital version + +class AudioEffectStereoPanorama : public AudioStream +{ + public: + AudioEffectStereoPanorama(void): + AudioStream(1, inputQueueArray) + { + pan = 0.5; + } + + virtual void update(void); + virtual void panorama(float p); + + private: + audio_block_t *inputQueueArray[2]; + audio_block_t *out[2]; + float in_f[2][AUDIO_BLOCK_SAMPLES]; + float pan; + const float _pseudo_log = 1048575 / (float)(1 << 20); +}; + +#endif