feat(Song): Support HOLD definition, allowing using other values than 1 as the hold.

This commit is contained in:
Veikko Sariola
2020-12-07 09:01:53 +02:00
parent 975a171d8c
commit 1a633778bc
95 changed files with 174 additions and 180 deletions

View File

@ -11,6 +11,7 @@ type Song struct {
Tracks []Track
Patch Patch
Output16Bit bool
Hold byte
}
func (s *Song) PatternRows() int {
@ -86,11 +87,11 @@ func Play(synth Synth, song Song) ([]float32, error) {
for t := range song.Tracks {
patternIndex := song.Tracks[t].Sequence[pattern]
note := song.Patterns[patternIndex][patternRow]
if note == 1 { // anything but hold causes an action.
continue // TODO: can hold be actually something else than 1?
if note > 0 && note <= song.Hold { // anything but hold causes an action.
continue
}
synth.Release(curVoices[t])
if note > 1 {
if note > song.Hold {
curVoices[t]++
first := song.FirstTrackVoice(t)
if curVoices[t] >= first+song.Tracks[t].NumVoices {