-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroove.go
More file actions
28 lines (22 loc) · 700 Bytes
/
Copy pathgroove.go
File metadata and controls
28 lines (22 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package liblsdj
import (
"fmt"
)
type Groove [grooveLength]byte
type Grooves [grooveCount]Groove
const (
grooveCount = 0x1f // The amount of grooves in a song
grooveLength = 16 // The number of steps in a groove
grooveNoValue = 0 // The value of an empty (unused) step
)
func setGrooves(grooves []byte) ([]Groove, error) {
// Adding +1, have to learn about grooves
if len(grooves) != (grooveCount+1)*grooveLength {
return nil, fmt.Errorf("unexpected Phrase length: %v, %v", len(grooves), (grooveCount+1)*grooveLength)
}
gr := make([]Groove, grooveCount+1)
for i := 0; i < grooveCount+1; i++ {
copy(gr[i][:], grooves[i*grooveLength:grooveLength*(i+1)])
}
return gr, nil
}