diff --git a/MicroDexed.ino b/MicroDexed.ino index b2c9ba7..2cca46e 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -51,219 +51,218 @@ #ifdef SGTL5000_AUDIO_ENHANCE #include "control_sgtl5000plus.h" #endif -#if defined (USE_EPIANO) +#if defined(USE_EPIANO) #include "synth_mda_epiano.h" #include #endif -#include "voices.h" // Audio engines -AudioSynthDexed* MicroDexed[NUM_DEXED]; +AudioSynthDexed* MicroDexed[NUM_DEXED]; #if defined(USE_EPIANO) -AudioSynthEPiano ep(NUM_EPIANO_VOICES); +AudioSynthEPiano ep(NUM_EPIANO_VOICES); #endif #if defined(USE_FX) -AudioSynthWaveform* chorus_modulator[NUM_DEXED]; +AudioSynthWaveform* chorus_modulator[NUM_DEXED]; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT -AudioFilterBiquad* modchorus_filter[NUM_DEXED]; +AudioFilterBiquad* modchorus_filter[NUM_DEXED]; #endif -AudioEffectModulatedDelay* modchorus[NUM_DEXED]; -AudioMixer<2>* chorus_mixer[NUM_DEXED]; -AudioMixer<2>* delay_fb_mixer[NUM_DEXED]; -AudioEffectDelay* delay_fx[NUM_DEXED]; -AudioMixer<2>* delay_mixer[NUM_DEXED]; +AudioEffectModulatedDelay* modchorus[NUM_DEXED]; +AudioMixer<2>* chorus_mixer[NUM_DEXED]; +AudioMixer<2>* delay_fb_mixer[NUM_DEXED]; +AudioEffectDelay* delay_fx[NUM_DEXED]; +AudioMixer<2>* delay_mixer[NUM_DEXED]; #endif -AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; +AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; #if defined(USE_FX) && defined(USE_EPIANO) -AudioEffectStereoPanorama ep_stereo_panorama; -AudioSynthWaveform ep_chorus_modulator; +AudioEffectStereoPanorama ep_stereo_panorama; +AudioSynthWaveform ep_chorus_modulator; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT -AudioFilterBiquad ep_modchorus_filter; +AudioFilterBiquad ep_modchorus_filter; #endif AudioEffectModulatedDelayStereo ep_modchorus; -AudioMixer<2> ep_chorus_mixer_r; -AudioMixer<2> ep_chorus_mixer_l; +AudioMixer<2> ep_chorus_mixer_r; +AudioMixer<2> ep_chorus_mixer_l; #endif -AudioMixer<2> microdexed_peak_mixer; -AudioAnalyzePeak microdexed_peak; +AudioMixer<2> microdexed_peak_mixer; +AudioAnalyzePeak microdexed_peak; #if defined(USE_FX) #if defined(USE_EPIANO) -AudioMixer<4> reverb_mixer_r; -AudioMixer<4> reverb_mixer_l; +AudioMixer<4> reverb_mixer_r; +AudioMixer<4> reverb_mixer_l; #else -AudioMixer<3> reverb_mixer_r; -AudioMixer<3> reverb_mixer_l; +AudioMixer<3> reverb_mixer_r; +AudioMixer<3> reverb_mixer_l; #endif #if defined(USE_PLATEREVERB) -AudioEffectPlateReverb reverb; +AudioEffectPlateReverb reverb; #else -AudioEffectFreeverbStereoFloat freeverb; +AudioEffectFreeverbStereoFloat freeverb; #endif #endif #if defined(USE_FX) && defined(USE_EPIANO) -AudioMixer<5> master_mixer_r; -AudioMixer<5> master_mixer_l; +AudioMixer<5> master_mixer_r; +AudioMixer<5> master_mixer_l; #else -AudioMixer<4> master_mixer_r; -AudioMixer<4> master_mixer_l; -#endif -AudioAmplifier volume_r; -AudioAmplifier volume_l; -AudioEffectStereoMono stereo2mono; -AudioAnalyzePeak master_peak_r; -AudioAnalyzePeak master_peak_l; +AudioMixer<4> master_mixer_r; +AudioMixer<4> master_mixer_l; +#endif +AudioAmplifier volume_r; +AudioAmplifier volume_l; +AudioEffectStereoMono stereo2mono; +AudioAnalyzePeak master_peak_r; +AudioAnalyzePeak master_peak_l; #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) -AudioMixer<2> audio_thru_mixer_r; -AudioMixer<2> audio_thru_mixer_l; +AudioMixer<2> audio_thru_mixer_r; +AudioMixer<2> audio_thru_mixer_l; #endif // Drumset #if NUM_DRUMS > 0 -AudioPlayArrayResmp* Drum[NUM_DRUMS]; -AudioMixer drum_mixer_r; -AudioMixer drum_mixer_l; +AudioPlayArrayResmp* Drum[NUM_DRUMS]; +AudioMixer drum_mixer_r; +AudioMixer drum_mixer_l; #ifdef USE_FX #if NUM_DRUMS < 5 -AudioMixer<4> drum_reverb_send_mixer_r; -AudioMixer<4> drum_reverb_send_mixer_l; +AudioMixer<4> drum_reverb_send_mixer_r; +AudioMixer<4> drum_reverb_send_mixer_l; #else -AudioMixer<8> drum_reverb_send_mixer_r; -AudioMixer<8> drum_reverb_send_mixer_l; +AudioMixer<8> drum_reverb_send_mixer_r; +AudioMixer<8> drum_reverb_send_mixer_l; #endif #endif #endif // Outputs #if defined(TEENSY_AUDIO_BOARD) -AudioOutputI2S i2s1; +AudioOutputI2S i2s1; #ifdef SGTL5000_AUDIO_ENHANCE -AudioControlSGTL5000Plus sgtl5000; +AudioControlSGTL5000Plus sgtl5000; #else -AudioControlSGTL5000 sgtl5000; +AudioControlSGTL5000 sgtl5000; #endif -#elif defined (I2S_AUDIO_ONLY) -AudioOutputI2S i2s1; +#elif defined(I2S_AUDIO_ONLY) +AudioOutputI2S i2s1; #elif defined(TGA_AUDIO_BOARD) -AudioOutputI2S i2s1; -AudioControlWM8731master wm8731_1; +AudioOutputI2S i2s1; +AudioControlWM8731master wm8731_1; #elif defined(PT8211_AUDIO) -AudioOutputPT8211 pt8211_1; +AudioOutputPT8211 pt8211_1; #elif defined(TEENSY_DAC_SYMMETRIC) -AudioOutputAnalogStereo dacOut; -AudioMixer<4> invMixer; +AudioOutputAnalogStereo dacOut; +AudioMixer<4> invMixer; #elif defined(TEENSY_DAC) -AudioOutputAnalogStereo dacOut; +AudioOutputAnalogStereo dacOut; #endif #ifdef AUDIO_DEVICE_USB -AudioOutputUSB usb1; +AudioOutputUSB usb1; #endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) -AudioInputI2S i2s1in; +AudioInputI2S i2s1in; #endif // // Static patching of audio objects // AudioConnection patchCord[] = { - // Audio chain tail +// Audio chain tail #if defined(USE_FX) #ifdef USE_PLATEREVERB - {reverb_mixer_r, 0, reverb, 0}, - {reverb_mixer_l, 0, reverb, 1}, - {reverb, 0, master_mixer_r, MASTER_MIX_CH_REVERB}, - {reverb, 1, master_mixer_l, MASTER_MIX_CH_REVERB}, + { reverb_mixer_r, 0, reverb, 0 }, + { reverb_mixer_l, 0, reverb, 1 }, + { 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, MASTER_MIX_CH_REVERB}, - {freeverb, 1, master_mixer_l, MASTER_MIX_CH_REVERB}, + { reverb_mixer_r, 0, freeverb, 0 }, + { reverb_mixer_l, 0, freeverb, 1 }, + { 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}, - {master_mixer_l, volume_l}, - {volume_r, 0, stereo2mono, 0}, - {volume_l, 0, stereo2mono, 1}, - {stereo2mono, 0, master_peak_r, 0}, - {stereo2mono, 0, master_peak_l, 0}, + { master_mixer_r, volume_r }, + { master_mixer_l, volume_l }, + { volume_r, 0, stereo2mono, 0 }, + { volume_l, 0, stereo2mono, 1 }, + { stereo2mono, 0, master_peak_r, 0 }, + { stereo2mono, 0, master_peak_l, 0 }, - // Outputs +// Outputs #if defined(TEENSY_AUDIO_BOARD) #ifndef SGTL5000_AUDIO_THRU - {stereo2mono, 0, i2s1, 0}, - {stereo2mono, 1, i2s1, 1}, + { stereo2mono, 0, i2s1, 0 }, + { stereo2mono, 1, i2s1, 1 }, #endif -#elif defined (I2S_AUDIO_ONLY) - {stereo2mono, 0, i2s1, 0}, - {stereo2mono, 1, i2s1, 1}, +#elif defined(I2S_AUDIO_ONLY) + { stereo2mono, 0, i2s1, 0 }, + { stereo2mono, 1, i2s1, 1 }, #elif defined(TGA_AUDIO_BOARD) - {stereo2mono, 0, i2s1, 0}, - {stereo2mono, 1, i2s1, 1}, + { stereo2mono, 0, i2s1, 0 }, + { stereo2mono, 1, i2s1, 1 }, #elif defined(PT8211_AUDIO) - {stereo2mono, 0, pt8211_1, 0}, - {stereo2mono, 1, pt8211_1, 1}, + { stereo2mono, 0, pt8211_1, 0 }, + { stereo2mono, 1, pt8211_1, 1 }, #elif defined(TEENSY_DAC_SYMMETRIC) - {stereo2mono, 0, dacOut , 0}, - {stereo2mono, 1, invMixer, 0}, - {invMixer, 0, dacOut , 1}, + { stereo2mono, 0, dacOut, 0 }, + { stereo2mono, 1, invMixer, 0 }, + { invMixer, 0, dacOut, 1 }, #elif defined(TEENSY_DAC) - {stereo2mono, 0, dacOut, 0}, - {stereo2mono, 1, dacOut, 1}, + { stereo2mono, 0, dacOut, 0 }, + { stereo2mono, 1, dacOut, 1 }, #endif #ifdef AUDIO_DEVICE_USB - {stereo2mono, 0, usb1, 0}, - {stereo2mono, 1, usb1, 1}, + { stereo2mono, 0, usb1, 0 }, + { stereo2mono, 1, usb1, 1 }, #endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) - {stereo2mono, 0, audio_thru_mixer_r, 0}, - {stereo2mono, 1, audio_thru_mixer_l, 0}, - {i2s1in, 0, audio_thru_mixer_r, 1}, - {i2s1in, 1, audio_thru_mixer_l, 1}, - {audio_thru_mixer_r, 0, i2s1, 0}, - {audio_thru_mixer_l, 0, i2s1, 1}, + { stereo2mono, 0, audio_thru_mixer_r, 0 }, + { stereo2mono, 1, audio_thru_mixer_l, 0 }, + { i2s1in, 0, audio_thru_mixer_r, 1 }, + { i2s1in, 1, audio_thru_mixer_l, 1 }, + { audio_thru_mixer_r, 0, i2s1, 0 }, + { audio_thru_mixer_l, 0, i2s1, 1 }, #endif #if NUM_DRUMS > 0 #ifdef USE_FX - {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}, + { 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, MASTER_MIX_CH_DRUMS}, - {drum_mixer_l, 0, master_mixer_l, MASTER_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 }, #endif #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, 0}, - {ep_stereo_panorama, 1, ep_modchorus, 1}, + { ep_stereo_panorama, 0, ep_chorus_mixer_r, 0 }, + { ep_stereo_panorama, 1, ep_chorus_mixer_l, 0 }, + { ep_stereo_panorama, 0, ep_modchorus, 0 }, + { ep_stereo_panorama, 1, ep_modchorus, 1 }, #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT - {ep_chorus_modulator, 0, ep_modchorus_filter, 0}, - {ep_modchorus_filter, 0, ep_modchorus, 2}, + { ep_chorus_modulator, 0, ep_modchorus_filter, 0 }, + { ep_modchorus_filter, 0, ep_modchorus, 2 }, #else - {ep_chorus_modulator, 0, ep_modchorus, 2}, -#endif - {ep_modchorus, 0, ep_chorus_mixer_r, 1}, - {ep_modchorus, 1, 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_chorus_mixer_r, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, - {ep_chorus_mixer_l, 0, master_mixer_l, MASTER_MIX_CH_EPIANO}, + { ep_chorus_modulator, 0, ep_modchorus, 2 }, +#endif + { ep_modchorus, 0, ep_chorus_mixer_r, 1 }, + { ep_modchorus, 1, 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_chorus_mixer_r, 0, master_mixer_r, MASTER_MIX_CH_EPIANO }, + { ep_chorus_mixer_l, 0, master_mixer_l, MASTER_MIX_CH_EPIANO }, #else - {ep_stereo_panorama, 0, master_mixer_r, MASTER_MIX_CH_EPIANO}, - {ep_stereo_panorama, 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 }; @@ -273,14 +272,13 @@ AudioConnection patchCord[] = { // uint8_t nDynamic = 0; #if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT -AudioConnection* dynamicConnections[NUM_DEXED * 16 + NUM_DRUMS * 4 ]; +AudioConnection* dynamicConnections[NUM_DEXED * 16 + NUM_DRUMS * 4]; #elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 4]; #else AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 2]; #endif -FLASHMEM void create_audio_dexed_chain(uint8_t instance_id) -{ +FLASHMEM void create_audio_dexed_chain(uint8_t instance_id) { MicroDexed[instance_id] = new AudioSynthDexed(MAX_NOTES / NUM_DEXED, SAMPLE_RATE); mono2stereo[instance_id] = new AudioEffectMonoStereo(); #if defined(USE_FX) @@ -298,7 +296,7 @@ FLASHMEM void create_audio_dexed_chain(uint8_t instance_id) dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, microdexed_peak_mixer, instance_id); #if defined(USE_FX) dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *chorus_mixer[instance_id], 0); - dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *modchorus[instance_id], 0); ////////////////////// + dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *modchorus[instance_id], 0); ////////////////////// #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT dynamicConnections[nDynamic++] = new AudioConnection(*chorus_modulator[instance_id], 0, *modchorus_filter[instance_id], 0); dynamicConnections[nDynamic++] = new AudioConnection(*modchorus_filter[instance_id], 0, *modchorus[instance_id], 1); @@ -330,8 +328,7 @@ FLASHMEM void create_audio_dexed_chain(uint8_t instance_id) // Dynamic patching of Drum objects // #if NUM_DRUMS > 0 -FLASHMEM void create_audio_drum_chain(uint8_t instance_id) -{ +FLASHMEM void create_audio_drum_chain(uint8_t instance_id) { //Drum[instance_id] = new AudioPlayMemory(); Drum[instance_id] = new AudioPlayArrayResmp(); Drum[instance_id]->enableInterpolation(false); @@ -349,7 +346,7 @@ FLASHMEM void create_audio_drum_chain(uint8_t instance_id) uint8_t sd_card = 0; Sd2Card card; SdVolume volume; -const float midi_ticks_factor[10] = {0.0, 0.25, 0.375, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0 , 4.0}; +const float midi_ticks_factor[10] = { 0.0, 0.25, 0.375, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 4.0 }; uint8_t midi_bpm_counter = 0; uint8_t midi_bpm = 0; int16_t _midi_bpm = -1; @@ -380,15 +377,15 @@ char receive_bank_filename[FILENAME_LEN]; uint8_t selected_instance_id = 0; uint8_t seq_UI_last_step = 0; #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) -#if NUM_DEXED>1 -int8_t midi_decay[NUM_DEXED] = { -1, -1}; +#if NUM_DEXED > 1 +int8_t midi_decay[NUM_DEXED] = { -1, -1 }; #else -int8_t midi_decay[NUM_DEXED] = { -1}; +int8_t midi_decay[NUM_DEXED] = { -1 }; #endif elapsedMillis midi_decay_timer; #endif -#if NUM_DEXED>1 +#if NUM_DEXED > 1 int perform_attack_mod[NUM_DEXED] = { 0, 0 }; int perform_release_mod[NUM_DEXED] = { 0, 0 }; #else @@ -421,12 +418,11 @@ extern void getNoteName(char* noteName, uint8_t noteNumber); /*********************************************************************** SETUP ***********************************************************************/ -void setup() -{ +void setup() { #ifdef DEBUG Serial.begin(SERIAL_SPEED); #else - delay(50); // seems to be needed when no serial debugging is enabled + delay(50); // seems to be needed when no serial debugging is enabled #endif #ifdef ENABLE_LCD_UI @@ -478,7 +474,7 @@ void setup() //sgtl5000.dacVolumeRampDisable(); sgtl5000.unmuteHeadphone(); sgtl5000.unmuteLineout(); - sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume + sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume #ifdef SGTL5000_AUDIO_THRU //sgtl5000.audioPreProcessorEnable(); sgtl5000.inputSelect(AUDIO_INPUT_LINEIN); @@ -527,18 +523,16 @@ void setup() #endif // create dynamic Dexed instances - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { #ifdef DEBUG Serial.print(F("Creating MicroDexed instance ")); Serial.println(instance_id, DEC); #endif create_audio_dexed_chain(instance_id); - MicroDexed[instance_id]->setCompressor(true); // just a test for enabling the compressor with default values + MicroDexed[instance_id]->setCompressor(true); // just a test for enabling the compressor with default values } #ifdef DEBUG - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { Serial.print(F("Instance ")); Serial.print(instance_id); Serial.print(F(": ")); @@ -550,8 +544,7 @@ void setup() // Setup (PROGMEM) sample drums #if NUM_DRUMS > 0 // create dynamic Drum instances - for (uint8_t instance_id = 0; instance_id < NUM_DRUMS; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DRUMS; instance_id++) { #ifdef DEBUG Serial.print(F("Creating Drum instance ")); Serial.println(instance_id, DEC); @@ -572,28 +565,28 @@ void setup() #if defined(USE_EPIANO) // EP_CHORUS ep_delayline_r = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (ep_delayline_r == NULL) - { + if (ep_delayline_r == NULL) { #ifdef DEBUG Serial.println(F("AudioEffectModulatedDelay R - memory allocation failed EP")); #endif - while (1); + while (1) + ; } ep_delayline_l = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (ep_delayline_l == NULL) - { + if (ep_delayline_l == NULL) { #ifdef DEBUG Serial.println(F("AudioEffectModulatedDelay L - memory allocation failed EP")); #endif - while (1); + while (1) + ; } - if (!ep_modchorus.begin(ep_delayline_r, ep_delayline_l, MOD_DELAY_SAMPLE_BUFFER)) - { + if (!ep_modchorus.begin(ep_delayline_r, ep_delayline_l, MOD_DELAY_SAMPLE_BUFFER)) { #ifdef DEBUG Serial.println(F("AudioEffectModulatedDelayStereo - begin failed EP")); #endif - while (1); + while (1) + ; } #if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT @@ -616,30 +609,27 @@ void setup() // Setup effects #if defined(USE_FX) - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { delayline[instance_id] = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (delayline[instance_id] != NULL) - { + if (delayline[instance_id] != NULL) { memset(delayline[instance_id], 0, MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t)); - if (!modchorus[instance_id]->begin(delayline[instance_id], MOD_DELAY_SAMPLE_BUFFER)) - { + if (!modchorus[instance_id]->begin(delayline[instance_id], MOD_DELAY_SAMPLE_BUFFER)) { #ifdef DEBUG Serial.print(F("AudioEffectModulatedDelay - begin failed [")); Serial.print(instance_id); Serial.println(F("]")); #endif - while (1); + while (1) + ; } - } - else - { + } else { #ifdef DEBUG Serial.print(F("AudioEffectModulatedDelay - memory allocation failed [")); Serial.print(instance_id); Serial.println(F("]")); #endif - while (1); + while (1) + ; } } #ifdef DEBUG @@ -652,18 +642,14 @@ void setup() // Start SD card sd_card = check_sd_cards(); - if (sd_card < 1) - { + if (sd_card < 1) { #ifdef DEBUG Serial.println(F("SD card not accessable.")); #endif - } - else - { + } else { check_and_create_directories(); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { // load default SYSEX data //load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id); memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); @@ -681,8 +667,7 @@ void setup() // Load voices #ifdef DEBUG - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { Serial.print(F("Dexed instance ")); Serial.print(instance_id); Serial.println(F(":")); @@ -701,14 +686,13 @@ void setup() Serial.println(F("ms)")); #endif -#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) +#if defined(DEBUG) && defined(SHOW_CPU_LOAD_MSEC) show_cpu_and_mem_usage(); #endif // Init master_mixer #if NUM_DEXED > 1 - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { master_mixer_r.gain(instance_id, VOL_MAX_FLOAT); master_mixer_l.gain(instance_id, VOL_MAX_FLOAT); } @@ -723,7 +707,7 @@ void setup() #if NUM_DRUMS > 0 master_mixer_r.gain(MASTER_MIX_CH_DRUMS, VOL_MAX_FLOAT); master_mixer_l.gain(MASTER_MIX_CH_DRUMS, VOL_MAX_FLOAT); - configuration.drums.vol = VOL_MAX_FLOAT; + configuration.drums.vol = DRUMS_MAIN_VOL_MAX; #else master_mixer_r.gain(MASTER_MIX_CH_DRUMS, 0.0); master_mixer_l.gain(MASTER_MIX_CH_DRUMS, 0.0); @@ -734,11 +718,11 @@ void setup() #endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) - audio_thru_mixer_r.gain(0, VOL_MAX_FLOAT); // MD signal sum - audio_thru_mixer_l.gain(0, VOL_MAX_FLOAT); // MD signal sum + audio_thru_mixer_r.gain(0, VOL_MAX_FLOAT); // MD signal sum + audio_thru_mixer_l.gain(0, VOL_MAX_FLOAT); // MD signal sum #ifdef TEENSY_AUDIO_BOARD - audio_thru_mixer_r.gain(1, VOL_MAX_FLOAT); // I2S input - audio_thru_mixer_l.gain(1, VOL_MAX_FLOAT); // I2S input + audio_thru_mixer_r.gain(1, VOL_MAX_FLOAT); // I2S input + audio_thru_mixer_l.gain(1, VOL_MAX_FLOAT); // I2S input #else audio_thru_mixer_r.gain(1, 0.0); audio_thru_mixer_l.gain(1, 0.0); @@ -759,8 +743,7 @@ void setup() LCDML.OTHER_jumpToFunc(UI_func_voice_select); } -void loop() -{ +void loop() { // MIDI input handling check_midi_devices(); @@ -773,84 +756,66 @@ void loop() #endif // CONTROL-RATE-EVENT-HANDLING - if (control_rate > CONTROL_RATE_MS) - { + if (control_rate > CONTROL_RATE_MS) { control_rate = 0; // check for value changes, unused voices and CPU overload - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { active_voices[instance_id] = MicroDexed[instance_id]->getNumNotesPlaying(); if (active_voices[instance_id] == 0) midi_voices[instance_id] = 0; } - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) - { - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) - if (midi_decay_timer > MIDI_DECAY_TIMER && midi_decay[instance_id] > 0) - { + if (midi_decay_timer > MIDI_DECAY_TIMER && midi_decay[instance_id] > 0) { midi_decay[instance_id]--; display.createChar(6 + instance_id, (uint8_t*)special_chars[15 - (7 - midi_decay[instance_id])]); display.setCursor(14 + instance_id, 1); display.write(6 + instance_id); - } - else if (midi_voices[instance_id] == 0 && midi_decay[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) - { + } else if (midi_voices[instance_id] == 0 && midi_decay[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) { midi_decay[instance_id]--; display.setCursor(14 + instance_id, 1); - display.write(20); // blank + display.write(20); // blank } #else static bool midi_playing[NUM_DEXED]; - if (midi_voices[instance_id] > 0 && midi_playing[instance_id] == false) - { + if (midi_voices[instance_id] > 0 && midi_playing[instance_id] == false) { midi_playing[instance_id] = true; display.setCursor(14 + instance_id, 1); display.write(6 + instance_id); - } - else if (midi_voices[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) - { + } else if (midi_voices[instance_id] == 0 && !MicroDexed[instance_id]->getSustain()) { midi_playing[instance_id] = false; display.setCursor(14 + instance_id, 1); - display.write(20); // blank + display.write(20); // blank } #endif } #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) - if (midi_decay_timer > MIDI_DECAY_LEVEL_TIME) - { + if (midi_decay_timer > MIDI_DECAY_LEVEL_TIME) { midi_decay_timer = 0; } #endif } - } - else + } else yield(); // SAVE-SYS-EVENT-HANDLING - if (save_sys > SAVE_SYS_MS && save_sys_flag == true) - { + if (save_sys > SAVE_SYS_MS && save_sys_flag == true) { #ifdef DEBUG Serial.println(F("Check if we can save configuration.sys")); #endif bool instance_is_playing = false; - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (active_voices[instance_id] > 0) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (active_voices[instance_id] > 0) { instance_is_playing = true; break; } } - if (instance_is_playing == false) - { - for (uint8_t instance_id = 0; instance_id < NUM_DRUMS; instance_id++) - { - if (Drum[instance_id]->isPlaying()) - { + if (instance_is_playing == false) { + for (uint8_t instance_id = 0; instance_id < NUM_DRUMS; instance_id++) { + if (Drum[instance_id]->isPlaying()) { instance_is_playing = true; break; } @@ -858,8 +823,7 @@ void loop() } if (instance_is_playing == false) save_sd_sys_json(); - else - { + else { #ifdef DEBUG Serial.println(F("System is playing, next try...")); #endif @@ -867,17 +831,15 @@ void loop() } } -#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) - if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) - { +#if defined(DEBUG) && defined(SHOW_CPU_LOAD_MSEC) + if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) { if (master_peak_r.available()) if (master_peak_r.read() == 1.0) peak_r++; if (master_peak_l.available()) if (master_peak_l.read() == 1.0) peak_l++; - if (microdexed_peak.available()) - { + if (microdexed_peak.available()) { peak_dexed_value = microdexed_peak.read(); if (peak_dexed_value > 0.99) peak_dexed++; @@ -891,15 +853,11 @@ void loop() /****************************************************************************** MIDI HELPER ******************************************************************************/ -bool checkMidiChannel(byte inChannel, uint8_t instance_id) -{ +bool checkMidiChannel(byte inChannel, uint8_t instance_id) { // check for MIDI channel - if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI) - { + if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI) { return (true); - } - else if (inChannel != configuration.dexed[instance_id].midi_channel) - { + } else if (inChannel != configuration.dexed[instance_id].midi_channel) { #ifdef DEBUG Serial.print(F("INSTANCE ")); Serial.print(instance_id, DEC); @@ -914,8 +872,7 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id) return (true); } -void init_MIDI_send_CC(void) -{ +void init_MIDI_send_CC(void) { #ifdef DEBUG Serial.println(F("init_MIDI_send_CC():")); #endif @@ -934,22 +891,17 @@ void init_MIDI_send_CC(void) /****************************************************************************** MIDI MESSAGE HANDLER ******************************************************************************/ -void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) -{ +void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { // Check for MicroDexed - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { - if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { + if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) { if (configuration.dexed[instance_id].polyphony > 0) - MicroDexed[instance_id]->keydown(inNumber, uint8_t(float(configuration.dexed[instance_id].velocity_level / 127.0)*inVelocity + 0.5)); + MicroDexed[instance_id]->keydown(inNumber, uint8_t(float(configuration.dexed[instance_id].velocity_level / 127.0) * inVelocity + 0.5)); midi_voices[instance_id]++; #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { midi_decay_timer = 0; midi_decay[instance_id] = min(inVelocity / 5, 7); } @@ -971,8 +923,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) #if NUM_DRUMS > 0 // Check for Drum - if (inChannel == drum_midi_channel || drum_midi_channel == MIDI_CHANNEL_OMNI) - { + if (inChannel == drum_midi_channel || drum_midi_channel == MIDI_CHANNEL_OMNI) { if (drum_counter >= NUM_DRUMS) drum_counter = 0; @@ -985,10 +936,8 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) Serial.println(note_name); #endif - for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG; d++) - { - if (inNumber == drum_config[d].midinote) - { + for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG; d++) { + if (inNumber == drum_config[d].midinote) { uint8_t slot = drum_get_slot(drum_config[d].drum_class); float pan = mapfloat(drum_config[d].pan, -1.0, 1.0, 0.0, 1.0); @@ -998,11 +947,9 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * volume_transform(drum_config[d].reverb_send)); drum_reverb_send_mixer_l.gain(slot, pan * volume_transform(drum_config[d].reverb_send)); #endif - if (drum_config[d].drum_data != NULL && drum_config[d].len > 0) - { + if (drum_config[d].drum_data != NULL && drum_config[d].len > 0) { //Drum[slot]->play(drum_config[d].drum_data); - if (drum_config[d].pitch != 0.0) - { + if (drum_config[d].pitch != 0.0) { Drum[slot]->enableInterpolation(true); Drum[slot]->setPlaybackRate(drum_config[d].pitch); } @@ -1035,10 +982,8 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) // E-Piano // #if defined(USE_EPIANO) - if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) - { - if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) - { + if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) { + if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) { ep.noteOn(inNumber + configuration.epiano.transpose - 24, inVelocity); #ifdef DEBUG char note_name[4]; @@ -1056,12 +1001,9 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) } #if NUM_DRUMS > 0 -uint8_t drum_get_slot(uint8_t dt) -{ - for (uint8_t i = 0; i < NUM_DRUMS; i++) - { - if (!Drum[i]->isPlaying()) - { +uint8_t drum_get_slot(uint8_t dt) { + for (uint8_t i = 0; i < NUM_DRUMS; i++) { + if (!Drum[i]->isPlaying()) { drum_type[i] = DRUM_NONE; Drum[i]->enableInterpolation(false); Drum[i]->setPlaybackRate(1.0); @@ -1092,14 +1034,10 @@ uint8_t drum_get_slot(uint8_t dt) } #endif -void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) -{ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { - if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) - { +void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { + if (inNumber >= configuration.dexed[instance_id].lowest_note && inNumber <= configuration.dexed[instance_id].highest_note) { if (configuration.dexed[instance_id].polyphony > 0) MicroDexed[instance_id]->keyup(inNumber); @@ -1120,10 +1058,8 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) } #if defined(USE_EPIANO) - if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) - { - if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) - { + if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) { + if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) { ep.noteOff(inNumber + configuration.epiano.transpose - 24); #ifdef DEBUG char note_name[4]; @@ -1140,15 +1076,12 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) #endif } -void handleControlChange(byte inChannel, byte inCtrl, byte inValue) -{ +void handleControlChange(byte inChannel, byte inCtrl, byte inValue) { inCtrl = constrain(inCtrl, 0, 127); inValue = constrain(inValue, 0, 127); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { #ifdef DEBUG Serial.print(F("INSTANCE ")); Serial.print(instance_id, DEC); @@ -1159,11 +1092,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif switch (inCtrl) { - case 0: // BankSelect MSB + case 0: // BankSelect MSB #ifdef DEBUG Serial.println(F("BANK-SELECT MSB CC")); #endif - configuration.dexed[instance_id].bank = constrain((inValue << 7)&configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1); + configuration.dexed[instance_id].bank = constrain((inValue << 7) & configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1); /* load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id); if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { @@ -1192,35 +1125,33 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) MicroDexed[instance_id]->setFootController(inValue); MicroDexed[instance_id]->ControllersRefresh(); break; - case 5: // Portamento time + case 5: // Portamento time configuration.dexed[instance_id].portamento_time = inValue; MicroDexed[instance_id]->setPortamentoTime(configuration.dexed[instance_id].portamento_time); break; - case 7: // Instance Volume + case 7: // Instance Volume #ifdef DEBUG Serial.println(F("VOLUME CC")); #endif configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 127, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127))); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } break; - case 10: // Pan + case 10: // Pan #ifdef DEBUG Serial.println(F("PANORAMA CC")); #endif configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_panorama)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_panorama)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } break; - case 32: // BankSelect LSB + case 32: // BankSelect LSB #ifdef DEBUG Serial.println(F("BANK-SELECT LSB CC")); #endif @@ -1250,8 +1181,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) break; case 65: MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1260,8 +1190,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) configuration.dexed[selected_instance_id].tune = map(inValue, 0, 0x7f, TUNE_MIN, TUNE_MAX); MicroDexed[selected_instance_id]->setMasterTune((int((configuration.dexed[selected_instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12)); MicroDexed[selected_instance_id]->doRefreshVoice(); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_tune)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_tune)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1271,8 +1200,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) configuration.fx.reverb_send[selected_instance_id] = map(inValue, 0, 0x7f, REVERB_SEND_MIN, REVERB_SEND_MAX); reverb_mixer_r.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT))); reverb_mixer_l.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT))); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_reverb_send)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_reverb_send)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1280,8 +1208,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) case 93: // CC 93: chorus level configuration.fx.chorus_level[selected_instance_id] = map(inValue, 0, 0x7f, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); chorus_mixer[selected_instance_id]->gain(1, volume_transform(mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5))); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_chorus_level)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_chorus_level)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1289,17 +1216,16 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) case 103: // CC 103: filter resonance configuration.fx.filter_resonance[instance_id] = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); MicroDexed[instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0)); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_resonance)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_resonance)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } break; case 104: // CC 104: filter cutoff configuration.fx.filter_cutoff[instance_id] = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); - MicroDexed[instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0));; - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_cutoff)) - { + MicroDexed[instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0)); + ; + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_cutoff)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1307,17 +1233,15 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) case 105: // CC 105: delay time configuration.fx.delay_time[instance_id] = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id] * 10, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10)); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_time)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_time)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } break; case 106: // CC 106: delay feedback - configuration.fx.delay_feedback[instance_id] = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); - delay_fb_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback)) - { + configuration.fx.delay_feedback[instance_id] = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); + delay_fb_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1325,8 +1249,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) case 107: // CC 107: delay volume configuration.fx.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); delay_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0, 127))); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1363,40 +1286,30 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif } -void handleAfterTouch(byte inChannel, byte inPressure) -{ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { +void handleAfterTouch(byte inChannel, byte inPressure) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { MicroDexed[instance_id]->setAftertouch(inPressure); MicroDexed[instance_id]->ControllersRefresh(); } } } -void handlePitchBend(byte inChannel, int inPitch) -{ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { +void handlePitchBend(byte inChannel, int inPitch) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { MicroDexed[instance_id]->setPitchbend(inPitch); } } } -void handleProgramChange(byte inChannel, byte inProgram) -{ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (checkMidiChannel(inChannel, instance_id)) - { +void handleProgramChange(byte inChannel, byte inProgram) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (checkMidiChannel(inChannel, instance_id)) { configuration.dexed[instance_id].voice = constrain(inProgram, 0, MAX_VOICES - 1); load_sd_voice(configuration.dexed[instance_id].bank, configuration.dexed[instance_id].voice, instance_id); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1404,14 +1317,11 @@ void handleProgramChange(byte inChannel, byte inProgram) } } -void handleSystemExclusive(byte * sysex, unsigned int len) -{ +void handleSystemExclusive(byte* sysex, unsigned int len) { int16_t sysex_return; - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (!checkMidiChannel((sysex[2] & 0x0f) + 1 , instance_id)) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (!checkMidiChannel((sysex[2] & 0x0f) + 1, instance_id)) { #ifdef DEBUG Serial.print(F("INSTANCE ")); Serial.print(instance_id, DEC); @@ -1426,8 +1336,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) Serial.println(F("]")); Serial.println(F("SysEx data:")); - for (uint16_t i = 0; i < len; i++) - { + for (uint16_t i = 0; i < len; i++) { Serial.print(F("[0x")); uint8_t s = sysex[i]; if (s < 16) @@ -1453,8 +1362,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) Serial.println(); #endif - switch (sysex_return) - { + switch (sysex_return) { case -1: #ifdef DEBUG Serial.println(F("E: SysEx end status byte not detected.")); @@ -1539,13 +1447,11 @@ void handleSystemExclusive(byte * sysex, unsigned int len) Serial.print(F(" Value : ")); Serial.println(sysex[5], DEC); #endif - switch (sysex[4]) - { + switch (sysex[4]) { case 65: configuration.dexed[instance_id].pb_range = constrain(sysex[5], PB_RANGE_MIN, PB_RANGE_MAX); MicroDexed[instance_id]->setPitchbendRange(configuration.dexed[instance_id].pb_range); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_range)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_range)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1553,8 +1459,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 66: configuration.dexed[instance_id].pb_step = constrain(sysex[5], PB_STEP_MIN, PB_STEP_MAX); MicroDexed[instance_id]->setPitchbendRange(configuration.dexed[instance_id].pb_step); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_step)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_step)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1562,8 +1467,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 67: configuration.dexed[instance_id].portamento_mode = constrain(sysex[5], PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1571,8 +1475,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 68: configuration.dexed[instance_id].portamento_glissando = constrain(sysex[5], PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); MicroDexed[instance_id]->setPortamentoGlissando(configuration.dexed[instance_id].portamento_glissando); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_glissando)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_glissando)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1580,8 +1483,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 69: configuration.dexed[instance_id].portamento_time = constrain(sysex[5], PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); MicroDexed[instance_id]->setPortamentoTime(configuration.dexed[instance_id].portamento_time); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_time)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_time)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1589,8 +1491,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 70: configuration.dexed[instance_id].mw_range = constrain(sysex[5], MW_RANGE_MIN, MW_RANGE_MAX); MicroDexed[instance_id]->setModWheelRange(configuration.dexed[instance_id].mw_range); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_range)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_range)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1598,8 +1499,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 71: configuration.dexed[instance_id].mw_assign = constrain(sysex[5], MW_ASSIGN_MIN, MW_ASSIGN_MAX); MicroDexed[instance_id]->setModWheelTarget(configuration.dexed[instance_id].mw_assign); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_assign)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_assign)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1607,8 +1507,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 72: configuration.dexed[instance_id].fc_range = constrain(sysex[5], FC_RANGE_MIN, FC_RANGE_MAX); MicroDexed[instance_id]->setFootControllerRange(configuration.dexed[instance_id].fc_range); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_range)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_range)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1616,8 +1515,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 73: configuration.dexed[instance_id].fc_assign = constrain(sysex[5], FC_ASSIGN_MIN, FC_ASSIGN_MAX); MicroDexed[instance_id]->setFootControllerTarget(configuration.dexed[instance_id].fc_assign); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_assign)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_assign)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1625,8 +1523,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 74: configuration.dexed[instance_id].bc_range = constrain(sysex[5], BC_RANGE_MIN, BC_RANGE_MAX); MicroDexed[instance_id]->setBreathControllerRange(configuration.dexed[instance_id].bc_range); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_range)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_range)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1634,8 +1531,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 75: configuration.dexed[instance_id].bc_assign = constrain(sysex[5], BC_ASSIGN_MIN, BC_ASSIGN_MAX); MicroDexed[instance_id]->setBreathControllerTarget(configuration.dexed[instance_id].bc_assign); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_assign)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_assign)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1643,8 +1539,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 76: configuration.dexed[instance_id].at_range = constrain(sysex[5], AT_RANGE_MIN, AT_RANGE_MAX); MicroDexed[instance_id]->setAftertouchRange(configuration.dexed[instance_id].at_range); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_range)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_range)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1652,8 +1547,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) case 77: configuration.dexed[instance_id].at_assign = constrain(sysex[5], AT_ASSIGN_MIN, AT_ASSIGN_MAX); MicroDexed[instance_id]->setAftertouchTarget(configuration.dexed[instance_id].at_assign); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_assign)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_assign)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } @@ -1662,9 +1556,8 @@ void handleSystemExclusive(byte * sysex, unsigned int len) break; case 100: // fix voice name - for (uint8_t i = 0; i < 10; i++) - { - if (sysex[151 + i] > 126) // filter characters + for (uint8_t i = 0; i < 10; i++) { + if (sysex[151 + i] > 126) // filter characters sysex[151 + i] = 32; } @@ -1677,20 +1570,17 @@ void handleSystemExclusive(byte * sysex, unsigned int len) #endif strncpy(g_voice_name[instance_id], (char*)&sysex[151], VOICE_NAME_LEN - 1); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { LCDML.OTHER_updateFunc(); LCDML.loop_menu(); } break; case 200: - if (strlen(receive_bank_filename) > 0 && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sysex_receive_bank)) - { + if (strlen(receive_bank_filename) > 0 && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sysex_receive_bank)) { #ifdef DEBUG Serial.println(F("Bank bulk upload.")); #endif - if (save_sd_bank(receive_bank_filename, sysex)) - { + if (save_sd_bank(receive_bank_filename, sysex)) { #ifdef DEBUG Serial.print(F("Bank saved as [")); Serial.print(receive_bank_filename); @@ -1700,9 +1590,7 @@ void handleSystemExclusive(byte * sysex, unsigned int len) display.print(F("Done. ")); delay(MESSAGE_WAIT_TIME); LCDML.FUNC_goBackToMenu(); - } - else - { + } else { #ifdef DEBUG Serial.println(F("Error during saving bank as [")); Serial.print(receive_bank_filename); @@ -1742,34 +1630,27 @@ void handleSystemExclusive(byte * sysex, unsigned int len) } } -void handleTimeCodeQuarterFrame(byte data) -{ +void handleTimeCodeQuarterFrame(byte data) { ; } -void handleAfterTouchPoly(byte inChannel, byte inNumber, byte inVelocity) -{ +void handleAfterTouchPoly(byte inChannel, byte inNumber, byte inVelocity) { ; } -void handleSongSelect(byte inSong) -{ +void handleSongSelect(byte inSong) { ; } -void handleTuneRequest(void) -{ +void handleTuneRequest(void) { ; } -void handleClock(void) -{ - if (midi_bpm_counter % 24 == 0) - { +void handleClock(void) { + if (midi_bpm_counter % 24 == 0) { midi_bpm = (60000.0f / float(midi_bpm_timer) + 0.5); - if (_midi_bpm > -1 && _midi_bpm != midi_bpm) - { + if (_midi_bpm > -1 && _midi_bpm != midi_bpm) { #ifdef DEBUG Serial.print(F("MIDI Clock: ")); Serial.print(midi_bpm); @@ -1790,10 +1671,8 @@ void handleClock(void) 8 1/2T = 72 ticks / 0.75 9 1/1 = 96 ticks / 1.0 */ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - if (configuration.fx.delay_sync[instance_id] > 0) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (configuration.fx.delay_sync[instance_id] > 0) { uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / float(midi_bpm) + 0.5); delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN * 10, DELAY_TIME_MAX * 10)); #ifdef DEBUG @@ -1816,35 +1695,29 @@ void handleClock(void) midi_bpm_counter++; } -void handleStart(void) -{ +void handleStart(void) { midi_bpm_timer = 0; midi_bpm_counter = 0; _midi_bpm = -1; } -void handleContinue(void) -{ +void handleContinue(void) { ; } -void handleStop(void) -{ +void handleStop(void) { MicroDexed[0]->panic(); #if NUM_DEXED > 1 MicroDexed[1]->panic(); #endif } -void handleActiveSensing(void) -{ +void handleActiveSensing(void) { ; } -void handleSystemReset(void) -{ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { +void handleSystemReset(void) { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { #ifdef DEBUG Serial.println(F("MIDI SYSEX RESET")); #endif @@ -1857,27 +1730,23 @@ void handleSystemReset(void) /****************************************************************************** VOLUME HELPER ******************************************************************************/ -void dac_mute(void) -{ +void dac_mute(void) { sgtl5000.lineOutLevel(0.0); sgtl5000.dacVolume(0.0); - sgtl5000.volume(0.0, 0.0); // Headphone volume + sgtl5000.volume(0.0, 0.0); // Headphone volume } -void dac_unmute(void) -{ +void dac_unmute(void) { sgtl5000.lineOutLevel(SGTL5000_LINEOUT_LEVEL); sgtl5000.dacVolume(1.0); - sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume + sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume } -void set_drums_volume(float vol) -{ +void set_drums_volume(float 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) -{ +void set_volume(uint8_t v, uint8_t m) { float tmp_v; configuration.sys.vol = v; @@ -1895,28 +1764,27 @@ void set_volume(uint8_t v, uint8_t m) Serial.println(volume_transform(tmp_v / 100.0)); #endif - volume_r.gain(volume_transform(tmp_v / 100.0)*VOLUME_MULTIPLIER); - volume_l.gain(volume_transform(tmp_v / 100.0)*VOLUME_MULTIPLIER); + volume_r.gain(volume_transform(tmp_v / 100.0) * VOLUME_MULTIPLIER); + volume_l.gain(volume_transform(tmp_v / 100.0) * VOLUME_MULTIPLIER); - switch (m) - { - case 0: // stereo + switch (m) { + case 0: // stereo stereo2mono.stereo(true); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); break; - case 1: // mono both + case 1: // mono both stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_DEFAULT, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); break; - case 2: // mono right + case 2: // mono right volume_l.gain(0.0); stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_MAX, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); break; - case 3: // mono left + case 3: // mono left volume_r.gain(0.0); stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -1929,44 +1797,34 @@ void set_volume(uint8_t v, uint8_t m) EEPROM HELPER ******************************************************************************/ -void initial_values(bool init) -{ +void initial_values(bool init) { uint16_t _m_; if (init == true) init_configuration(); - else - { + else { _m_ = (EEPROM[EEPROM_START_ADDRESS] << 8) | EEPROM[EEPROM_START_ADDRESS + 1]; - if (_m_ != EEPROM_MARKER) - { + if (_m_ != EEPROM_MARKER) { #ifdef DEBUG Serial.println(F("Found wrong EEPROM marker, initializing EEPROM...")); #endif init_configuration(); //load_sd_performance_json(PERFORMANCE_NUM_MIN); - } - else - { + } else { load_sd_sys_json(); - if (configuration.sys.load_at_startup == 255) - { + if (configuration.sys.load_at_startup == 255) { #ifdef DEBUG Serial.print(F("Loading initial system data from performance ")); Serial.println(configuration.sys.performance_number, DEC); #endif load_sd_performance_json(configuration.sys.performance_number); - } - else if (configuration.sys.load_at_startup < 100) - { + } else if (configuration.sys.load_at_startup < 100) { #ifdef DEBUG Serial.print(F("Loading initial system data from performance ")); Serial.println(configuration.sys.load_at_startup, DEC); #endif load_sd_performance_json(configuration.sys.load_at_startup); - } - else - { + } else { #ifdef DEBUG Serial.print(F("Loading initial system data from default performance ")); Serial.println(STARTUP_NUM_DEFAULT, DEC); @@ -1988,8 +1846,7 @@ void initial_values(bool init) #endif } -void check_configuration(void) -{ +void check_configuration(void) { check_configuration_sys(); check_configuration_fx(); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -1997,8 +1854,7 @@ void check_configuration(void) check_configuration_epiano(); } -void check_configuration_sys(void) -{ +void check_configuration_sys(void) { configuration.sys.vol = constrain(configuration.sys.vol, VOLUME_MIN, VOLUME_MAX); configuration.sys.mono = constrain(configuration.sys.mono, MONO_MIN, MONO_MAX); configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX); @@ -2007,8 +1863,7 @@ void check_configuration_sys(void) configuration.sys.load_at_startup = constrain(configuration.sys.load_at_startup, STARTUP_NUM_MIN, STARTUP_NUM_MAX); } -void check_configuration_fx(void) -{ +void check_configuration_fx(void) { #ifdef USE_PLATEREVERB configuration.fx.reverb_lowpass = constrain(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX); configuration.fx.reverb_lodamp = constrain(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX); @@ -2020,8 +1875,7 @@ void check_configuration_fx(void) configuration.fx.reverb_roomsize = constrain(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX); configuration.fx.reverb_level = constrain(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { configuration.fx.filter_cutoff[instance_id] = constrain(configuration.fx.filter_cutoff[instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); configuration.fx.filter_resonance[instance_id] = constrain(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); configuration.fx.chorus_frequency[instance_id] = constrain(configuration.fx.chorus_frequency[instance_id], CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); @@ -2053,8 +1907,7 @@ void check_configuration_fx(void) #endif } -void check_configuration_dexed(uint8_t instance_id) -{ +void check_configuration_dexed(uint8_t instance_id) { configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1); configuration.dexed[instance_id].voice = constrain(configuration.dexed[instance_id].voice, 0, MAX_VOICES - 1); configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); @@ -2088,8 +1941,7 @@ void check_configuration_dexed(uint8_t instance_id) configuration.dexed[instance_id].op_enabled = constrain(configuration.dexed[instance_id].op_enabled, OP_ENABLED_MIN, OP_ENABLED_MAX); } -void check_configuration_epiano(void) -{ +void check_configuration_epiano(void) { configuration.epiano.decay = constrain(configuration.epiano.decay, EP_DECAY_MIN, EP_DECAY_MAX); configuration.epiano.release = constrain(configuration.epiano.release, EP_RELEASE_MIN, EP_RELEASE_MAX); configuration.epiano.hardness = constrain(configuration.epiano.hardness, EP_HARDNESS_MIN, EP_HARDNESS_MAX); @@ -2111,8 +1963,7 @@ void check_configuration_epiano(void) configuration.epiano.midi_channel = constrain(configuration.epiano.midi_channel, EP_MIDI_CHANNEL_MIN, EP_MIDI_CHANNEL_MAX); } -void init_configuration(void) -{ +void init_configuration(void) { #ifdef DEBUG Serial.println(F("INITIALIZING CONFIGURATION")); #endif @@ -2143,8 +1994,7 @@ void init_configuration(void) configuration.fx.ep_reverb_send = EP_REVERB_SEND_DEFAULT; #endif - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT; configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT; configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; @@ -2217,8 +2067,7 @@ void init_configuration(void) eeprom_update(); } -void eeprom_update(void) -{ +void eeprom_update(void) { EEPROM.update(EEPROM_START_ADDRESS, (EEPROM_MARKER & 0xff00) >> 8); EEPROM.update(EEPROM_START_ADDRESS + 1, EEPROM_MARKER & 0xff); EEPROM.update(EEPROM_START_ADDRESS + 2, configuration.sys.vol); @@ -2228,77 +2077,60 @@ void eeprom_update(void) PARAMETER-HELPERS ******************************************************************************/ -void set_sample_note(uint8_t sample, uint8_t note) -{ +void set_sample_note(uint8_t sample, uint8_t note) { drum_config[sample].midinote = note; } -void set_sample_pitch(uint8_t sample, float playbackspeed) -{ +void set_sample_pitch(uint8_t sample, float playbackspeed) { drum_config[sample].pitch = playbackspeed; } -void set_sample_p_offset(uint8_t sample, float s_offset) -{ +void set_sample_p_offset(uint8_t sample, float s_offset) { drum_config[sample].p_offset = s_offset; } -void set_sample_pan(uint8_t sample, float s_pan) -{ +void set_sample_pan(uint8_t sample, float s_pan) { drum_config[sample].pan = s_pan; } -void set_sample_vol_max(uint8_t sample, float s_max) -{ +void set_sample_vol_max(uint8_t sample, float s_max) { drum_config[sample].vol_max = s_max; } -void set_sample_vol_min(uint8_t sample, float s_min) -{ +void set_sample_vol_min(uint8_t sample, float s_min) { drum_config[sample].vol_min = s_min; } -void set_sample_reverb_send(uint8_t sample, float s_reverb) -{ +void set_sample_reverb_send(uint8_t sample, float s_reverb) { drum_config[sample].reverb_send = s_reverb; } -uint8_t get_sample_note(uint8_t sample) -{ +uint8_t get_sample_note(uint8_t sample) { return (drum_config[sample].midinote); } -float get_sample_pitch(uint8_t sample) -{ +float get_sample_pitch(uint8_t sample) { return (drum_config[sample].pitch); } -float get_sample_p_offset(uint8_t sample) -{ +float get_sample_p_offset(uint8_t sample) { return (drum_config[sample].p_offset); } -float get_sample_pan(uint8_t sample) -{ +float get_sample_pan(uint8_t sample) { return (drum_config[sample].pan); } -float get_sample_vol_max(uint8_t sample) -{ +float get_sample_vol_max(uint8_t sample) { return (drum_config[sample].vol_max); } -float get_sample_vol_min(uint8_t sample) -{ +float get_sample_vol_min(uint8_t sample) { return (drum_config[sample].vol_min); } -float get_sample_reverb_send(uint8_t sample) -{ +float get_sample_reverb_send(uint8_t sample) { return (drum_config[sample].reverb_send); } -uint8_t find_drum_number_from_note(uint8_t note) -{ +uint8_t find_drum_number_from_note(uint8_t note) { uint8_t number = 0; - for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG - 1; d++) - { - if (note == drum_config[d].midinote) - { + for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG - 1; d++) { + if (note == drum_config[d].midinote) { number = d; break; } @@ -2306,14 +2138,11 @@ uint8_t find_drum_number_from_note(uint8_t note) return number; } -void set_fx_params(void) -{ +void set_fx_params(void) { #if defined(USE_FX) - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { // CHORUS - switch (configuration.fx.chorus_waveform[instance_id]) - { + switch (configuration.fx.chorus_waveform[instance_id]) { case 0: chorus_modulator[instance_id]->begin(WAVEFORM_TRIANGLE); break; @@ -2349,9 +2178,8 @@ void set_fx_params(void) delay_fx[instance_id]->disable(0); else if (configuration.fx.delay_sync[instance_id] == 0) delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10); - if (configuration.fx.delay_sync[instance_id] > 0) - { - uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / midi_bpm); + if (configuration.fx.delay_sync[instance_id] > 0) { + uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / midi_bpm); delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); } @@ -2379,19 +2207,18 @@ void set_fx_params(void) #if NUM_DRUMS > 0 #ifdef USE_FX - reverb_mixer_r.gain(REVERB_MIX_CH_DRUMS, 1.0); // Drums Reverb-Send - reverb_mixer_l.gain(REVERB_MIX_CH_DRUMS, 1.0); // Drums Reverb-Send + reverb_mixer_r.gain(REVERB_MIX_CH_DRUMS, 1.0); // Drums Reverb-Send + reverb_mixer_l.gain(REVERB_MIX_CH_DRUMS, 1.0); // Drums Reverb-Send #endif #endif #if defined(USE_EPIANO) #ifdef USE_FX - reverb_mixer_r.gain(REVERB_MIX_CH_EPIANO, mapfloat(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 0.0, 1.0)); // EPiano Reverb-Send - reverb_mixer_l.gain(REVERB_MIX_CH_EPIANO, mapfloat(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 0.0, 1.0)); // EPiano Reverb-Send + reverb_mixer_r.gain(REVERB_MIX_CH_EPIANO, mapfloat(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 0.0, 1.0)); // EPiano Reverb-Send + reverb_mixer_l.gain(REVERB_MIX_CH_EPIANO, mapfloat(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 0.0, 1.0)); // EPiano Reverb-Send // EP_CHORUS - switch (configuration.fx.ep_chorus_waveform) - { + switch (configuration.fx.ep_chorus_waveform) { case 0: ep_chorus_modulator.begin(WAVEFORM_TRIANGLE); break; @@ -2435,8 +2262,7 @@ void set_fx_params(void) sgtl5000.setEQGain(5, mapfloat(configuration.fx.eq_5, EQ_5_MIN, EQ_5_MAX, -9.9, 9.9)); sgtl5000.setEQGain(6, mapfloat(configuration.fx.eq_6, EQ_6_MIN, EQ_6_MAX, -9.9, 9.9)); sgtl5000.setEQFc(7, float(configuration.fx.eq_7)); - for (uint8_t band = 1; band <= 7; band++) - { + for (uint8_t band = 1; band <= 7; band++) { sgtl5000.commitFilter(band); #ifdef DEBUG sgtl5000.show_params(band); @@ -2447,8 +2273,7 @@ void set_fx_params(void) init_MIDI_send_CC(); } -void set_voiceconfig_params(uint8_t instance_id) -{ +void set_voiceconfig_params(uint8_t instance_id) { // INIT PEAK MIXER microdexed_peak_mixer.gain(instance_id, 1.0); @@ -2471,8 +2296,7 @@ void set_voiceconfig_params(uint8_t instance_id) mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); } -void set_epiano_params(void) -{ +void set_epiano_params(void) { #if defined(USE_EPIANO) #ifdef DEBUG Serial.print(F("Setting EPiano parameters... ")); @@ -2498,8 +2322,7 @@ void set_epiano_params(void) #endif } -void set_sys_params(void) -{ +void set_sys_params(void) { // set initial volume set_volume(configuration.sys.vol, configuration.sys.mono); } @@ -2509,10 +2332,9 @@ void set_sys_params(void) ******************************************************************************/ // https://www.reddit.com/r/Teensy/comments/7r19uk/reset_and_reboot_teensy_lc_via_code/ -#define SCB_AIRCR (*(volatile uint32_t *)0xE000ED0C) // Application Interrupt and Reset Control location -void _softRestart(void) -{ - Serial.end(); //clears the serial monitor if used +#define SCB_AIRCR (*(volatile uint32_t*)0xE000ED0C) // Application Interrupt and Reset Control location +void _softRestart(void) { + Serial.end(); //clears the serial monitor if used SCB_AIRCR = 0x05FA0004; //write value for restart } @@ -2524,8 +2346,7 @@ void _softRestart(void) return (pow(value, 2.2)); }*/ -float midi_volume_transform(uint8_t midi_amp) -{ +float midi_volume_transform(uint8_t midi_amp) { #ifdef DEBUG Serial.print(F("midi_amp=")); Serial.print(midi_amp, DEC); @@ -2535,15 +2356,13 @@ float midi_volume_transform(uint8_t midi_amp) return powf(midi_amp / 127.0, 4); } -float volume_transform(float amp) -{ +float volume_transform(float amp) { return powf(amp, 4); } -uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc +uint32_t crc32(byte* calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc { - const uint32_t crc_table[16] = - { + const uint32_t crc_table[16] = { 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, @@ -2551,8 +2370,7 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/ }; uint32_t crc = ~0L; - for (byte* index = calc_start ; index < (calc_start + calc_bytes) ; ++index) - { + for (byte* index = calc_start; index < (calc_start + calc_bytes); ++index) { crc = crc_table[(crc ^ *index) & 0x0f] ^ (crc >> 4); crc = crc_table[(crc ^ (*index >> 4)) & 0x0f] ^ (crc >> 4); crc = ~crc; @@ -2561,8 +2379,7 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/ return (crc); } -void generate_version_string(char* buffer, uint8_t len) -{ +void generate_version_string(char* buffer, uint8_t len) { char tmp[3]; memset(buffer, 0, len); @@ -2579,19 +2396,17 @@ void generate_version_string(char* buffer, uint8_t len) #endif #if defined(MAX_NOTES) strncat(buffer, "-", 1); - itoa (MAX_NOTES, tmp, 10); + itoa(MAX_NOTES, tmp, 10); strncat(buffer, tmp, 2); #endif } -FLASHMEM uint8_t check_sd_cards(void) -{ +FLASHMEM uint8_t check_sd_cards(void) { uint8_t ret = 0; memset(sd_string, 0, sizeof(sd_string)); - for (uint8_t i = 0; i < sizeof(cs_pins); i++) - { + for (uint8_t i = 0; i < sizeof(cs_pins); i++) { #ifdef DEBUG Serial.print(F("Checking CS pin ")); Serial.print(cs_pins[i], DEC); @@ -2600,8 +2415,7 @@ FLASHMEM uint8_t check_sd_cards(void) SPI.setMOSI(mosi_pins[i]); SPI.setSCK(sck_pins[i]); - if (SD.begin(cs_pins[i]) == true) - { + if (SD.begin(cs_pins[i]) == true) { #ifdef DEBUG Serial.print(F("Found. Using pin ")); Serial.println(cs_pins[i], DEC); @@ -2611,10 +2425,8 @@ FLASHMEM uint8_t check_sd_cards(void) } } - if (ret >= 0) - { - if (!card.init(SPI_HALF_SPEED, ret)) - { + if (ret >= 0) { + if (!card.init(SPI_HALF_SPEED, ret)) { #ifdef DEBUG Serial.println(F("SD card initialization failed.")); #endif @@ -2622,8 +2434,7 @@ FLASHMEM uint8_t check_sd_cards(void) } } - if (ret >= 0) - { + if (ret >= 0) { #ifdef DEBUG Serial.print(F("Card type: ")); #endif @@ -2653,8 +2464,7 @@ FLASHMEM uint8_t check_sd_cards(void) #endif } - if (!volume.init(card)) - { + if (!volume.init(card)) { #ifdef DEBUG Serial.println(F("Could not find FAT16/FAT32 partition.")); #endif @@ -2662,8 +2472,7 @@ FLASHMEM uint8_t check_sd_cards(void) } } - if (ret >= 0) - { + if (ret >= 0) { uint32_t volumesize; volumesize = volume.blocksPerCluster() * volume.clusterCount() / 2097152; @@ -2688,10 +2497,8 @@ FLASHMEM uint8_t check_sd_cards(void) return (ret); } -FLASHMEM void check_and_create_directories(void) -{ - if (sd_card > 0) - { +FLASHMEM void check_and_create_directories(void) { + if (sd_card > 0) { uint8_t i; char tmp[FILENAME_LEN]; @@ -2699,11 +2506,9 @@ FLASHMEM void check_and_create_directories(void) Serial.println(F("Directory check... ")); #endif // create directories for banks - for (i = 0; i < MAX_BANKS; i++) - { + for (i = 0; i < MAX_BANKS; i++) { snprintf_P(tmp, sizeof(tmp), PSTR("/%d"), i); - if (!SD.exists(tmp)) - { + if (!SD.exists(tmp)) { #ifdef DEBUG Serial.print(F("Creating directory ")); Serial.println(tmp); @@ -2713,8 +2518,7 @@ FLASHMEM void check_and_create_directories(void) } snprintf_P(tmp, sizeof(tmp), PSTR("/%s"), PERFORMANCE_CONFIG_PATH); - if (!SD.exists(tmp)) - { + if (!SD.exists(tmp)) { #ifdef DEBUG Serial.print(F("Creating directory ")); Serial.println(tmp); @@ -2772,8 +2576,7 @@ FLASHMEM void check_and_create_directories(void) */ snprintf_P(tmp, sizeof(tmp), PSTR("/%s"), PERFORMANCE_CONFIG_PATH); - if (!SD.exists(tmp)) - { + if (!SD.exists(tmp)) { #ifdef DEBUG Serial.print(F("Creating directory ")); Serial.println(tmp); @@ -2787,8 +2590,7 @@ FLASHMEM void check_and_create_directories(void) // Clear now obsolte marker files from Favs. // Only needs to run once. - for (uint8_t i = 0; i < MAX_BANKS; i++) - { + for (uint8_t i = 0; i < MAX_BANKS; i++) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/hasfav"), FAV_CONFIG_PATH, i); #ifdef DEBUG Serial.print(F("Delete Marker File")); @@ -2799,8 +2601,7 @@ FLASHMEM void check_and_create_directories(void) } // Remove empty Folders. rmdir will only remove strictly emtpy folders, which is the desired result. // Only needs to run once. - for (uint8_t i = 0; i < MAX_BANKS; i++) - { + for (uint8_t i = 0; i < MAX_BANKS; i++) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, i); #ifdef DEBUG Serial.print(F("Delete empty folder ")); @@ -2823,20 +2624,17 @@ FLASHMEM void check_and_create_directories(void) /****************************************************************************** DEBUG HELPER ******************************************************************************/ -#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) -void show_cpu_and_mem_usage(void) -{ +#if defined(DEBUG) && defined(SHOW_CPU_LOAD_MSEC) +void show_cpu_and_mem_usage(void) { uint32_t sum_xrun = 0; uint16_t sum_render_time_max = 0; - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { sum_xrun += MicroDexed[instance_id]->getXRun(); sum_render_time_max += MicroDexed[instance_id]->getRenderTimeMax(); MicroDexed[instance_id]->resetRenderTimeMax(); } - if (AudioProcessorUsageMax() > 99.9) - { + if (AudioProcessorUsageMax() > 99.9) { cpumax++; #ifdef DEBUG Serial.print(F("*")); @@ -2881,8 +2679,7 @@ void show_cpu_and_mem_usage(void) Serial.print(FreeMem(), DEC); Serial.print(F("|ACTVOICES:")); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { Serial.print(instance_id, DEC); Serial.print(F("=")); Serial.print(active_voices[instance_id], DEC); @@ -2899,74 +2696,126 @@ void show_cpu_and_mem_usage(void) #endif #ifdef DEBUG -void show_configuration(void) -{ +void show_configuration(void) { Serial.println(); Serial.println(F("CONFIGURATION:")); Serial.println(F("System")); - Serial.print(F(" Volume ")); Serial.println(configuration.sys.vol, DEC); - Serial.print(F(" Mono ")); Serial.println(configuration.sys.mono, DEC); - Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC); - Serial.print(F(" Favorites ")); Serial.println(configuration.sys.favorites, DEC); - Serial.print(F(" Performance Number ")); Serial.println(configuration.sys.performance_number, DEC); - Serial.print(F(" Load at startup ")); Serial.println(configuration.sys.load_at_startup, DEC); + Serial.print(F(" Volume ")); + Serial.println(configuration.sys.vol, DEC); + Serial.print(F(" Mono ")); + Serial.println(configuration.sys.mono, DEC); + Serial.print(F(" Soft MIDI Thru ")); + Serial.println(configuration.sys.soft_midi_thru, DEC); + Serial.print(F(" Favorites ")); + Serial.println(configuration.sys.favorites, DEC); + Serial.print(F(" Performance Number ")); + Serial.println(configuration.sys.performance_number, DEC); + Serial.print(F(" Load at startup ")); + Serial.println(configuration.sys.load_at_startup, DEC); Serial.println(F("FX")); - Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC); - Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC); + Serial.print(F(" Reverb Roomsize ")); + Serial.println(configuration.fx.reverb_roomsize, DEC); + Serial.print(F(" Reverb Level ")); + Serial.println(configuration.fx.reverb_level, DEC); #ifdef USE_PLATEREVERB - Serial.print(F(" Reverb Lowpass ")); Serial.println(configuration.fx.reverb_lowpass, DEC); - Serial.print(F(" Reverb Lodamp ")); Serial.println(configuration.fx.reverb_lodamp, DEC); - Serial.print(F(" Reverb Hidamp ")); Serial.println(configuration.fx.reverb_hidamp, DEC); - Serial.print(F(" Reverb Diffusion ")); Serial.println(configuration.fx.reverb_diffusion, DEC); + Serial.print(F(" Reverb Lowpass ")); + Serial.println(configuration.fx.reverb_lowpass, DEC); + Serial.print(F(" Reverb Lodamp ")); + Serial.println(configuration.fx.reverb_lodamp, DEC); + Serial.print(F(" Reverb Hidamp ")); + Serial.println(configuration.fx.reverb_hidamp, DEC); + Serial.print(F(" Reverb Diffusion ")); + Serial.println(configuration.fx.reverb_diffusion, DEC); #else - Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC); + Serial.print(F(" Reverb Damping ")); + Serial.println(configuration.fx.reverb_damping, DEC); #endif - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { Serial.print(F("Dexed instance ")); Serial.println(instance_id, 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(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC); - Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC); - Serial.print(F(" Highest Note ")); Serial.println(configuration.dexed[instance_id].highest_note, DEC); - Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.fx.filter_cutoff[instance_id], DEC); - Serial.print(F(" Filter Resonance ")); Serial.println(configuration.fx.filter_resonance[instance_id], DEC); - Serial.print(F(" Chorus Frequency ")); Serial.println(configuration.fx.chorus_frequency[instance_id], DEC); - Serial.print(F(" Chorus Waveform ")); Serial.println(configuration.fx.chorus_waveform[instance_id], DEC); - Serial.print(F(" Chorus Depth ")); Serial.println(configuration.fx.chorus_depth[instance_id], DEC); - Serial.print(F(" Chorus Level ")); Serial.println(configuration.fx.chorus_level[instance_id], DEC); - Serial.print(F(" Delay Time ")); Serial.println(configuration.fx.delay_time[instance_id], DEC); - Serial.print(F(" Delay Feedback ")); Serial.println(configuration.fx.delay_feedback[instance_id], DEC); - Serial.print(F(" Delay Level ")); Serial.println(configuration.fx.delay_level[instance_id], DEC); - Serial.print(F(" Delay Sync ")); Serial.println(configuration.fx.delay_sync[instance_id], DEC); - Serial.print(F(" Reverb Send ")); Serial.println(configuration.fx.reverb_send[instance_id], DEC); - Serial.print(F(" Sound Intensity ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); - Serial.print(F(" Panorama ")); Serial.println(configuration.dexed[instance_id].pan, DEC); - Serial.print(F(" Transpose ")); Serial.println(configuration.dexed[instance_id].transpose, DEC); - Serial.print(F(" Tune ")); Serial.println(configuration.dexed[instance_id].tune, DEC); - Serial.print(F(" Polyphony ")); Serial.println(configuration.dexed[instance_id].polyphony, DEC); - Serial.print(F(" Mono/Poly ")); Serial.println(configuration.dexed[instance_id].monopoly, DEC); - Serial.print(F(" Note Refresh ")); Serial.println(configuration.dexed[instance_id].note_refresh, DEC); - Serial.print(F(" Pitchbend Range ")); Serial.println(configuration.dexed[instance_id].pb_range, DEC); - Serial.print(F(" Pitchbend Step ")); Serial.println(configuration.dexed[instance_id].pb_step, DEC); - Serial.print(F(" Modwheel Range ")); Serial.println(configuration.dexed[instance_id].mw_range, DEC); - Serial.print(F(" Modwheel Assign ")); Serial.println(configuration.dexed[instance_id].mw_assign, DEC); - Serial.print(F(" Modwheel Mode ")); Serial.println(configuration.dexed[instance_id].mw_mode, DEC); - Serial.print(F(" Footctrl Range ")); Serial.println(configuration.dexed[instance_id].fc_range, DEC); - Serial.print(F(" Footctrl Assign ")); Serial.println(configuration.dexed[instance_id].fc_assign, DEC); - Serial.print(F(" Footctrl Mode ")); Serial.println(configuration.dexed[instance_id].fc_mode, DEC); - Serial.print(F(" BreathCtrl Range ")); Serial.println(configuration.dexed[instance_id].bc_range, DEC); - Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.dexed[instance_id].bc_assign, DEC); - Serial.print(F(" Breathctrl Mode ")); Serial.println(configuration.dexed[instance_id].bc_mode, DEC); - Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.dexed[instance_id].at_range, DEC); - Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.dexed[instance_id].at_assign, DEC); - Serial.print(F(" Aftertouch Mode ")); Serial.println(configuration.dexed[instance_id].at_mode, DEC); - Serial.print(F(" Portamento Mode ")); Serial.println(configuration.dexed[instance_id].portamento_mode, DEC); - Serial.print(F(" Portamento Glissando ")); Serial.println(configuration.dexed[instance_id].portamento_glissando, DEC); - Serial.print(F(" Portamento Time ")); Serial.println(configuration.dexed[instance_id].portamento_time, DEC); - Serial.print(F(" OP Enabled ")); Serial.println(configuration.dexed[instance_id].op_enabled, 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(" MIDI-Channel ")); + Serial.println(configuration.dexed[instance_id].midi_channel, DEC); + Serial.print(F(" Lowest Note ")); + Serial.println(configuration.dexed[instance_id].lowest_note, DEC); + Serial.print(F(" Highest Note ")); + Serial.println(configuration.dexed[instance_id].highest_note, DEC); + Serial.print(F(" Filter Cutoff ")); + Serial.println(configuration.fx.filter_cutoff[instance_id], DEC); + Serial.print(F(" Filter Resonance ")); + Serial.println(configuration.fx.filter_resonance[instance_id], DEC); + Serial.print(F(" Chorus Frequency ")); + Serial.println(configuration.fx.chorus_frequency[instance_id], DEC); + Serial.print(F(" Chorus Waveform ")); + Serial.println(configuration.fx.chorus_waveform[instance_id], DEC); + Serial.print(F(" Chorus Depth ")); + Serial.println(configuration.fx.chorus_depth[instance_id], DEC); + Serial.print(F(" Chorus Level ")); + Serial.println(configuration.fx.chorus_level[instance_id], DEC); + Serial.print(F(" Delay Time ")); + Serial.println(configuration.fx.delay_time[instance_id], DEC); + Serial.print(F(" Delay Feedback ")); + Serial.println(configuration.fx.delay_feedback[instance_id], DEC); + Serial.print(F(" Delay Level ")); + Serial.println(configuration.fx.delay_level[instance_id], DEC); + Serial.print(F(" Delay Sync ")); + Serial.println(configuration.fx.delay_sync[instance_id], DEC); + Serial.print(F(" Reverb Send ")); + Serial.println(configuration.fx.reverb_send[instance_id], DEC); + Serial.print(F(" Sound Intensity ")); + Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); + Serial.print(F(" Panorama ")); + Serial.println(configuration.dexed[instance_id].pan, DEC); + Serial.print(F(" Transpose ")); + Serial.println(configuration.dexed[instance_id].transpose, DEC); + Serial.print(F(" Tune ")); + Serial.println(configuration.dexed[instance_id].tune, DEC); + Serial.print(F(" Polyphony ")); + Serial.println(configuration.dexed[instance_id].polyphony, DEC); + Serial.print(F(" Mono/Poly ")); + Serial.println(configuration.dexed[instance_id].monopoly, DEC); + Serial.print(F(" Note Refresh ")); + Serial.println(configuration.dexed[instance_id].note_refresh, DEC); + Serial.print(F(" Pitchbend Range ")); + Serial.println(configuration.dexed[instance_id].pb_range, DEC); + Serial.print(F(" Pitchbend Step ")); + Serial.println(configuration.dexed[instance_id].pb_step, DEC); + Serial.print(F(" Modwheel Range ")); + Serial.println(configuration.dexed[instance_id].mw_range, DEC); + Serial.print(F(" Modwheel Assign ")); + Serial.println(configuration.dexed[instance_id].mw_assign, DEC); + Serial.print(F(" Modwheel Mode ")); + Serial.println(configuration.dexed[instance_id].mw_mode, DEC); + Serial.print(F(" Footctrl Range ")); + Serial.println(configuration.dexed[instance_id].fc_range, DEC); + Serial.print(F(" Footctrl Assign ")); + Serial.println(configuration.dexed[instance_id].fc_assign, DEC); + Serial.print(F(" Footctrl Mode ")); + Serial.println(configuration.dexed[instance_id].fc_mode, DEC); + Serial.print(F(" BreathCtrl Range ")); + Serial.println(configuration.dexed[instance_id].bc_range, DEC); + Serial.print(F(" Breathctrl Assign ")); + Serial.println(configuration.dexed[instance_id].bc_assign, DEC); + Serial.print(F(" Breathctrl Mode ")); + Serial.println(configuration.dexed[instance_id].bc_mode, DEC); + Serial.print(F(" Aftertouch Range ")); + Serial.println(configuration.dexed[instance_id].at_range, DEC); + Serial.print(F(" Aftertouch Assign ")); + Serial.println(configuration.dexed[instance_id].at_assign, DEC); + Serial.print(F(" Aftertouch Mode ")); + Serial.println(configuration.dexed[instance_id].at_mode, DEC); + Serial.print(F(" Portamento Mode ")); + Serial.println(configuration.dexed[instance_id].portamento_mode, DEC); + Serial.print(F(" Portamento Glissando ")); + Serial.println(configuration.dexed[instance_id].portamento_glissando, DEC); + Serial.print(F(" Portamento Time ")); + Serial.println(configuration.dexed[instance_id].portamento_time, DEC); + Serial.print(F(" OP Enabled ")); + Serial.println(configuration.dexed[instance_id].op_enabled, DEC); Serial.flush(); } @@ -2974,8 +2823,7 @@ void show_configuration(void) Serial.flush(); } -void show_patch(uint8_t instance_id) -{ +void show_patch(uint8_t instance_id) { char vn[VOICE_NAME_LEN]; Serial.print(F("INSTANCE ")); @@ -2983,8 +2831,7 @@ void show_patch(uint8_t instance_id) memset(vn, 0, sizeof(vn)); Serial.println(F("+==========================================================================================================+")); - for (int8_t i = 5; i >= 0; --i) - { + for (int8_t i = 5; i >= 0; --i) { Serial.println(F("+==========================================================================================================+")); Serial.print(F("| OP")); Serial.print(6 - i, DEC); @@ -3044,8 +2891,7 @@ void show_patch(uint8_t instance_id) Serial.println(F("| PR1 | PR2 | PR3 | PR4 | PL1 | PL2 | PL3 | PL4 | ALG | FB | OKS | TRANSPOSE |")); Serial.println(F("+-------+-------+-------+-------+-------+-------+-------+-------+------+------+-----+----------------------+")); Serial.print(F("| ")); - for (int8_t i = 0; i < 8; i++) - { + for (int8_t i = 0; i < 8; i++) { SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement(DEXED_VOICE_OFFSET + i)); Serial.print(F(" | ")); } @@ -3082,8 +2928,7 @@ void show_patch(uint8_t instance_id) Serial.println(F("+==========================================================================================================+")); } -void SerialPrintFormatInt3(uint8_t num) -{ +void SerialPrintFormatInt3(uint8_t num) { char buf[4]; memset(buf, 0, 4); snprintf_P(buf, sizeof(buf), PSTR("%3d"), num); @@ -3093,18 +2938,16 @@ void SerialPrintFormatInt3(uint8_t num) #if defined(ARDUINO_TEENSY36) /* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */ extern "C" char* sbrk(int incr); -uint32_t FreeMem(void) -{ +uint32_t FreeMem(void) { char top; return &top - reinterpret_cast(sbrk(0)); } #else /* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */ extern unsigned long _heap_end; -extern char *__brkval; -int FreeMem(void) -{ - return (char *)&_heap_end - __brkval; +extern char* __brkval; +int FreeMem(void) { + return (char*)&_heap_end - __brkval; } #endif -#endif +#endif \ No newline at end of file diff --git a/UI.hpp b/UI.hpp index f739fae..0222928 100644 --- a/UI.hpp +++ b/UI.hpp @@ -39,20 +39,20 @@ #endif #include #include "drumset.h" -#if defined (USE_EPIANO) +#if defined(USE_EPIANO) #include "synth_mda_epiano.h" #include #endif -#define _LCDML_DISP_cols LCD_cols -#define _LCDML_DISP_rows LCD_rows +#define _LCDML_DISP_cols LCD_cols +#define _LCDML_DISP_rows LCD_rows #ifdef I2C_DISPLAY -#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol +#define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol #else -#define _LCDML_DISP_cfg_cursor 0x8d // cursor Symbol +#define _LCDML_DISP_cfg_cursor 0x8d // cursor Symbol #endif -#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar +#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar extern bool check_sd_performance_exists(uint8_t number); @@ -74,69 +74,69 @@ extern void get_sd_performance_name_json(uint8_t number); extern bool save_sd_performance_json(uint8_t p); extern uint8_t drum_midi_channel; extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; -uint8_t activesample; // CAN BE REMOVED LATER! +uint8_t activesample; // CAN BE REMOVED LATER! #endif #ifdef SGTL5000_AUDIO_ENHANCE #include "control_sgtl5000plus.h" -extern AudioControlSGTL5000Plus sgtl5000; +extern AudioControlSGTL5000Plus sgtl5000; #else -extern AudioControlSGTL5000 sgtl5000; +extern AudioControlSGTL5000 sgtl5000; #endif #if defined(USE_FX) -extern AudioSynthWaveform* chorus_modulator[NUM_DEXED]; -extern AudioEffectModulatedDelay* modchorus[NUM_DEXED]; -extern AudioMixer<2>* chorus_mixer[NUM_DEXED]; -extern AudioMixer<2>* delay_fb_mixer[NUM_DEXED]; -extern AudioEffectDelay* delay_fx[NUM_DEXED]; -extern AudioMixer<2>* delay_mixer[NUM_DEXED]; -#endif -extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; -extern AudioMixer<2> microdexed_peak_mixer; -extern AudioAnalyzePeak microdexed_peak; +extern AudioSynthWaveform* chorus_modulator[NUM_DEXED]; +extern AudioEffectModulatedDelay* modchorus[NUM_DEXED]; +extern AudioMixer<2>* chorus_mixer[NUM_DEXED]; +extern AudioMixer<2>* delay_fb_mixer[NUM_DEXED]; +extern AudioEffectDelay* delay_fx[NUM_DEXED]; +extern AudioMixer<2>* delay_mixer[NUM_DEXED]; +#endif +extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; +extern AudioMixer<2> microdexed_peak_mixer; +extern AudioAnalyzePeak microdexed_peak; #if defined(USE_FX) #if defined(USE_EPIANO) -extern AudioSynthEPiano ep; -extern AudioMixer<4> reverb_mixer_r; -extern AudioMixer<4> reverb_mixer_l; +extern AudioSynthEPiano ep; +extern AudioMixer<4> reverb_mixer_r; +extern AudioMixer<4> reverb_mixer_l; #else -extern AudioMixer<3> reverb_mixer_r; -extern AudioMixer<3> reverb_mixer_l; +extern AudioMixer<3> reverb_mixer_r; +extern AudioMixer<3> reverb_mixer_l; #endif #if defined(USE_PLATEREVERB) -extern AudioEffectPlateReverb reverb; +extern AudioEffectPlateReverb reverb; #else extern AudioEffectFreeverbStereoFloat freeverb; #endif #endif #if defined(USE_FX) && defined(USE_EPIANO) -extern AudioEffectStereoPanorama ep_stereo_panorama; -extern AudioSynthWaveform ep_chorus_modulator; +extern AudioEffectStereoPanorama ep_stereo_panorama; +extern AudioSynthWaveform ep_chorus_modulator; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT -extern AudioFilterBiquad ep_modchorus_filter; +extern AudioFilterBiquad ep_modchorus_filter; #endif extern AudioEffectModulatedDelayStereo ep_modchorus; -extern AudioMixer<2> ep_chorus_mixer_r; -extern AudioMixer<2> ep_chorus_mixer_l; -extern AudioMixer<2> ep_delay_fb_mixer_r; -extern AudioMixer<2> ep_delay_fb_mixer_l; -extern AudioEffectDelay ep_delay_fx_r; -extern AudioEffectDelay ep_delay_fx_l; -extern AudioMixer<2> ep_delay_mixer_r; -extern AudioMixer<2> ep_delay_mixer_l; +extern AudioMixer<2> ep_chorus_mixer_r; +extern AudioMixer<2> ep_chorus_mixer_l; +extern AudioMixer<2> ep_delay_fb_mixer_r; +extern AudioMixer<2> ep_delay_fb_mixer_l; +extern AudioEffectDelay ep_delay_fx_r; +extern AudioEffectDelay ep_delay_fx_l; +extern AudioMixer<2> ep_delay_mixer_r; +extern AudioMixer<2> ep_delay_mixer_l; #endif #if defined(USE_EPIANO) -extern AudioMixer<5> master_mixer_r; -extern AudioMixer<5> master_mixer_l; +extern AudioMixer<5> master_mixer_r; +extern AudioMixer<5> master_mixer_l; #else -extern AudioMixer<4> master_mixer_r; -extern AudioMixer<4> master_mixer_l; +extern AudioMixer<4> master_mixer_r; +extern AudioMixer<4> master_mixer_l; #endif -extern AudioEffectStereoMono stereo2mono; -extern AudioAnalyzePeak master_peak_r; -extern AudioAnalyzePeak master_peak_l; +extern AudioEffectStereoMono stereo2mono; +extern AudioAnalyzePeak master_peak_r; +extern AudioAnalyzePeak master_peak_l; extern char sd_string[LCD_cols + 1]; extern char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; @@ -175,59 +175,63 @@ Disp_Plus display(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_D #ifdef U8X8_HAVE_HW_I2C #include #endif -Disp_Plus lcd(/* cs=*/ U8X8_CS_PIN, /* dc=*/ U8X8_DC_PIN, /* reset=*/ U8X8_RESET_PIN); +Disp_Plus lcd(/* cs=*/U8X8_CS_PIN, /* dc=*/U8X8_DC_PIN, /* reset=*/U8X8_RESET_PIN); //Disp_Plus lcd(U8X8_PIN_NONE); #endif const uint8_t scroll_bar[5][8] = { - {B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top - {B11111, B11111, B10001, B10001, B10001, B10001, B10001, B10001}, // scroll state 1 - {B10001, B10001, B11111, B11111, B10001, B10001, B10001, B10001}, // scroll state 2 - {B10001, B10001, B10001, B10001, B11111, B11111, B10001, B10001}, // scroll state 3 - {B10001, B10001, B10001, B10001, B10001, B10001, B11111, B11111} // scrollbar bottom + { B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001 }, // scrollbar top + { B11111, B11111, B10001, B10001, B10001, B10001, B10001, B10001 }, // scroll state 1 + { B10001, B10001, B11111, B11111, B10001, B10001, B10001, B10001 }, // scroll state 2 + { B10001, B10001, B10001, B10001, B11111, B11111, B10001, B10001 }, // scroll state 3 + { B10001, B10001, B10001, B10001, B10001, B10001, B11111, B11111 } // scrollbar bottom }; const uint8_t block_bar[5][8] = { - {B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000}, - {B11000, B11000, B11000, B11000, B11000, B11000, B11000, B11000}, - {B11100, B11100, B11100, B11100, B11100, B11100, B11100, B11100}, - {B11110, B11110, B11110, B11110, B11110, B11110, B11110, B11110}, - {B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111} + { B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000 }, + { B11000, B11000, B11000, B11000, B11000, B11000, B11000, B11000 }, + { B11100, B11100, B11100, B11100, B11100, B11100, B11100, B11100 }, + { B11110, B11110, B11110, B11110, B11110, B11110, B11110, B11110 }, + { B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111 } }; const uint8_t meter_bar[5][8] = { - {B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000}, - {B01000, B01000, B01000, B01000, B01000, B01000, B01000, B01000}, - {B00100, B00100, B00100, B00100, B00100, B00100, B00100, B00100}, - {B00010, B00010, B00010, B00010, B00010, B00010, B00010, B00010}, - {B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001} + { B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000 }, + { B01000, B01000, B01000, B01000, B01000, B01000, B01000, B01000 }, + { B00100, B00100, B00100, B00100, B00100, B00100, B00100, B00100 }, + { B00010, B00010, B00010, B00010, B00010, B00010, B00010, B00010 }, + { B00001, B00001, B00001, B00001, B00001, B00001, B00001, B00001 } }; const uint8_t special_chars[22][8] = { - {B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [0] 1 small invers - {B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111}, // [1] 2 small invers - {B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111}, // [2] 1 OP invers - {B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111}, // [3] 2 OP invers - {B11111, B10001, B11101, B11011, B11101, B10101, B11011, B11111}, // [4] 3 OP invers - {B11111, B10111, B10111, B10101, B10001, B11101, B11101, B11111}, // [5] 4 OP invers - {B11111, B10001, B10111, B10011, B11101, B11101, B10011, B11111}, // [6] 5 OP invers - {B11111, B11001, B10111, B10011, B10101, B10101, B11011, B11111}, // [7] 6 OP invers - {B00000, B00000, B00000, B00000, B00000, B00000, B00000, B11111}, // [8] Level 1 - {B00000, B00000, B00000, B00000, B00000, B00000, B11111, B11111}, // [9] Level 2 - {B00000, B00000, B00000, B00000, B00000, B11111, B11111, B11111}, // [10] Level 3 - {B00000, B00000, B00000, B00000, B11111, B11111, B11111, B11111}, // [11] Level 4 - {B00000, B00000, B00000, B11111, B11111, B11111, B11111, B11111}, // [12] Level 5 - {B00000, B00000, B11111, B11111, B11111, B11111, B11111, B11111}, // [13] Level 6 - {B00000, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [14] Level 7 - {B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // [15] Level 8 - {B00100, B00110, B00101, B00101, B01101, B11101, B11100, B11000}, // [16] Note - {B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110}, // [17] Disabled 2nd instance symbol - {B11111, B10001, B10111, B10001, B10111, B10111, B10111, B11111}, // [18] Favorites Icon + { B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111 }, // [0] 1 small invers + { B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111 }, // [1] 2 small invers + { B11111, B11011, B10011, B11011, B11011, B11011, B11011, B11111 }, // [2] 1 OP invers + { B11111, B11011, B10101, B11101, B11011, B10111, B10001, B11111 }, // [3] 2 OP invers + { B11111, B10001, B11101, B11011, B11101, B10101, B11011, B11111 }, // [4] 3 OP invers + { B11111, B10111, B10111, B10101, B10001, B11101, B11101, B11111 }, // [5] 4 OP invers + { B11111, B10001, B10111, B10011, B11101, B11101, B10011, B11111 }, // [6] 5 OP invers + { B11111, B11001, B10111, B10011, B10101, B10101, B11011, B11111 }, // [7] 6 OP invers + { B00000, B00000, B00000, B00000, B00000, B00000, B00000, B11111 }, // [8] Level 1 + { B00000, B00000, B00000, B00000, B00000, B00000, B11111, B11111 }, // [9] Level 2 + { B00000, B00000, B00000, B00000, B00000, B11111, B11111, B11111 }, // [10] Level 3 + { B00000, B00000, B00000, B00000, B11111, B11111, B11111, B11111 }, // [11] Level 4 + { B00000, B00000, B00000, B11111, B11111, B11111, B11111, B11111 }, // [12] Level 5 + { B00000, B00000, B11111, B11111, B11111, B11111, B11111, B11111 }, // [13] Level 6 + { B00000, B11111, B11111, B11111, B11111, B11111, B11111, B11111 }, // [14] Level 7 + { B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111 }, // [15] Level 8 + { B00100, B00110, B00101, B00101, B01101, B11101, B11100, B11000 }, // [16] Note + { B01110, B10001, B10001, B01110, B00100, B00100, B00110, B00110 }, // [17] Disabled 2nd instance symbol + { B11111, B10001, B10111, B10001, B10111, B10111, B10111, B11111 }, // [18] Favorites Icon }; -enum { SCROLLBAR, BLOCKBAR, METERBAR }; -enum { ENC_R, ENC_L }; -enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; +enum { SCROLLBAR, + BLOCKBAR, + METERBAR }; +enum { ENC_R, + ENC_L }; +enum { MENU_VOICE_BANK, + MENU_VOICE_SOUND }; void lcdml_menu_display(void); void lcdml_menu_clear(void); @@ -342,7 +346,7 @@ void lcd_active_instance_number(uint8_t instance_id); void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op); void lcd_special_chars(uint8_t mode); void lcd_display_delay_sync(uint8_t sync); -void string_trim(char *s); +void string_trim(char* s); void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id); void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id); bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id); @@ -362,7 +366,7 @@ char* basename(const char* filename); char* strip_extension(char* filename); // normal menu -LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change) +LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change) LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); #if defined(USE_FX) @@ -383,154 +387,130 @@ LCDML_createMenu(_LCDML_DISP_cnt); /*********************************************************************** CONTROL ***********************************************************************/ -class EncoderDirection -{ - public: - EncoderDirection(void) - { - reset(); - } +class EncoderDirection { +public: + EncoderDirection(void) { + reset(); + } - void reset(void) - { - button_short = false; - button_long = false; - button_pressed = false; - left = false; - right = false; - up = false; - down = false; - } + void reset(void) { + button_short = false; + button_long = false; + button_pressed = false; + left = false; + right = false; + up = false; + down = false; + } - void ButtonShort(bool state) - { - button_short = state; - } + void ButtonShort(bool state) { + button_short = state; + } - bool ButtonShort(void) - { - if (button_short == true) - { - button_short = false; - return (true); - } - return (false); + bool ButtonShort(void) { + if (button_short == true) { + button_short = false; + return (true); } + return (false); + } - void ButtonLong(bool state) - { - button_long = state; - } + void ButtonLong(bool state) { + button_long = state; + } - bool ButtonLong(void) - { - if (button_long == true) - { - button_long = false; - return (true); - } - return (false); + bool ButtonLong(void) { + if (button_long == true) { + button_long = false; + return (true); } + return (false); + } - void ButtonPressed(bool state) - { - button_pressed = state; - } + void ButtonPressed(bool state) { + button_pressed = state; + } - bool ButtonPressed(void) - { - return (button_pressed); - } + bool ButtonPressed(void) { + return (button_pressed); + } - void Left(bool state) - { - left = state; - } + void Left(bool state) { + left = state; + } - bool Left(void) - { - if (left == true) - { - left = false; - return (true); - } - return (false); + bool Left(void) { + if (left == true) { + left = false; + return (true); } + return (false); + } - void Right(bool state) - { - right = state; - } + void Right(bool state) { + right = state; + } - bool Right(void) - { - if (right == true) - { - right = false; - return (true); - } - return (false); + bool Right(void) { + if (right == true) { + right = false; + return (true); } + return (false); + } - void Up(bool state) - { - up = state; - } + void Up(bool state) { + up = state; + } - bool Up(void) - { - if (up == true) - { - up = false; - return (true); - } - return (false); + bool Up(void) { + if (up == true) { + up = false; + return (true); } + return (false); + } - void Down(bool state) - { - down = state; - } + void Down(bool state) { + down = state; + } - bool Down(void) - { - if (down == true) - { - down = false; - return (true); - } - return (false); + bool Down(void) { + if (down == true) { + down = false; + return (true); } + return (false); + } - private: - bool button_short; - bool button_long; - bool button_pressed; - bool left; - bool right; - bool up; - bool down; +private: + bool button_short; + bool button_long; + bool button_pressed; + bool left; + bool right; + bool up; + bool down; }; -MD_REncoder ENCODER[NUM_ENCODER] = {MD_REncoder(ENC_R_PIN_B, ENC_R_PIN_A), MD_REncoder(ENC_L_PIN_B, ENC_L_PIN_A)}; +MD_REncoder ENCODER[NUM_ENCODER] = { MD_REncoder(ENC_R_PIN_B, ENC_R_PIN_A), MD_REncoder(ENC_L_PIN_B, ENC_L_PIN_A) }; EncoderDirection encoderDir[NUM_ENCODER]; -long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0}; -bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; -uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0}; +long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = { 0, 0 }; +bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = { HIGH, HIGH }; +uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = { 0, 0 }; bool menu_init = true; #ifdef U8X8_DISPLAY -const uint8_t * flipped_scroll_bar[5]; -const uint8_t * flipped_block_bar[7]; -const uint8_t * flipped_meter_bar[7]; +const uint8_t* flipped_scroll_bar[5]; +const uint8_t* flipped_block_bar[7]; +const uint8_t* flipped_meter_bar[7]; -uint8_t * rotTile(const uint8_t * tile) -{ - uint8_t * newt = new uint8_t[8]; +uint8_t* rotTile(const uint8_t* tile) { + uint8_t* newt = new uint8_t[8]; for (int x = 0; x < 8; x++) { uint8_t newb = 0; - for (int y = 0 ; y < 8; y++) { + for (int y = 0; y < 8; y++) { newb |= (tile[y] << x) & 0x80; newb >>= 1; } @@ -540,8 +520,7 @@ uint8_t * rotTile(const uint8_t * tile) } #endif -FLASHMEM void setup_ui(void) -{ +FLASHMEM void setup_ui(void) { // LCD Begin #ifdef I2C_DISPLAY display.init(); @@ -564,8 +543,7 @@ FLASHMEM void setup_ui(void) } #ifdef DEBUG -FLASHMEM void setup_debug_message(void) -{ +FLASHMEM void setup_debug_message(void) { // LCD Begin display.clear(); display.setCursor(1, 0); @@ -582,9 +560,8 @@ FLASHMEM void setup_debug_message(void) /*********************************************************************** MENU CONTROL ***********************************************************************/ -uint8_t get_current_cursor_id(void) -{ - LCDMenuLib2_menu *tmp; +uint8_t get_current_cursor_id(void) { + LCDMenuLib2_menu* tmp; if ((tmp = LCDML.MENU_getCurrentObj()) != NULL) return (tmp->getChild(LCDML.MENU_getCursorPosAbs())->getID()); @@ -592,11 +569,9 @@ uint8_t get_current_cursor_id(void) return (0); } -void lcdml_menu_control(void) -{ +void lcdml_menu_control(void) { // If something must init, put in in the setup condition - if (LCDML.BT_setup()) - { + if (LCDML.BT_setup()) { pinMode(BUT_R_PIN, INPUT_PULLUP); pinMode(BUT_L_PIN, INPUT_PULLUP); @@ -604,8 +579,7 @@ void lcdml_menu_control(void) ENCODER[ENC_L].begin(); } - if (back_from_volume > BACK_FROM_VOLUME_MS && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_volume)) - { + if (back_from_volume > BACK_FROM_VOLUME_MS && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_volume)) { encoderDir[ENC_L].reset(); encoderDir[ENC_R].reset(); @@ -617,18 +591,16 @@ void lcdml_menu_control(void) } // Volatile Variables - long g_LCDML_CONTROL_Encoder_position[NUM_ENCODER] = {ENCODER[ENC_R].read(), ENCODER[ENC_L].read()}; - bool button[NUM_ENCODER] = {digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN)}; + long g_LCDML_CONTROL_Encoder_position[NUM_ENCODER] = { ENCODER[ENC_R].read(), ENCODER[ENC_L].read() }; + bool button[NUM_ENCODER] = { digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN) }; /************************************************************************************ Basic encoder handling (from LCDMenuLib2) ************************************************************************************/ // RIGHT - if (g_LCDML_CONTROL_Encoder_position[ENC_R] <= -3) - { - if (!button[ENC_R]) - { + if (g_LCDML_CONTROL_Encoder_position[ENC_R] <= -3) { + if (!button[ENC_R]) { LCDML.BT_left(); #ifdef DEBUG Serial.println(F("ENC-R left")); @@ -636,9 +608,7 @@ void lcdml_menu_control(void) encoderDir[ENC_R].Left(true); g_LCDML_CONTROL_button_prev[ENC_R] = LOW; g_LCDML_CONTROL_button_press_time[ENC_R] = -1; - } - else - { + } else { #ifdef DEBUG Serial.println(F("ENC-R down")); #endif @@ -646,11 +616,8 @@ void lcdml_menu_control(void) LCDML.BT_down(); } ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] + 4); - } - else if (g_LCDML_CONTROL_Encoder_position[ENC_R] >= 3) - { - if (!button[ENC_R]) - { + } else if (g_LCDML_CONTROL_Encoder_position[ENC_R] >= 3) { + if (!button[ENC_R]) { #ifdef DEBUG Serial.println(F("ENC-R right")); #endif @@ -658,9 +625,7 @@ void lcdml_menu_control(void) LCDML.BT_right(); g_LCDML_CONTROL_button_prev[ENC_R] = LOW; g_LCDML_CONTROL_button_press_time[ENC_R] = -1; - } - else - { + } else { #ifdef DEBUG Serial.println(F("ENC-R up")); #endif @@ -668,35 +633,27 @@ void lcdml_menu_control(void) LCDML.BT_up(); } ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] - 4); - } - else - { - if (!button[ENC_R] && g_LCDML_CONTROL_button_prev[ENC_R]) //falling edge, button pressed + } else { + if (!button[ENC_R] && g_LCDML_CONTROL_button_prev[ENC_R]) //falling edge, button pressed { encoderDir[ENC_R].ButtonPressed(true); g_LCDML_CONTROL_button_prev[ENC_R] = LOW; g_LCDML_CONTROL_button_press_time[ENC_R] = millis(); - } - else if (button[ENC_R] && !g_LCDML_CONTROL_button_prev[ENC_R]) //rising edge, button not active + } else if (button[ENC_R] && !g_LCDML_CONTROL_button_prev[ENC_R]) //rising edge, button not active { encoderDir[ENC_R].ButtonPressed(false); g_LCDML_CONTROL_button_prev[ENC_R] = HIGH; - if (g_LCDML_CONTROL_button_press_time[ENC_R] < 0) - { + if (g_LCDML_CONTROL_button_press_time[ENC_R] < 0) { g_LCDML_CONTROL_button_press_time[ENC_R] = millis(); //Reset for left right action - } - else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) - { + } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) { #ifdef DEBUG Serial.println(F("ENC-R long released")); #endif //LCDML.BT_quit(); encoderDir[ENC_R].ButtonLong(true); - } - else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= BUT_DEBOUNCE_MS) - { + } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= BUT_DEBOUNCE_MS) { #ifdef DEBUG Serial.println(F("ENC-R short")); #endif @@ -707,23 +664,19 @@ void lcdml_menu_control(void) } } - if (encoderDir[ENC_R].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) - { + if (encoderDir[ENC_R].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) { #ifdef DEBUG Serial.println(F("ENC-R long recognized")); #endif encoderDir[ENC_R].ButtonLong(true); - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) - { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) { LCDML.BT_enter(); LCDML.OTHER_updateFunc(); LCDML.loop_menu(); encoderDir[ENC_R].ButtonPressed(false); encoderDir[ENC_R].ButtonLong(false); - } - else - { + } else { if (LCDML.FUNC_getID() < 0xff) LCDML.FUNC_setGBAToLastFunc(); else @@ -735,10 +688,8 @@ void lcdml_menu_control(void) } // LEFT - if (g_LCDML_CONTROL_Encoder_position[ENC_L] <= -3) - { - if (!button[ENC_L]) - { + if (g_LCDML_CONTROL_Encoder_position[ENC_L] <= -3) { + if (!button[ENC_L]) { #ifdef DEBUG Serial.println(F("ENC-L left")); #endif @@ -746,25 +697,19 @@ void lcdml_menu_control(void) LCDML.BT_left(); g_LCDML_CONTROL_button_prev[ENC_L] = LOW; g_LCDML_CONTROL_button_press_time[ENC_L] = -1; - } - else - { + } else { #ifdef DEBUG Serial.println(F("ENC-L down")); #endif encoderDir[ENC_L].Down(true); LCDML.BT_down(); - if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) - { + if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) { LCDML.OTHER_jumpToFunc(UI_func_volume); } } ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] + 4); - } - else if (g_LCDML_CONTROL_Encoder_position[ENC_L] >= 3) - { - if (!button[ENC_L]) - { + } else if (g_LCDML_CONTROL_Encoder_position[ENC_L] >= 3) { + if (!button[ENC_L]) { #ifdef DEBUG Serial.println(F("ENC-L right")); #endif @@ -772,62 +717,48 @@ void lcdml_menu_control(void) LCDML.BT_right(); g_LCDML_CONTROL_button_prev[ENC_L] = LOW; g_LCDML_CONTROL_button_press_time[ENC_L] = -1; - } - else - { + } else { #ifdef DEBUG Serial.println(F("ENC-L up")); #endif encoderDir[ENC_L].Up(true); LCDML.BT_up(); - if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) - { + if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) { LCDML.OTHER_jumpToFunc(UI_func_volume); } } ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] - 4); - } - else - { - if (!button[ENC_L] && g_LCDML_CONTROL_button_prev[ENC_L]) //falling edge, button pressed + } else { + if (!button[ENC_L] && g_LCDML_CONTROL_button_prev[ENC_L]) //falling edge, button pressed { encoderDir[ENC_L].ButtonPressed(true); g_LCDML_CONTROL_button_prev[ENC_L] = LOW; g_LCDML_CONTROL_button_press_time[ENC_L] = millis(); - } - else if (button[ENC_L] && !g_LCDML_CONTROL_button_prev[ENC_L]) //rising edge, button not active + } else if (button[ENC_L] && !g_LCDML_CONTROL_button_prev[ENC_L]) //rising edge, button not active { encoderDir[ENC_L].ButtonPressed(false); g_LCDML_CONTROL_button_prev[ENC_L] = HIGH; - if (g_LCDML_CONTROL_button_press_time[ENC_L] < 0) - { + if (g_LCDML_CONTROL_button_press_time[ENC_L] < 0) { g_LCDML_CONTROL_button_press_time[ENC_L] = millis(); //Reset for left right action - } - else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= LONG_BUTTON_PRESS) - { + } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= LONG_BUTTON_PRESS) { #ifdef DEBUG Serial.println(F("ENC-L long released")); #endif //encoderDir[ENC_L].ButtonLong(true); //LCDML.BT_quit(); - } - else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= BUT_DEBOUNCE_MS) - { + } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= BUT_DEBOUNCE_MS) { //LCDML.BT_enter(); #ifdef DEBUG Serial.println(F("ENC-L short")); #endif encoderDir[ENC_L].ButtonShort(true); - if ((LCDML.MENU_getLastActiveFunctionID() == 0xff && LCDML.MENU_getLastCursorPositionID() == 0) || menu_init == true) - { + if ((LCDML.MENU_getLastActiveFunctionID() == 0xff && LCDML.MENU_getLastCursorPositionID() == 0) || menu_init == true) { LCDML.MENU_goRoot(); menu_init = false; - } - else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_volume)) - { + } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_volume)) { encoderDir[ENC_L].reset(); encoderDir[ENC_R].reset(); @@ -835,15 +766,13 @@ void lcdml_menu_control(void) LCDML.OTHER_jumpToID(LCDML.MENU_getLastActiveFunctionID()); else LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); - } - else + } else LCDML.BT_quit(); } } } - if (encoderDir[ENC_L].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= LONG_BUTTON_PRESS) - { + if (encoderDir[ENC_L].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= LONG_BUTTON_PRESS) { #ifdef DEBUG Serial.println(F("ENC-L long recognized")); #endif @@ -863,14 +792,12 @@ void lcdml_menu_control(void) /*********************************************************************** MENU DISPLAY ***********************************************************************/ -void lcdml_menu_clear(void) -{ +void lcdml_menu_clear(void) { display.clear(); display.setCursor(0, 0); } -void lcdml_menu_display(void) -{ +void lcdml_menu_display(void) { // update content // *************** if (LCDML.DISP_checkMenuUpdate()) { @@ -883,31 +810,25 @@ void lcdml_menu_display(void) // content variable char content_text[_LCDML_DISP_cols]; // save the content text of every menu element // menu element object - LCDMenuLib2_menu *tmp; + LCDMenuLib2_menu* tmp; // some limit values uint8_t i = LCDML.MENU_getScroll(); uint8_t maxi = _LCDML_DISP_rows + i; uint8_t n = 0; // check if this element has children - if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL) - { + if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL) { // loop to display lines - do - { + do { // check if a menu element has a condition and if the condition be true - if (tmp->checkCondition()) - { + if (tmp->checkCondition()) { // check the type off a menu element - if (tmp->checkType_menu() == true) - { + if (tmp->checkType_menu() == true) { // display normal content LCDML_getContent(content_text, tmp->getID()); display.setCursor(1, n); display.print(content_text); - } - else - { + } else { if (tmp->checkType_dynParam()) { tmp->callback(n); } @@ -921,18 +842,16 @@ void lcdml_menu_display(void) } } - if (LCDML.DISP_checkMenuCursorUpdate()) - { + if (LCDML.DISP_checkMenuCursorUpdate()) { // init vars - uint8_t n_max = (LCDML.MENU_getChilds() >= _LCDML_DISP_rows) ? _LCDML_DISP_rows : (LCDML.MENU_getChilds()); - uint8_t scrollbar_min = 0; - uint8_t scrollbar_max = LCDML.MENU_getChilds(); + uint8_t n_max = (LCDML.MENU_getChilds() >= _LCDML_DISP_rows) ? _LCDML_DISP_rows : (LCDML.MENU_getChilds()); + uint8_t scrollbar_min = 0; + uint8_t scrollbar_max = LCDML.MENU_getChilds(); uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs(); - uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos); + uint8_t scroll_pos = ((1. * n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos); // display rows - for (uint8_t n = 0; n < n_max; n++) - { + for (uint8_t n = 0; n < n_max; n++) { //set cursor display.setCursor(0, n); @@ -953,8 +872,7 @@ void lcdml_menu_display(void) display.drawTile((_LCDML_DISP_cols - 1), n, 1, flipped_scroll_bar[0]); display.setCursor((_LCDML_DISP_cols), n + 1); #endif - } - else { + } else { display.setCursor((_LCDML_DISP_cols - 1), n); display.print(F(" ")); } @@ -1005,9 +923,8 @@ void lcdml_menu_display(void) ***********************************************************************/ #ifdef USE_FX -void UI_func_reverb_roomsize(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_roomsize(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1015,10 +932,9 @@ void UI_func_reverb_roomsize(uint8_t param) display_bar_int("Reverb Room", configuration.fx.reverb_roomsize, 1.0, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_roomsize = constrain(configuration.fx.reverb_roomsize + ENCODER[ENC_R].speed(), REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX); else if (LCDML.BT_checkUp()) @@ -1033,7 +949,7 @@ void UI_func_reverb_roomsize(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -1041,9 +957,8 @@ void UI_func_reverb_roomsize(uint8_t param) } #if USE_PLATEREVERB != 1 -void UI_func_reverb_damping(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_damping(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1051,10 +966,9 @@ void UI_func_reverb_damping(uint8_t param) display_bar_int("Reverb Damp.", configuration.fx.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_damping = constrain(configuration.fx.reverb_damping + ENCODER[ENC_R].speed(), REVERB_DAMPING_MIN, REVERB_DAMPING_MAX); else if (LCDML.BT_checkUp()) @@ -1066,16 +980,15 @@ void UI_func_reverb_damping(uint8_t param) freeverb.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } #else -void UI_func_reverb_lowpass(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_lowpass(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1083,10 +996,9 @@ void UI_func_reverb_lowpass(uint8_t param) display_bar_int("Reverb Lowpass", configuration.fx.reverb_lowpass, 1.0, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_lowpass = constrain(configuration.fx.reverb_lowpass + ENCODER[ENC_R].speed(), REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX); else if (LCDML.BT_checkUp()) @@ -1098,16 +1010,15 @@ void UI_func_reverb_lowpass(uint8_t param) reverb.lowpass(mapfloat(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX, 0.0, 1.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_reverb_lodamp(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_lodamp(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1115,10 +1026,9 @@ void UI_func_reverb_lodamp(uint8_t param) display_bar_int("Reverb Lodamp.", configuration.fx.reverb_lodamp, 1.0, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_lodamp = constrain(configuration.fx.reverb_lodamp + ENCODER[ENC_R].speed(), REVERB_LODAMP_MIN, REVERB_LODAMP_MAX); else if (LCDML.BT_checkUp()) @@ -1130,16 +1040,15 @@ void UI_func_reverb_lodamp(uint8_t param) reverb.lodamp(mapfloat(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX, 0.0, 1.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_reverb_hidamp(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_hidamp(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1147,10 +1056,9 @@ void UI_func_reverb_hidamp(uint8_t param) display_bar_int("Reverb Hidamp.", configuration.fx.reverb_hidamp, 1.0, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_hidamp = constrain(configuration.fx.reverb_hidamp + ENCODER[ENC_R].speed(), REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX); else if (LCDML.BT_checkUp()) @@ -1162,16 +1070,15 @@ void UI_func_reverb_hidamp(uint8_t param) reverb.hidamp(mapfloat(configuration.fx.reverb_hidamp, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX, 0.0, 1.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_reverb_diffusion(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_diffusion(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1179,10 +1086,9 @@ void UI_func_reverb_diffusion(uint8_t param) display_bar_int("Reverb Diff.", configuration.fx.reverb_diffusion, 1.0, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_diffusion = constrain(configuration.fx.reverb_diffusion + ENCODER[ENC_R].speed(), REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX); else if (LCDML.BT_checkUp()) @@ -1194,17 +1100,16 @@ void UI_func_reverb_diffusion(uint8_t param) reverb.diffusion(mapfloat(configuration.fx.reverb_diffusion, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX, 0.0, 1.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -#endif // PLATEREVERB != 1 +#endif // PLATEREVERB != 1 -void UI_func_reverb_level(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_level(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1212,10 +1117,9 @@ void UI_func_reverb_level(uint8_t param) display_bar_int("Reverb Level", configuration.fx.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.reverb_level = constrain(configuration.fx.reverb_level + ENCODER[ENC_R].speed(), REVERB_LEVEL_MIN, REVERB_LEVEL_MAX); else if (LCDML.BT_checkUp()) @@ -1230,16 +1134,15 @@ void UI_func_reverb_level(uint8_t param) 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 ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_chorus_frequency(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_chorus_frequency(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1250,17 +1153,15 @@ void UI_func_chorus_frequency(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.chorus_frequency[selected_instance_id] = constrain(configuration.fx.chorus_frequency[selected_instance_id] + ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); else if (LCDML.BT_checkUp()) configuration.fx.chorus_frequency[selected_instance_id] = constrain(configuration.fx.chorus_frequency[selected_instance_id] - ENCODER[ENC_R].speed(), CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1272,16 +1173,15 @@ void UI_func_chorus_frequency(uint8_t param) chorus_modulator[selected_instance_id]->frequency(configuration.fx.chorus_frequency[selected_instance_id] / 10.0); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_chorus_waveform(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_chorus_waveform(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1292,15 +1192,14 @@ void UI_func_chorus_waveform(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) configuration.fx.chorus_waveform[selected_instance_id] = constrain(configuration.fx.chorus_waveform[selected_instance_id] + 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX); else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) configuration.fx.chorus_waveform[selected_instance_id] = constrain(configuration.fx.chorus_waveform[selected_instance_id] - 1, CHORUS_WAVEFORM_MIN, CHORUS_WAVEFORM_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1308,8 +1207,7 @@ void UI_func_chorus_waveform(uint8_t param) #endif display.setCursor(0, 1); - switch (configuration.fx.chorus_waveform[selected_instance_id]) - { + switch (configuration.fx.chorus_waveform[selected_instance_id]) { case 0: chorus_modulator[selected_instance_id]->begin(WAVEFORM_TRIANGLE); display.print(F("[TRIANGLE]")); @@ -1325,16 +1223,15 @@ void UI_func_chorus_waveform(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_chorus_depth(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_chorus_depth(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1345,17 +1242,15 @@ void UI_func_chorus_depth(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.fx.chorus_depth[selected_instance_id] = constrain(configuration.fx.chorus_depth[selected_instance_id] + ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX); else if (LCDML.BT_checkUp()) configuration.fx.chorus_depth[selected_instance_id] = constrain(configuration.fx.chorus_depth[selected_instance_id] - ENCODER[ENC_R].speed(), CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1368,16 +1263,15 @@ void UI_func_chorus_depth(uint8_t param) chorus_modulator[selected_instance_id]->amplitude(configuration.fx.chorus_depth[selected_instance_id] / 100.0); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_chorus_level(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_chorus_level(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1388,23 +1282,18 @@ void UI_func_chorus_level(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.chorus_level[selected_instance_id] = constrain(configuration.fx.chorus_level[selected_instance_id] + ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 93, configuration.fx.chorus_level[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.chorus_level[selected_instance_id] = constrain(configuration.fx.chorus_level[selected_instance_id] - ENCODER[ENC_R].speed(), CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 93, configuration.fx.chorus_level[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1420,26 +1309,22 @@ void UI_func_chorus_level(uint8_t param) //chorus_mixer[selected_instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_delay_time(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_delay_time(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(BLOCKBAR); - if (configuration.fx.delay_sync[selected_instance_id] > 0) - { - lcd_display_delay_sync(configuration.fx.delay_sync[selected_instance_id]); //goto MIDI Sync - } - else - { + if (configuration.fx.delay_sync[selected_instance_id] > 0) { + lcd_display_delay_sync(configuration.fx.delay_sync[selected_instance_id]); //goto MIDI Sync + } else { #if DELAY_TIME_MAX >= 100 display_bar_int("Delay Time", configuration.fx.delay_time[selected_instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 4, false, false, true); #else @@ -1450,44 +1335,32 @@ void UI_func_delay_time(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { - if (configuration.fx.delay_time[selected_instance_id] == DELAY_TIME_MIN && configuration.fx.delay_sync[selected_instance_id] > DELAY_SYNC_MIN) - { + 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()) { + if (configuration.fx.delay_time[selected_instance_id] == DELAY_TIME_MIN && configuration.fx.delay_sync[selected_instance_id] > DELAY_SYNC_MIN) { // MIDI-sync delay configuration.fx.delay_sync[selected_instance_id] = constrain(configuration.fx.delay_sync[selected_instance_id] - 1, DELAY_SYNC_MIN, DELAY_SYNC_MAX); - } - else - { + } else { configuration.fx.delay_time[selected_instance_id] = constrain(configuration.fx.delay_time[selected_instance_id] + ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 105, configuration.fx.delay_time[selected_instance_id]); } - } - else if (LCDML.BT_checkUp()) - { - if (configuration.fx.delay_time[selected_instance_id] == DELAY_TIME_MIN && configuration.fx.delay_sync[selected_instance_id] > DELAY_SYNC_MIN) - { + } else if (LCDML.BT_checkUp()) { + if (configuration.fx.delay_time[selected_instance_id] == DELAY_TIME_MIN && configuration.fx.delay_sync[selected_instance_id] > DELAY_SYNC_MIN) { // MIDI-sync delay configuration.fx.delay_sync[selected_instance_id] = constrain(configuration.fx.delay_sync[selected_instance_id] + 1, DELAY_SYNC_MIN, DELAY_SYNC_MAX); - } - else - { + } else { if (configuration.fx.delay_time[selected_instance_id] == DELAY_TIME_MIN) configuration.fx.delay_sync[selected_instance_id] = DELAY_SYNC_MIN + 1; - else - { + else { configuration.fx.delay_time[selected_instance_id] = constrain(configuration.fx.delay_time[selected_instance_id] - ENCODER[ENC_R].speed(), DELAY_TIME_MIN, DELAY_TIME_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 105, configuration.fx.delay_time[selected_instance_id]); } } } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1495,12 +1368,9 @@ void UI_func_delay_time(uint8_t param) #endif } - if (configuration.fx.delay_sync[selected_instance_id] > 0) - { - lcd_display_delay_sync(configuration.fx.delay_sync[selected_instance_id]);//MIDI Sync Delay - } - else - { + if (configuration.fx.delay_sync[selected_instance_id] > 0) { + lcd_display_delay_sync(configuration.fx.delay_sync[selected_instance_id]); //MIDI Sync Delay + } else { #if DELAY_TIME_MAX >= 100 display_bar_int("Delay Time", configuration.fx.delay_time[selected_instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 4, false, false, true); #else @@ -1513,16 +1383,15 @@ void UI_func_delay_time(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_delay_feedback(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_delay_feedback(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1533,23 +1402,18 @@ void UI_func_delay_feedback(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.delay_feedback[selected_instance_id] = constrain(configuration.fx.delay_feedback[selected_instance_id] + ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 106, configuration.fx.delay_feedback[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.delay_feedback[selected_instance_id] = constrain(configuration.fx.delay_feedback[selected_instance_id] - ENCODER[ENC_R].speed(), DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 106, configuration.fx.delay_feedback[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1559,19 +1423,18 @@ void UI_func_delay_feedback(uint8_t param) display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[selected_instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false); - delay_fb_mixer[selected_instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[selected_instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback + delay_fb_mixer[selected_instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[selected_instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_delay_level(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_delay_level(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1582,23 +1445,18 @@ void UI_func_delay_level(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.delay_level[selected_instance_id] = constrain(configuration.fx.delay_level[selected_instance_id] + ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 107, configuration.fx.delay_level[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.delay_level[selected_instance_id] = constrain(configuration.fx.delay_level[selected_instance_id] - ENCODER[ENC_R].speed(), DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 107, configuration.fx.delay_level[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1611,16 +1469,15 @@ void UI_func_delay_level(uint8_t param) delay_mixer[selected_instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_level[selected_instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0, 127))); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_reverb_send(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_reverb_send(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1631,23 +1488,18 @@ void UI_func_reverb_send(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.reverb_send[selected_instance_id] = constrain(configuration.fx.reverb_send[selected_instance_id] + ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.reverb_send[selected_instance_id] = constrain(configuration.fx.reverb_send[selected_instance_id] - ENCODER[ENC_R].speed(), REVERB_SEND_MIN, REVERB_SEND_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1661,16 +1513,15 @@ void UI_func_reverb_send(uint8_t param) reverb_mixer_l.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT))); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_filter_cutoff(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_filter_cutoff(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1681,23 +1532,18 @@ void UI_func_filter_cutoff(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.filter_cutoff[selected_instance_id] = constrain(configuration.fx.filter_cutoff[selected_instance_id] + ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 104, configuration.fx.filter_cutoff[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.filter_cutoff[selected_instance_id] = constrain(configuration.fx.filter_cutoff[selected_instance_id] - ENCODER[ENC_R].speed(), FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 104, configuration.fx.filter_cutoff[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1710,16 +1556,15 @@ void UI_func_filter_cutoff(uint8_t param) MicroDexed[selected_instance_id]->setFilterCutoff(mapfloat(configuration.fx.filter_cutoff[selected_instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_filter_resonance(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_filter_resonance(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1730,23 +1575,18 @@ void UI_func_filter_resonance(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.filter_resonance[selected_instance_id] = constrain(configuration.fx.filter_resonance[selected_instance_id] + ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 103, configuration.fx.filter_resonance[selected_instance_id]); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.filter_resonance[selected_instance_id] = constrain(configuration.fx.filter_resonance[selected_instance_id] - ENCODER[ENC_R].speed(), FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 103, configuration.fx.filter_resonance[selected_instance_id]); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1759,7 +1599,7 @@ void UI_func_filter_resonance(uint8_t param) MicroDexed[selected_instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[selected_instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0)); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -1767,9 +1607,8 @@ void UI_func_filter_resonance(uint8_t param) } #endif -void UI_func_transpose(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_transpose(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1780,17 +1619,15 @@ void UI_func_transpose(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].transpose = constrain(configuration.dexed[selected_instance_id].transpose + ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].transpose = constrain(configuration.dexed[selected_instance_id].transpose - ENCODER[ENC_R].speed(), TRANSPOSE_MIN, TRANSPOSE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1805,16 +1642,15 @@ void UI_func_transpose(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 144, configuration.dexed[selected_instance_id].transpose, 0); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_tune(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_tune(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1825,23 +1661,18 @@ void UI_func_tune(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.dexed[selected_instance_id].tune = constrain(configuration.dexed[selected_instance_id].tune + ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 94, configuration.dexed[selected_instance_id].tune); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.dexed[selected_instance_id].tune = constrain(configuration.dexed[selected_instance_id].tune - ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 94, configuration.dexed[selected_instance_id].tune); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1855,16 +1686,15 @@ void UI_func_tune(uint8_t param) MicroDexed[selected_instance_id]->doRefreshVoice(); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_midi_channel(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_midi_channel(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1875,15 +1705,14 @@ void UI_func_midi_channel(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) configuration.dexed[selected_instance_id].midi_channel = constrain(configuration.dexed[selected_instance_id].midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) configuration.dexed[selected_instance_id].midi_channel = constrain(configuration.dexed[selected_instance_id].midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1891,37 +1720,32 @@ void UI_func_midi_channel(uint8_t param) #endif display.setCursor(0, 1); - if (configuration.dexed[selected_instance_id].midi_channel == 0) - { + if (configuration.dexed[selected_instance_id].midi_channel == 0) { display.print(F("[OMNI]")); - } - else - { + } else { display_int(configuration.dexed[selected_instance_id].midi_channel, 4, false, true, false); } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void getNoteName(char* noteName, uint8_t noteNumber) -{ - char notes [12][3] = {"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"}; +void getNoteName(char* noteName, uint8_t noteNumber) { + char notes[12][3] = { "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#" }; uint8_t oct_index = noteNumber - 12; noteNumber -= 21; snprintf_P(noteName, sizeof(noteName), PSTR("%2s%1d"), notes[noteNumber % 12], oct_index / 12); } -void UI_func_lowest_note(uint8_t param) -{ +void UI_func_lowest_note(uint8_t param) { char note_name[4]; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1937,17 +1761,15 @@ void UI_func_lowest_note(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].lowest_note = constrain(configuration.dexed[selected_instance_id].lowest_note + ENCODER[ENC_R].speed(), INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].lowest_note = constrain(configuration.dexed[selected_instance_id].lowest_note - ENCODER[ENC_R].speed(), INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -1960,18 +1782,17 @@ void UI_func_lowest_note(uint8_t param) display.print(note_name); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_highest_note(uint8_t param) -{ +void UI_func_highest_note(uint8_t param) { char note_name[4]; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -1987,17 +1808,15 @@ void UI_func_highest_note(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].highest_note = constrain(configuration.dexed[selected_instance_id].highest_note + ENCODER[ENC_R].speed(), INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].highest_note = constrain(configuration.dexed[selected_instance_id].highest_note - ENCODER[ENC_R].speed(), INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -2010,16 +1829,15 @@ void UI_func_highest_note(uint8_t param) display.print(note_name); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_sound_intensity(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_sound_intensity(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2030,26 +1848,21 @@ void UI_func_sound_intensity(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.dexed[selected_instance_id].sound_intensity = constrain(configuration.dexed[selected_instance_id].sound_intensity + ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.dexed[selected_instance_id].sound_intensity = constrain(configuration.dexed[selected_instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -2061,21 +1874,19 @@ void UI_func_sound_intensity(uint8_t param) MicroDexed[selected_instance_id]->setGain(midi_volume_transform(map(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127))); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_panorama(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_panorama(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - if (configuration.sys.mono > 0) - { + if (configuration.sys.mono > 0) { display.setCursor(0, 0); display.print(F("Panorama")); display.setCursor(0, 1); @@ -2089,46 +1900,40 @@ void UI_func_panorama(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down() && configuration.sys.mono == 0) - { + if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down() && configuration.sys.mono == 0) { configuration.dexed[selected_instance_id].pan = constrain(configuration.dexed[selected_instance_id].pan + ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, map(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, 0, 127)); - } - else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up() && configuration.sys.mono == 0) - { + } else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up() && configuration.sys.mono == 0) { configuration.dexed[selected_instance_id].pan = constrain(configuration.dexed[selected_instance_id].pan - ENCODER[ENC_R].speed(), PANORAMA_MIN, PANORAMA_MAX); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, map(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, 0, 127)); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); } #endif - if (configuration.sys.mono == 0) - { + if (configuration.sys.mono == 0) { display_meter_float("Panorama", configuration.dexed[selected_instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 1, 1, false, true, false); mono2stereo[selected_instance_id]->panorama(mapfloat(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_favorites(uint8_t param) -{ +void UI_func_favorites(uint8_t param) { static uint8_t old_favorites; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_L].reset(); old_favorites = configuration.sys.favorites; @@ -2136,8 +1941,7 @@ void UI_func_favorites(uint8_t param) display.setCursor(0, 0); display.print(F("Favorites")); display.setCursor(0, 1); - switch (configuration.sys.favorites) - { + switch (configuration.sys.favorites) { case 0: display.print(F("[ All presets ]")); break; @@ -2153,7 +1957,7 @@ void UI_func_favorites(uint8_t param) } } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown()) configuration.sys.favorites = constrain(configuration.sys.favorites + 1, 0, 3); @@ -2161,8 +1965,7 @@ void UI_func_favorites(uint8_t param) configuration.sys.favorites = constrain(configuration.sys.favorites - 1, 0, 3); display.setCursor(0, 1); - switch (configuration.sys.favorites) - { + switch (configuration.sys.favorites) { case 0: display.print(F("[ All presets ]")); break; @@ -2178,21 +1981,19 @@ void UI_func_favorites(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_L].reset(); - if (old_favorites != configuration.sys.favorites) - { + if (old_favorites != configuration.sys.favorites) { save_sys_flag = true; save_sys = 0; } } } -void UI_func_epiano_midi_channel(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_midi_channel(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2200,7 +2001,7 @@ void UI_func_epiano_midi_channel(uint8_t param) display.print(F("EP MIDI Channel")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) configuration.epiano.midi_channel = constrain(configuration.epiano.midi_channel + ENCODER[ENC_R].speed(), EP_MIDI_CHANNEL_MIN, EP_MIDI_CHANNEL_MAX); @@ -2208,28 +2009,24 @@ void UI_func_epiano_midi_channel(uint8_t param) configuration.epiano.midi_channel = constrain(configuration.epiano.midi_channel - ENCODER[ENC_R].speed(), EP_MIDI_CHANNEL_MIN, EP_MIDI_CHANNEL_MAX); display.setCursor(0, 1); - if (configuration.epiano.midi_channel == 0) - { + if (configuration.epiano.midi_channel == 0) { display.print(F("[OMNI]")); - } - else - { + } else { display_int(configuration.epiano.midi_channel, 4, false, true, false); } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_lowest_note(uint8_t param) -{ +void UI_func_epiano_lowest_note(uint8_t param) { char note_name[4]; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2242,10 +2039,9 @@ void UI_func_epiano_lowest_note(uint8_t param) display.print(F("]")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.epiano.lowest_note = constrain(configuration.epiano.lowest_note + ENCODER[ENC_R].speed(), EP_LOWEST_NOTE_MIN, EP_LOWEST_NOTE_MAX); else if (LCDML.BT_checkUp()) @@ -2257,18 +2053,17 @@ void UI_func_epiano_lowest_note(uint8_t param) display.print(note_name); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_highest_note(uint8_t param) -{ +void UI_func_epiano_highest_note(uint8_t param) { char note_name[4]; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2281,10 +2076,9 @@ void UI_func_epiano_highest_note(uint8_t param) display.print(F("]")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.epiano.highest_note = constrain(configuration.epiano.highest_note + ENCODER[ENC_R].speed(), EP_HIGHEST_NOTE_MIN, EP_HIGHEST_NOTE_MAX); else if (LCDML.BT_checkUp()) @@ -2296,16 +2090,15 @@ void UI_func_epiano_highest_note(uint8_t param) display.print(note_name); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_sound_intensity(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_sound_intensity(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2318,19 +2111,15 @@ void UI_func_epiano_sound_intensity(uint8_t param) #endif } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.sound_intensity = constrain(configuration.epiano.sound_intensity + ENCODER[ENC_R].speed(), EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 7, configuration.epiano.sound_intensity); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.sound_intensity = constrain(configuration.epiano.sound_intensity - ENCODER[ENC_R].speed(), EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 7, configuration.epiano.sound_intensity); } @@ -2342,21 +2131,19 @@ void UI_func_epiano_sound_intensity(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_panorama(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_panorama(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - if (configuration.sys.mono > 0) - { + if (configuration.sys.mono > 0) { display.setCursor(0, 0); display.print(F("EP Panorama")); display.setCursor(0, 1); @@ -2368,21 +2155,17 @@ void UI_func_epiano_panorama(uint8_t param) display_meter_float("EP Panorama", configuration.epiano.pan, 0.05, -20.0, EP_PANORAMA_MIN, EP_PANORAMA_MAX, 1, 1, false, true, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down() && configuration.sys.mono == 0) - { + if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down() && configuration.sys.mono == 0) { configuration.epiano.pan = constrain(configuration.epiano.pan + ENCODER[ENC_R].speed(), EP_PANORAMA_MIN, EP_PANORAMA_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 10, map(configuration.epiano.pan, EP_PANORAMA_MIN, EP_PANORAMA_MAX, 0, 127)); - } - else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up() && configuration.sys.mono == 0) - { + } else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up() && configuration.sys.mono == 0) { configuration.epiano.pan = constrain(configuration.epiano.pan - ENCODER[ENC_R].speed(), EP_PANORAMA_MIN, EP_PANORAMA_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 10, map(configuration.epiano.pan, EP_PANORAMA_MIN, EP_PANORAMA_MAX, 0, 127)); } - if (configuration.sys.mono == 0) - { + if (configuration.sys.mono == 0) { display_meter_float("EP Panorama", configuration.epiano.pan, 0.05, -20.0, EP_PANORAMA_MIN, EP_PANORAMA_MAX, 1, 1, false, true, false); #if defined(USE_EPIANO) ep_stereo_panorama.panorama(mapfloat(configuration.epiano.pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); @@ -2390,16 +2173,15 @@ void UI_func_epiano_panorama(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_decay(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_decay(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2407,18 +2189,14 @@ void UI_func_epiano_decay(uint8_t param) display_bar_int("EP Decay", configuration.epiano.decay, 1.0, EP_DECAY_MIN, EP_DECAY_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.decay = constrain(configuration.epiano.decay + ENCODER[ENC_R].speed(), EP_DECAY_MIN, EP_DECAY_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.decay = constrain(configuration.epiano.decay - ENCODER[ENC_R].speed(), EP_DECAY_MIN, EP_DECAY_MAX); } } @@ -2429,16 +2207,15 @@ void UI_func_epiano_decay(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_release(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_release(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2446,18 +2223,14 @@ void UI_func_epiano_release(uint8_t param) display_bar_int("EP Release", configuration.epiano.release, 1.0, EP_RELEASE_MIN, EP_RELEASE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.release = constrain(configuration.epiano.release + ENCODER[ENC_R].speed(), EP_RELEASE_MIN, EP_RELEASE_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.release = constrain(configuration.epiano.release - ENCODER[ENC_R].speed(), EP_RELEASE_MIN, EP_RELEASE_MAX); } } @@ -2468,16 +2241,15 @@ void UI_func_epiano_release(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_hardness(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_hardness(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2485,18 +2257,14 @@ void UI_func_epiano_hardness(uint8_t param) display_bar_int("EP Hardness", configuration.epiano.hardness, 1.0, EP_HARDNESS_MIN, EP_HARDNESS_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.hardness = constrain(configuration.epiano.hardness + ENCODER[ENC_R].speed(), EP_HARDNESS_MIN, EP_HARDNESS_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.hardness = constrain(configuration.epiano.hardness - ENCODER[ENC_R].speed(), EP_HARDNESS_MIN, EP_HARDNESS_MAX); } } @@ -2507,16 +2275,15 @@ void UI_func_epiano_hardness(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_treble(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_treble(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2524,18 +2291,14 @@ void UI_func_epiano_treble(uint8_t param) display_bar_int("EP Treble", configuration.epiano.treble, 1.0, EP_TREBLE_MIN, EP_TREBLE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.treble = constrain(configuration.epiano.treble + ENCODER[ENC_R].speed(), EP_TREBLE_MIN, EP_TREBLE_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.treble = constrain(configuration.epiano.treble - ENCODER[ENC_R].speed(), EP_TREBLE_MIN, EP_TREBLE_MAX); } } @@ -2546,16 +2309,15 @@ void UI_func_epiano_treble(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_stereo(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_stereo(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2563,18 +2325,14 @@ void UI_func_epiano_stereo(uint8_t param) display_bar_int("EP Stereo", configuration.epiano.stereo, 1.0, EP_STEREO_MIN, EP_STEREO_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.stereo = constrain(configuration.epiano.stereo + ENCODER[ENC_R].speed(), EP_STEREO_MIN, EP_STEREO_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.stereo = constrain(configuration.epiano.stereo - ENCODER[ENC_R].speed(), EP_STEREO_MIN, EP_STEREO_MAX); } } @@ -2585,16 +2343,15 @@ void UI_func_epiano_stereo(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_tune(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_tune(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2602,17 +2359,13 @@ void UI_func_epiano_tune(uint8_t param) display_meter_int("EP Tune", configuration.epiano.tune, 1.0, -100.0, EP_TUNE_MIN, EP_TUNE_MAX, 3, false, true, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.epiano.tune = constrain(configuration.epiano.tune + ENCODER[ENC_R].speed(), EP_TUNE_MIN, EP_TUNE_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 94, configuration.epiano.tune); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.tune = constrain(configuration.epiano.tune - ENCODER[ENC_R].speed(), EP_TUNE_MIN, EP_TUNE_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 94, configuration.epiano.tune); } @@ -2624,16 +2377,15 @@ void UI_func_epiano_tune(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_detune(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_detune(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2641,18 +2393,14 @@ void UI_func_epiano_detune(uint8_t param) display_bar_int("EP Detune", configuration.epiano.detune, 1.0, EP_DETUNE_MIN, EP_DETUNE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.detune = constrain(configuration.epiano.detune + ENCODER[ENC_R].speed(), EP_DETUNE_MIN, EP_DETUNE_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.detune = constrain(configuration.epiano.detune - ENCODER[ENC_R].speed(), EP_DETUNE_MIN, EP_DETUNE_MAX); } } @@ -2663,16 +2411,15 @@ void UI_func_epiano_detune(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_pan_tremolo(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_pan_tremolo(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2680,18 +2427,14 @@ void UI_func_epiano_pan_tremolo(uint8_t param) display_bar_int("EP Trem. Width", configuration.epiano.pan_tremolo, 1.0, EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.pan_tremolo = constrain(configuration.epiano.pan_tremolo + ENCODER[ENC_R].speed(), EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.pan_tremolo = constrain(configuration.epiano.pan_tremolo - ENCODER[ENC_R].speed(), EP_PAN_TREMOLO_MIN, EP_PAN_TREMOLO_MAX); } } @@ -2705,16 +2448,15 @@ void UI_func_epiano_pan_tremolo(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_pan_lfo(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_pan_lfo(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2722,18 +2464,14 @@ void UI_func_epiano_pan_lfo(uint8_t param) display_bar_int("EP LFO", configuration.epiano.pan_lfo, 1.0, EP_PAN_LFO_MIN, EP_PAN_LFO_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.pan_lfo = constrain(configuration.epiano.pan_lfo + ENCODER[ENC_R].speed(), EP_PAN_LFO_MIN, EP_PAN_LFO_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.pan_lfo = constrain(configuration.epiano.pan_lfo - ENCODER[ENC_R].speed(), EP_PAN_LFO_MIN, EP_PAN_LFO_MAX); } } @@ -2747,16 +2485,15 @@ void UI_func_epiano_pan_lfo(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_overdrive(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_overdrive(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2764,18 +2501,14 @@ void UI_func_epiano_overdrive(uint8_t param) display_bar_int("EP Overdrive", configuration.epiano.overdrive, 1.0, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.overdrive = constrain(configuration.epiano.overdrive + ENCODER[ENC_R].speed(), EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.overdrive = constrain(configuration.epiano.overdrive - ENCODER[ENC_R].speed(), EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX); } } @@ -2786,16 +2519,15 @@ void UI_func_epiano_overdrive(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_transpose(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_transpose(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2803,10 +2535,9 @@ void UI_func_epiano_transpose(uint8_t param) display_meter_int("EP Transpose", configuration.epiano.transpose, 1.0, -24.0, EP_TRANSPOSE_MIN, EP_TRANSPOSE_MAX, 2, false, true, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.epiano.transpose = constrain(configuration.epiano.transpose + ENCODER[ENC_R].speed(), EP_TRANSPOSE_MIN, EP_TRANSPOSE_MAX); else if (LCDML.BT_checkUp()) @@ -2816,16 +2547,15 @@ void UI_func_epiano_transpose(uint8_t param) display_meter_int("EP Transpose", configuration.epiano.transpose, 1.0, -24.0, EP_TRANSPOSE_MIN, EP_TRANSPOSE_MAX, 2, false, true, true); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_polyphony(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_polyphony(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2833,20 +2563,15 @@ void UI_func_epiano_polyphony(uint8_t param) display_bar_int("EP Polyphony", configuration.epiano.polyphony, 1.0, EP_POLYPHONY_MIN, EP_POLYPHONY_MAX, 2, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.epiano.polyphony = constrain(configuration.epiano.polyphony + 1, EP_POLYPHONY_MIN, EP_POLYPHONY_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { if (configuration.epiano.polyphony - 1 < 1) configuration.epiano.polyphony = 1; - else - { + else { configuration.epiano.polyphony = constrain(configuration.epiano.polyphony - 1, EP_POLYPHONY_MIN, EP_POLYPHONY_MAX); } } @@ -2858,16 +2583,15 @@ void UI_func_epiano_polyphony(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_velocity_sense(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_velocity_sense(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2875,18 +2599,14 @@ void UI_func_epiano_velocity_sense(uint8_t param) display_bar_int("EP Vel. Sense", configuration.epiano.velocity_sense, 1.0, EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { encoderDir[ENC_R].reset(); - if (LCDML.BT_checkDown()) - { + if (LCDML.BT_checkDown()) { configuration.epiano.velocity_sense = constrain(configuration.epiano.velocity_sense + ENCODER[ENC_R].speed(), EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.epiano.velocity_sense = constrain(configuration.epiano.velocity_sense - ENCODER[ENC_R].speed(), EP_VELOCITY_SENSE_MIN, EP_VELOCITY_SENSE_MAX); } } @@ -2897,16 +2617,15 @@ void UI_func_epiano_velocity_sense(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_reverb_send(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_reverb_send(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2914,17 +2633,13 @@ void UI_func_epiano_reverb_send(uint8_t param) display_bar_int("EP Reverb Send", configuration.fx.ep_reverb_send, 1.0, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { configuration.fx.ep_reverb_send = constrain(configuration.fx.ep_reverb_send + ENCODER[ENC_R].speed(), EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 91, configuration.fx.ep_reverb_send); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.ep_reverb_send = constrain(configuration.fx.ep_reverb_send - ENCODER[ENC_R].speed(), EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 91, configuration.fx.ep_reverb_send); } @@ -2936,16 +2651,15 @@ void UI_func_epiano_reverb_send(uint8_t param) reverb_mixer_l.gain(REVERB_MIX_CH_EPIANO, volume_transform(mapfloat(configuration.fx.ep_reverb_send, EP_REVERB_SEND_MIN, EP_REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT))); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_chorus_frequency(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_chorus_frequency(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2953,10 +2667,9 @@ void UI_func_epiano_chorus_frequency(uint8_t param) 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, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.ep_chorus_frequency = constrain(configuration.fx.ep_chorus_frequency + ENCODER[ENC_R].speed(), EP_CHORUS_FREQUENCY_MIN, EP_CHORUS_FREQUENCY_MAX); else if (LCDML.BT_checkUp()) @@ -2968,16 +2681,15 @@ void UI_func_epiano_chorus_frequency(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_chorus_waveform(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_chorus_waveform(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -2985,7 +2697,7 @@ void UI_func_epiano_chorus_waveform(uint8_t param) display.print(F("EP Ch. Wavefrm")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) configuration.fx.ep_chorus_waveform = constrain(configuration.fx.ep_chorus_waveform + 1, EP_CHORUS_WAVEFORM_MIN, EP_CHORUS_WAVEFORM_MAX); @@ -2993,8 +2705,7 @@ void UI_func_epiano_chorus_waveform(uint8_t param) configuration.fx.ep_chorus_waveform = constrain(configuration.fx.ep_chorus_waveform - 1, EP_CHORUS_WAVEFORM_MIN, EP_CHORUS_WAVEFORM_MAX); display.setCursor(0, 1); - switch (configuration.fx.ep_chorus_waveform) - { + switch (configuration.fx.ep_chorus_waveform) { case 0: #if defined(USE_EPIANO) ep_chorus_modulator.begin(WAVEFORM_TRIANGLE); @@ -3016,16 +2727,15 @@ void UI_func_epiano_chorus_waveform(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_chorus_depth(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_chorus_depth(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3033,10 +2743,9 @@ void UI_func_epiano_chorus_depth(uint8_t param) display_bar_int("EP Ch. Depth", configuration.fx.ep_chorus_depth, 1.0, EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.fx.ep_chorus_depth = constrain(configuration.fx.ep_chorus_depth + ENCODER[ENC_R].speed(), EP_CHORUS_DEPTH_MIN, EP_CHORUS_DEPTH_MAX); else if (LCDML.BT_checkUp()) @@ -3049,16 +2758,15 @@ void UI_func_epiano_chorus_depth(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_epiano_chorus_level(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_epiano_chorus_level(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3066,17 +2774,13 @@ void UI_func_epiano_chorus_level(uint8_t param) display_bar_int("EP Ch. Level", configuration.fx.ep_chorus_level, 1.0, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 3, false, false, true); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.ep_chorus_level = constrain(configuration.fx.ep_chorus_level + ENCODER[ENC_R].speed(), EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 93, configuration.fx.ep_chorus_level); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.ep_chorus_level = constrain(configuration.fx.ep_chorus_level - ENCODER[ENC_R].speed(), EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX); MD_sendControlChange(configuration.epiano.midi_channel, 93, configuration.fx.ep_chorus_level); } @@ -3091,18 +2795,17 @@ void UI_func_epiano_chorus_level(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_stereo_mono(uint8_t param) -{ +void UI_func_stereo_mono(uint8_t param) { static uint8_t old_mono; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); old_mono = configuration.sys.mono; @@ -3110,8 +2813,7 @@ void UI_func_stereo_mono(uint8_t param) display.setCursor(0, 0); display.print(F("Stereo/Mono")); display.setCursor(0, 1); - switch (configuration.sys.mono) - { + switch (configuration.sys.mono) { case 0: display.print(F("[STEREO]")); stereo2mono.stereo(true); @@ -3131,7 +2833,7 @@ void UI_func_stereo_mono(uint8_t param) } } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown()) configuration.sys.mono = constrain(configuration.sys.mono + 1, MONO_MIN, MONO_MAX); @@ -3139,8 +2841,7 @@ void UI_func_stereo_mono(uint8_t param) configuration.sys.mono = constrain(configuration.sys.mono - 1, MONO_MIN, MONO_MAX); display.setCursor(0, 1); - switch (configuration.sys.mono) - { + switch (configuration.sys.mono) { case 0: display.print(F("[STEREO]")); stereo2mono.stereo(true); @@ -3161,27 +2862,25 @@ void UI_func_stereo_mono(uint8_t param) set_volume(configuration.sys.vol, configuration.sys.mono); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_L].reset(); - if (old_mono != configuration.sys.mono) - { + if (old_mono != configuration.sys.mono) { save_sys_flag = true; save_sys = 0; } } } -void UI_func_polyphony(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_polyphony(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(BLOCKBAR); -#if NUM_DEXED>1 +#if NUM_DEXED > 1 display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX - configuration.dexed[(selected_instance_id + 1) % NUM_DEXED].polyphony, 2, false, false, true); #else display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 2, false, false, true); @@ -3190,26 +2889,21 @@ void UI_func_polyphony(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { -#if NUM_DEXED>1 + 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()) { +#if NUM_DEXED > 1 if (configuration.dexed[selected_instance_id].polyphony < POLYPHONY_MAX - configuration.dexed[(selected_instance_id + 1) % NUM_DEXED].polyphony) configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX - configuration.dexed[(selected_instance_id + 1) % NUM_DEXED].polyphony); #else configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX); #endif - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { if (configuration.dexed[selected_instance_id].polyphony - 1 < 0) configuration.dexed[selected_instance_id].polyphony = 0; - else - { -#if NUM_DEXED>1 + else { +#if NUM_DEXED > 1 configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony - 1, POLYPHONY_MIN, POLYPHONY_MAX - configuration.dexed[(selected_instance_id + 1) % NUM_DEXED].polyphony); #else configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony - 1, POLYPHONY_MIN, POLYPHONY_MAX); @@ -3217,8 +2911,7 @@ void UI_func_polyphony(uint8_t param) } } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3227,7 +2920,7 @@ void UI_func_polyphony(uint8_t param) #endif } -#if NUM_DEXED>1 +#if NUM_DEXED > 1 display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX - configuration.dexed[(selected_instance_id + 1) % NUM_DEXED].polyphony, 2, false, false, false); #else display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 2, false, false, false); @@ -3235,16 +2928,15 @@ void UI_func_polyphony(uint8_t param) MicroDexed[selected_instance_id]->setMaxNotes(configuration.dexed[selected_instance_id].polyphony); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_mono_poly(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_mono_poly(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3255,10 +2947,9 @@ void UI_func_mono_poly(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].monopoly = constrain(configuration.dexed[selected_instance_id].monopoly + 1, MONOPOLY_MIN, MONOPOLY_MAX); else if (LCDML.BT_checkUp()) @@ -3268,8 +2959,7 @@ void UI_func_mono_poly(uint8_t param) configuration.dexed[selected_instance_id].monopoly = MicroDexed[selected_instance_id]->getMonoMode(); } #if NUM_DEXED > 1 - if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3279,8 +2969,7 @@ void UI_func_mono_poly(uint8_t param) } display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].monopoly) - { + switch (configuration.dexed[selected_instance_id].monopoly) { case 1: display.print(F("[MONOPHONIC]")); break; @@ -3289,16 +2978,15 @@ void UI_func_mono_poly(uint8_t param) break; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_note_refresh(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_note_refresh(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3309,17 +2997,15 @@ void UI_func_note_refresh(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].note_refresh = constrain(configuration.dexed[selected_instance_id].note_refresh + 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].note_refresh = constrain(configuration.dexed[selected_instance_id].note_refresh - 1, NOTE_REFRESH_MIN, NOTE_REFRESH_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3330,8 +3016,7 @@ void UI_func_note_refresh(uint8_t param) MicroDexed[selected_instance_id]->setNoteRefreshMode(configuration.dexed[selected_instance_id].note_refresh); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].note_refresh) - { + switch (configuration.dexed[selected_instance_id].note_refresh) { case 0: display.print(F("[NORMAL ]")); break; @@ -3341,16 +3026,15 @@ void UI_func_note_refresh(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_pb_range(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_pb_range(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3361,17 +3045,15 @@ void UI_func_pb_range(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].pb_range = constrain(configuration.dexed[selected_instance_id].pb_range + ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].pb_range = constrain(configuration.dexed[selected_instance_id].pb_range - ENCODER[ENC_R].speed(), PB_RANGE_MIN, PB_RANGE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3385,16 +3067,15 @@ void UI_func_pb_range(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 65, configuration.dexed[selected_instance_id].pb_range, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_pb_step(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_pb_step(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3405,17 +3086,15 @@ void UI_func_pb_step(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].pb_step = constrain(configuration.dexed[selected_instance_id].pb_step + ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].pb_step = constrain(configuration.dexed[selected_instance_id].pb_step - ENCODER[ENC_R].speed(), PB_STEP_MIN, PB_STEP_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3429,16 +3108,15 @@ void UI_func_pb_step(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 66, configuration.dexed[selected_instance_id].pb_step, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_mw_range(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_mw_range(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3449,17 +3127,15 @@ void UI_func_mw_range(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].mw_range = constrain(configuration.dexed[selected_instance_id].mw_range + ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].mw_range = constrain(configuration.dexed[selected_instance_id].mw_range - ENCODER[ENC_R].speed(), MW_RANGE_MIN, MW_RANGE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3473,16 +3149,15 @@ void UI_func_mw_range(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 70, configuration.dexed[selected_instance_id].mw_range, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_mw_assign(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_mw_assign(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3493,17 +3168,15 @@ void UI_func_mw_assign(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].mw_assign = constrain(configuration.dexed[selected_instance_id].mw_assign + 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].mw_assign = constrain(configuration.dexed[selected_instance_id].mw_assign - 1, MW_ASSIGN_MIN, MW_ASSIGN_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3515,8 +3188,7 @@ void UI_func_mw_assign(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 71, configuration.dexed[selected_instance_id].mw_assign, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].mw_assign) - { + switch (configuration.dexed[selected_instance_id].mw_assign) { case 0: display.print(F("[ NONE ]")); break; @@ -3544,16 +3216,15 @@ void UI_func_mw_assign(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_mw_mode(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_mw_mode(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3564,17 +3235,15 @@ void UI_func_mw_mode(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].mw_mode = constrain(configuration.dexed[selected_instance_id].mw_mode + 1, MW_MODE_MIN, MW_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].mw_mode = constrain(configuration.dexed[selected_instance_id].mw_mode - 1, MW_MODE_MIN, MW_MODE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3586,8 +3255,7 @@ void UI_func_mw_mode(uint8_t param) MicroDexed[selected_instance_id]->ControllersRefresh(); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].mw_mode) - { + switch (configuration.dexed[selected_instance_id].mw_mode) { case 0: display.print(F("[LINEAR ]")); break; @@ -3600,16 +3268,15 @@ void UI_func_mw_mode(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_fc_range(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_fc_range(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3620,17 +3287,15 @@ void UI_func_fc_range(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].fc_range = constrain(configuration.dexed[selected_instance_id].fc_range + ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].fc_range = constrain(configuration.dexed[selected_instance_id].fc_range - ENCODER[ENC_R].speed(), FC_RANGE_MIN, FC_RANGE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3644,16 +3309,15 @@ void UI_func_fc_range(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 72, configuration.dexed[selected_instance_id].fc_range, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_fc_assign(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_fc_assign(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3664,17 +3328,15 @@ void UI_func_fc_assign(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].fc_assign = constrain(configuration.dexed[selected_instance_id].fc_assign + 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].fc_assign = constrain(configuration.dexed[selected_instance_id].fc_assign - 1, FC_ASSIGN_MIN, FC_ASSIGN_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3686,8 +3348,7 @@ void UI_func_fc_assign(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 73, configuration.dexed[selected_instance_id].fc_assign, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].fc_assign) - { + switch (configuration.dexed[selected_instance_id].fc_assign) { case 0: display.print(F("[ NONE ]")); break; @@ -3715,16 +3376,15 @@ void UI_func_fc_assign(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_fc_mode(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_fc_mode(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3735,17 +3395,15 @@ void UI_func_fc_mode(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].fc_mode = constrain(configuration.dexed[selected_instance_id].fc_mode + 1, FC_MODE_MIN, FC_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].fc_mode = constrain(configuration.dexed[selected_instance_id].fc_mode - 1, FC_MODE_MIN, FC_MODE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3757,8 +3415,7 @@ void UI_func_fc_mode(uint8_t param) MicroDexed[selected_instance_id]->ControllersRefresh(); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].fc_mode) - { + switch (configuration.dexed[selected_instance_id].fc_mode) { case 0: display.print(F("[LINEAR ]")); break; @@ -3771,16 +3428,15 @@ void UI_func_fc_mode(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_bc_range(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_bc_range(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3791,17 +3447,15 @@ void UI_func_bc_range(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].bc_range = constrain(configuration.dexed[selected_instance_id].bc_range + ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].bc_range = constrain(configuration.dexed[selected_instance_id].bc_range - ENCODER[ENC_R].speed(), BC_RANGE_MIN, BC_RANGE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3815,16 +3469,15 @@ void UI_func_bc_range(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 74, configuration.dexed[selected_instance_id].bc_range, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_bc_assign(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_bc_assign(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3835,17 +3488,15 @@ void UI_func_bc_assign(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].bc_assign = constrain(configuration.dexed[selected_instance_id].bc_assign + 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].bc_assign = constrain(configuration.dexed[selected_instance_id].bc_assign - 1, BC_ASSIGN_MIN, BC_ASSIGN_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3857,8 +3508,7 @@ void UI_func_bc_assign(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 75, configuration.dexed[selected_instance_id].bc_assign, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].bc_assign) - { + switch (configuration.dexed[selected_instance_id].bc_assign) { case 0: display.print(F("[ NONE ]")); break; @@ -3886,16 +3536,15 @@ void UI_func_bc_assign(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_bc_mode(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_bc_mode(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3906,17 +3555,15 @@ void UI_func_bc_mode(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].bc_mode = constrain(configuration.dexed[selected_instance_id].bc_mode + 1, BC_MODE_MIN, BC_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].bc_mode = constrain(configuration.dexed[selected_instance_id].bc_mode - 1, BC_MODE_MIN, BC_MODE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3928,8 +3575,7 @@ void UI_func_bc_mode(uint8_t param) MicroDexed[selected_instance_id]->ControllersRefresh(); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].bc_mode) - { + switch (configuration.dexed[selected_instance_id].bc_mode) { case 0: display.print(F("[LINEAR ]")); break; @@ -3942,16 +3588,15 @@ void UI_func_bc_mode(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_at_range(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_at_range(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -3962,17 +3607,15 @@ void UI_func_at_range(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].at_range = constrain(configuration.dexed[selected_instance_id].at_range + ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].at_range = constrain(configuration.dexed[selected_instance_id].at_range - ENCODER[ENC_R].speed(), AT_RANGE_MIN, AT_RANGE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -3986,16 +3629,15 @@ void UI_func_at_range(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 76, configuration.dexed[selected_instance_id].at_range, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_at_assign(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_at_assign(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4006,17 +3648,15 @@ void UI_func_at_assign(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].at_assign = constrain(configuration.dexed[selected_instance_id].at_assign + 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].at_assign = constrain(configuration.dexed[selected_instance_id].at_assign - 1, AT_ASSIGN_MIN, AT_ASSIGN_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4028,8 +3668,7 @@ void UI_func_at_assign(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 77, configuration.dexed[selected_instance_id].at_assign, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].at_assign) - { + switch (configuration.dexed[selected_instance_id].at_assign) { case 0: display.print(F("[ NONE ]")); break; @@ -4057,16 +3696,15 @@ void UI_func_at_assign(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_at_mode(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_at_mode(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4077,17 +3715,15 @@ void UI_func_at_mode(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].at_mode = constrain(configuration.dexed[selected_instance_id].at_mode + 1, AT_MODE_MIN, AT_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].at_mode = constrain(configuration.dexed[selected_instance_id].at_mode - 1, AT_MODE_MIN, AT_MODE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4099,8 +3735,7 @@ void UI_func_at_mode(uint8_t param) MicroDexed[selected_instance_id]->ControllersRefresh(); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].at_mode) - { + switch (configuration.dexed[selected_instance_id].at_mode) { case 0: display.print(F("[LINEAR ]")); break; @@ -4113,16 +3748,15 @@ void UI_func_at_mode(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_portamento_mode(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_portamento_mode(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4133,17 +3767,15 @@ void UI_func_portamento_mode(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].portamento_mode = constrain(configuration.dexed[selected_instance_id].portamento_mode + 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].portamento_mode = constrain(configuration.dexed[selected_instance_id].portamento_mode - 1, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4155,8 +3787,7 @@ void UI_func_portamento_mode(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 67, configuration.dexed[selected_instance_id].portamento_mode, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].portamento_mode) - { + switch (configuration.dexed[selected_instance_id].portamento_mode) { case 0: if (configuration.dexed[selected_instance_id].monopoly == 1) display.print(F("[RETAIN ]")); @@ -4172,16 +3803,15 @@ void UI_func_portamento_mode(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_portamento_glissando(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_portamento_glissando(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4192,17 +3822,15 @@ void UI_func_portamento_glissando(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].portamento_glissando = constrain(configuration.dexed[selected_instance_id].portamento_glissando + 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].portamento_glissando = constrain(configuration.dexed[selected_instance_id].portamento_glissando - 1, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4214,8 +3842,7 @@ void UI_func_portamento_glissando(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 68, configuration.dexed[selected_instance_id].portamento_glissando, 2); display.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].portamento_glissando) - { + switch (configuration.dexed[selected_instance_id].portamento_glissando) { case 0: display.print(F("[OFF]")); break; @@ -4225,16 +3852,15 @@ void UI_func_portamento_glissando(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_portamento_time(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_portamento_time(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4245,17 +3871,15 @@ void UI_func_portamento_time(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].portamento_time = constrain(configuration.dexed[selected_instance_id].portamento_time + ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].portamento_time = constrain(configuration.dexed[selected_instance_id].portamento_time - ENCODER[ENC_R].speed(), PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4269,20 +3893,19 @@ void UI_func_portamento_time(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 69, configuration.dexed[selected_instance_id].portamento_time, 2); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_handle_OP(uint8_t param) -{ +void UI_handle_OP(uint8_t param) { static uint8_t op_selected; lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled); - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4298,36 +3921,27 @@ void UI_handle_OP(uint8_t param) display.blink(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) - { -#if NUM_DEXED>1 - if (op_selected == 0) - { + if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) { +#if NUM_DEXED > 1 + if (op_selected == 0) { selected_instance_id = !selected_instance_id; op_selected = 5; lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled); - } - else + } else #endif op_selected = constrain(op_selected - 1, 0, 5); - } - else if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) - { -#if NUM_DEXED>1 - if (op_selected == 5) - { + } else if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) { +#if NUM_DEXED > 1 + if (op_selected == 5) { selected_instance_id = !selected_instance_id; op_selected = 0; lcd_OP_active_instance_number(selected_instance_id, configuration.dexed[selected_instance_id].op_enabled); - } - else + } else #endif op_selected = constrain(op_selected + 1, 0, 5); - } - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + } else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { if (bitRead(configuration.dexed[selected_instance_id].op_enabled, op_selected)) bitClear(configuration.dexed[selected_instance_id].op_enabled, op_selected); else @@ -4343,7 +3957,7 @@ void UI_handle_OP(uint8_t param) send_sysex_param(configuration.dexed[selected_instance_id].midi_channel, 155, configuration.dexed[selected_instance_id].op_enabled, 0); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { display.noBlink(); display.noCursor(); @@ -4352,10 +3966,9 @@ void UI_handle_OP(uint8_t param) } } -void UI_func_drum_reverb_send(uint8_t param) -{ - char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_reverb_send(uint8_t param) { + char displayname[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); temp_int = (int)(drum_config[activesample].reverb_send * 100); @@ -4366,16 +3979,12 @@ void UI_func_drum_reverb_send(uint8_t param) display.print(displayname); display.show(4, 5, 6, basename(drum_config[activesample].name)); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), 0, REVERB_SEND_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, REVERB_SEND_MAX); } } @@ -4394,21 +4003,20 @@ void UI_func_drum_reverb_send(uint8_t param) drum_config[activesample].reverb_send = mapfloat(temp_int, 0, 100, 0.0, 1.0); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_drum_midi_channel(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_midi_channel(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); display.print(F("MIDI Channel")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) drum_midi_channel = constrain(drum_midi_channel + ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); @@ -4416,20 +4024,49 @@ void UI_func_drum_midi_channel(uint8_t param) drum_midi_channel = constrain(drum_midi_channel - ENCODER[ENC_R].speed(), MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); display.setCursor(0, 1); - if (drum_midi_channel == 0) - { + if (drum_midi_channel == 0) { display.print(F("[OMNI]")); - } - else - { + } else { display_int(drum_midi_channel, 4, false, true, false); } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* + encoderDir[ENC_R].reset(); +} + +void UI_func_drums_main_volume(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + encoderDir[ENC_R].reset(); + + lcd_special_chars(BLOCKBAR); + display_bar_int("Drum Main Vol", configuration.drums.vol, 1.0, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 3, false, false, true); + } + + 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()) + configuration.drums.vol = constrain(configuration.drums.vol + ENCODER[ENC_R].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX); + else if (LCDML.BT_checkUp()) + configuration.drums.vol = constrain(configuration.drums.vol - ENCODER[ENC_R].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX); + } + + display_bar_int("Drum Main Vol", configuration.drums.vol, 1.0, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 3, false, false, false); + + master_mixer_r.gain(MASTER_MIX_CH_DRUMS, mapfloat(configuration.drums.vol, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 0.0, VOL_MAX_FLOAT)); + master_mixer_l.gain(MASTER_MIX_CH_DRUMS, mapfloat(configuration.drums.vol, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 0.0, VOL_MAX_FLOAT)); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); + } } -void UI_func_drums_main_volume(uint8_t param) + +/* void UI_func_drums_main_volume(uint8_t param) { char displayname[4] = {0, 0, 0, 0}; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -4465,12 +4102,11 @@ void UI_func_drums_main_volume(uint8_t param) { encoderDir[ENC_R].reset(); } -} +} */ -void UI_func_drum_tune_offset(uint8_t param) -{ - char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_tune_offset(uint8_t param) { + char displayname[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); temp_int = (int)(drum_config[activesample].p_offset * 200); @@ -4478,22 +4114,17 @@ void UI_func_drum_tune_offset(uint8_t param) display.print("DrumSmp. Tune"); display.setCursor(1, 1); display.setCursor(1, 1); - snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample); + snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample); display.print(displayname); display.show(1, 4, 7, basename(drum_config[activesample].name)); - } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), 0, 400); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, 400); } } @@ -4514,15 +4145,14 @@ void UI_func_drum_tune_offset(uint8_t param) drum_config[activesample].p_offset = temp_float; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_drum_pitch(uint8_t param) -{ - char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_pitch(uint8_t param) { + char displayname[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); temp_int = (int)(drum_config[activesample].pitch * 200); @@ -4530,21 +4160,16 @@ void UI_func_drum_pitch(uint8_t param) display.print("DrumSmp. Pitch"); display.setCursor(1, 1); display.setCursor(1, 1); - snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample); + snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample); display.print(displayname); display.show(1, 4, 7, basename(drum_config[activesample].name)); - } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), 0, 400); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, 400); } } @@ -4564,16 +4189,15 @@ void UI_func_drum_pitch(uint8_t param) drum_config[activesample].pitch = temp_float; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_drum_volume(uint8_t param) -{ - char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_volume(uint8_t param) { + char displayname[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); temp_int = (int)(drum_config[activesample].vol_max * 100); @@ -4584,9 +4208,8 @@ void UI_func_drum_volume(uint8_t param) snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample); display.print(displayname); display.show(1, 4, 7, basename(drum_config[activesample].name)); - } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { temp_float = mapfloat(temp_int, 0, 100, 0.0, 1.0); display.setCursor(0, 1); @@ -4603,16 +4226,15 @@ void UI_func_drum_volume(uint8_t param) drum_config[activesample].vol_max = temp_float; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_drum_pan(uint8_t param) -{ - char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_drum_pan(uint8_t param) { + char displayname[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); temp_int = mapfloat(drum_config[activesample].pan, -1.0, 1.0, -99, 99); @@ -4623,16 +4245,12 @@ void UI_func_drum_pan(uint8_t param) display.print(displayname); display.show(1, 4, 6, basename(drum_config[activesample].name)); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), -99, 99); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), -99, 99); } } @@ -4655,27 +4273,25 @@ void UI_func_drum_pan(uint8_t param) display.print("R"); } else if (temp_int < 0) { display.print("L"); - } - else { + } else { display.print("C"); } snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), abs(temp_int)); display.setCursor(13, 1); - display.print( displayname); + display.print(displayname); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_save_performance(uint8_t param) -{ +void UI_func_save_performance(uint8_t param) { static bool overwrite; static bool yesno; static uint8_t mode; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { char tmp[CONFIG_FILENAME_LEN]; yesno = false; @@ -4692,52 +4308,39 @@ void UI_func_save_performance(uint8_t param) overwrite = true; else overwrite = false; - if (check_sd_performance_exists(temp_int)) - { + if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( configuration.performance.name_temp[0] != 0 ) + if (configuration.performance.name_temp[0] != 0) display.show(1, 5, 11, configuration.performance.name_temp); else display.print(" -- DATA --"); } } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { if (mode == 0) temp_int = constrain(temp_int + ENCODER[ENC_L].speed(), 0, 99); else yesno = true; - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { if (mode == 0) temp_int = constrain(temp_int - ENCODER[ENC_L].speed(), 0, 99); else yesno = false; - } - else if (LCDML.BT_checkEnter()) - { - if (mode == 0 && overwrite == true) - { + } else if (LCDML.BT_checkEnter()) { + if (mode == 0 && overwrite == true) { mode = 1; display.setCursor(0, 1); display.print(F("Overwrite: [ ]")); - } - else - { + } else { mode = 0xff; - if (overwrite == false || yesno == true) - { + if (overwrite == false || yesno == true) { display.show(1, 0, 16, "Done."); delay(MESSAGE_WAIT_TIME); LCDML.FUNC_goBackToMenu(); - } - else if (overwrite == true && yesno == false) - { + } else if (overwrite == true && yesno == false) { char tmp[10]; mode = 0; @@ -4747,8 +4350,7 @@ void UI_func_save_performance(uint8_t param) } } } - if (mode == 0) - { + if (mode == 0) { char tmp[CONFIG_FILENAME_LEN]; snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%s.json"), PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME); @@ -4763,47 +4365,39 @@ void UI_func_save_performance(uint8_t param) display.setCursor(5, 1); if (overwrite == false) { display.print("-- EMPTY --"); - } else if (check_sd_performance_exists(temp_int)) - { + } else if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( configuration.performance.name_temp[0] != 0 ) - display.show(1, 5, 11, configuration.performance.name_temp); else + if (configuration.performance.name_temp[0] != 0) + display.show(1, 5, 11, configuration.performance.name_temp); + else display.print("-- DATA --"); - } - else display.print(" "); - } - else if (mode < 0xff) - { + } else display.print(" "); + } else if (mode < 0xff) { display.setCursor(12, 1); - if (yesno == true) - { + if (yesno == true) { display.print(F("YES")); - } - else + } else display.print(F("NO ")); } } encoderDir[ENC_R].reset(); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { - if (mode < 0xff) - { + if (mode < 0xff) { display.show(1, 0, 16, "Canceled."); delay(MESSAGE_WAIT_TIME); - } - else + } else save_sd_performance_json(temp_int); encoderDir[ENC_R].reset(); } } -void UI_func_load_performance(uint8_t param) -{ +void UI_func_load_performance(uint8_t param) { static uint8_t mode; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { char tmp[10]; temp_int = 0; @@ -4815,26 +4409,19 @@ void UI_func_load_performance(uint8_t param) snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), param); display.print(tmp); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { temp_int = constrain(temp_int + ENCODER[ENC_L].speed(), 0, 99); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - ENCODER[ENC_L].speed(), 0, 99); - } - else if (LCDML.BT_checkEnter()) - { + } else if (LCDML.BT_checkEnter()) { mode = 0xff; display.setCursor(0, 1); if (load_sd_performance_json(temp_int) == false) display.print("Does not exist."); - else - { + else { load_sd_performance_json(temp_int); display.print("Done. "); } @@ -4846,25 +4433,20 @@ void UI_func_load_performance(uint8_t param) char tmp[10]; snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int); display.print(tmp); - if (check_sd_performance_exists(temp_int)) - { + if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( configuration.performance.name_temp[0] != 0 ) + if (configuration.performance.name_temp[0] != 0) display.show(1, 5, 11, configuration.performance.name_temp); else display.print(" -- DATA --"); - } - else display.print(" "); + } else display.print(" "); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { - if (mode < 0xff) - { + if (mode < 0xff) { display.show(1, 0, 16, "Canceled."); delay(MESSAGE_WAIT_TIME); - } - else - { + } else { configuration.sys.performance_number = temp_int; save_sd_sys_json(); encoderDir[ENC_R].reset(); @@ -4872,9 +4454,8 @@ void UI_func_load_performance(uint8_t param) } } -void UI_func_information(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_information(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { char version_string[LCD_cols + 1]; @@ -4889,22 +4470,21 @@ void UI_func_information(uint8_t param) display.print(sd_string); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { ; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_func_midi_soft_thru(uint8_t param) -{ +void UI_func_midi_soft_thru(uint8_t param) { static uint8_t old_soft_midi_thru; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4912,10 +4492,9 @@ void UI_func_midi_soft_thru(uint8_t param) display.print(F("MIDI Soft THRU")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru + 1, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX); else if (LCDML.BT_checkUp()) @@ -4923,8 +4502,7 @@ void UI_func_midi_soft_thru(uint8_t param) } display.setCursor(0, 1); - switch (configuration.sys.soft_midi_thru) - { + switch (configuration.sys.soft_midi_thru) { case 0: display.print(F("[OFF]")); break; @@ -4934,21 +4512,19 @@ void UI_func_midi_soft_thru(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (old_soft_midi_thru != configuration.sys.soft_midi_thru) - { + if (old_soft_midi_thru != configuration.sys.soft_midi_thru) { save_sys_flag = true; save_sys = 0; } } } -void UI_func_velocity_level(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_func_velocity_level(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -4959,18 +4535,16 @@ void UI_func_velocity_level(uint8_t param) UI_update_instance_icons(); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].velocity_level = constrain(configuration.dexed[selected_instance_id].velocity_level + ENCODER[ENC_R].speed(), VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].velocity_level = constrain(configuration.dexed[selected_instance_id].velocity_level - ENCODER[ENC_R].speed(), VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -4980,33 +4554,31 @@ void UI_func_velocity_level(uint8_t param) display_bar_int("Velocity Lvl", configuration.dexed[selected_instance_id].velocity_level, 1.0, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX, 3, false, false, false); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_update_instance_icons() -{ +void UI_update_instance_icons() { #ifdef TESTDISPLAY20x4 display.setCursor(18, 0); display.write(0); //Icon for first instance display.setCursor(19, 0); - display.write(1); //Icon for second instance + display.write(1); //Icon for second instance #else display.setCursor(14, 0); display.write(0); //Icon for first instance display.setCursor(15, 0); - display.write(1); //Icon for second instance + display.write(1); //Icon for second instance #endif } -void UI_func_voice_select(uint8_t param) -{ +void UI_func_voice_select(uint8_t param) { static uint8_t menu_voice_select = MENU_VOICE_SOUND; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { #ifdef TESTDISPLAY20x4 display.setCursor(0, 3); @@ -5028,39 +4600,34 @@ void UI_func_voice_select(uint8_t param) UI_update_instance_icons(); - display.createChar(2, (uint8_t*)special_chars[18]); // favorites symbol + display.createChar(2, (uint8_t*)special_chars[18]); // favorites symbol #if defined(TEENSY36) - display.createChar(6, (uint8_t*)special_chars[16]); // MIDI activity note symbol - display.createChar(7, (uint8_t*)special_chars[16]); // MIDI activity note symbol + display.createChar(6, (uint8_t*)special_chars[16]); // MIDI activity note symbol + display.createChar(7, (uint8_t*)special_chars[16]); // MIDI activity note symbol #endif } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { char bank_name[BANK_NAME_LEN]; char voice_name[VOICE_NAME_LEN]; - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && (encoderDir[ENC_R].ButtonShort() || encoderDir[ENC_R].ButtonLong()))) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && (encoderDir[ENC_R].ButtonShort() || encoderDir[ENC_R].ButtonLong()))) { uint8_t bank_tmp; int8_t voice_tmp; // Reset Performance Modifiers to 0 after every preset change - for (uint8_t count_tmp = 0; count_tmp < NUM_DEXED; count_tmp++) - { + for (uint8_t count_tmp = 0; count_tmp < NUM_DEXED; count_tmp++) { perform_attack_mod[count_tmp] = 0; perform_release_mod[count_tmp] = 0; } active_perform_page = 1; - if (LCDML.BT_checkUp()) - { + if (LCDML.BT_checkUp()) { //start : show all presets - if (configuration.sys.favorites == 0) - { - switch (menu_voice_select) - { + if (configuration.sys.favorites == 0) { + switch (menu_voice_select) { case MENU_VOICE_BANK: memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); bank_tmp = constrain(configuration.dexed[selected_instance_id].bank - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); @@ -5070,13 +4637,10 @@ void UI_func_voice_select(uint8_t param) case MENU_VOICE_SOUND: memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); voice_tmp = configuration.dexed[selected_instance_id].voice - ENCODER[ENC_R].speed(); - if (voice_tmp < 0 && configuration.dexed[selected_instance_id].bank - 1 >= 0) - { + if (voice_tmp < 0 && configuration.dexed[selected_instance_id].bank - 1 >= 0) { configuration.dexed[selected_instance_id].bank--; configuration.dexed[selected_instance_id].bank = constrain(configuration.dexed[selected_instance_id].bank, 0, MAX_BANKS - 1); - } - else if (voice_tmp < 0 && configuration.dexed[selected_instance_id].bank - 1 <= 0) - { + } else if (voice_tmp < 0 && configuration.dexed[selected_instance_id].bank - 1 <= 0) { voice_tmp = 0; } if (voice_tmp < 0) @@ -5085,34 +4649,26 @@ void UI_func_voice_select(uint8_t param) load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); break; } - } - else //only Favs - if (configuration.sys.favorites == 1) - { + } else //only Favs + if (configuration.sys.favorites == 1) { locate_previous_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); - } - else //only non-Favs - if (configuration.sys.favorites == 2) - { + } else //only non-Favs + if (configuration.sys.favorites == 2) { locate_previous_non_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); //break; } else //random non-Favs - if (configuration.sys.favorites == 3) - { + if (configuration.sys.favorites == 3) { locate_random_non_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); } } //end UP - else if (LCDML.BT_checkDown()) - { + else if (LCDML.BT_checkDown()) { //start : show all presets - if (configuration.sys.favorites == 0) - { - switch (menu_voice_select) - { + if (configuration.sys.favorites == 0) { + switch (menu_voice_select) { case MENU_VOICE_BANK: memset(g_bank_name[selected_instance_id], 0, BANK_NAME_LEN); bank_tmp = constrain(configuration.dexed[selected_instance_id].bank + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); @@ -5122,53 +4678,42 @@ void UI_func_voice_select(uint8_t param) case MENU_VOICE_SOUND: memset(g_voice_name[selected_instance_id], 0, VOICE_NAME_LEN); voice_tmp = configuration.dexed[selected_instance_id].voice + ENCODER[ENC_R].speed(); - if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].bank + 1 < MAX_BANKS) - { + if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].bank + 1 < MAX_BANKS) { voice_tmp %= MAX_VOICES; configuration.dexed[selected_instance_id].bank++; configuration.dexed[selected_instance_id].bank = constrain(configuration.dexed[selected_instance_id].bank, 0, MAX_BANKS - 1); - } - else if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].bank + 1 >= MAX_BANKS) - { + } else if (voice_tmp >= MAX_VOICES && configuration.dexed[selected_instance_id].bank + 1 >= MAX_BANKS) { voice_tmp = MAX_VOICES - 1; } - configuration.dexed[selected_instance_id].voice = constrain(voice_tmp, 0, MAX_VOICES - 1); + configuration.dexed[selected_instance_id].voice = constrain(voice_tmp, 0, MAX_VOICES - 1); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); break; } - } - else //only Favs - if (configuration.sys.favorites == 1) - { + } else //only Favs + if (configuration.sys.favorites == 1) { locate_next_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); //break; - } - else //only non-Favs - if (configuration.sys.favorites == 2) - { + } else //only non-Favs + if (configuration.sys.favorites == 2) { locate_next_non_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); //break; } else //random non-Favs - if (configuration.sys.favorites == 3) - { + if (configuration.sys.favorites == 3) { locate_random_non_favorite(); load_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); } - } - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonPressed()) - { + } else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonPressed()) { if (menu_voice_select == MENU_VOICE_BANK) menu_voice_select = MENU_VOICE_SOUND; else menu_voice_select = MENU_VOICE_BANK; } #if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { + else if (LCDML.BT_checkEnter()) { selected_instance_id = !selected_instance_id; lcd_active_instance_number(selected_instance_id); UI_update_instance_icons(); @@ -5176,22 +4721,16 @@ void UI_func_voice_select(uint8_t param) #endif } - if (strlen(g_bank_name[selected_instance_id]) > 0) - { + if (strlen(g_bank_name[selected_instance_id]) > 0) { strcpy(bank_name, g_bank_name[selected_instance_id]); - } - else - { + } else { if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name))) strcpy(bank_name, "*ERROR*"); } - if (strlen(g_voice_name[selected_instance_id]) > 0) - { + if (strlen(g_voice_name[selected_instance_id]) > 0) { strcpy(voice_name, g_voice_name[selected_instance_id]); - } - else - { + } else { if (!get_voice_by_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, configuration.dexed[selected_instance_id].voice, voice_name, sizeof(voice_name))) strcpy(voice_name, "*ERROR*"); } @@ -5203,8 +4742,7 @@ void UI_func_voice_select(uint8_t param) display.show(0, 4, 8, bank_name); string_toupper(voice_name); display.show(1, 4, 10, voice_name); - switch (menu_voice_select) - { + switch (menu_voice_select) { case MENU_VOICE_BANK: display.show(0, 3, 1, "["); display.show(0, 12, 1, "]"); @@ -5225,8 +4763,7 @@ void UI_func_voice_select(uint8_t param) string_toupper(voice_name); display.show(1, 3, 10, voice_name); - switch (menu_voice_select) - { + switch (menu_voice_select) { case MENU_VOICE_BANK: display.show(0, 2, 1, "["); display.show(0, 11, 1, "]"); @@ -5243,33 +4780,30 @@ void UI_func_voice_select(uint8_t param) #endif draw_favorite_icon(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); } } -void UI_func_volume(uint8_t param) -{ +void UI_func_volume(uint8_t param) { char tmp[6]; static uint8_t old_volume; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { old_volume = configuration.sys.vol; encoderDir[ENC_L].reset(); - if (active_perform_page == 1) - { //Master Volume + if (active_perform_page == 1) { //Master Volume lcd_special_chars(BLOCKBAR); display_bar_int("Master Vol.", configuration.sys.vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, true); back_from_volume = 0; } - else if (active_perform_page == 2) - { // Live Performance Mod - Attack + else if (active_perform_page == 2) { // Live Performance Mod - Attack display.setCursor(0, 0); display.print("Live Modify"); display.setCursor(0, 1); @@ -5280,8 +4814,7 @@ void UI_func_volume(uint8_t param) back_from_volume = 0; } - else if (active_perform_page == 3) - { // Live Performance Mod - Release + else if (active_perform_page == 3) { // Live Performance Mod - Release display.setCursor(0, 0); display.print("Live Modify"); display.setCursor(11, 1); @@ -5298,55 +4831,43 @@ void UI_func_volume(uint8_t param) display.print(active_perform_page); display.setCursor(14, 0); display.print("/3"); - } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ( LCDML.BT_checkDown() && encoderDir[ENC_R].Down() ) - { + if (LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) { back_from_volume = 0; active_perform_page++; - if (active_perform_page > 3)active_perform_page = 1; - } - else if ( LCDML.BT_checkUp() && encoderDir[ENC_R].Up() ) - { + if (active_perform_page > 3) active_perform_page = 1; + } else if (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) { back_from_volume = 0; active_perform_page--; - if (active_perform_page < 1)active_perform_page = 3; + if (active_perform_page < 1) active_perform_page = 3; } - if ((LCDML.BT_checkDown() && encoderDir[ENC_L].Down() ) || (LCDML.BT_checkUp() && encoderDir[ENC_L].Up() )) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_L].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_L].Up())) { if (active_perform_page == 1) { back_from_volume = 0; - if (LCDML.BT_checkDown() ) - { + if (LCDML.BT_checkDown()) { configuration.sys.vol = constrain(configuration.sys.vol + ENCODER[ENC_L].speed(), VOLUME_MIN, VOLUME_MAX); - } - else if (LCDML.BT_checkUp() ) - { + } else if (LCDML.BT_checkUp()) { configuration.sys.vol = constrain(configuration.sys.vol - ENCODER[ENC_L].speed(), VOLUME_MIN, VOLUME_MAX); } } - else if ( active_perform_page == 2) - { //Attack + else if (active_perform_page == 2) { //Attack - if (LCDML.BT_checkDown() ) - { + if (LCDML.BT_checkDown()) { if (perform_attack_mod[selected_instance_id] == 0) for (uint8_t i = 0; i < 6; i++) { orig_attack_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getOPRate(i, ATTACK); } perform_attack_mod[selected_instance_id] = constrain(perform_attack_mod[selected_instance_id] + ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setOPRate(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id] ); - } - else if (LCDML.BT_checkUp() ) - { + MicroDexed[selected_instance_id]->setOPRate(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id]); + } else if (LCDML.BT_checkUp()) { if (perform_attack_mod[selected_instance_id] == 0) // Save initial Values for (uint8_t i = 0; i < 6; i++) { orig_attack_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getOPRate(i, ATTACK); @@ -5354,32 +4875,27 @@ void UI_func_volume(uint8_t param) perform_attack_mod[selected_instance_id] = constrain(perform_attack_mod[selected_instance_id] - ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setOPRate(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id] ); + MicroDexed[selected_instance_id]->setOPRate(i, ATTACK, orig_attack_values[selected_instance_id][i] - perform_attack_mod[selected_instance_id]); } - } - else if (active_perform_page == 3) - { //Release + } else if (active_perform_page == 3) { //Release - if (LCDML.BT_checkDown() ) - { - if (perform_release_mod[selected_instance_id] == 0) // Save initial Values + if (LCDML.BT_checkDown()) { + if (perform_release_mod[selected_instance_id] == 0) // Save initial Values for (uint8_t i = 0; i < 6; i++) { orig_release_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getOPRate(i, RELEASE); } perform_release_mod[selected_instance_id] = constrain(perform_release_mod[selected_instance_id] + ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setOPRate(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id] ); - } - else if (LCDML.BT_checkUp() ) - { + MicroDexed[selected_instance_id]->setOPRate(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id]); + } else if (LCDML.BT_checkUp()) { if (perform_release_mod[selected_instance_id] == 0) for (uint8_t i = 0; i < 6; i++) { orig_release_values[selected_instance_id][i] = MicroDexed[selected_instance_id]->getOPRate(i, RELEASE); } perform_release_mod[selected_instance_id] = constrain(perform_release_mod[selected_instance_id] - ENCODER[ENC_L].speed(), -MAX_PERF_MOD, MAX_PERF_MOD); for (uint8_t i = 0; i < 6; i++) - MicroDexed[selected_instance_id]->setOPRate(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id] ); + MicroDexed[selected_instance_id]->setOPRate(i, RELEASE, orig_release_values[selected_instance_id][i] - perform_release_mod[selected_instance_id]); } } } @@ -5387,14 +4903,13 @@ void UI_func_volume(uint8_t param) display.setCursor(13, 0); display.print(active_perform_page); - if (active_perform_page == 1) { //Master Volume + if (active_perform_page == 1) { //Master Volume display.setCursor(0, 0); display.print("Master Vol. "); lcd_special_chars(BLOCKBAR); display_bar_int("Master Vol.", configuration.sys.vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, false); set_volume(configuration.sys.vol, configuration.sys.mono); - } - else if (active_perform_page == 2) { //Attack + } else if (active_perform_page == 2) { //Attack display.setCursor(0, 0); display.print("Live Modify"); display.setCursor(0, 1); @@ -5403,8 +4918,7 @@ void UI_func_volume(uint8_t param) snprintf_P(tmp, sizeof(tmp), PSTR("%03d"), perform_attack_mod[selected_instance_id]); display.print(tmp); back_from_volume = 0; - } - else if (active_perform_page == 3) { //Release + } else if (active_perform_page == 3) { //Release display.setCursor(0, 0); display.print("Live Modify"); display.setCursor(0, 1); @@ -5416,13 +4930,12 @@ void UI_func_volume(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_L].reset(); - if (old_volume != configuration.sys.vol) - { + if (old_volume != configuration.sys.vol) { eeprom_update(); save_sys_flag = true; save_sys = 0; @@ -5430,12 +4943,11 @@ void UI_func_volume(uint8_t param) } } -void UI_func_save_voice(uint8_t param) -{ +void UI_func_save_voice(uint8_t param) { static bool yesno; static uint8_t mode; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -5469,16 +4981,14 @@ void UI_func_save_voice(uint8_t param) #endif } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { char bank_name[BANK_NAME_LEN]; char voice_name[VOICE_NAME_LEN]; - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - switch (mode) - { - case 0: // Instance selection + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + switch (mode) { + case 0: // Instance selection if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) selected_instance_id = !selected_instance_id; @@ -5488,7 +4998,7 @@ void UI_func_save_voice(uint8_t param) display.setCursor(10, 1); display.write(1); break; - case 1: // Bank selection + case 1: // Bank selection if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].bank = constrain(configuration.dexed[selected_instance_id].bank + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); else if (LCDML.BT_checkUp() && configuration.dexed[selected_instance_id].voice > 0) @@ -5500,7 +5010,7 @@ void UI_func_save_voice(uint8_t param) display.show(1, 0, 2, configuration.dexed[selected_instance_id].bank); display.show(1, 3, 10, bank_name); break; - case 2: // Voice selection + case 2: // Voice selection if (LCDML.BT_checkDown() && configuration.dexed[selected_instance_id].voice < MAX_VOICES - 1) configuration.dexed[selected_instance_id].voice = constrain(configuration.dexed[selected_instance_id].voice + ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1); else if (LCDML.BT_checkUp() && configuration.dexed[selected_instance_id].voice > 0) @@ -5514,25 +5024,19 @@ void UI_func_save_voice(uint8_t param) display.show(1, 0, 2, configuration.dexed[selected_instance_id].voice + 1); display.show(1, 3, 10, voice_name); break; - case 3: // Yes/No selection + case 3: // Yes/No selection yesno = !yesno; - if (yesno == true) - { + if (yesno == true) { display.show(1, 1, 3, "YES"); - } - else - { + } else { display.show(1, 1, 3, "NO"); } break; } - } - else if (LCDML.BT_checkEnter()) - { + } else if (LCDML.BT_checkEnter()) { if (encoderDir[ENC_R].ButtonShort()) mode++; - switch (mode) - { + switch (mode) { case 1: if (!get_bank_name(configuration.dexed[selected_instance_id].bank, bank_name, sizeof(bank_name))) strncpy(bank_name, "*ERROR*", sizeof(bank_name)); @@ -5560,8 +5064,7 @@ void UI_func_save_voice(uint8_t param) display.show(1, 4, 1, "]"); break; default: - if (yesno == true) - { + if (yesno == true) { #ifdef DEBUG bool ret = save_sd_voice(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, selected_instance_id); @@ -5585,12 +5088,11 @@ void UI_func_save_voice(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); - if (mode < 0xff) - { + if (mode < 0xff) { display.show(1, 0, 16, "Canceled."); delay(MESSAGE_WAIT_TIME); } @@ -5598,14 +5100,13 @@ void UI_func_save_voice(uint8_t param) } } -void UI_func_sysex_receive_bank(uint8_t param) -{ +void UI_func_sysex_receive_bank(uint8_t param) { static bool yesno; static uint8_t mode; static uint8_t bank_number; static uint8_t ui_select_name_state; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -5626,14 +5127,11 @@ void UI_func_sysex_receive_bank(uint8_t param) display.show(1, 3, 10, receive_bank_filename); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { - switch (mode) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { + switch (mode) { case 0: bank_number = constrain(bank_number + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); if (!get_bank_name(bank_number, receive_bank_filename, sizeof(receive_bank_filename))) @@ -5652,11 +5150,8 @@ void UI_func_sysex_receive_bank(uint8_t param) ui_select_name_state = UI_select_name(1, 1, receive_bank_filename, BANK_NAME_LEN - 1, false); break; } - } - else if (LCDML.BT_checkUp()) - { - switch (mode) - { + } else if (LCDML.BT_checkUp()) { + switch (mode) { case 0: bank_number = constrain(bank_number - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); if (!get_bank_name(bank_number, receive_bank_filename, sizeof(receive_bank_filename))) @@ -5676,13 +5171,9 @@ void UI_func_sysex_receive_bank(uint8_t param) break; } } - } - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { - if (mode == 0) - { - if (!strcmp(receive_bank_filename, "*ERROR*")) - { + } else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { + if (mode == 0) { + if (!strcmp(receive_bank_filename, "*ERROR*")) { yesno = true; strcpy(receive_bank_filename, "NONAME"); mode = 2; @@ -5690,29 +5181,21 @@ void UI_func_sysex_receive_bank(uint8_t param) display.print(F("[ ] ")); ui_select_name_state = UI_select_name(1, 1, receive_bank_filename, BANK_NAME_LEN - 1, true); display.blink(); - } - else - { + } else { mode = 1; display.setCursor(0, 1); display.print(F("Overwrite: [NO ]")); } - } - else if (mode == 1 && yesno == true) - { + } else if (mode == 1 && yesno == true) { mode = 2; display.setCursor(0, 1); display.print(F("[ ] ")); ui_select_name_state = UI_select_name(1, 1, receive_bank_filename, BANK_NAME_LEN - 1, true); display.blink(); - } - else if (mode == 2) - { + } else if (mode == 2) { ui_select_name_state = UI_select_name(1, 1, receive_bank_filename, BANK_NAME_LEN - 1, false); - if (ui_select_name_state == true) - { - if (yesno == true) - { + if (ui_select_name_state == true) { + if (yesno == true) { #ifdef DEBUG Serial.print(F("Bank name: [")); Serial.print(receive_bank_filename); @@ -5735,9 +5218,7 @@ void UI_func_sysex_receive_bank(uint8_t param) /// Storing is done in SYSEX code } } - } - else if (mode >= 1 && yesno == false) - { + } else if (mode >= 1 && yesno == false) { Serial.println(mode, DEC); memset(receive_bank_filename, 0, sizeof(receive_bank_filename)); mode = 0xff; @@ -5751,15 +5232,14 @@ void UI_func_sysex_receive_bank(uint8_t param) encoderDir[ENC_R].reset(); } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); memset(receive_bank_filename, 0, sizeof(receive_bank_filename)); display.noBlink(); - if (mode < 0xff) - { + if (mode < 0xff) { display.setCursor(0, 1); display.print(F("Canceled. ")); delay(MESSAGE_WAIT_TIME); @@ -5767,26 +5247,23 @@ void UI_func_sysex_receive_bank(uint8_t param) } } -void UI_func_set_performance_name(uint8_t param) -{ +void UI_func_set_performance_name(uint8_t param) { static uint8_t mode; static uint8_t ui_select_name_state; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); mode = 0; display.setCursor(0, 0); display.print(F("Perf. Name")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { - if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false); - } - else if (LCDML.BT_checkUp()) { - if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false); + if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false); + } else if (LCDML.BT_checkUp()) { + if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false); // if (ui_select_name_state == false) { // display.setCursor(12, 1); // display.print(" "); @@ -5798,15 +5275,11 @@ void UI_func_set_performance_name(uint8_t param) // ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, true); // } } - } - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + } else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { - if (mode == 1) - { + if (mode == 1) { ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false); - if (ui_select_name_state == true) - { + if (ui_select_name_state == true) { strcpy(configuration.performance.name, configuration.performance.name_temp); mode = 0xff; display.noBlink(); @@ -5817,8 +5290,7 @@ void UI_func_set_performance_name(uint8_t param) } } } - if (mode == 0 ) - { + if (mode == 0) { mode = 1; strcpy(configuration.performance.name_temp, configuration.performance.name); display.setCursor(0, 1); @@ -5827,19 +5299,18 @@ void UI_func_set_performance_name(uint8_t param) display.blink(); } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); display.noBlink(); } } -void UI_func_sysex_send_bank(uint8_t param) -{ +void UI_func_sysex_send_bank(uint8_t param) { char bank_name[BANK_NAME_LEN]; static uint8_t bank_number; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); bank_number = configuration.dexed[selected_instance_id].bank; @@ -5853,31 +5324,24 @@ void UI_func_sysex_send_bank(uint8_t param) display.show(1, 3, 10, bank_name); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { bank_number = constrain(bank_number + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { bank_number = constrain(bank_number - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); } if (!get_bank_name(bank_number, bank_name, sizeof(bank_name))) strcpy(bank_name, "*ERROR*"); display.show(1, 0, 2, bank_number); display.show(1, 3, 10, bank_name); - } - else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) - { + } else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { File sysex; char filename[FILENAME_LEN]; - if (get_bank_name(bank_number, bank_name, sizeof(bank_name))) - { + if (get_bank_name(bank_number, bank_name, sizeof(bank_name))) { snprintf_P(filename, sizeof(filename), PSTR("/%d/%s.syx"), bank_number, bank_name); #ifdef DEBUG Serial.print(F("Send bank ")); @@ -5885,38 +5349,30 @@ void UI_func_sysex_send_bank(uint8_t param) Serial.println(F(" from SD.")); #endif sysex = SD.open(filename); - if (!sysex) - { + if (!sysex) { #ifdef DEBUG Serial.println(F("Connot read from SD.")); #endif display.show(1, 0, 16, "Read error."); bank_number = 0xff; - } - else - { + } else { uint8_t bank_data[4104]; sysex.read(bank_data, 4104); sysex.close(); display.show(1, 0, 16, "Sending Ch"); - if (configuration.dexed[selected_instance_id].midi_channel == MIDI_CHANNEL_OMNI) - { + if (configuration.dexed[selected_instance_id].midi_channel == MIDI_CHANNEL_OMNI) { display.show(1, 11, 2, "01"); send_sysex_bank(1, bank_data); - } - else - { + } else { display.show(1, 11, 2, configuration.dexed[selected_instance_id].midi_channel + 1); send_sysex_bank(configuration.dexed[selected_instance_id].midi_channel, bank_data); } display.show(1, 0, 16, "Done."); bank_number = 0xff; } - } - else - { + } else { display.show(1, 0, 16, "No bank."); bank_number = 0xff; } @@ -5926,12 +5382,11 @@ void UI_func_sysex_send_bank(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - if (bank_number < 0xff) - { + if (bank_number < 0xff) { display.setCursor(0, 1); display.print(F("Canceled. ")); delay(MESSAGE_WAIT_TIME); @@ -5939,13 +5394,12 @@ void UI_func_sysex_send_bank(uint8_t param) } } -void UI_func_sysex_send_voice(uint8_t param) -{ +void UI_func_sysex_send_voice(uint8_t param) { static uint8_t mode; static uint8_t bank_number; static uint8_t voice_number; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); mode = 0; @@ -5965,16 +5419,14 @@ void UI_func_sysex_send_voice(uint8_t param) display.show(1, 13, 1, "]"); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { char bank_name[BANK_NAME_LEN]; char voice_name[VOICE_NAME_LEN]; - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - switch (mode) - { - case 0: // Bank selection + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + switch (mode) { + case 0: // Bank selection if (LCDML.BT_checkDown()) bank_number = constrain(bank_number + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); else if (LCDML.BT_checkUp() && bank_number > 0) @@ -5986,7 +5438,7 @@ void UI_func_sysex_send_voice(uint8_t param) display.show(1, 0, 2, bank_number); display.show(1, 3, 10, bank_name); break; - case 1: // Voice selection + case 1: // Voice selection if (LCDML.BT_checkDown() && voice_number < MAX_VOICES - 1) voice_number = constrain(voice_number + ENCODER[ENC_R].speed(), 0, MAX_VOICES - 1); else if (LCDML.BT_checkUp() && voice_number > 0) @@ -6000,13 +5452,10 @@ void UI_func_sysex_send_voice(uint8_t param) display.show(1, 3, 10, voice_name); break; } - } - else if (LCDML.BT_checkEnter()) - { + } else if (LCDML.BT_checkEnter()) { if (encoderDir[ENC_R].ButtonShort()) mode++; - switch (mode) - { + switch (mode) { case 1: if (!get_bank_name(bank_number, bank_name, sizeof(bank_name))) strncpy(bank_name, "*ERROR*", sizeof(bank_name)); @@ -6020,8 +5469,7 @@ void UI_func_sysex_send_voice(uint8_t param) File sysex; char filename[FILENAME_LEN]; - if (get_bank_name(bank_number, bank_name, sizeof(bank_name))) - { + if (get_bank_name(bank_number, bank_name, sizeof(bank_name))) { snprintf_P(filename, sizeof(filename), PSTR("/%d/%s.syx"), bank_number, bank_name); #ifdef DEBUG Serial.print(F("Send voice ")); @@ -6031,16 +5479,13 @@ void UI_func_sysex_send_voice(uint8_t param) Serial.println(F(" from SD.")); #endif sysex = SD.open(filename); - if (!sysex) - { + if (!sysex) { #ifdef DEBUG Serial.println(F("Connot read from SD.")); #endif display.show(1, 0, 16, "Read error."); bank_number = 0xff; - } - else - { + } else { uint8_t voice_data[155]; uint8_t encoded_voice_data[128]; @@ -6050,13 +5495,10 @@ void UI_func_sysex_send_voice(uint8_t param) MicroDexed[selected_instance_id]->decodeVoice(voice_data, encoded_voice_data); display.show(1, 0, 16, "Sending Ch"); - if (configuration.dexed[selected_instance_id].midi_channel == MIDI_CHANNEL_OMNI) - { + if (configuration.dexed[selected_instance_id].midi_channel == MIDI_CHANNEL_OMNI) { display.show(1, 11, 2, "01"); send_sysex_voice(1, voice_data); - } - else - { + } else { display.show(1, 11, 2, configuration.dexed[selected_instance_id].midi_channel + 1); send_sysex_voice(configuration.dexed[selected_instance_id].midi_channel, voice_data); } @@ -6066,9 +5508,7 @@ void UI_func_sysex_send_voice(uint8_t param) bank_number = 0xff; } - } - else - { + } else { display.show(1, 0, 16, "No voice."); bank_number = 0xff; } @@ -6082,10 +5522,9 @@ void UI_func_sysex_send_voice(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { - if (mode < 0xff) - { + if (mode < 0xff) { display.show(1, 0, 16, "Canceled."); delay(MESSAGE_WAIT_TIME); } @@ -6093,10 +5532,9 @@ void UI_func_sysex_send_voice(uint8_t param) } } -void UI_func_eq_1(uint8_t param) -{ +void UI_func_eq_1(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6105,22 +5543,18 @@ void UI_func_eq_1(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_1 = constrain(configuration.fx.eq_1 + ENCODER[ENC_R].speed(), EQ_1_MIN, EQ_1_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_1 = constrain(configuration.fx.eq_1 - ENCODER[ENC_R].speed(), EQ_1_MIN, EQ_1_MAX); } } @@ -6133,7 +5567,7 @@ void UI_func_eq_1(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6141,10 +5575,9 @@ void UI_func_eq_1(uint8_t param) #endif } -void UI_func_eq_2(uint8_t param) -{ +void UI_func_eq_2(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6153,22 +5586,18 @@ void UI_func_eq_2(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_2 = constrain(configuration.fx.eq_2 + ENCODER[ENC_R].speed(), EQ_2_MIN, EQ_2_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_2 = constrain(configuration.fx.eq_2 - ENCODER[ENC_R].speed(), EQ_2_MIN, EQ_2_MAX); } } @@ -6180,7 +5609,7 @@ void UI_func_eq_2(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6188,10 +5617,9 @@ void UI_func_eq_2(uint8_t param) #endif } -void UI_func_eq_3(uint8_t param) -{ +void UI_func_eq_3(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6200,22 +5628,18 @@ void UI_func_eq_3(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_3 = constrain(configuration.fx.eq_3 + ENCODER[ENC_R].speed(), EQ_3_MIN, EQ_3_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_3 = constrain(configuration.fx.eq_3 - ENCODER[ENC_R].speed(), EQ_3_MIN, EQ_3_MAX); } } @@ -6227,7 +5651,7 @@ void UI_func_eq_3(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6235,10 +5659,9 @@ void UI_func_eq_3(uint8_t param) #endif } -void UI_func_eq_4(uint8_t param) -{ +void UI_func_eq_4(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6247,22 +5670,18 @@ void UI_func_eq_4(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_4 = constrain(configuration.fx.eq_4 + ENCODER[ENC_R].speed(), EQ_4_MIN, EQ_4_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_4 = constrain(configuration.fx.eq_4 - ENCODER[ENC_R].speed(), EQ_4_MIN, EQ_4_MAX); } } @@ -6274,7 +5693,7 @@ void UI_func_eq_4(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6282,10 +5701,9 @@ void UI_func_eq_4(uint8_t param) #endif } -void UI_func_eq_5(uint8_t param) -{ +void UI_func_eq_5(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6294,22 +5712,18 @@ void UI_func_eq_5(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_5 = constrain(configuration.fx.eq_5 + ENCODER[ENC_R].speed(), EQ_5_MIN, EQ_5_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_5 = constrain(configuration.fx.eq_5 - ENCODER[ENC_R].speed(), EQ_5_MIN, EQ_5_MAX); } } @@ -6321,7 +5735,7 @@ void UI_func_eq_5(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6329,10 +5743,9 @@ void UI_func_eq_5(uint8_t param) #endif } -void UI_func_eq_6(uint8_t param) -{ +void UI_func_eq_6(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6341,22 +5754,18 @@ void UI_func_eq_6(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_6 = constrain(configuration.fx.eq_6 + ENCODER[ENC_R].speed(), EQ_6_MIN, EQ_6_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_6 = constrain(configuration.fx.eq_6 - ENCODER[ENC_R].speed(), EQ_6_MIN, EQ_6_MAX); } } @@ -6368,7 +5777,7 @@ void UI_func_eq_6(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6376,10 +5785,9 @@ void UI_func_eq_6(uint8_t param) #endif } -void UI_func_eq_7(uint8_t param) -{ +void UI_func_eq_7(uint8_t param) { #ifndef SGTL5000_AUDIO_ENHANCE - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); display.setCursor(0, 0); @@ -6388,22 +5796,18 @@ void UI_func_eq_7(uint8_t param) display.print(F("Not implemented.")); } #else - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); lcd_special_chars(METERBAR); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) - { - if (LCDML.BT_checkDown()) - { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) { configuration.fx.eq_7 = constrain(configuration.fx.eq_7 + ENCODER[ENC_R].speed(), EQ_7_MIN, EQ_7_MAX); - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { configuration.fx.eq_7 = constrain(configuration.fx.eq_7 - ENCODER[ENC_R].speed(), EQ_7_MIN, EQ_7_MAX); } } @@ -6415,7 +5819,7 @@ void UI_func_eq_7(uint8_t param) #endif } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { lcd_special_chars(SCROLLBAR); encoderDir[ENC_R].reset(); @@ -6423,12 +5827,11 @@ void UI_func_eq_7(uint8_t param) #endif } -void UI_func_startup(uint8_t param) -{ +void UI_func_startup(uint8_t param) { bool stored = false; static uint8_t old_load_at_startup; - if (LCDML.FUNC_setup()) // ****** SETUP ********* + if (LCDML.FUNC_setup()) // ****** SETUP ********* { old_load_at_startup = configuration.sys.load_at_startup; @@ -6437,36 +5840,29 @@ void UI_func_startup(uint8_t param) display.show(0, 0, 16, "Load at startup"); if (configuration.sys.load_at_startup == 255) display.show(1, 0, 16, "Last Perf."); - else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) - { + else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) { display.show(1, 0, 16, "Fixed Perf. ["); display.show(1, 13, 2, configuration.sys.load_at_startup); display.show(1, 15, 1, "]"); } } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + 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()) - { + 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()) { if (configuration.sys.load_at_startup == 255) configuration.sys.load_at_startup = PERFORMANCE_NUM_MIN; else if (configuration.sys.load_at_startup >= 0 && configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) configuration.sys.load_at_startup++; if (configuration.sys.load_at_startup > PERFORMANCE_NUM_MAX) configuration.sys.load_at_startup = 255; - } - else if (LCDML.BT_checkUp()) - { + } else if (LCDML.BT_checkUp()) { if (configuration.sys.load_at_startup == 255) configuration.sys.load_at_startup = PERFORMANCE_NUM_MAX; else if (configuration.sys.load_at_startup >= PERFORMANCE_NUM_MIN && configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) configuration.sys.load_at_startup--; - } - else if (LCDML.BT_checkEnter()) - { + } else if (LCDML.BT_checkEnter()) { stored = true; display.show(1, 0, 16, "Done."); save_sd_sys_json(); @@ -6479,8 +5875,7 @@ void UI_func_startup(uint8_t param) display.setCursor(0, 1); if (configuration.sys.load_at_startup == 255) display.show(1, 0, 16, "Last Perf."); - else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) - { + else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX) { display.show(1, 0, 16, "Fixed Perf. ["); display.show(1, 13, 2, configuration.sys.load_at_startup); display.show(1, 15, 1, "]"); @@ -6488,11 +5883,10 @@ void UI_func_startup(uint8_t param) } } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { //lcd_special_chars(SCROLLBAR); - if (stored == false) - { + if (stored == false) { display.show(1, 0, 16, "Canceled."); configuration.sys.load_at_startup = old_load_at_startup; delay(MESSAGE_WAIT_TIME); @@ -6501,9 +5895,8 @@ void UI_func_startup(uint8_t param) } } -void UI_function_not_enabled(void) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_function_not_enabled(void) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -6513,20 +5906,19 @@ void UI_function_not_enabled(void) display.print(F("enbaled!")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { ; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -void UI_function_not_implemented(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* +void UI_function_not_implemented(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); @@ -6536,32 +5928,30 @@ void UI_function_not_implemented(uint8_t param) display.print(F("implemented!")); } - if (LCDML.FUNC_loop()) // ****** LOOP ********* + if (LCDML.FUNC_loop()) // ****** LOOP ********* { ; } - if (LCDML.FUNC_close()) // ****** STABLE END ********* + if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); } } -bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool init) -{ +bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool init) { static int8_t edit_pos; static bool edit_mode; static uint8_t edit_value; static uint8_t last_char_pos; - if (init == true) - { + if (init == true) { edit_mode = false; edit_pos = 0; edit_value = search_accepted_char(edit_string[edit_pos]); last_char_pos = strlen(edit_string); - string_trim(edit_string); // just to be sure + string_trim(edit_string); // just to be sure display.setCursor(x, y); display.print(edit_string); @@ -6570,12 +5960,9 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i return (false); } - if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) - { - if (LCDML.BT_checkDown()) - { - if (edit_mode == true) - { + if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) { + if (LCDML.BT_checkDown()) { + if (edit_mode == true) { edit_value = search_accepted_char(edit_string[edit_pos]); if (edit_value < sizeof(accepted_chars) - 2) @@ -6587,19 +5974,15 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i display.setCursor(x + edit_pos, y); display.print(edit_string[edit_pos]); - } - else - { + } else { if (edit_string[edit_pos] != 0 && edit_string[edit_pos] != 32) edit_pos = constrain(edit_pos + 1, 0, len); - else - { + else { if (edit_pos + 1 > last_char_pos) edit_pos = len; } - if (edit_pos == len) - { + if (edit_pos == len) { display.noBlink(); display.setCursor(x - 1, y); display.print(F(" ")); @@ -6609,11 +5992,8 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i display.print(F("[OK]")); } } - } - else if (LCDML.BT_checkUp()) - { - if (edit_mode == true) - { + } else if (LCDML.BT_checkUp()) { + if (edit_mode == true) { edit_value = search_accepted_char(edit_string[edit_pos]); if (edit_value >= 1) @@ -6624,16 +6004,13 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i display.setCursor(x + edit_pos, y); display.print(edit_string[edit_pos]); - } - else - { + } else { if (edit_pos - 1 > last_char_pos) edit_pos = last_char_pos; else edit_pos = constrain(edit_pos - 1, 0, len - 1); - if (edit_pos == last_char_pos) - { + if (edit_pos == last_char_pos) { display.setCursor(x - 1, y); display.print(F("[")); display.setCursor(x + len, y); @@ -6644,35 +6021,26 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i } } } - } - else if (LCDML.BT_checkEnter()) - { + } else if (LCDML.BT_checkEnter()) { last_char_pos = strlen(edit_string); - if (edit_pos >= len) - { + if (edit_pos >= len) { edit_pos = 0; edit_mode = false; return (true); - } - else - { + } else { last_char_pos = strlen(edit_string); edit_mode = !edit_mode; } if (edit_mode == false && edit_pos < len && edit_string[edit_pos] != 0 && edit_string[edit_pos] != 32) edit_pos++; - if (edit_mode == true) - { + if (edit_mode == true) { display.setCursor(x + len + 1, y); display.print(F("*")); - } - else - { + } else { display.setCursor(x + len + 1, y); display.print(F(" ")); } - } display.setCursor(x + edit_pos, y); encoderDir[ENC_R].reset(); @@ -6680,13 +6048,11 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i return (false); } -uint8_t search_accepted_char(uint8_t c) -{ +uint8_t search_accepted_char(uint8_t c) { //if (c == 0) // c = 32; - for (uint8_t i = 0; i < sizeof(accepted_chars) - 1; i++) - { + for (uint8_t i = 0; i < sizeof(accepted_chars) - 1; i++) { Serial.print(i, DEC); Serial.print(F(":")); Serial.print(c); @@ -6698,17 +6064,14 @@ uint8_t search_accepted_char(uint8_t c) return (0); } -void display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign) -{ +void display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign) { display_float(float(var), size, 0, zeros, brackets, sign); } -void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign) -{ +void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign) { char s[LCD_cols + 1]; - if (size_fraction > 0) - { + if (size_fraction > 0) { if (zeros == true && sign == true) snprintf_P(s, sizeof(s), PSTR("%+0*.*f"), size_number + size_fraction + 2, size_fraction, var); else if (zeros == true && sign == false) @@ -6717,9 +6080,7 @@ void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool z snprintf_P(s, sizeof(s), PSTR("%+*.*f"), size_number + size_fraction + 2, size_fraction, var); else if (zeros == false && sign == false) snprintf_P(s, sizeof(s), PSTR("%*.*f"), size_number + size_fraction + 1, size_fraction, var); - } - else - { + } else { if (zeros == true && sign == true) snprintf_P(s, sizeof(s), PSTR("%+0*d"), size_number + 1, int(var)); else if (zeros == true && sign == false) @@ -6730,8 +6091,7 @@ void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool z snprintf_P(s, sizeof(s), PSTR("%*d"), size_number, int(var)); } - if (brackets == true) - { + if (brackets == true) { char tmp[LCD_cols + 1]; strcpy(tmp, s); @@ -6744,13 +6104,11 @@ void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool z display.print(s); } -inline void display_bar_int(const char* title, uint32_t value, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool sign, bool init) -{ +inline void display_bar_int(const char* title, uint32_t value, float factor, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool sign, bool init) { display_bar_float(title, float(value), factor, min_value, max_value, size, 0, zeros, sign, init); } -void display_bar_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool sign, bool init) -{ +void display_bar_float(const char* title, float value, float factor, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool sign, bool init) { uint8_t size; float v; float _vi = 0.0; @@ -6777,7 +6135,7 @@ void display_bar_float(const char* title, float value, float factor, int32_t min // Value display.setCursor(LCD_cols - size, 1); - display_float(value * factor, size_number, size_fraction, zeros, false, sign); // does not work with "Smallest code" optimizer + display_float(value * factor, size_number, size_fraction, zeros, false, sign); // does not work with "Smallest code" optimizer /* char s[LCD_cols + 1]; snprintf_P(s, sizeof(s), PSTR("%+1.1f"), value * factor); // not so good solution, but works with optimizer display.print(s); */ @@ -6785,30 +6143,25 @@ void display_bar_float(const char* title, float value, float factor, int32_t min // Bar display.setCursor(0, 1); - if (vi == 0) - { + if (vi == 0) { display.write((uint8_t)(vf / 2.0 - 0.5) + 2); for (uint8_t i = vi + 1; i < LCD_cols - size; i++) - display.print(F(" ")); // empty block - } - else - { + display.print(F(" ")); // empty block + } else { for (uint8_t i = 0; i < vi; i++) - display.write((uint8_t)4 + 2); // full block + display.write((uint8_t)4 + 2); // full block if (vi < LCD_cols - size) display.write((uint8_t)(vf / 2.0 - 0.5) + 2); for (uint8_t i = vi + 1; i < LCD_cols - size; i++) - display.print(F(" ")); // empty block + display.print(F(" ")); // empty block } } -inline void display_meter_int(const char* title, uint32_t value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool sign, bool init) -{ +inline void display_meter_int(const char* title, uint32_t value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool sign, bool init) { display_meter_float(title, float(value), factor, offset, min_value, max_value, size, 0, zeros, sign, init); } -void display_meter_float(const char* title, float value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool sign, bool init) -{ +void display_meter_float(const char* title, float value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool sign, bool init) { uint8_t size = 0; float v; float _vi = 0.0; @@ -6826,8 +6179,7 @@ void display_meter_float(const char* title, float value, float factor, float off vf = uint8_t(modff(v, &_vi) * 10.0 + 0.5); vi = uint8_t(_vi); - if (init == true) - { + if (init == true) { // Title display.setCursor(0, 0); display.print(title); @@ -6835,7 +6187,7 @@ void display_meter_float(const char* title, float value, float factor, float off // Value display.setCursor(LCD_cols - size, 1); - display_float((value + offset) * factor, size_number, size_fraction, zeros, false, sign); // does not work with "Smallest code" optimizer + display_float((value + offset) * factor, size_number, size_fraction, zeros, false, sign); // does not work with "Smallest code" optimizer /* char s[LCD_cols + 1]; snprintf_P(s, sizeof(s), PSTR("%+1.1f"), (value + offset) * factor); // not so good solution, but works with optimizer display.print(s); */ @@ -6843,64 +6195,49 @@ void display_meter_float(const char* title, float value, float factor, float off // Bar display.setCursor(0, 1); - if (vi == 0) - { + if (vi == 0) { display.write((uint8_t)(vf / 2.0) + 2); for (uint8_t i = 1; i < LCD_cols - size; i++) - display.print(F(" ")); // empty block - } - else if (vi == LCD_cols - size) - { + display.print(F(" ")); // empty block + } else if (vi == LCD_cols - size) { for (uint8_t i = 0; i < LCD_cols - size - 1; i++) - display.print(F(" ")); // empty block + display.print(F(" ")); // empty block display.write(4 + 2); - } - else - { + } else { for (uint8_t i = 0; i < LCD_cols - size; i++) - display.print(F(" ")); // empty block + display.print(F(" ")); // empty block display.setCursor(vi, 1); display.write((uint8_t)(vf / 2.0) + 2); for (uint8_t i = vi + 1; i < LCD_cols - size; i++) - display.print(F(" ")); // empty block + display.print(F(" ")); // empty block } } -uint8_t bit_reverse8(uint8_t v) -{ +uint8_t bit_reverse8(uint8_t v) { uint8_t result = 0; - for ( ; v > 0; v >>= 1 ) + for (; v > 0; v >>= 1) (result <<= 1) |= (v & 1); return (result); } -void lcd_active_instance_number(uint8_t instance_id) -{ - for (uint8_t i = 0; i < 8; i++) - { - if (instance_id == 0) - { +void lcd_active_instance_number(uint8_t instance_id) { + for (uint8_t i = 0; i < 8; i++) { + if (instance_id == 0) { if (configuration.dexed[instance_id].polyphony == 0) instance_num[0][i] = bit_reverse8(special_chars[0][i]); else instance_num[0][i] = special_chars[0][i]; - if (configuration.dexed[!instance_id].polyphony == 0) - { + if (configuration.dexed[!instance_id].polyphony == 0) { instance_num[1][i] = bit_reverse8(special_chars[1][i]); instance_num[1][i] = ~instance_num[1][i]; - } - else + } else instance_num[1][i] = ~special_chars[1][i]; - } - else - { - if (configuration.dexed[!instance_id].polyphony == 0) - { + } else { + if (configuration.dexed[!instance_id].polyphony == 0) { instance_num[0][i] = bit_reverse8(special_chars[0][i]); instance_num[0][i] = ~instance_num[0][i]; - } - else + } else instance_num[0][i] = ~special_chars[0][i]; if (configuration.dexed[instance_id].polyphony == 0) @@ -6919,14 +6256,11 @@ void lcd_active_instance_number(uint8_t instance_id) #endif } -void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op) -{ +void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op) { uint8_t i, n; - for (n = 2; n < 8; n++) - { - for (i = 0; i < 8; i++) - { + for (n = 2; n < 8; n++) { + for (i = 0; i < 8; i++) { if (bitRead(op, n - 2)) instance_num[n][i] = special_chars[n][i]; else @@ -6935,31 +6269,23 @@ void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op) display.createChar(n, instance_num[n]); } - for (i = 0; i < 8; i++) - { - if (instance_id == 0) - { + for (i = 0; i < 8; i++) { + if (instance_id == 0) { if (configuration.dexed[instance_id].polyphony == 0) instance_num[0][i] = bit_reverse8(special_chars[0][i]); else instance_num[0][i] = special_chars[0][i]; - if (configuration.dexed[!instance_id].polyphony == 0) - { + if (configuration.dexed[!instance_id].polyphony == 0) { instance_num[1][i] = bit_reverse8(special_chars[1][i]); instance_num[1][i] = ~instance_num[1][i]; - } - else + } else instance_num[1][i] = ~special_chars[1][i]; - } - else - { - if (configuration.dexed[!instance_id].polyphony == 0) - { + } else { + if (configuration.dexed[!instance_id].polyphony == 0) { instance_num[0][i] = bit_reverse8(special_chars[0][i]); instance_num[0][i] = ~instance_num[0][i]; - } - else + } else instance_num[0][i] = ~special_chars[0][i]; if (configuration.dexed[instance_id].polyphony == 0) @@ -6973,18 +6299,15 @@ void lcd_OP_active_instance_number(uint8_t instance_id, uint8_t op) #if NUM_DEXED > 1 display.createChar(1, instance_num[1]); #else - display.createChar(1, (uint8_t *)special_chars[17]); + display.createChar(1, (uint8_t*)special_chars[17]); #endif } -void lcd_special_chars(uint8_t mode) -{ - switch (mode) - { +void lcd_special_chars(uint8_t mode) { + switch (mode) { case SCROLLBAR: // set special chars for scrollbar - for (uint8_t i = 0; i < 5; i++) - { + for (uint8_t i = 0; i < 5; i++) { #ifdef I2C_DISPLAY display.createChar(i, (uint8_t*)scroll_bar[i]); #else @@ -6994,8 +6317,7 @@ void lcd_special_chars(uint8_t mode) break; case BLOCKBAR: // set special chars for volume-bar - for (uint8_t i = 0; i < 7; i++) - { + for (uint8_t i = 0; i < 7; i++) { #ifdef I2C_DISPLAY display.createChar(i + 2, (uint8_t*)block_bar[i]); #else @@ -7005,8 +6327,7 @@ void lcd_special_chars(uint8_t mode) break; case METERBAR: // set special chars for panorama-bar - for (uint8_t i = 0; i < 7; i++) - { + for (uint8_t i = 0; i < 7; i++) { #ifdef I2C_DISPLAY display.createChar(i + 2, (uint8_t*)meter_bar[i]); #else @@ -7018,12 +6339,10 @@ void lcd_special_chars(uint8_t mode) } #ifdef USE_FX -void lcd_display_delay_sync(uint8_t sync) -{ +void lcd_display_delay_sync(uint8_t sync) { display.show(0, 0, LCD_cols - 2, "Delay Sync"); display.show(1, 0, 10, "MIDI Sync "); - switch (sync) - { + switch (sync) { case 1: display.show(1, 10, 6, "1/16"); break; @@ -7054,8 +6373,7 @@ void lcd_display_delay_sync(uint8_t sync) } uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[sync] / midi_bpm + 0.5); - if (midi_sync_delay_time > DELAY_MAX_TIME) - { + if (midi_sync_delay_time > DELAY_MAX_TIME) { #ifdef DEBUG Serial.println(F("Calculated MIDI-Sync delay: ")); Serial.print(round(60000.0 * midi_ticks_factor[sync] / midi_bpm), DEC); @@ -7069,32 +6387,28 @@ void lcd_display_delay_sync(uint8_t sync) } #endif -void string_trim(char *s) -{ +void string_trim(char* s) { int i; - while (isspace (*s)) s++; // skip left side white spaces - for (i = strlen (s) - 1; (isspace (s[i])); i--) ; // skip right side white spaces + while (isspace(*s)) s++; // skip left side white spaces + for (i = strlen(s) - 1; (isspace(s[i])); i--) + ; // skip right side white spaces s[i + 1] = '\0'; } -void locate_previous_non_favorite() -{ +void locate_previous_non_favorite() { //find prev. non fav in current bank display.setCursor(3, 0); display.print("= 0 && configuration.dexed[selected_instance_id].bank >= 0) { @@ -7145,29 +6456,32 @@ void locate_previous_favorite() configuration.dexed[selected_instance_id].voice--; favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 36); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 36); // if found, we are done. else quick check in previous banks - if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 0 && - configuration.dexed[selected_instance_id].bank >= 0 && favsearcher < 170) - { + if (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].voice >= 0 && configuration.dexed[selected_instance_id].bank >= 0 && favsearcher < 170) { configuration.dexed[selected_instance_id].voice = 32; - do { //seek for previous bank + do { //seek for previous bank configuration.dexed[selected_instance_id].bank--; favsearcher++; - } while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false && - favsearcher < 132 && configuration.dexed[selected_instance_id].bank >= 0); + } while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false && favsearcher < 132 && configuration.dexed[selected_instance_id].bank >= 0); do { //last try to search if a bank with fav was found configuration.dexed[selected_instance_id].voice--; favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 170); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].voice >= 1 && favsearcher < 170); } } favsearcher = 0; @@ -7177,70 +6491,70 @@ void locate_next_favorite() { - bool RollOver = false; - if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank >= MAX_BANKS - 1 ) - { //if at end of all banks + bool RollOver = false; + if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank >= MAX_BANKS - 1) { //if at end of all banks configuration.dexed[selected_instance_id].bank = 0; configuration.dexed[selected_instance_id].voice = 0; RollOver = true; - } else if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank < MAX_BANKS - 1 ) - { //if at end of any other bank + } else if (configuration.dexed[selected_instance_id].voice > 30 && configuration.dexed[selected_instance_id].bank < MAX_BANKS - 1) { //if at end of any other bank configuration.dexed[selected_instance_id].bank++; configuration.dexed[selected_instance_id].voice = 0; } - if (configuration.dexed[selected_instance_id].voice <= 30 && configuration.dexed[selected_instance_id].bank <= MAX_BANKS ) { + if (configuration.dexed[selected_instance_id].voice <= 30 && configuration.dexed[selected_instance_id].bank <= MAX_BANKS) { display.setCursor(3, 0); display.print(">SEARCHING"); do { //first find next fav in current bank - if (RollOver == false) configuration.dexed[selected_instance_id].voice++; else RollOver = true; + if (RollOver == false) configuration.dexed[selected_instance_id].voice++; + else RollOver = true; favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 36); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 36); // if found, we are done. else quick check in next banks - if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && - configuration.dexed[selected_instance_id].bank < MAX_BANKS && favsearcher < 170) - { + if (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].bank < MAX_BANKS && favsearcher < 170) { configuration.dexed[selected_instance_id].voice = 0; - do { //seek in next bank + do { //seek in next bank configuration.dexed[selected_instance_id].bank++; - if ( configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1 && favsearcher < 190) - { + if (configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1 && favsearcher < 190) { configuration.dexed[selected_instance_id].bank = 0; configuration.dexed[selected_instance_id].voice = 0; } favsearcher++; - } while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false && - favsearcher < 132 ); + } while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == false && favsearcher < 132); - if ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 190) - { + if (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && configuration.dexed[selected_instance_id].voice <= 32 && favsearcher < 190) { do { //last bank to search if a fav can be found configuration.dexed[selected_instance_id].voice++; favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == false && favsearcher < 170); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == false + && favsearcher < 170); } } } favsearcher = 0; - } -void locate_next_non_favorite() -{ +void locate_next_non_favorite() { //find next non-fav in current bank display.setCursor(3, 0); display.print(">SEARCHING"); @@ -7251,7 +6565,7 @@ void locate_next_non_favorite() //configuration.dexed[selected_instance_id].bank++; if (configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1) configuration.dexed[selected_instance_id].bank = 0; - do { //seek for next bank + do { //seek for next bank configuration.dexed[selected_instance_id].bank++; if (configuration.dexed[selected_instance_id].bank > MAX_BANKS - 1) configuration.dexed[selected_instance_id].bank = 0; @@ -7259,78 +6573,69 @@ void locate_next_non_favorite() } while (quick_check_favorites_in_bank(configuration.dexed[selected_instance_id].bank, selected_instance_id) == true && favsearcher < 132); } favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == true && favsearcher < 170); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == true + && favsearcher < 170); favsearcher = 0; } -void locate_random_non_favorite() -{ +void locate_random_non_favorite() { //find random non-fav - do - { + do { configuration.dexed[selected_instance_id].voice = random(32); configuration.dexed[selected_instance_id].bank = random(MAX_BANKS - 1); favsearcher++; - } while ( check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, - selected_instance_id) == true && favsearcher < 100); + } while (check_favorite(configuration.dexed[selected_instance_id].bank, configuration.dexed[selected_instance_id].voice, + selected_instance_id) + == true + && favsearcher < 100); favsearcher = 0; } -bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id) -{ +bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id) { b = constrain(b, 0, MAX_BANKS - 1); v = constrain(v, 0, MAX_VOICES - 1); char tmp[18]; File myFav; - if (sd_card > 0) - { + if (sd_card > 0) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v); #ifdef DEBUG Serial.print(F("check if Voice is a Favorite: ")); Serial.print(tmp); Serial.println(); #endif - if (SD.exists(tmp)) - { //is Favorite + if (SD.exists(tmp)) { //is Favorite #ifdef DEBUG Serial.println(F(" - It is in Favorites.")); #endif return true; - } - else - { // it was not a favorite + } else { // it was not a favorite #ifdef DEBUG Serial.println(F(" - It is not in Favorites.")); #endif return false; } - } - else + } else return false; } -void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id) -{ +void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id) { b = constrain(b, 0, MAX_BANKS - 1); v = constrain(v, 0, MAX_VOICES - 1); char tmp[18]; File myFav; - if (sd_card > 0) - { + if (sd_card > 0) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v); - if (SD.exists(tmp)) - { //is Favorite + if (SD.exists(tmp)) { //is Favorite #ifdef TESTDISPLAY20x4 display.setCursor(17, 0); #else display.setCursor(13, 0); #endif - display.write(2); //fav symbol - } - else - { // it was not a favorite + display.write(2); //fav symbol + } else { // it was not a favorite #ifdef TESTDISPLAY20x4 display.setCursor(17, 0); #else @@ -7341,40 +6646,33 @@ void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id) } } -bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id) -{ +bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id) { b = constrain(b, 0, MAX_BANKS - 1); char tmp[18]; - if (sd_card > 0) - { + if (sd_card > 0) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, b); #ifdef DEBUG Serial.print(F("check if there is a Favorite in Bank: ")); Serial.print(tmp); Serial.println(); #endif - if (SD.exists(tmp) ) - { // this bank HAS at least 1 favorite(s) + if (SD.exists(tmp)) { // this bank HAS at least 1 favorite(s) #ifdef DEBUG Serial.println(F("quickcheck found a FAV in bank!")); #endif return (true); - } - else - { // no favorites in bank stored + } else { // no favorites in bank stored return (false); #ifdef DEBUG Serial.println(F(" - It is no Favorite in current Bank.")); #endif } - } - else + } else return false; } -void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) -{ +void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) { #ifdef DEBUG Serial.println(F("Starting saving Favorite.")); #endif @@ -7384,18 +6682,15 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) char tmpfolder[18]; File myFav; uint8_t i = 0, countfavs = 0; - if (sd_card > 0) - { + if (sd_card > 0) { snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v); snprintf_P(tmpfolder, sizeof(tmpfolder), PSTR("/%s/%d"), FAV_CONFIG_PATH, b); #ifdef DEBUG Serial.println(F("Save Favorite to SD card...")); Serial.println(tmp); #endif - if (!SD.exists(tmp)) - { //create Favorite Semaphore - if (!SD.exists(tmpfolder)) - { + if (!SD.exists(tmp)) { //create Favorite Semaphore + if (!SD.exists(tmpfolder)) { SD.mkdir(tmpfolder); } myFav = SD.open(tmp, FILE_WRITE); @@ -7406,18 +6701,16 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) #else display.setCursor(13, 0); #endif - display.write(2); //fav symbol + display.write(2); //fav symbol #ifdef DEBUG Serial.println(F("Added to Favorites...")); #endif - } - else - { // delete the file, is no longer a favorite + } else { // delete the file, is no longer a favorite SD.remove(tmp); #ifdef DEBUG Serial.println(F("Removed from Favorites...")); #endif - for (i = 0; i < 32; i++) { //if no other favs exist in current bank, remove folder + for (i = 0; i < 32; i++) { //if no other favs exist in current bank, remove folder snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, i); if (SD.exists(tmp)) countfavs++; } @@ -7435,7 +6728,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) #else display.setCursor(13, 0); #endif - display.print(" "); //remove fav symbol + display.print(" "); //remove fav symbol #ifdef DEBUG Serial.println(F("Removed from Favorites...")); #endif @@ -7443,10 +6736,9 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) } } -char* basename(const char* filename) -{ - char* p = strrchr (filename, '/'); - return p ? p + 1 : (char *) filename; +char* basename(const char* filename) { + char* p = strrchr(filename, '/'); + return p ? p + 1 : (char*)filename; } -#endif //ENABLE_LCD_UI +#endif //ENABLE_LCD_UI \ No newline at end of file diff --git a/config.h b/config.h index b69a2d0..fd257e8 100644 --- a/config.h +++ b/config.h @@ -103,10 +103,10 @@ //************************************************************************************************* // Number of Dexed instances #if defined(ARDUINO_TEENSY36) -#warning >>> Sorry, only one instance possible for Teensy-3.6 -#define NUM_DEXED 1 // 1 or 2 - nothing else! +#warning>>> Sorry, only one instance possible for Teensy-3.6 +#define NUM_DEXED 1 // 1 or 2 - nothing else! #else -#define NUM_DEXED 2 // 1 or 2 - nothing else! +#define NUM_DEXED 2 // 1 or 2 - nothing else! #endif // FX-CHAIN ENABLE/DISABLE @@ -145,9 +145,9 @@ #endif // CHORUS parameters -#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(15.0)) // 15.0 ms delay buffer. -#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE -#define MOD_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT +#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(15.0)) // 15.0 ms delay buffer. +#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE +#define MOD_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_CUTOFF_HZ 2000 // SGTL5000 @@ -164,23 +164,23 @@ // DELAYTIME #if NUM_DEXED > 1 -# if defined(ARDUINO_TEENSY41) -# define DELAY_MAX_TIME 500 -# elif defined(ARDUINO_TEENSY41) -# define DELAY_MAX_TIME 250 -# else -# define DELAY_MAX_TIME 100 -# endif +#if defined(ARDUINO_TEENSY41) +#define DELAY_MAX_TIME 500 +#elif defined(ARDUINO_TEENSY41) +#define DELAY_MAX_TIME 250 #else -# if defined(ARDUINO_TEENSY36) -# define DELAY_MAX_TIME 400 -# elif defined(ARDUINO_TEENSY41) -# define DELAY_MAX_TIME 1000 -# elif defined(ARDUINO_TEENSY41) -# define DELAY_MAX_TIME 500 -# else -# define DELAY_MAX_TIME 200 -# endif +#define DELAY_MAX_TIME 100 +#endif +#else +#if defined(ARDUINO_TEENSY36) +#define DELAY_MAX_TIME 400 +#elif defined(ARDUINO_TEENSY41) +#define DELAY_MAX_TIME 1000 +#elif defined(ARDUINO_TEENSY41) +#define DELAY_MAX_TIME 500 +#else +#define DELAY_MAX_TIME 200 +#endif #endif //************************************************************************************************* @@ -190,9 +190,9 @@ #ifdef USE_FX #if defined(USE_EPIANO) -#define AUDIO_MEM SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 + 36 + 14 +#define AUDIO_MEM SAMPLE_RATE* NUM_DEXED* DELAY_MAX_TIME / 128000 + 36 + 14 #else -#define AUDIO_MEM SAMPLE_RATE * NUM_DEXED * DELAY_MAX_TIME / 128000 + 36 +#define AUDIO_MEM SAMPLE_RATE* NUM_DEXED* DELAY_MAX_TIME / 128000 + 36 #endif #else #if defined(USE_EPIANO) @@ -242,11 +242,11 @@ //#define LCD_I2C_ADDRESS 0x3f //Display size, must be set for U8X8 as well #ifdef TESTDISPLAY20x4 -#define LCD_cols 20 -#define LCD_rows 4 +#define LCD_cols 20 +#define LCD_rows 4 #else -#define LCD_cols 16 -#define LCD_rows 2 +#define LCD_cols 16 +#define LCD_rows 2 #endif #define I2C_DISPLAY @@ -255,8 +255,8 @@ #endif #ifdef OLED_SPI -#define LCD_cols 16 -#define LCD_rows 4 +#define LCD_cols 16 +#define LCD_rows 4 //enable U8X8 support #define U8X8_DISPLAY //enable SPI CS switching @@ -278,38 +278,38 @@ //************************************************************************************************* // Teensy Audio Shield -#define SDCARD_AUDIO_CS_PIN 10 -#define SDCARD_AUDIO_MOSI_PIN 7 -#define SDCARD_AUDIO_SCK_PIN 14 +#define SDCARD_AUDIO_CS_PIN 10 +#define SDCARD_AUDIO_MOSI_PIN 7 +#define SDCARD_AUDIO_SCK_PIN 14 #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) // new detection logic to also find on board SD Card from Teensy 4.1 // Teensy 3.6 & 4.1 internal SD card -#define SDCARD_TEENSY_CS_PIN BUILTIN_SDCARD -#define SDCARD_TEENSY_MOSI_PIN 11 -#define SDCARD_TEENSY_SCK_PIN 13 +#define SDCARD_TEENSY_CS_PIN BUILTIN_SDCARD +#define SDCARD_TEENSY_MOSI_PIN 11 +#define SDCARD_TEENSY_SCK_PIN 13 #else -#define SDCARD_TEENSY_CS_PIN 10 -#define SDCARD_TEENSY_MOSI_PIN 11 -#define SDCARD_TEENSY_SCK_PIN 13 +#define SDCARD_TEENSY_CS_PIN 10 +#define SDCARD_TEENSY_MOSI_PIN 11 +#define SDCARD_TEENSY_SCK_PIN 13 #endif // Encoder with button //#define ENCODER_USE_INTERRUPTS #define NUM_ENCODER 2 -#define ENC_L_PIN_A 3 -#define ENC_L_PIN_B 2 -#define BUT_L_PIN 4 +#define ENC_L_PIN_A 3 +#define ENC_L_PIN_B 2 +#define BUT_L_PIN 4 #if defined(ARDUINO_TEENSY36) -#define ENC_R_PIN_A 28 -#define ENC_R_PIN_B 29 -#define BUT_R_PIN 30 +#define ENC_R_PIN_A 28 +#define ENC_R_PIN_B 29 +#define BUT_R_PIN 30 #elif defined(ARDUINO_TEENSY40) -#define ENC_R_PIN_A 6 -#define ENC_R_PIN_B 5 -#define BUT_R_PIN 8 -#else // ARDUINO_ARDUINO_TEENSY41 -#define ENC_R_PIN_A 24 -#define ENC_R_PIN_B 5 -#define BUT_R_PIN 9 +#define ENC_R_PIN_A 6 +#define ENC_R_PIN_B 5 +#define BUT_R_PIN 8 +#else // ARDUINO_ARDUINO_TEENSY41 +#define ENC_R_PIN_A 24 +#define ENC_R_PIN_B 5 +#define BUT_R_PIN 9 #endif #define BUT_DEBOUNCE_MS 20 #define LONG_BUTTON_PRESS 500 @@ -321,9 +321,9 @@ #define EEPROM_START_ADDRESS 0xFF #define MAX_BANKS 100 -#define MAX_VOICES 32 // voices per bank -#define BANK_NAME_LEN 11 // 10 (plus '\0') -#define VOICE_NAME_LEN 12 // 11 (plus '\0') +#define MAX_VOICES 32 // voices per bank +#define BANK_NAME_LEN 11 // 10 (plus '\0') +#define VOICE_NAME_LEN 12 // 11 (plus '\0') #define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN #define CONFIG_FILENAME_LEN 50 #define DRUM_NAME_LEN 21 @@ -345,7 +345,7 @@ //************************************************************************************************* //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //************************************************************************************************* -#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS! +#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS! #define CONTROL_RATE_MS 50 #define SAVE_SYS_MS 5000 #define VOL_MAX_FLOAT 0.95 @@ -366,36 +366,36 @@ // Teensy-3.6 settings #if defined(ARDUINO_TEENSY36) #undef USE_SEQUENCER -# if defined(USE_FX) -# warning >>> With enabled FX a maximum of 12 voices is possible (due to RAM and CPU limitations) -# define MAX_NOTES 12 -# if F_CPU > 180000000 -# error >>> Enabled FX with clockrate more than 180MHz is not useful due to RAM limitations. -# endif -# else -# if F_CPU == 256000000 -# warning >>> Maximum of 22 voices. -# define MAX_NOTES 22 -# elif F_CPU == 240000000 -# warning >>> Maximum of 20 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. -# define MAX_NOTES 20 -# elif F_CPU == 216000000 -# warning >>> Maximum of 18 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. -# define MAX_NOTES 18 -# elif F_CPU == 192000000 -# warning >>> Maximum of 16 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. -# define MAX_NOTES 16 -# elif F_CPU == 180000000 -# warning >>> Maximum of 14 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. -# define MAX_NOTES 14 -# else -# error >>> CPU Clock below 180MHz is not supported -# endif -# endif +#if defined(USE_FX) +#warning>>> With enabled FX a maximum of 12 voices is possible (due to RAM and CPU limitations) +#define MAX_NOTES 12 +#if F_CPU > 180000000 +#error>>> Enabled FX with clockrate more than 180MHz is not useful due to RAM limitations. +#endif +#else +#if F_CPU == 256000000 +#warning>>> Maximum of 22 voices. +#define MAX_NOTES 22 +#elif F_CPU == 240000000 +#warning>>> Maximum of 20 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +#define MAX_NOTES 20 +#elif F_CPU == 216000000 +#warning>>> Maximum of 18 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +#define MAX_NOTES 18 +#elif F_CPU == 192000000 +#warning>>> Maximum of 16 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +#define MAX_NOTES 16 +#elif F_CPU == 180000000 +#warning>>> Maximum of 14 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +#define MAX_NOTES 14 +#else +#error>>> CPU Clock below 180MHz is not supported +#endif +#endif #endif #if defined(ARDUINO_TEENSY35) -#error >>> Not supported anymore!!! +#error>>> Not supported anymore!!! #endif // MIDI @@ -467,7 +467,7 @@ #define CHORUS_LEVEL_DEFAULT 0 #define DELAY_TIME_MIN 0 -#define DELAY_TIME_MAX DELAY_MAX_TIME/10 +#define DELAY_TIME_MAX DELAY_MAX_TIME / 10 #define DELAY_TIME_DEFAULT 0 #define DELAY_FEEDBACK_MIN 0 @@ -560,7 +560,7 @@ #define MW_ASSIGN_MIN 0 #define MW_ASSIGN_MAX 7 -#define MW_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias +#define MW_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define MW_MODE_MIN 0 #define MW_MODE_MAX MIDI_CONTROLLER_MODE_MAX @@ -572,7 +572,7 @@ #define FC_ASSIGN_MIN 0 #define FC_ASSIGN_MAX 7 -#define FC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias +#define FC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define FC_MODE_MIN 0 #define FC_MODE_MAX MIDI_CONTROLLER_MODE_MAX @@ -584,7 +584,7 @@ #define BC_ASSIGN_MIN 0 #define BC_ASSIGN_MAX 7 -#define BC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias +#define BC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define BC_MODE_MIN 0 #define BC_MODE_MAX MIDI_CONTROLLER_MODE_MAX @@ -596,7 +596,7 @@ #define AT_ASSIGN_MIN 0 #define AT_ASSIGN_MAX 7 -#define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias +#define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define AT_MODE_MIN 0 #define AT_MODE_MAX MIDI_CONTROLLER_MODE_MAX @@ -608,7 +608,7 @@ #define PORTAMENTO_MODE_MIN 0 #define PORTAMENTO_MODE_MAX 1 -#define PORTAMENTO_MODE_DEFAULT 0 // 0: Retain, 1: Follow +#define PORTAMENTO_MODE_DEFAULT 0 // 0: Retain, 1: Follow #define PORTAMENTO_GLISSANDO_MIN 0 #define PORTAMENTO_GLISSANDO_MAX 1 @@ -660,6 +660,10 @@ #define SEQUENCE_CONFIG_DEFAULT 0 */ +#define DRUMS_MAIN_VOL_MIN 0 +#define DRUMS_MAIN_VOL_MAX 100 +#define DRUMS_MAIN_VOL_DEFAULT 80 + #define EQ_1_MIN 15 #define EQ_1_MAX 250 #define EQ_1_DEFAULT 50 @@ -944,8 +948,7 @@ enum reverb_mixer_ports { #ifndef _MAPFLOAT #define _MAPFLOAT -inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) -{ +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 @@ -966,4 +969,4 @@ inline float mapfloat(float val, float in_min, float in_max, float out_min, floa ARDUINO_TEENSY40 - Teensy 4.0 ARDUINO_TEENSY41 - Teensy 4.1 ARDUINO_TEENSYMM - Teensy 4 MM -*/ +*/ \ No newline at end of file diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 83bfd90..2dbbb61 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -1123,7 +1123,7 @@ bool load_sd_sys_json(void) { // ... and if: load #ifdef DEBUG - Serial.print(F("Found sys configuration")); + Serial.println(F("Found sys configuration")); #endif json = SD.open(filename); if (json)