mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
fix: changes after review (see PR #176)
This commit is contained in:
18
patch.go
18
patch.go
@ -465,21 +465,19 @@ func (p Patch) FindUnit(id int) (instrIndex int, unitIndex int, err error) {
|
||||
return 0, 0, fmt.Errorf("could not find a unit with id %v", id)
|
||||
}
|
||||
|
||||
func FindParamForModulationPort(unitName string, index int) *UnitParameter {
|
||||
// qm210: couldn't see a function yet that matches the parameter index to the modulateable param.
|
||||
// Not sure whether *UnitParameters is good here, would this make them mutable?
|
||||
func FindParamForModulationPort(unitName string, index int) (UnitParameter, bool) {
|
||||
unitType, ok := UnitTypes[unitName]
|
||||
if !ok {
|
||||
return nil
|
||||
return UnitParameter{}, false
|
||||
}
|
||||
for _, param := range unitType {
|
||||
if !param.CanModulate {
|
||||
continue
|
||||
}
|
||||
if index == 0 {
|
||||
return ¶m
|
||||
}
|
||||
if param.CanModulate {
|
||||
index--
|
||||
return param, true
|
||||
}
|
||||
index--
|
||||
}
|
||||
// index outside range
|
||||
return nil
|
||||
return UnitParameter{}, false
|
||||
}
|
||||
|
Reference in New Issue
Block a user