mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
feat(tracker): solo and mute can toggle multiple instruments
This commit is contained in:
parent
063b2c29c5
commit
63c08d53fe
@ -213,7 +213,13 @@ func (m *Mute) setValue(val bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer (*Model)(m).change("Mute", PatchChange, MinorChange)()
|
defer (*Model)(m).change("Mute", PatchChange, MinorChange)()
|
||||||
m.d.Song.Patch[m.d.InstrIndex].Mute = val
|
a, b := intMin(m.d.InstrIndex, m.d.InstrIndex2), intMax(m.d.InstrIndex, m.d.InstrIndex2)
|
||||||
|
for i := a; i <= b; i++ {
|
||||||
|
if i < 0 || i >= len(m.d.Song.Patch) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
m.d.Song.Patch[i].Mute = val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (m *Mute) Enabled() bool { return m.d.InstrIndex >= 0 && m.d.InstrIndex < len(m.d.Song.Patch) }
|
func (m *Mute) Enabled() bool { return m.d.InstrIndex >= 0 && m.d.InstrIndex < len(m.d.Song.Patch) }
|
||||||
|
|
||||||
@ -221,30 +227,25 @@ func (m *Mute) Enabled() bool { return m.d.InstrIndex >= 0 && m.d.InstrIndex < l
|
|||||||
|
|
||||||
func (m *Solo) Bool() Bool { return Bool{m} }
|
func (m *Solo) Bool() Bool { return Bool{m} }
|
||||||
func (m *Solo) Value() bool {
|
func (m *Solo) Value() bool {
|
||||||
if m.d.InstrIndex < 0 || m.d.InstrIndex >= len(m.d.Song.Patch) {
|
a, b := intMin(m.d.InstrIndex, m.d.InstrIndex2), intMax(m.d.InstrIndex, m.d.InstrIndex2)
|
||||||
return false
|
|
||||||
}
|
|
||||||
for i := range m.d.Song.Patch {
|
for i := range m.d.Song.Patch {
|
||||||
if i == m.d.InstrIndex {
|
if i < 0 || i >= len(m.d.Song.Patch) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !m.d.Song.Patch[i].Mute {
|
if (i >= a && i <= b) == m.d.Song.Patch[i].Mute {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !m.d.Song.Patch[m.d.InstrIndex].Mute
|
return true
|
||||||
}
|
}
|
||||||
func (m *Solo) setValue(val bool) {
|
func (m *Solo) setValue(val bool) {
|
||||||
if m.d.InstrIndex < 0 || m.d.InstrIndex >= len(m.d.Song.Patch) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer (*Model)(m).change("Solo", PatchChange, MinorChange)()
|
defer (*Model)(m).change("Solo", PatchChange, MinorChange)()
|
||||||
|
a, b := intMin(m.d.InstrIndex, m.d.InstrIndex2), intMax(m.d.InstrIndex, m.d.InstrIndex2)
|
||||||
for i := range m.d.Song.Patch {
|
for i := range m.d.Song.Patch {
|
||||||
if i == m.d.InstrIndex {
|
if i < 0 || i >= len(m.d.Song.Patch) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.d.Song.Patch[i].Mute = val
|
m.d.Song.Patch[i].Mute = !(i >= a && i <= b) && val
|
||||||
}
|
}
|
||||||
m.d.Song.Patch[m.d.InstrIndex].Mute = false
|
|
||||||
}
|
}
|
||||||
func (m *Solo) Enabled() bool { return m.d.InstrIndex >= 0 && m.d.InstrIndex < len(m.d.Song.Patch) }
|
func (m *Solo) Enabled() bool { return m.d.InstrIndex >= 0 && m.d.InstrIndex < len(m.d.Song.Patch) }
|
||||||
|
Loading…
Reference in New Issue
Block a user