Fixing drum filename handling.

Adding drums and sequencer to T_3.6 menus.
pull/61/head
Holger Wirtz 3 years ago
parent 853895222e
commit ee10414a03
  1. 9
      MicroDexed.ino
  2. 28
      UI.hpp
  3. 32
      UI_FX.h
  4. 4
      UI_FX_T4.h
  5. 4
      UI_NO_FX.h
  6. 1
      config.h
  7. 13
      drums.cpp

@ -521,7 +521,7 @@ void setup()
}
else
{
strcpy(drumset_name,"StdDrums");
strcpy(drumset_name, "StdDrums");
num_drums = read_drum_config(drumset_name);
check_and_create_directories();
@ -776,7 +776,12 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
drum_mixer_l.gain(slot, fsin * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_reverb_send_mixer_r.gain(slot, (1.0 - fsin) * pseudo_log_curve(drum_config[d].reverb_send));
drum_reverb_send_mixer_l.gain(slot, fsin * pseudo_log_curve(drum_config[d].reverb_send));
Drum[slot]->play(drum_config[d].filename);
char f[DRUM_CFG_GILENAME_LEN];
strcpy(f, drum_config[d].filename);
strcat(f, ".wav");
Drum[slot]->play(f);
#ifdef DEBUG
Serial.print(F("Drum "));

@ -314,6 +314,8 @@ void UI_func_drum_main_volume(uint8_t param);
void UI_func_drum_volume(uint8_t param);
void UI_func_drum_pan(uint8_t param);
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)
@ -3613,8 +3615,7 @@ void UI_func_drum_reverb_send(uint8_t param)
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.setCursor(4, 1);
strncpy(displayname, drum_config[activesample].filename + 6 + strlen(drumset_name), 7);
lcd.print(displayname);
lcd.print(basename(drum_config[activesample].filename));
sprintf(displayname, "%03d", (int)(drum_config[activesample].reverb_send * 100) );
lcd.setCursor(12, 1);
lcd.print(displayname);
@ -3641,7 +3642,7 @@ void UI_func_drum_reverb_send(uint8_t param)
void UI_func_drum_main_volume(uint8_t param)
{
;
;
}
void UI_func_drum_volume(uint8_t param)
@ -3702,8 +3703,7 @@ void UI_func_drum_volume(uint8_t param)
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.setCursor(4, 1);
strncpy(displayname, drum_config[activesample].filename + 6+ strlen(drumset_name), 7);
lcd.print(displayname);
lcd.print(basename(drum_config[activesample].filename));
sprintf(displayname, "%03d", (int)(drum_config[activesample].vol_max * 100) );
lcd.setCursor(12, 1);
lcd.print(displayname);
@ -3791,8 +3791,7 @@ void UI_func_drum_pan(uint8_t param)
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.setCursor(4, 1);
strncpy(displayname, drum_config[activesample].filename + 6 + strlen(drumset_name), 7);
lcd.print(displayname);
lcd.print(basename(drum_config[activesample].filename));
sprintf(displayname, "%+f", drum_config[activesample].pan);
lcd.setCursor(12, 1);
lcd.print(displayname);
@ -3935,17 +3934,13 @@ void UI_func_seq_lenght(uint8_t param)
void UI_func_sequencer(uint8_t param)
{
char displayname[8]={0,0,0,0,0,0,0,0};
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
seq_note_in = 0;
// setup function
lcd.setCursor(1, 0);
strncpy(displayname, drum_config[activesample].filename + 6 + strlen(drumset_name), 6);
lcd.print(displayname);
lcd.print(basename(drum_config[activesample].filename));
lcd.setCursor(9, 0);
if (seq_running == false && seq_recording == false)
{
@ -4067,8 +4062,7 @@ void UI_func_sequencer(uint8_t param)
if (activesample < num_drums) {
lcd.setCursor(1, 0);
strncpy(displayname, drum_config[activesample].filename + 6 + strlen(drumset_name), 6);
lcd.print(displayname);
lcd.print(basename(drum_config[activesample].filename));
} else if (activesample == num_drums) {
lcd.setCursor(1, 0);
lcd.print("EMPTY ");
@ -7293,5 +7287,11 @@ 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;
}
#endif
#endif

@ -109,14 +109,26 @@ LCDML_add(75, LCDML_0_3, 5, "MIDI", NULL);
LCDML_add(76, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(77, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank);
LCDML_add(78, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice);
LCDML_add(79, LCDML_0, 4, "Sequencer", UI_func_sequencer);
LCDML_add(80, LCDML_0, 5, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(81, LCDML_0, 6, "System", NULL);
LCDML_add(82, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(83, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(84, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(85, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(86, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(87, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 87
LCDML_add(79, LCDML_0, 4, "Drums", NULL);
LCDML_add(80, LCDML_0_4, 1, "Drums Main Vol", UI_func_drum_main_volume);
LCDML_add(81, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(82, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(83, LCDML_0_4, 4, "Drum Rev.Send", UI_func_drum_reverb_send);
LCDML_add(84, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(85, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(86, LCDML_0_5, 2, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(87, LCDML_0_5, 3, "Seq. Length", UI_func_seq_lenght);
LCDML_add(88, LCDML_0_5, 4, "Tempo", NULL);
LCDML_add(89, LCDML_0_5, 5, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(90, LCDML_0_5, 6, "L.Trp.Offset", NULL);
LCDML_add(91, LCDML_0_5, 7, "Pattern load", NULL);
LCDML_add(92, LCDML_0_5, 8, "Pattern save", NULL);
LCDML_add(93, LCDML_0, 6, "System", NULL);
LCDML_add(94, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(95, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(96, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(97, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(98, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(99, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 99
#endif

@ -112,12 +112,12 @@ LCDML_add(78, LCDML_0_3, 5, "MIDI", NULL);
LCDML_add(79, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(80, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank);
LCDML_add(81, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice);
LCDML_add(82, LCDML_0, 4, "Drum Settings", NULL);
LCDML_add(82, LCDML_0, 4, "Drums", NULL);
LCDML_add(83, LCDML_0_4, 1, "Drums Main Vol", UI_func_drum_main_volume);
LCDML_add(84, LCDML_0_4, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(85, LCDML_0_4, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(86, LCDML_0_4, 4, "Drum Rev.Send", UI_func_drum_reverb_send);
LCDML_add(87, LCDML_0, 5, "Sequencer Set.", NULL);
LCDML_add(87, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(88, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(89, LCDML_0_5, 2, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(90, LCDML_0_5, 3, "Seq. Length", UI_func_seq_lenght);

@ -85,11 +85,11 @@ LCDML_add(51, LCDML_0_2, 4, "MIDI", NULL);
LCDML_add(52, LCDML_0_2_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(53, LCDML_0_2_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank);
LCDML_add(54, LCDML_0_2_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice);
LCDML_add(55, LCDML_0, 3, "Drum Settings", NULL);
LCDML_add(55, LCDML_0, 3, "Drum", NULL);
LCDML_add(56, LCDML_0_3, 1, "Drums Main Vol", UI_func_drum_main_volume);
LCDML_add(57, LCDML_0_3, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(58, LCDML_0_3, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(59, LCDML_0, 4, "Sequencer Set.", NULL);
LCDML_add(59, LCDML_0, 4, "Sequencer", NULL);
LCDML_add(60, LCDML_0_4, 1, "Sequencer", UI_func_sequencer);
LCDML_add(61, LCDML_0_4, 2, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(62, LCDML_0_4, 3, "Seq. Length", NULL);

@ -281,6 +281,7 @@
#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 DRUM_CFG_GILENAME_LEN 42
#define FX_CONFIG_PATH "FXCFG"
#define FX_CONFIG_NAME "FXCFG"

@ -89,12 +89,17 @@ uint8_t read_drum_config(const char* drumset)
sprintf(ds, "/DRM/%s", drumset);
for (JsonPair kv : root)
{
sprintf(drum_config[drum].filename, "%s/%s.wav", ds, kv.key().c_str());
if (!SD.exists(drum_config[drum].filename))
sprintf(drum_config[drum].filename, "%s/%s", ds, kv.key().c_str());
char f[DRUM_CFG_GILENAME_LEN];
strcpy(f, drum_config[drum].filename);
strcat(f, ".wav");
if (!SD.exists(f))
{
#ifdef DEBUG
Serial.print(F("Cannot find WAV file ["));
Serial.print(drum_config[drum].filename);
Serial.print(f);
Serial.println(F("]"));
#endif
continue;
@ -259,7 +264,7 @@ uint8_t read_drum_config(const char* drumset)
Serial.print(F("midinote = "));
Serial.println(drum_config[drum].midinote, DEC);
Serial.print(F("filename = "));
Serial.println(drum_config[drum].filename);
Serial.println(f);
Serial.print(F("shortname = "));
Serial.println(drum_config[drum].shortname);
Serial.print(F("pan = "));

Loading…
Cancel
Save