mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-25 18:00:37 -04:00
The old "native" compiler bridged version is now started with cmd/sointu-nativetrack, while the new pure-Go bytecode implemented bytecode interpreter is started with cmd/sointu-track Thus, you do not need any of the CMake / cgo stuff to run cmd/sointu-track
26 lines
564 B
Go
26 lines
564 B
Go
package compiler
|
|
|
|
import (
|
|
"github.com/vsariola/sointu"
|
|
)
|
|
|
|
type SongMacros struct {
|
|
Song *sointu.Song
|
|
VoiceTrackBitmask int
|
|
MaxSamples int
|
|
}
|
|
|
|
func NewSongMacros(s *sointu.Song) *SongMacros {
|
|
maxSamples := s.SamplesPerRow() * s.Score.LengthInRows()
|
|
p := SongMacros{Song: s, MaxSamples: maxSamples}
|
|
trackVoiceNumber := 0
|
|
for _, t := range s.Score.Tracks {
|
|
for b := 0; b < t.NumVoices-1; b++ {
|
|
p.VoiceTrackBitmask += 1 << trackVoiceNumber
|
|
trackVoiceNumber++
|
|
}
|
|
trackVoiceNumber++ // set all bits except last one
|
|
}
|
|
return &p
|
|
}
|