Created
August 23, 2017 17:08
-
-
Save JoshuaGrams/5ae4c740ccf07dc4cba6d9ebe9700b2f to your computer and use it in GitHub Desktop.
First-up chord algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chord prev_keys = NONE, can_trigger = ALL; | |
void process_sample(Chord keys) { | |
Chord released = prev_keys & ~keys; | |
if(released & can_trigger) { | |
send_chord(prev_keys); | |
// These keys do not fire a chord the next time they are released. | |
can_trigger = ~keys; | |
} | |
prev_keys = keys; | |
// Keys which have been released can now fire a chord again. | |
can_trigger |= ~keys; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment