mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 23:14:59 -04:00
drafting
This commit is contained in:
parent
4e295a3a2f
commit
3c6c24c6af
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user