refactor(sointu): add explicit RowsPerPattern to the song

This commit is contained in:
vsariola
2021-01-21 13:16:41 +02:00
parent 08dcbb9edb
commit 61437db0d6
98 changed files with 117 additions and 28 deletions

View File

@ -167,7 +167,7 @@ func bytesToInts(array []byte) []int {
}
func ConstructPatterns(song *sointu.Song) ([][]byte, [][]byte, error) {
patLength := song.PatternRows()
patLength := song.RowsPerPattern
sequences := make([][]byte, len(song.Tracks))
var patterns [][]int
for i, t := range song.Tracks {

View File

@ -10,6 +10,7 @@ import (
func TestPatternReusing(t *testing.T) {
song := sointu.Song{
RowsPerPattern: 8,
Tracks: []sointu.Track{{
Patterns: [][]byte{{64, 1, 1, 1, 0, 0, 0, 0}, {72, 0, 0, 0, 0, 0, 0, 0}},
Sequence: []byte{0, 1},
@ -34,6 +35,7 @@ func TestPatternReusing(t *testing.T) {
func TestUnnecessaryHolds(t *testing.T) {
song := sointu.Song{
RowsPerPattern: 8,
Tracks: []sointu.Track{{
Patterns: [][]byte{{64, 1, 1, 1, 0, 1, 0, 0}, {72, 0, 1, 0, 1, 0, 0, 0}},
Sequence: []byte{0, 1},
@ -58,6 +60,7 @@ func TestUnnecessaryHolds(t *testing.T) {
func TestDontCares(t *testing.T) {
song := sointu.Song{
RowsPerPattern: 8,
Tracks: []sointu.Track{{
Patterns: [][]byte{{64, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}},
Sequence: []byte{0, 1},