This shows you the differences between two versions of the page.
x0x:pattern_play.c [2016/01/28 18:05] |
x0x:pattern_play.c [2016/01/28 18:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Pattern Play Mode ===== | ||
+ | |||
+ | ==== Initialization ==== | ||
+ | |||
+ | (fill in here) | ||
+ | |||
+ | ==== Pattern Play Loop ==== | ||
+ | |||
+ | The pattern play loop looks like this: | ||
+ | |||
+ | - Read any input from the switches | ||
+ | - If the function has changed, stop and exit | ||
+ | - If we are in master sync mode, handle tap tempo | ||
+ | - Start a new chain if the chain key was just pressed | ||
+ | - Finalize chain mode once chain is released | ||
+ | - Display Somthing... | ||
+ | - If we are in the middle of chain mode, then display the current chain and add patterns/tracks **OR** | ||
+ | -If up/down is pressed handle pitch shift **OR** | ||
+ | -Display the current data | ||
+ | - Or Handle Playback | ||
+ | - If the pitch shift keys are released, stop blinking the leds | ||
+ | - If they changed the pattern/track build a chain one pattern long to the new pattern/track | ||
+ | - Display the current (and next if applicable) track | ||
+ | - If we are playing and have midi or din sync handle the sync through clock ticks and play the note with [[do_tempo]] | ||
+ | - if we get a Midi Song Select message, set it to the current pattern/track | ||
+ | - if we get a stop message (midi, dyn, r/s) then stop | ||
+ | - if we get a go message then start playing | ||
+ | - toggle slide if slide button pressed | ||
+ | - toggle accent if accent button pressed | ||
+ | - toggle rest if rest button pressed | ||
+ | |||
+ | <note classic> CodeRefactoring: This function seems rather smelly (large method, lots of complex conditionals). From a maintainability and readability standpoint it would be nice to do the "Replace conditional with function" and "Decompose Function" on this monster function to turn it into a bunch of small pieces. </note> | ||
+ | |||