mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(sointu, tracker,...): restructure domain & tracker models
send targets are now by ID and Song has "Score" part, which is the notes for it. also, moved the model part separate of the actual gioui dependend stuff. sorry to my future self about the code bomb; ended up too far and did not find an easy way to rewrite the history to make the steps smaller, so in the end, just squashed everything.
This commit is contained in:
35
score.go
Normal file
35
score.go
Normal file
@ -0,0 +1,35 @@
|
||||
package sointu
|
||||
|
||||
type Score struct {
|
||||
Tracks []Track
|
||||
RowsPerPattern int
|
||||
Length int // length of the song, in number of patterns
|
||||
}
|
||||
|
||||
func (l Score) Copy() Score {
|
||||
tracks := make([]Track, len(l.Tracks))
|
||||
for i, t := range l.Tracks {
|
||||
tracks[i] = t.Copy()
|
||||
}
|
||||
return Score{Tracks: tracks, RowsPerPattern: l.RowsPerPattern, Length: l.Length}
|
||||
}
|
||||
|
||||
func (l Score) NumVoices() int {
|
||||
ret := 0
|
||||
for _, t := range l.Tracks {
|
||||
ret += t.NumVoices
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (l Score) FirstVoiceForTrack(track int) int {
|
||||
ret := 0
|
||||
for _, t := range l.Tracks[:track] {
|
||||
ret += t.NumVoices
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (l Score) LengthInRows() int {
|
||||
return l.RowsPerPattern * l.Length
|
||||
}
|
Reference in New Issue
Block a user