User Tools

Site Tools


Pattern Play Mode


(fill in here)

Pattern Play Loop

The pattern play loop looks like this:

  1. Read any input from the switches
  2. If the function has changed, stop and exit
  3. If we are in master sync mode, handle tap tempo
  4. Start a new chain if the chain key was just pressed
  5. Finalize chain mode once chain is released
  6. Display Somthing…
    1. If we are in the middle of chain mode, then display the current chain and add patterns/tracks OR
    2. If up/down is pressed handle pitch shift OR
    3. Display the current data
  7. Or Handle Playback
    1. If the pitch shift keys are released, stop blinking the leds
    2. If they changed the pattern/track build a chain one pattern long to the new pattern/track
    3. Display the current (and next if applicable) track
  8. If we are playing and have midi or din sync handle the sync through clock ticks and play the note with do_tempo
  9. if we get a Midi Song Select message, set it to the current pattern/track
  10. if we get a stop message (midi, dyn, r/s) then stop
  11. if we get a go message then start playing
  12. toggle slide if slide button pressed
  13. toggle accent if accent button pressed
  14. toggle rest if rest button pressed
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.
/home/ladyada/public_html/wiki/data/pages/x0x/pattern_play.c.txt · Last modified: 2016/01/28 18:05 (external edit)