mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-03 09:08:18 -04:00
fix(vm): skip empty units when detecting what units are used
This commit is contained in:
parent
dfc864d131
commit
c5972bc023
@ -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{}}
|
features := NecessaryFeatures{opcodes: map[string]int{}, supportsParamValue: map[paramKey](map[int]bool){}, supportsModulation: map[paramKey]bool{}}
|
||||||
for instrIndex, instrument := range patch {
|
for instrIndex, instrument := range patch {
|
||||||
for _, unit := range instrument.Units {
|
for _, unit := range instrument.Units {
|
||||||
|
if unit.Type == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, ok := features.opcodes[unit.Type]; !ok {
|
if _, ok := features.opcodes[unit.Type]; !ok {
|
||||||
features.instructions = append(features.instructions, unit.Type)
|
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
|
features.opcodes[unit.Type] = len(features.instructions) * 2 // note that the first opcode gets value 1, as 0 is always reserved for advance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user