mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 15:04:36 -04:00
feat: highlight sliders that are controlled by a send, and add tooltip (over value)
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"iter"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -597,3 +598,38 @@ func clamp(a, min, max int) int {
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func (m *Model) CollectSendsTo(param Parameter) iter.Seq[sointu.Unit] {
|
||||
return func(yield func(sointu.Unit) bool) {
|
||||
p, ok := param.(NamedParameter)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
for _, instr := range m.d.Song.Patch {
|
||||
for _, unit := range instr.Units {
|
||||
if unit.Type != "send" {
|
||||
continue
|
||||
}
|
||||
targetId, ok := unit.Parameters["target"]
|
||||
if !ok || targetId != p.Unit().ID {
|
||||
continue
|
||||
}
|
||||
if !yield(unit) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Model) InstrumentForUnit(id int) *sointu.Instrument {
|
||||
for _, instr := range m.d.Song.Patch {
|
||||
for _, unit := range instr.Units {
|
||||
if unit.ID == id {
|
||||
return &instr
|
||||
}
|
||||
}
|
||||
}
|
||||
// ID does not exist
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user