Skip to content

Commit

Permalink
notify sequencer triggers when a track is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
briansorahan committed Apr 1, 2017
1 parent 325f313 commit f79d020
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ type Trig struct {
}

// Trigger is a thing that can be triggered by a Sequencer.
// Use the Track method to get notified of track selection.
type Trigger interface {
Track(track uint8) error
Trig(step uint8, trigs []Trig) error
}

Expand Down Expand Up @@ -258,6 +260,12 @@ func (seq *Sequencer) selectTrackFrom(hit Hit) error {
if err := seq.lightCurrentTrack(); err != nil {
return err
}
// Invoke all the trigs.
for _, trig := range seq.triggers {
if err := trig.Track(seq.track); err != nil {
return err
}
}
// Light all the steps of the current track.
return seq.lightTrackSteps()
}
Expand Down

0 comments on commit f79d020

Please sign in to comment.