-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwave.go
More file actions
26 lines (20 loc) · 729 Bytes
/
wave.go
File metadata and controls
26 lines (20 loc) · 729 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
package liblsdj
import (
"fmt"
)
const (
waveCount = 0xFF + 1 //! The amount of waves in a song
wavePerSynthCount = 0xF //! The amount of waves per synth
waveByteCount = 16 //! The number of bytes a wave takes /*! Do note that each step is represented by 4 bits, so the step count is twice this */
)
type Wave [waveByteCount]byte
func setWaves(waves []byte) ([]Wave, error) {
if len(waves) != waveCount*waveByteCount {
return nil, fmt.Errorf("unexpected Phrase length: %v, %v", len(waves), waveCount*waveByteCount)
}
wv := make([]Wave, waveCount)
for i := 0; i < waveCount*waveByteCount/waveByteCount; i++ {
copy(wv[i][:], waves[waveByteCount*i:waveByteCount*(i+1)])
}
return wv, nil
}