Several fixes fir loading and saving performances.

Additional small fixes.
dev
Holger Wirtz 2 years ago
parent bd89c6f07b
commit 6993cdcb0b
  1. 5
      MicroDexed.ino
  2. 73
      UI.hpp
  3. 5
      config.h
  4. 4
      dexed_sd.cpp
  5. 2
      disp_plus.h
  6. 2
      third-party/TeensyVariablePlayback/src/playresmp.h

@ -1986,8 +1986,6 @@ void check_configuration_epiano(void) {
configuration.epiano.midi_channel = constrain(configuration.epiano.midi_channel, EP_MIDI_CHANNEL_MIN, EP_MIDI_CHANNEL_MAX); configuration.epiano.midi_channel = constrain(configuration.epiano.midi_channel, EP_MIDI_CHANNEL_MIN, EP_MIDI_CHANNEL_MAX);
} }
void check_configuration_drums(void) { void check_configuration_drums(void) {
configuration.drums.main_vol = constrain(configuration.drums.main_vol, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX); configuration.drums.main_vol = constrain(configuration.drums.main_vol, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX);
configuration.drums.midi_channel = constrain(configuration.drums.midi_channel, DRUMS_MIDI_CHANNEL_MIN, DRUMS_MIDI_CHANNEL_MAX); configuration.drums.midi_channel = constrain(configuration.drums.midi_channel, DRUMS_MIDI_CHANNEL_MIN, DRUMS_MIDI_CHANNEL_MAX);
@ -2108,6 +2106,9 @@ void init_configuration(void) {
#endif #endif
#endif #endif
strlcpy(configuration.performance.name, "INIT Perf", sizeof(configuration.performance.name));
strlcpy(configuration.performance.name_temp, "INIT Perf", sizeof(configuration.performance.name_temp));
eeprom_update(); eeprom_update();
} }

@ -4056,7 +4056,7 @@ void _check_display_name_min_max(uint8_t input_mode, uint8_t input_type, uint8_t
#endif #endif
void UI_func_drum_midi_channel(uint8_t param) { void UI_func_drum_midi_channel(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4109,7 +4109,7 @@ void UI_func_drum_midi_channel(uint8_t param) {
} }
void UI_func_drums_main_volume(uint8_t param) { void UI_func_drums_main_volume(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4148,7 +4148,7 @@ void UI_func_drums_main_volume(uint8_t param) {
} }
void UI_func_drum_pitch(uint8_t param) { void UI_func_drum_pitch(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4225,7 +4225,7 @@ void UI_func_drum_pitch(uint8_t param) {
} }
void UI_func_drum_vol_min_max(uint8_t param) { void UI_func_drum_vol_min_max(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4334,7 +4334,7 @@ void UI_func_drum_vol_min_max(uint8_t param) {
} }
void UI_func_drum_pan(uint8_t param) { void UI_func_drum_pan(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4412,7 +4412,7 @@ void UI_func_drum_pan(uint8_t param) {
} }
void UI_func_drum_reverb_send(uint8_t param) { void UI_func_drum_reverb_send(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4490,7 +4490,7 @@ void UI_func_drum_reverb_send(uint8_t param) {
} }
void UI_func_drum_midi_note(uint8_t param) { void UI_func_drum_midi_note(uint8_t param) {
#if NUM_DRUMS > 0 #if NUM_DRUMS == 0
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
@ -4605,9 +4605,11 @@ void UI_func_save_performance(uint8_t param) {
if (configuration.performance.name_temp[0] != 0) if (configuration.performance.name_temp[0] != 0)
display.show(1, 5, 11, configuration.performance.name_temp); display.show(1, 5, 11, configuration.performance.name_temp);
else else
display.print(" -- DATA --"); display.print("-- DATA -- ");
} } else
display.print("-- EMPTY --");
} }
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())) {
@ -4629,8 +4631,7 @@ void UI_func_save_performance(uint8_t param) {
} else { } else {
mode = 0xff; mode = 0xff;
if (overwrite == false || yesno == true) { if (overwrite == false || yesno == true) {
display.show(1, 0, 16, "Done."); display.show(1, 0, 16, "Writing...");
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
} else if (overwrite == true && yesno == false) { } else if (overwrite == true && yesno == false) {
char tmp[10]; char tmp[10];
@ -4661,9 +4662,8 @@ void UI_func_save_performance(uint8_t param) {
get_sd_performance_name_json(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); display.show(1, 5, 11, configuration.performance.name_temp);
else else display.print("-- DATA -- ");
display.print("-- DATA --"); } else display.print("-- EMPTY --");
} else display.print(" ");
} else if (mode < 0xff) { } else if (mode < 0xff) {
display.setCursor(12, 1); display.setCursor(12, 1);
if (yesno == true) { if (yesno == true) {
@ -4672,7 +4672,7 @@ void UI_func_save_performance(uint8_t param) {
display.print(F("NO ")); display.print(F("NO "));
} }
} }
encoderDir[ENC_R].reset(); //encoderDir[ENC_R].reset();
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -4689,18 +4689,28 @@ void UI_func_save_performance(uint8_t param) {
void UI_func_load_performance(uint8_t param) { void UI_func_load_performance(uint8_t param) {
static uint8_t mode; static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
char tmp[10]; char tmp[CONFIG_FILENAME_LEN];
temp_int = 0; temp_int = 0;
mode = 0; mode = 0;
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
display.setCursor(0, 0); display.setCursor(0, 0);
display.print(F("Load Performance ")); display.print(F("Load Performance "));
display.setCursor(0, 1); display.setCursor(0, 1);
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), param); snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int);
display.print(tmp); display.print(tmp);
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
display.print(" -- DATA -- ");
} else display.print(" -- EMPTY --");
} }
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())) {
@ -4712,27 +4722,29 @@ void UI_func_load_performance(uint8_t param) {
mode = 0xff; mode = 0xff;
display.setCursor(0, 1); display.setCursor(0, 1);
if (load_sd_performance_json(temp_int) == false) if (load_sd_performance_json(temp_int) == false)
display.print("Does not exist."); display.print("Does not exist. ");
else { else {
display.print("Loading... ");
load_sd_performance_json(temp_int); load_sd_performance_json(temp_int);
display.print("Done. ");
} }
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu(); LCDML.FUNC_goBackToMenu();
} }
display.setCursor(0, 1);
char tmp[10];
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int);
display.print(tmp);
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
display.print(" -- DATA -- ");
} else display.print(" -- EMPTY --");
} }
display.setCursor(0, 1);
char tmp[10];
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int);
display.print(tmp);
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
display.print(" -- DATA --");
} else display.print(" ");
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
if (mode < 0xff) { if (mode < 0xff) {
@ -4740,7 +4752,6 @@ void UI_func_load_performance(uint8_t param) {
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
} else { } else {
configuration.sys.performance_number = temp_int; configuration.sys.performance_number = temp_int;
save_sd_sys_json();
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
} }
} }

@ -319,6 +319,7 @@
#define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN #define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN
#define CONFIG_FILENAME_LEN 50 #define CONFIG_FILENAME_LEN 50
#define DRUM_NAME_LEN 9 #define DRUM_NAME_LEN 9
#define PERFORMANCE_NAME_LEN 12
#define FAV_CONFIG_PATH "FAVCFG" #define FAV_CONFIG_PATH "FAVCFG"
#define FAV_CONFIG_NAME "FAVCFG" #define FAV_CONFIG_NAME "FAVCFG"
@ -907,8 +908,8 @@ typedef struct sys_s {
} sys_t; } sys_t;
typedef struct performance_s { typedef struct performance_s {
char name[FILENAME_LEN]; char name[PERFORMANCE_NAME_LEN];
char name_temp[FILENAME_LEN]; char name_temp[PERFORMANCE_NAME_LEN];
} performance_t; } performance_t;
typedef struct drums_s { typedef struct drums_s {

@ -1258,9 +1258,9 @@ void get_sd_performance_name_json(uint8_t number) {
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Get performance name for ")); Serial.print(F("Get performance name for "));
Serial.print(number); Serial.print(number);
Serial.print(F(": ")); Serial.print(F(": ["));
Serial.print(configuration.performance.name_temp); Serial.print(configuration.performance.name_temp);
Serial.println(); Serial.println("]");
#endif #endif
} }
} }

@ -66,7 +66,7 @@ private:
s += field_size - l; s += field_size - l;
strncpy(s, str, l); strncpy(s, str, l);
s[l] = '\0'; //s[l] = '\0';
//setCursor(pos_x * getMaxCharWidth(), pos_y * getMaxCharHeight()); //setCursor(pos_x * getMaxCharWidth(), pos_y * getMaxCharHeight());
this->setCursor(pos_x, pos_y); this->setCursor(pos_x, pos_y);

@ -91,7 +91,7 @@ class AudioPlayResmp : public AudioStream
if (_numChannels == -1) if (_numChannels == -1)
return; return;
unsigned int i, n; unsigned int n;
audio_block_t *blocks[_numChannels]; audio_block_t *blocks[_numChannels];
int16_t *data[_numChannels]; int16_t *data[_numChannels];
// only update if we're playing // only update if we're playing

Loading…
Cancel
Save