feat(tracker): adding, setting, unsetting and deleting units

This commit is contained in:
vsariola
2021-02-04 21:50:41 +02:00
parent 29b289d2fb
commit 6307dd51de
8 changed files with 316 additions and 86 deletions

View File

@ -33,6 +33,9 @@ func Encode(patch *sointu.Patch, featureSet FeatureSet) (*EncodedPatch, error) {
return nil, errors.New("Each instrument must have at least 1 voice")
}
for _, unit := range instr.Units {
if unit.Type == "" { // empty units are just ignored & skipped
continue
}
if unit.Type == "oscillator" && unit.Parameters["type"] == 4 {
s := SampleOffset{Start: uint32(unit.Parameters["start"]), LoopStart: uint16(unit.Parameters["loopstart"]), LoopLength: uint16(unit.Parameters["looplength"])}
index, ok := sampleOffsetMap[s]