Bugfix: Suppress the automatic release sequence for MIDI output if there's an explicit release sequence.

master
Albert Graef 2018-09-23 12:27:23 +02:00
parent df6083ea7a
commit 0d265f5ebc
2 changed files with 46 additions and 33 deletions

View File

@ -42,15 +42,6 @@ F8 SHIFT ^F8 RELEASE SHIFT ^F8
^A#4 C5
^B4 C#5
# Pass through the shifted cursor keys. This assumes that they're already
# mapped to something in the DAW; e.g., I have the shifted left/right keys
# bound to the previous/next marker functions in Ardour.
^C8 A#5 C8 # Up
^C#8 A#5 C#8 # Down
^D8 A#5 D8 # Left
^D#8 A#5 D#8 # Right
# Since the X-Touch ONE is a single-channel controller, I find it convenient
# to have the bank and channel switches linked up with the channel SELECT
# switch, so that the first channel in the current bank is also selected in
@ -62,22 +53,37 @@ F8 SHIFT ^F8 RELEASE SHIFT ^F8
^C4 C4 C2 # CHAN< SELECT
^C#4 C#4 C2 # CHAN> SELECT
# Other shifted keys in the CHANNEL and TRANSPORT sections are simply passed
# through along with the SHIFT key. You can either assign these combinations
# in the DAW, or edit them below as needed.
# Pass through the shifted cursor keys. This assumes that they're already
# mapped to something in the DAW; e.g., I have the shifted left/right keys
# bound to the previous/next marker functions in Ardour.
^C0 A#5 C0 # SHIFT REC
^G#0 A#5 G#0 # SHIFT SOLO
^E1 A#5 E1 # SHIFT MUTE
^C2 A#5 C2 # SHIFT SELECT
# NOTE: We use an explicit RELEASE sequence here, so that the SHIFT key (A#5)
# is released last. By default, midizap will release MIDI key events in the
# same order in which they are pressed, which may not work in some key
# combinations, since the SHIFT key gets released too early. (At least I found
# that this confuses Ardour in some cases, YMMV.)
^C7 A#5 C7 # SHIFT MARKER
^C#7 A#5 C#7 # SHIFT NUDGE
^D7 A#5 D7 # SHIFT CYCLE
^D#7 A#5 D#7 # SHIFT DROP
^E7 A#5 E7 # SHIFT REPLACE
^F7 A#5 F7 # SHIFT CLICK
^F#7 A#5 F#7 # SHIFT SOLO
^C8 A#5 C8 RELEASE C8 A#5 # Up
^C#8 A#5 C#8 RELEASE C#8 A#5 # Down
^D8 A#5 D8 RELEASE D8 A#5 # Left
^D#8 A#5 D#8 RELEASE D#8 A#5 # Right
# By default, other shifted keys in the CHANNEL and TRANSPORT sections are
# simply passed through along with the SHIFT key as well. You can either
# assign these combinations in the DAW, or edit them below as needed.
^C0 A#5 C0 RELEASE C0 A#5 # SHIFT REC
^G#0 A#5 G#0 RELEASE G#0 A#5 # SHIFT SOLO
^E1 A#5 E1 RELEASE E1 A#5 # SHIFT MUTE
^C2 A#5 C2 RELEASE C2 A#5 # SHIFT SELECT
^C7 A#5 C7 RELEASE C7 A#5 # SHIFT MARKER
^C#7 A#5 C#7 RELEASE C#7 A#5 # SHIFT NUDGE
^D7 A#5 D7 RELEASE D7 A#5 # SHIFT CYCLE
^D#7 A#5 D#7 RELEASE D#7 A#5 # SHIFT DROP
^E7 A#5 E7 RELEASE E7 A#5 # SHIFT REPLACE
^F7 A#5 F7 RELEASE F7 A#5 # SHIFT CLICK
^F#7 A#5 F#7 RELEASE F#7 A#5 # SHIFT SOLO
[MIDI2]

View File

@ -823,7 +823,8 @@ stroke **first_stroke;
stroke *last_stroke;
stroke **press_first_stroke;
stroke **release_first_stroke;
int is_keystroke, is_bidirectional, is_midi, is_nop, mode;
int is_keystroke, is_bidirectional, is_nop, midi_release, explicit_release;
int mode;
char *current_translation;
char *key_name;
int first_release_stroke; // is this the first stroke of a release?
@ -909,7 +910,7 @@ append_midi(int status, int data, int step, int n_steps, int *steps,
*first_stroke = s;
}
last_stroke = s;
is_midi = 1;
midi_release = 1;
}
// s->press values in modifiers_down:
@ -1427,7 +1428,8 @@ start_translation(translation *tr, char *which_key)
}
current_translation = tr->name;
key_name = which_key;
is_keystroke = is_bidirectional = is_midi = is_nop = anyshift = 0;
is_keystroke = is_bidirectional = is_nop = anyshift = 0;
midi_release = explicit_release = 0;
first_release_stroke = 0;
regular_key_down = 0;
modifier_count = 0;
@ -1665,15 +1667,17 @@ add_release(int all_keys)
if (!all_keys) {
if (!*first_stroke) append_nop();
first_stroke = release_first_stroke;
if (is_midi) {
if (midi_release) {
// walk the list of "press" strokes, find all "dirty" (as yet unhandled)
// MIDI events in there and add them to the "release" strokes
// MIDI events in there and add them to the "release" strokes (unless
// there's an explicit release sequence in which case we output nothing)
stroke *s = *press_first_stroke;
while (s) {
if (!s->keysym && !s->shift && s->dirty) {
append_midi(s->status, s->data,
s->step, s->n_steps, s->steps,
s->swap, s->change, s->incr, s->recursive, s->feedback);
if (!explicit_release)
append_midi(s->status, s->data,
s->step, s->n_steps, s->steps,
s->swap, s->change, s->incr, s->recursive, s->feedback);
s->dirty = 0;
}
s = s->next;
@ -2009,9 +2013,12 @@ read_config_file(void)
case '\t':
case '\n':
case '\0': // no newline at eof
if (!strcmp(tok, "RELEASE"))
if (!strcmp(tok, "RELEASE")) {
// Suppress the default MIDI release sequence if there's an
// explicit release sequence.
explicit_release = 1;
add_keystroke(tok, PRESS_RELEASE);
else if (!strncmp(tok, "SHIFT", 5)) {
} else if (!strncmp(tok, "SHIFT", 5)) {
int shift = isdigit(tok[5])?tok[5]-'0':1;
if ((tok[5] == 0 || (isdigit(tok[5]) && tok[6] == 0)) &&
shift >= 1 && shift <= N_SHIFTS)