Sending voice data via MIDI (DIN and USB) when changing a voice.

pull/32/head
Holger Wirtz 4 years ago
parent ccc37a34c5
commit ff6e5cd6cb
  1. 2
      MicroDexed.ino
  2. 1
      UI.hpp
  3. 8
      dexed.cpp
  4. 1
      dexed.h
  5. 6
      dexed_sd.cpp
  6. 2
      dexed_sd.h
  7. 27
      midi_devices.hpp

@ -1229,8 +1229,6 @@ void handleSystemExclusive(byte * sysex, uint len)
lcd.print(F("Done. "));
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
//if (!get_bank_name(bank_number, bank_name, sizeof(bank_name)))
// strncpy(bank_name, "*ERROR*", 7);
}
else
{

@ -5186,7 +5186,6 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i
{
edit_pos = 0;
edit_mode = false;
//string_trim(edit_string);
return (true);
}

@ -638,6 +638,14 @@ bool Dexed::encodeVoice(uint8_t* encoded_data)
return (true);
}
bool Dexed::getVoiceData(uint8_t* data_copy)
{
for (uint8_t i = 0; i < sizeof(data); i++)
data_copy[i] = data[i];
return (true);
}
bool Dexed::loadVoiceParameters(uint8_t* new_data)
{
char dexed_voice_name[11];

@ -160,6 +160,7 @@ class Dexed
void setOPs(uint8_t ops);
bool decodeVoice(uint8_t* encoded_data);
bool encodeVoice(uint8_t* encoded_data);
bool getVoiceData(uint8_t* data_copy);
bool loadVoiceParameters(uint8_t* data);
bool loadGlobalParameters(uint8_t* data);
bool initGlobalParameters(void);

@ -75,9 +75,15 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
#ifdef DEBUG
show_patch(instance_id);
#endif
configuration.dexed[instance_id].transpose = MicroDexed[instance_id]->data[DEXED_VOICE_OFFSET + DEXED_TRANSPOSE];
sysex.close();
uint8_t data_copy[155];
MicroDexed[instance_id]->getVoiceData(data_copy);
send_sysex_voice(configuration.dexed[instance_id].midi_channel, data_copy);
return (ret);
}
#ifdef DEBUG

@ -34,6 +34,8 @@ extern Dexed* dexed;
extern AudioSourceMicroDexed * MicroDexed[NUM_DEXED];
extern void show_patch(uint8_t instance_id);
extern void send_sysex_voice(uint8_t midi_channel, uint8_t* data);
extern uint8_t bank;
extern uint8_t voice;
extern uint8_t ui_state;

@ -1670,4 +1670,31 @@ void check_midi_devices(void)
midi_usb.read();
#endif
}
void send_sysex_voice(uint8_t midi_channel, uint8_t* data)
{
uint8_t checksum = 0;
uint8_t voice_data[161];
// Send SYSEX data also via MIDI
//voice_data[0] = 0xF0; // SysEx start
voice_data[0] = 0x43; // ID=Yamaha
voice_data[1] = midi_channel; // Sub-status and MIDI channel
voice_data[2] = 0x00; // Format number (0=1 voice)
voice_data[3] = 0x01; // Byte count MSB
voice_data[4] = 0x1B; // Byte count LSB
for (uint8_t n = 0; n < 155; n++)
{
checksum -= data[n];
voice_data[5 + n] = data[n];
}
checksum &= 0x7f;
voice_data[160] = checksum; // Checksum
//voice_data[162] = 0xF7; // SysEx end
midi_serial.sendSysEx(161, voice_data); // Send to DIN MIDI
midi_usb.sendSysEx(161, voice_data); // Send to USB MIDI
usbMIDI.sendSysEx(161, voice_data); // Send to USB-HOST MIDI
}
#endif // MIDI_DEVICES_H

Loading…
Cancel
Save