mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-21 14:34:36 -04:00
feat!: display the parameters as knobs in a grid
Also removed the negbandpass & neghighpass parameters and replaced them with bandpass & highpass set to -1, to fit the switches better to the GUI. Closes #51, closes #173
This commit is contained in:
parent
c3caa8de11
commit
666af9433e
@ -36,9 +36,9 @@ type (
|
||||
}
|
||||
|
||||
UnitListItem struct {
|
||||
Type, Comment string
|
||||
Disabled bool
|
||||
StackNeed, StackBefore, StackAfter int
|
||||
Type, Comment string
|
||||
Disabled bool
|
||||
Signals Rail
|
||||
}
|
||||
|
||||
// Range is used to represent a range [Start,End) of integers
|
||||
@ -299,24 +299,21 @@ func (m *Units) SetSelectedType(t string) {
|
||||
m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex].ID = oldUnit.ID // keep the ID of the replaced unit
|
||||
}
|
||||
|
||||
func (v *Units) Iterate(yield UnitYieldFunc) {
|
||||
if v.d.InstrIndex < 0 || v.d.InstrIndex >= len(v.d.Song.Patch) {
|
||||
return
|
||||
func (v *Units) Item(index int) UnitListItem {
|
||||
i := v.d.InstrIndex
|
||||
if i < 0 || i >= len(v.d.Song.Patch) || index < 0 || index >= v.Count() {
|
||||
return UnitListItem{}
|
||||
}
|
||||
stackBefore := 0
|
||||
for i, unit := range v.d.Song.Patch[v.d.InstrIndex].Units {
|
||||
stackAfter := stackBefore + unit.StackChange()
|
||||
if !yield(i, UnitListItem{
|
||||
Type: unit.Type,
|
||||
Comment: unit.Comment,
|
||||
Disabled: unit.Disabled,
|
||||
StackNeed: unit.StackNeed(),
|
||||
StackBefore: stackBefore,
|
||||
StackAfter: stackAfter,
|
||||
}) {
|
||||
break
|
||||
}
|
||||
stackBefore = stackAfter
|
||||
unit := v.d.Song.Patch[v.d.InstrIndex].Units[index]
|
||||
signals := Rail{}
|
||||
if i >= 0 && i < len(v.derived.patch) && index >= 0 && index < len(v.derived.patch[i].rails) {
|
||||
signals = v.derived.patch[i].rails[index]
|
||||
}
|
||||
return UnitListItem{
|
||||
Type: unit.Type,
|
||||
Comment: unit.Comment,
|
||||
Disabled: unit.Disabled,
|
||||
Signals: signals,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user