Godtone (talk | contribs)
Godtone (talk | contribs)
Isomorphic keyboard code for launchpads with programmer mode: fix equivalent notes bug on large=True EDO layouts
Line 1,807: Line 1,807:
if note_state[tuning_note]: # if one or more equivalent keys are already held
if note_state[tuning_note]: # if one or more equivalent keys are already held
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=0)
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=0)
if not is_half_button or distinct_half_buttons:
if not is_half_button or distinct_half_buttons or large: # or large was added to fix note not turning off for half-buttons
print(to_send)
print(to_send)
mo.send(to_send) # turn off equivalent midi note before repressing
mo.send(to_send) # turn off equivalent midi note before repressing
Line 1,815: Line 1,815:
col.send(mido.Message('note_on', channel=0, note=k, velocity=0))
col.send(mido.Message('note_on', channel=0, note=k, velocity=0))
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=note_vel)
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=note_vel)
if not is_half_button or note_state[tuning_note]==0 or distinct_half_buttons:
if not is_half_button or note_state[tuning_note]==0 or distinct_half_buttons or large: # or large was added to fix note not turning off for half-buttons
print(to_send)
print(to_send)
mo.send(to_send) # turn on equivalent midi note
mo.send(to_send) # turn on equivalent midi note
Line 1,821: Line 1,821:
elif note_state[tuning_note]: # if we're releasing a key and there are equivalent keys held
elif note_state[tuning_note]: # if we're releasing a key and there are equivalent keys held
note_state[tuning_note] -= 1
note_state[tuning_note] -= 1
if note_state[tuning_note]==0: # if we turn off all keys as a result... turn off
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=0)
to_send = mido.Message('note_on', channel=0, note=midi_note, velocity=0)
if note_state[tuning_note]==0 or large:
mo.send(to_send) # turn off equivalent midi note
if note_state[tuning_note]==0: # if we turn off all equivalent keys as a result... turn off (relight) them
print('col='+str(colmap[ (tuning_note - last_tuning_note) % len(colmap) ]),to_send)
print('col='+str(colmap[ (tuning_note - last_tuning_note) % len(colmap) ]),to_send)
mo.send(to_send) # turn off equivalent midi note
for k in key_codes:
for k in key_codes:
if transform(k)==tuning_note: # if equivalent... set key to unpressed col
if transform(k)==tuning_note: # if equivalent... set key to unpressed col