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
|
// playback speed, but this could be changed to a floating point in future if
|
||||||
// finer adjustments are necessary.
|
// finer adjustments are necessary.
|
||||||
type Song struct {
|
type Song struct {
|
||||||
BPM int
|
BPM int
|
||||||
RowsPerBeat int
|
RowsPerBeat int
|
||||||
Score Score
|
Score Score
|
||||||
Patch Patch
|
Patch Patch
|
||||||
|
CreateEmptyPatterns bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy makes a deep copy of a Score.
|
// 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")
|
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 {
|
for i, pat := range patterns {
|
||||||
var err error
|
var err error
|
||||||
replaceInts(pat, -1, 0) // replace don't cares with releases
|
replaceInts(pat, -1, 0) // replace don't cares with releases
|
||||||
|
Loading…
Reference in New Issue
Block a user