feat(go4k): Implement .asm exporting.

This commit is contained in:
Veikko Sariola
2020-11-10 20:05:03 +02:00
parent 5ceab766cc
commit 377132321f
4 changed files with 342 additions and 5 deletions

View File

@ -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