Added sending of banks via sysex.

pull/32/head
Holger Wirtz 5 years ago
parent ff6e5cd6cb
commit 1bbfed551e
  1. 1
      MicroDexed.ino
  2. 73
      UI.hpp
  3. 4
      config.h
  4. 4
      dexed.cpp
  5. 7
      midi_devices.hpp

@ -2,7 +2,6 @@
MicroDexed MicroDexed
MicroDexed is a port of the Dexed sound engine MicroDexed is a port of the Dexed sound engine
(https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6/4.x/4.x with audio shield.
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
(c)2018-2020 H. Wirtz <wirtz@parasitstudio.de> (c)2018-2020 H. Wirtz <wirtz@parasitstudio.de>

@ -4850,14 +4850,21 @@ void UI_func_sysex_receive_bank(uint8_t param)
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(); encoderDir[ENC_R].reset();
bank_number = configuration.performance.bank[selected_instance_id];
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("MIDI Send Bank")); lcd.print(F("MIDI Send Bank"));
lcd.setCursor(0, 1); if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name)))
lcd.print(F("Not implemented.")); strncpy(bank_name, "*ERROR*", sizeof(bank_name));
lcd.show(1, 0, 1, "[");
lcd.show(1, 3, 1, "]");
lcd.show(1, 1, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 5, 10, bank_name);
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
@ -4866,18 +4873,74 @@ void UI_func_sysex_send_bank(uint8_t param)
{ {
if (LCDML.BT_checkDown()) 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*");
lcd.show(1, 1, 2, bank_number);
lcd.show(1, 5, 10, bank_name);
}
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)))
{
sprintf(filename, "/%d/%s.syx", bank_number, bank_name);
#ifdef DEBUG
Serial.print(F("Send bank "));
Serial.print(filename);
Serial.println(F(" from SD."));
#endif
sysex = SD.open(filename);
if (!sysex)
{
#ifdef DEBUG
Serial.println(F("Connot read from SD."));
#endif
lcd.show(1, 0, 16, "Read error.");
bank_number = 0xff;
}
else
{
uint8_t bank_data[4104];
sysex.read(bank_data, 4104);
sysex.close();
lcd.show(1, 0, 16, "Sending...");
send_sysex_bank(configuration.dexed[selected_instance_id].midi_channel, bank_data);
lcd.show(1, 0, 16, "Done.");
bank_number = 0xff;
}
}
else
{
lcd.show(1, 0, 16, "No bank.");
bank_number = 0xff;
}
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
} }
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
if (bank_number != 0xff)
{
lcd.setCursor(0, 1);
lcd.print(F("Canceled. "));
delay(MESSAGE_WAIT_TIME);
}
} }
} }

@ -54,9 +54,9 @@
// For SYSEX Bank upload via USB: // For SYSEX Bank upload via USB:
// sed -i.orig 's/SYSEX_MAX_LEN = 290/SYSEX_MAX_LEN = 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/libraries/USBHost_t36/USBHost_t36.h // sed -i.orig 's/SYSEX_MAX_LEN = 290/SYSEX_MAX_LEN = 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/libraries/USBHost_t36/USBHost_t36.h
// sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/cores/teensy3/usb_midi.h // sed -i.orig 's/^#define USB_MIDI_SYSEX_MAX 290/#define USB_MIDI_SYSEX_MAX 4104/' /usr/local/arduino-teensy-1.8.12/hardware/teensy/avr/cores/teensy3/usb_midi.h
#define USB_MIDI_SYSEX_MAX 4104 //#define USB_MIDI_SYSEX_MAX 4104
#define VERSION "0.9.9k" #define VERSION "0.9.9l"
//************************************************************************************************* //*************************************************************************************************
//* DEVICE SETTINGS //* DEVICE SETTINGS

@ -640,9 +640,7 @@ bool Dexed::encodeVoice(uint8_t* encoded_data)
bool Dexed::getVoiceData(uint8_t* data_copy) bool Dexed::getVoiceData(uint8_t* data_copy)
{ {
for (uint8_t i = 0; i < sizeof(data); i++) memcpy(data_copy, data, sizeof(data));
data_copy[i] = data[i];
return (true); return (true);
} }

@ -1697,4 +1697,11 @@ void send_sysex_voice(uint8_t midi_channel, uint8_t* data)
usbMIDI.sendSysEx(161, voice_data); // Send to USB-HOST MIDI usbMIDI.sendSysEx(161, voice_data); // Send to USB-HOST MIDI
} }
void send_sysex_bank(uint8_t midi_channel, uint8_t* bank_data)
{
midi_serial.sendSysEx(4104, bank_data); // Send to DIN MIDI
midi_usb.sendSysEx(4104, bank_data); // Send to USB MIDI
usbMIDI.sendSysEx(4104, bank_data); // Send to USB-HOST MIDI
}
#endif // MIDI_DEVICES_H #endif // MIDI_DEVICES_H

Loading…
Cancel
Save