Fixed favorite initialisation.

pull/41/head
Holger Wirtz 4 years ago
parent 71412c4bd6
commit 2288a84fd3
  1. 16
      MicroDexed.ino
  2. 451
      UI.hpp

@ -1444,6 +1444,9 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id)
void init_MIDI_send_CC(void) void init_MIDI_send_CC(void)
{ {
#ifdef DEBUG
Serial.println("init_MIDI_send_CC():");
#endif
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity);
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan);
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]);
@ -1593,7 +1596,7 @@ void check_configuration(void)
configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX); configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX);
configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX);
configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX);
configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX / instance_id); configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX / NUM_DEXED);
configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX);
configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX);
configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX); configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX);
@ -2175,6 +2178,17 @@ void check_and_create_directories(void)
#endif #endif
SD.mkdir(tmp); SD.mkdir(tmp);
} }
for (uint8_t i = 0; i < MAX_BANKS; i++)
{
sprintf(tmp, "/%s/%d", FAV_CONFIG_PATH, i);
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
if (!SD.exists(tmp))
SD.mkdir(tmp);
}
} }
#ifdef DEBUG #ifdef DEBUG
else else

451
UI.hpp

@ -25,7 +25,6 @@
#ifdef ENABLE_LCD_UI #ifdef ENABLE_LCD_UI
#ifndef _UI_HPP_ #ifndef _UI_HPP_
#define _UI_HPP_ #define _UI_HPP_
#endif
#include "config.h" #include "config.h"
#include "disp_plus.h" #include "disp_plus.h"
@ -269,6 +268,11 @@ 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); 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); bool check_favorite(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);
void locate_previous_non_favorite();
void locate_previous_favorite();
void locate_next_favorite();
void locate_next_non_favorite();
void locate_random_non_favorite();
// normal menu // 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)
@ -954,6 +958,7 @@ void UI_func_reverb_roomsize(uint8_t param)
} }
} }
#if USE_PLATEREVERB != 1
void UI_func_reverb_damping(uint8_t param) void UI_func_reverb_damping(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -976,12 +981,8 @@ void UI_func_reverb_damping(uint8_t param)
lcd_display_bar_int("Reverb Damp.", configuration.fx.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, false); lcd_display_bar_int("Reverb Damp.", configuration.fx.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, false);
#ifdef USE_PLATEREVERB
reverb.hidamp(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
#else
freeverb_l.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); freeverb_l.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
freeverb_r.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); freeverb_r.damping(mapfloat(configuration.fx.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0));
#endif
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -991,27 +992,139 @@ void UI_func_reverb_damping(uint8_t param)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_damping), configuration.fx.reverb_damping); EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_damping), configuration.fx.reverb_damping);
} }
} }
#else
//// HIER
void UI_func_reverb_lowpass(uint8_t param) void UI_func_reverb_lowpass(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR);
lcd_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.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())
configuration.fx.reverb_lowpass = constrain(configuration.fx.reverb_lowpass - ENCODER[ENC_R].speed(), REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX);
}
lcd_display_bar_int("Reverb Lowpass", configuration.fx.reverb_lowpass, 1.0, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX, 3, false, false, false);
reverb.lowpass(mapfloat(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX, 0.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_lowpass), configuration.fx.reverb_lowpass);
}
} }
void UI_func_reverb_lodamp(uint8_t param) void UI_func_reverb_lodamp(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR);
lcd_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.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())
configuration.fx.reverb_lodamp = constrain(configuration.fx.reverb_lodamp - ENCODER[ENC_R].speed(), REVERB_LODAMP_MIN, REVERB_LODAMP_MAX);
}
lcd_display_bar_int("Reverb Lodamp.", configuration.fx.reverb_lodamp, 1.0, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX, 3, false, false, false);
reverb.lodamp(mapfloat(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX, 0.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_lodamp), configuration.fx.reverb_lodamp);
}
} }
void UI_func_reverb_hidamp(uint8_t param) void UI_func_reverb_hidamp(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR);
lcd_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.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())
configuration.fx.reverb_hidamp = constrain(configuration.fx.reverb_hidamp - ENCODER[ENC_R].speed(), REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX);
}
lcd_display_bar_int("Reverb Hidamp.", configuration.fx.reverb_hidamp, 1.0, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX, 3, false, false, false);
reverb.hidamp(mapfloat(configuration.fx.reverb_hidamp, REVERB_HIDAMP_MIN, REVERB_HIDAMP_MAX, 0.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_hidamp), configuration.fx.reverb_hidamp);
}
} }
void UI_func_reverb_diffusion(uint8_t param) void UI_func_reverb_diffusion(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR);
lcd_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.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())
configuration.fx.reverb_diffusion = constrain(configuration.fx.reverb_diffusion - ENCODER[ENC_R].speed(), REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX);
}
lcd_display_bar_int("Reverb Diff.", configuration.fx.reverb_diffusion, 1.0, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX, 3, false, false, false);
reverb.diffusion(mapfloat(configuration.fx.reverb_diffusion, REVERB_DIFFUSION_MIN, REVERB_DIFFUSION_MAX, 0.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_diffusion), configuration.fx.reverb_diffusion);
}
} }
#endif // PLATEREVERB != 1
void UI_func_reverb_level(uint8_t param) void UI_func_reverb_level(uint8_t param)
{ {
@ -1486,7 +1599,7 @@ void UI_func_filter_cutoff(uint8_t param)
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR); lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Filter Cut", configuration.fx.filter_cutoff[selected_instance_id], 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, true); lcd_display_bar_int("Filter Cutoff", configuration.fx.filter_cutoff[selected_instance_id], 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, true);
lcd_active_instance_number(selected_instance_id); lcd_active_instance_number(selected_instance_id);
UI_update_instance_icons(); UI_update_instance_icons();
@ -1516,7 +1629,7 @@ void UI_func_filter_cutoff(uint8_t param)
#endif #endif
} }
lcd_display_bar_int("Filter Cut", configuration.fx.filter_cutoff[selected_instance_id], 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false); lcd_display_bar_int("Filter Cutoff", configuration.fx.filter_cutoff[selected_instance_id], 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->fx.Cutoff = mapfloat(configuration.fx.filter_cutoff[selected_instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); MicroDexed[selected_instance_id]->fx.Cutoff = mapfloat(configuration.fx.filter_cutoff[selected_instance_id], FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
} }
@ -1539,7 +1652,7 @@ void UI_func_filter_resonance(uint8_t param)
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd_special_chars(BLOCKBAR); lcd_special_chars(BLOCKBAR);
lcd_display_bar_int("Filter Res", configuration.fx.filter_resonance[selected_instance_id], 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, true); lcd_display_bar_int("Filter Reso.", configuration.fx.filter_resonance[selected_instance_id], 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, true);
lcd_active_instance_number(selected_instance_id); lcd_active_instance_number(selected_instance_id);
UI_update_instance_icons(); UI_update_instance_icons();
@ -1569,7 +1682,7 @@ void UI_func_filter_resonance(uint8_t param)
#endif #endif
} }
lcd_display_bar_int("Filter Res", configuration.fx.filter_resonance[selected_instance_id], 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false); lcd_display_bar_int("Filter Reso.", configuration.fx.filter_resonance[selected_instance_id], 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->fx.Reso = mapfloat(configuration.fx.filter_resonance[selected_instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[selected_instance_id]->fx.Reso = mapfloat(configuration.fx.filter_resonance[selected_instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
} }
@ -1987,19 +2100,15 @@ void UI_func_favorites(uint8_t param)
{ {
case 0: case 0:
lcd.print(F("[ All presets ]")); lcd.print(F("[ All presets ]"));
break; break;
case 1: case 1:
lcd.print(F("[ FAVs. only ]")); lcd.print(F("[ FAVs. only ]"));
break; break;
case 2: case 2:
lcd.print(F("[non-FAVs. only]")); lcd.print(F("[non-FAVs. only]"));
break; break;
case 3: case 3:
lcd.print(F("[random non-FAV]")); lcd.print(F("[random non-FAV]"));
break; break;
} }
} }
@ -2027,7 +2136,6 @@ void UI_func_favorites(uint8_t param)
lcd.print(F("[random non-FAV]")); lcd.print(F("[random non-FAV]"));
break; break;
} }
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2128,7 +2236,7 @@ void UI_func_polyphony(uint8_t param)
if (LCDML.BT_checkDown()) if (LCDML.BT_checkDown())
{ {
#if NUM_DEXED>1 #if NUM_DEXED>1
if (configuration.dexed[selected_instance_id].polyphony < POLYPHONY_MAX - configuration.dexed[selected_instance_id + 1 % NUM_DEXED].polyphony) 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); 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 #else
configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX); configuration.dexed[selected_instance_id].polyphony = constrain(configuration.dexed[selected_instance_id].polyphony + 1, POLYPHONY_MIN, POLYPHONY_MAX);
@ -2159,7 +2267,7 @@ void UI_func_polyphony(uint8_t param)
} }
#if NUM_DEXED>1 #if NUM_DEXED>1
lcd_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); lcd_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 #else
lcd_display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 2, false, false, false); lcd_display_bar_int("Polyphony", configuration.dexed[selected_instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 2, false, false, false);
#endif #endif
@ -3610,161 +3718,6 @@ void UI_func_eeprom_reset(uint8_t param)
} }
} }
void locate_previous_non_favorite()
{
//find prev. non fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do {
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_previous_favorite()
{
//find previous fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do {
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 ) configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_favorite()
{
//find next fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_non_favorite()
{
//find next non-fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
//configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1) configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_random_non_favorite()
{
//find random non-fav
do {
configuration.performance.voice[selected_instance_id] = random(32);
configuration.performance.bank[selected_instance_id] = random(MAX_BANKS - 1);
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 100);
favsearcher = 0;
}
void UI_update_instance_icons() void UI_update_instance_icons()
{ {
lcd.setCursor(14, 0); lcd.setCursor(14, 0);
@ -3859,9 +3812,7 @@ void UI_func_voice_select(uint8_t param)
else //only Favs else //only Favs
if (configuration.sys.favorites == 1) if (configuration.sys.favorites == 1)
{ {
locate_previous_favorite(); locate_previous_favorite();
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
#endif #endif
@ -3869,7 +3820,8 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
} else //only non-Favs }
else //only non-Favs
if (configuration.sys.favorites == 2) if (configuration.sys.favorites == 2)
{ {
locate_previous_non_favorite(); locate_previous_non_favorite();
@ -4039,9 +3991,7 @@ void UI_func_voice_select(uint8_t param)
lcd.show(1, 13, 1, "]"); lcd.show(1, 13, 1, "]");
break; break;
} }
draw_favorite_icon(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id); draw_favorite_icon(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id], selected_instance_id);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -5721,7 +5671,8 @@ void lcd_display_bar_float(const char* title, float value, float factor, int32_t
// Title // Title
if (init == true) if (init == true)
lcd.show(0, 0, LCD_cols - 3, title); lcd.show(0, 0, LCD_cols - 2, title);
//lcd.show(0, 0, LCD_cols - 3, title);
// Value // Value
lcd.setCursor(LCD_cols - size, 1); lcd.setCursor(LCD_cols - size, 1);
@ -5978,8 +5929,131 @@ void string_trim(char *s)
s[i + 1] = '\0'; s[i + 1] = '\0';
} }
bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id) void locate_previous_non_favorite()
{
//find prev. non fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do
{
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do
{ //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while (check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_previous_favorite()
{
//find previous fav in current bank
lcd.setCursor(3, 0);
lcd.print("<SEARCHING");
do {
if (configuration.performance.voice[selected_instance_id] == 0)
{
configuration.performance.voice[selected_instance_id] = 32; //+1
//configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
do { //seek for previous bank
configuration.performance.bank[selected_instance_id]--;
if (configuration.performance.bank[selected_instance_id] < 1 )
configuration.performance.bank[selected_instance_id] = MAX_BANKS - 1;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
configuration.performance.voice[selected_instance_id]--;
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_favorite()
{
//find next fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == false && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == false && favsearcher < 170);
favsearcher = 0;
}
void locate_next_non_favorite()
{
//find next non-fav in current bank
lcd.setCursor(3, 0);
lcd.print(">SEARCHING");
do {
configuration.performance.voice[selected_instance_id]++;
if (configuration.performance.voice[selected_instance_id] > 31) {
configuration.performance.voice[selected_instance_id] = 0;
//configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
do { //seek for next bank
configuration.performance.bank[selected_instance_id]++;
if (configuration.performance.bank[selected_instance_id] > MAX_BANKS - 1)
configuration.performance.bank[selected_instance_id] = 0;
favsearcher++;
} while (quick_check_favorites_in_bank(configuration.performance.bank[selected_instance_id], selected_instance_id) == true && favsearcher < 132);
}
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 170);
favsearcher = 0;
}
void locate_random_non_favorite()
{
//find random non-fav
do
{
configuration.performance.voice[selected_instance_id] = random(32);
configuration.performance.bank[selected_instance_id] = random(MAX_BANKS - 1);
favsearcher++;
} while ( check_favorite(configuration.performance.bank[selected_instance_id], configuration.performance.voice[selected_instance_id],
selected_instance_id) == true && favsearcher < 100);
favsearcher = 0;
}
bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{ {
b = constrain(b, 0, MAX_BANKS - 1); b = constrain(b, 0, MAX_BANKS - 1);
v = constrain(v, 0, MAX_VOICES - 1); v = constrain(v, 0, MAX_VOICES - 1);
@ -6003,9 +6077,7 @@ bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
#endif #endif
return true; return true;
} }
else else
{ // it was not a favorite { // it was not a favorite
#ifdef DEBUG #ifdef DEBUG
@ -6013,9 +6085,9 @@ bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
#endif #endif
return false; return false;
} }
}
} else return false; 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)
@ -6031,12 +6103,12 @@ void draw_favorite_icon(uint8_t b, uint8_t v, uint8_t instance_id)
if (SD.exists(tmp)) if (SD.exists(tmp))
{ //is Favorite { //is Favorite
lcd.setCursor(12, 0); lcd.setCursor(13, 0);
lcd.write(2); //fav symbol lcd.write(2); //fav symbol
} }
else else
{ // it was not a favorite { // it was not a favorite
lcd.setCursor(12, 0); lcd.setCursor(13, 0);
lcd.print(" "); lcd.print(" ");
} }
} }
@ -6070,7 +6142,9 @@ bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id)
Serial.println(" - It is no Favorite in current Bank."); Serial.println(" - It is no Favorite in current Bank.");
#endif #endif
} }
} else return false; }
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)
@ -6144,3 +6218,4 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
} }
#endif #endif
#endif

Loading…
Cancel
Save