mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
Configurable to create empty patterns for the live coding environment
This commit is contained in:
parent
eb846ba42d
commit
77356f8e49
9
song.go
9
song.go
@ -11,10 +11,11 @@ import (
|
||||
// playback speed, but this could be changed to a floating point in future if
|
||||
// finer adjustments are necessary.
|
||||
type Song struct {
|
||||
BPM int
|
||||
RowsPerBeat int
|
||||
Score Score
|
||||
Patch Patch
|
||||
BPM int
|
||||
RowsPerBeat int
|
||||
Score Score
|
||||
Patch Patch
|
||||
CreateEmptyPatterns bool
|
||||
}
|
||||
|
||||
// Copy makes a deep copy of a Score.
|
||||
|
@ -162,7 +162,18 @@ func ConstructPatterns(song *sointu.Song) ([][]byte, [][]byte, error) {
|
||||
return nil, nil, errors.New("the constructed pattern table would result in > 256 unique patterns; only 256 unique patterns are supported")
|
||||
}
|
||||
}
|
||||
bytePatterns := make([][]byte, len(patterns))
|
||||
|
||||
// Determine the length of bytePatterns
|
||||
bytePatternsLength := len(patterns)
|
||||
if song.CreateEmptyPatterns {
|
||||
bytePatternsLength = 256
|
||||
}
|
||||
|
||||
bytePatterns := make([][]byte, bytePatternsLength) // Initialize bytePatterns with the specified length
|
||||
for i := 0; i < bytePatternsLength; i++ {
|
||||
bytePatterns[i] = make([]byte, song.Score.RowsPerPattern) // Initialize each element with an array of zeros with length RowsPerPattern
|
||||
}
|
||||
|
||||
for i, pat := range patterns {
|
||||
var err error
|
||||
replaceInts(pat, -1, 0) // replace don't cares with releases
|
||||
|
Loading…
Reference in New Issue
Block a user