This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-07-04 15:05:49 +03:00
parent 4e295a3a2f
commit 3c6c24c6af
9 changed files with 206 additions and 67 deletions

View File

@ -20,6 +20,7 @@ type (
up *sointu.UnitParameter
index int
vtable parameterVtable
port int
}
parameterVtable interface {
@ -70,6 +71,12 @@ func (p *Parameter) Value() int {
}
return p.vtable.Value(p)
}
func (p *Parameter) Port() (int, bool) {
if p.port <= 0 {
return 0, false
}
return p.port - 1, true
}
func (p *Parameter) SetValue(value int) bool {
if p.vtable == nil {
return false
@ -123,6 +130,12 @@ func (p *Parameter) Reset() {
}
p.vtable.Reset(p)
}
func (p *Parameter) UnitID() int {
if p.unit == nil {
return 0
}
return p.unit.ID
}
//
@ -212,6 +225,9 @@ func (n *namedParameter) Range(p *Parameter) IntRange {
return IntRange{Min: p.up.MinValue, Max: p.up.MaxValue}
}
func (n *namedParameter) Type(p *Parameter) ParameterType {
if p.up == nil || !p.up.CanSet {
return NoParameter
}
if p.unit.Type == "send" && p.up.Name == "target" {
return IDParameter
}