style(tracker): group code into less number of files

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2023-10-20 01:50:38 +03:00
parent ff8e662857
commit b6ec5d1a04
6 changed files with 144 additions and 155 deletions

View File

@ -59,6 +59,16 @@ type (
modelMessages chan<- interface{}
}
// Describes a note triggered either a track or an instrument
// If Go had union or Either types, this would be it, but in absence
// those, this uses a boolean to define if the instrument is defined or the track
NoteID struct {
IsInstr bool
Instr int
Track int
Note byte
}
ModelPlayingChangedMessage struct {
bool
}
@ -1474,6 +1484,14 @@ func (m *Model) computePatternUseCounts() {
}
}
func NoteIDInstr(instr int, note byte) NoteID {
return NoteID{IsInstr: true, Instr: instr, Note: note}
}
func NoteIDTrack(track int, note byte) NoteID {
return NoteID{IsInstr: false, Track: track, Note: note}
}
func clamp(a, min, max int) int {
if a < min {
return min