fix(vm): skip empty units when detecting what units are used

This commit is contained in:
vsariola 2021-03-24 00:17:10 +02:00
parent dfc864d131
commit c5972bc023

View File

@ -127,6 +127,9 @@ func NecessaryFeaturesFor(patch sointu.Patch) NecessaryFeatures {
features := NecessaryFeatures{opcodes: map[string]int{}, supportsParamValue: map[paramKey](map[int]bool){}, supportsModulation: map[paramKey]bool{}}
for instrIndex, instrument := range patch {
for _, unit := range instrument.Units {
if unit.Type == "" {
continue
}
if _, ok := features.opcodes[unit.Type]; !ok {
features.instructions = append(features.instructions, unit.Type)
features.opcodes[unit.Type] = len(features.instructions) * 2 // note that the first opcode gets value 1, as 0 is always reserved for advance