From ec54b5d551c956f4c60c275dd3cd094c67b0e48e Mon Sep 17 00:00:00 2001 From: Justin Mammarella Date: Mon, 6 Jan 2020 13:44:44 +1100 Subject: [PATCH] Re-implemnt Bug fix: chaining an entire row then immediately starting clock could cause corrupt sysex We now use delay compensation to anticipate the duration of the MDKit transfer and mute the sequencer for that time. --- Changelog | 11 +++++++++-- avr/cores/megacommand/MCL/MCLActions.cpp | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 198763361..a5e1c3b29 100644 --- a/Changelog +++ b/Changelog @@ -4,11 +4,14 @@ Bug fix release: - Poly mode would not work unless MD was restarted, fixed. + - Poly voice select is now accessible from Chromatic Page by pressing [ + Save + Write|Chain ] + - Chromatic Page: Changes to voice selection. If current track is a poly track, then select voices from the poly - tracks. Otherwise if current is not a poly track use the current track - as the chromatic voice. + tracks. Otherwise if current track is not a poly track use the current track + as a monophonic voice. When MD is set to be controlled by external midi, only the poly voices will be playable. @@ -21,6 +24,10 @@ Bug fix release: - Sequencer notes would occasionally drop out when using page_select page. fixed. + - Chaining an entire row, and then immediately pressing play on the MD + could cause corrupt sysex data to be sent to the MD, causing loud noises + and an abrupt pattern change. fixed. + MCL 2.50 01/12/2019 Complete GUI overhaul: diff --git a/avr/cores/megacommand/MCL/MCLActions.cpp b/avr/cores/megacommand/MCL/MCLActions.cpp index 66eee514f..d8c9091d6 100644 --- a/avr/cores/megacommand/MCL/MCLActions.cpp +++ b/avr/cores/megacommand/MCL/MCLActions.cpp @@ -325,10 +325,11 @@ void MCLActions::send_tracks_to_devices() { KitExtra kit_extra; volatile uint8_t *ptr; - + uint8_t mute_states[16]; for (i = 0; i < NUM_TRACKS; i++) { - + mute_states[i] = mcl_seq.md_tracks[i].mute_state; + mcl_seq.md_tracks[i].mute_state = SEQ_MUTE_ON; if ((note_interface.notes[i] > 1)) { if (first_note == 254) { first_note = i; @@ -380,6 +381,7 @@ void MCLActions::send_tracks_to_devices() { MD.kit.origPosition = MD.currentKit; /*Send the encoded kit to the MD via sysex*/ + uint16_t myclock = slowclock; md_setsysex_recpos(4, MD.kit.origPosition); MD.kit.toSysex(); @@ -399,6 +401,17 @@ void MCLActions::send_tracks_to_devices() { } } #endif + uint16_t md_latency_ms = 10000.0 * ((float)sizeof(MDKit) / (float) MidiUart.speed); + + DEBUG_PRINTLN("latency"); + DEBUG_PRINTLN(md_latency_ms); + + while (clock_diff(myclock,slowclock) < md_latency_ms) { GUI.loop(); }; + + for (uint8_t i = 0; i < NUM_MD_TRACKS; i++) { + mcl_seq.md_tracks[i].mute_state = mute_states[i]; + } + /*All the tracks have been sent so clear the write queue*/ write_original = 0; if ((mcl_cfg.chain_mode == 0) || (mcl_cfg.chain_mode == 2)) {