mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 23:14:59 -04:00
feat(go4k): Implement .asm exporting.
This commit is contained in:
20
go4k/go4k.go
20
go4k/go4k.go
@ -38,6 +38,20 @@ func (p Patch) TotalVoices() int {
|
||||
return ret
|
||||
}
|
||||
|
||||
func (patch Patch) InstrumentForVoice(voice int) (int, error) {
|
||||
if voice < 0 {
|
||||
return 0, errors.New("voice cannot be negative")
|
||||
}
|
||||
for i, instr := range patch {
|
||||
if voice < instr.NumVoices {
|
||||
return i, nil
|
||||
} else {
|
||||
voice -= instr.NumVoices
|
||||
}
|
||||
}
|
||||
return 0, errors.New("voice number is beyond the total voices of an instrument")
|
||||
}
|
||||
|
||||
type Track struct {
|
||||
NumVoices int
|
||||
Sequence []byte
|
||||
@ -57,6 +71,12 @@ func Render(synth Synth, buffer []float32) error {
|
||||
return err
|
||||
}
|
||||
|
||||
type SampleOffset struct {
|
||||
Start int
|
||||
LoopStart int
|
||||
LoopLength int
|
||||
}
|
||||
|
||||
// UnitParameter documents one parameter that an unit takes
|
||||
type UnitParameter struct {
|
||||
Name string // thould be found with this name in the Unit.Parameters map
|
||||
|
Reference in New Issue
Block a user