mirror of
https://github.com/vsariola/sointu.git
synced 2026-03-20 22:00:00 -04:00
refactor: put all info about different unit types into UnitTypes map
This commit is contained in:
parent
8ea9d3a191
commit
6a331f7a57
@ -262,7 +262,7 @@ func (b *bytecodeBuilder) operand(operands ...int) {
|
||||
// defOperands appends the operands to the stream for all parameters that can be
|
||||
// modulated and set
|
||||
func (b *bytecodeBuilder) defOperands(unit sointu.Unit) {
|
||||
for _, v := range sointu.UnitTypes[unit.Type] {
|
||||
for _, v := range sointu.UnitTypes[unit.Type].Params {
|
||||
if v.CanModulate && v.CanSet {
|
||||
b.Operands = append(b.Operands, byte(unit.Parameters[v.Name]))
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ func init() {
|
||||
for k, v := range sointu.UnitTypes {
|
||||
inputCount := 0
|
||||
transformCount := 0
|
||||
for _, t := range v {
|
||||
for _, t := range v.Params {
|
||||
if t.CanModulate {
|
||||
allInputs[paramKey{k, t.Name}] = inputCount
|
||||
inputCount++
|
||||
@ -125,7 +125,7 @@ func NecessaryFeaturesFor(patch sointu.Patch) NecessaryFeatures {
|
||||
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
|
||||
}
|
||||
for _, paramType := range sointu.UnitTypes[unit.Type] {
|
||||
for _, paramType := range sointu.UnitTypes[unit.Type].Params {
|
||||
v := unit.Parameters[paramType.Name]
|
||||
key := paramKey{unit.Type, paramType.Name}
|
||||
if features.supportsParamValue[key] == nil {
|
||||
|
||||
Reference in New Issue
Block a user