feat(tracker): Add a matrix showing track sequences

This commit is contained in:
vsariola
2021-01-02 17:40:53 +02:00
parent c68d9d3bf5
commit 06c006086b
6 changed files with 94 additions and 6 deletions

View File

@ -23,6 +23,7 @@ type Tracker struct {
DisplayPattern int
ActiveTrack int
CurrentOctave byte
NoteTracking bool
ticked chan struct{}
setPlaying chan bool
@ -59,6 +60,9 @@ func (t *Tracker) TogglePlay() {
t.songPlayMutex.Lock()
defer t.songPlayMutex.Unlock()
t.Playing = !t.Playing
if t.Playing {
t.NoteTracking = true
}
}
func (t *Tracker) sequencerLoop(closer <-chan struct{}) {
@ -85,6 +89,10 @@ func (t *Tracker) sequencerLoop(closer <-chan struct{}) {
if t.PlayPattern >= t.song.SequenceLength() {
t.PlayPattern = 0
}
if t.NoteTracking {
t.DisplayPattern = t.PlayPattern
t.CursorRow = t.PlayRow
}
notes := make([]Note, 0, 32)
for track := range t.song.Tracks {
patternIndex := t.song.Tracks[track].Sequence[t.PlayPattern]