feat: highlight sliders that are controlled by a send, and add tooltip (over value)

This commit is contained in:
qm210
2024-10-27 21:12:05 +01:00
parent 4e81fcc10f
commit 033f3ab57b
5 changed files with 139 additions and 11 deletions

View File

@ -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
}