mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-19 05:24:48 -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
@ -93,6 +93,16 @@ type (
|
||||
*Model
|
||||
}
|
||||
ShowLicense Model
|
||||
|
||||
ChooseSendSource struct {
|
||||
ID int
|
||||
*Model
|
||||
}
|
||||
ChooseSendTarget struct {
|
||||
ID int
|
||||
Port int
|
||||
*Model
|
||||
}
|
||||
)
|
||||
|
||||
// Action methods
|
||||
@ -298,8 +308,7 @@ func (m *Undo) Do() {
|
||||
m.d = m.undoStack[len(m.undoStack)-1]
|
||||
m.undoStack = m.undoStack[:len(m.undoStack)-1]
|
||||
m.prevUndoKind = ""
|
||||
(*Model)(m).updateDerivedScoreData()
|
||||
(*Model)(m).updateDerivedPatchData()
|
||||
(*Model)(m).updateDeriveData(SongChange)
|
||||
TrySend(m.broker.ToPlayer, any(m.d.Song.Copy()))
|
||||
}
|
||||
|
||||
@ -316,30 +325,29 @@ func (m *Redo) Do() {
|
||||
m.d = m.redoStack[len(m.redoStack)-1]
|
||||
m.redoStack = m.redoStack[:len(m.redoStack)-1]
|
||||
m.prevUndoKind = ""
|
||||
(*Model)(m).updateDerivedScoreData()
|
||||
(*Model)(m).updateDerivedPatchData()
|
||||
(*Model)(m).updateDeriveData(SongChange)
|
||||
TrySend(m.broker.ToPlayer, any(m.d.Song.Copy()))
|
||||
}
|
||||
|
||||
// AddSemiTone
|
||||
|
||||
func (m *Model) AddSemitone() Action { return MakeEnabledAction((*AddSemitone)(m)) }
|
||||
func (m *AddSemitone) Do() { Table{(*Notes)(m)}.Add(1) }
|
||||
func (m *AddSemitone) Do() { Table{(*Notes)(m)}.Add(1, false) }
|
||||
|
||||
// SubtractSemitone
|
||||
|
||||
func (m *Model) SubtractSemitone() Action { return MakeEnabledAction((*SubtractSemitone)(m)) }
|
||||
func (m *SubtractSemitone) Do() { Table{(*Notes)(m)}.Add(-1) }
|
||||
func (m *SubtractSemitone) Do() { Table{(*Notes)(m)}.Add(-1, false) }
|
||||
|
||||
// AddOctave
|
||||
|
||||
func (m *Model) AddOctave() Action { return MakeEnabledAction((*AddOctave)(m)) }
|
||||
func (m *AddOctave) Do() { Table{(*Notes)(m)}.Add(12) }
|
||||
func (m *AddOctave) Do() { Table{(*Notes)(m)}.Add(1, true) }
|
||||
|
||||
// SubtractOctave
|
||||
|
||||
func (m *Model) SubtractOctave() Action { return MakeEnabledAction((*SubtractOctave)(m)) }
|
||||
func (m *SubtractOctave) Do() { Table{(*Notes)(m)}.Add(-12) }
|
||||
func (m *SubtractOctave) Do() { Table{(*Notes)(m)}.Add(-1, true) }
|
||||
|
||||
// EditNoteOff
|
||||
|
||||
@ -517,6 +525,44 @@ func (d DeleteOrderRow) Do() {
|
||||
m.d.Cursor2.OrderRow = m.d.Cursor.OrderRow
|
||||
}
|
||||
|
||||
// ChooseSendSource
|
||||
|
||||
func (m *Model) IsChoosingSendTarget() bool {
|
||||
return m.d.SendSource > 0
|
||||
}
|
||||
|
||||
func (m *Model) ChooseSendSource(id int) Action {
|
||||
return MakeEnabledAction(ChooseSendSource{ID: id, Model: m})
|
||||
}
|
||||
func (s ChooseSendSource) Do() {
|
||||
defer (*Model)(s.Model).change("ChooseSendSource", NoChange, MinorChange)()
|
||||
if s.Model.d.SendSource == s.ID {
|
||||
s.Model.d.SendSource = 0 // unselect
|
||||
return
|
||||
}
|
||||
s.Model.d.SendSource = s.ID
|
||||
}
|
||||
|
||||
// ChooseSendTarget
|
||||
|
||||
func (m *Model) ChooseSendTarget(id int, port int) Action {
|
||||
return MakeEnabledAction(ChooseSendTarget{ID: id, Port: port, Model: m})
|
||||
}
|
||||
func (s ChooseSendTarget) Do() {
|
||||
defer (*Model)(s.Model).change("ChooseSendTarget", SongChange, MinorChange)()
|
||||
sourceID := (*Model)(s.Model).d.SendSource
|
||||
s.d.SendSource = 0
|
||||
if sourceID <= 0 || s.ID <= 0 || s.Port < 0 || s.Port > 7 {
|
||||
return
|
||||
}
|
||||
si, su, err := s.d.Song.Patch.FindUnit(sourceID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.d.Song.Patch[si].Units[su].Parameters["target"] = s.ID
|
||||
s.d.Song.Patch[si].Units[su].Parameters["port"] = s.Port
|
||||
}
|
||||
|
||||
// NewSong
|
||||
|
||||
func (m *Model) NewSong() Action { return MakeEnabledAction((*NewSong)(m)) }
|
||||
|
Reference in New Issue
Block a user