mirror of
				https://github.com/vsariola/sointu.git
				synced 2025-11-04 00:45:35 -05:00 
			
		
		
		
	refactor(sointu): add explicit RowsPerPattern to the song
This commit is contained in:
		@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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},
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user