mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(tracker): add numeric up down to adjust number of voices per track
This commit is contained in:
@ -47,6 +47,7 @@ type Tracker struct {
|
||||
RowsPerPattern *NumberInput
|
||||
RowsPerBeat *NumberInput
|
||||
InstrumentVoices *NumberInput
|
||||
TrackVoices *NumberInput
|
||||
InstrumentNameEditor *widget.Editor
|
||||
NewTrackBtn *widget.Clickable
|
||||
NewInstrumentBtn *widget.Clickable
|
||||
@ -220,6 +221,25 @@ func (t *Tracker) AddTrack() {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tracker) SetTrackVoices(value int) bool {
|
||||
if value < 1 {
|
||||
value = 1
|
||||
}
|
||||
maxRemain := t.song.Patch.TotalVoices() - t.song.TotalTrackVoices() + t.song.Tracks[t.Cursor.Track].NumVoices
|
||||
if maxRemain < 1 {
|
||||
maxRemain = 1
|
||||
}
|
||||
if value > maxRemain {
|
||||
value = maxRemain
|
||||
}
|
||||
if value != int(t.song.Tracks[t.Cursor.Track].NumVoices) {
|
||||
t.SaveUndo()
|
||||
t.song.Tracks[t.Cursor.Track].NumVoices = value
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t *Tracker) AddInstrument() {
|
||||
if t.song.Patch.TotalVoices() >= 32 {
|
||||
return
|
||||
@ -519,6 +539,7 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService) *Tr
|
||||
RowsPerPattern: new(NumberInput),
|
||||
RowsPerBeat: new(NumberInput),
|
||||
InstrumentVoices: new(NumberInput),
|
||||
TrackVoices: new(NumberInput),
|
||||
InstrumentNameEditor: &widget.Editor{SingleLine: true, Submit: true, Alignment: text.Middle},
|
||||
NewTrackBtn: new(widget.Clickable),
|
||||
NewInstrumentBtn: new(widget.Clickable),
|
||||
|
Reference in New Issue
Block a user