feat!: both native & Go synths are included in the same executables

Closes #200
This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-07-10 17:46:00 +03:00
parent 13102aa7d6
commit 3163f46447
21 changed files with 106 additions and 83 deletions

View File

@ -21,9 +21,11 @@ type SongPanel struct {
ScopeExpander *Expander
LoudnessExpander *Expander
PeakExpander *Expander
CPUExpander *Expander
WeightingTypeBtn *Clickable
OversamplingBtn *Clickable
SynthBtn *Clickable
BPM *NumericUpDownState
RowsPerPattern *NumericUpDownState
@ -50,11 +52,13 @@ func NewSongPanel(tr *Tracker) *SongPanel {
WeightingTypeBtn: new(Clickable),
OversamplingBtn: new(Clickable),
SynthBtn: new(Clickable),
SongSettingsExpander: &Expander{Expanded: true},
ScopeExpander: &Expander{},
LoudnessExpander: &Expander{},
PeakExpander: &Expander{},
CPUExpander: &Expander{},
}
return ret
}
@ -66,6 +70,10 @@ func (s *SongPanel) Update(gtx C, t *Tracker) {
for s.OversamplingBtn.Clicked(gtx) {
t.Model.Oversampling().SetValue(!t.Oversampling().Value())
}
for s.SynthBtn.Clicked(gtx) {
r := t.Model.SyntherIndex().Range()
t.Model.SyntherIndex().SetValue((t.SyntherIndex().Value()+1)%(r.Max-r.Min+1) + r.Min)
}
}
func (s *SongPanel) Layout(gtx C) D {
@ -102,6 +110,14 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
}
oversamplingBtn := Btn(tr.Theme, &tr.Theme.Button.Text, t.OversamplingBtn, oversamplingTxt, "")
cpuload := tr.Model.CPULoad()
cpuLabel := Label(tr.Theme, &tr.Theme.SongPanel.RowValue, fmt.Sprintf("%.0f %%", cpuload*100))
if cpuload >= 1 {
cpuLabel.Color = tr.Theme.SongPanel.ErrorColor
}
synthBtn := Btn(tr.Theme, &tr.Theme.Button.Text, t.SynthBtn, tr.Model.SyntherName(), "")
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return t.SongSettingsExpander.Layout(gtx, tr.Theme, "Song",
@ -130,17 +146,19 @@ func (t *SongPanel) layoutSongOptions(gtx C) D {
step := NumUpDown(tr.Step(), tr.Theme, t.Step, "Cursor step")
return layoutSongOptionRow(gtx, tr.Theme, "Cursor step", step.Layout)
}),
layout.Rigid(func(gtx C) D {
cpuload := tr.Model.CPULoad()
label := Label(tr.Theme, &tr.Theme.SongPanel.RowValue, fmt.Sprintf("%.0f %%", cpuload*100))
if cpuload >= 1 {
label.Color = tr.Theme.SongPanel.ErrorColor
}
return layoutSongOptionRow(gtx, tr.Theme, "CPU load", label.Layout)
}),
)
})
}),
layout.Rigid(func(gtx C) D {
return t.CPUExpander.Layout(gtx, tr.Theme, "CPU", cpuLabel.Layout,
func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.End}.Layout(gtx,
layout.Rigid(func(gtx C) D { return layoutSongOptionRow(gtx, tr.Theme, "Load", cpuLabel.Layout) }),
layout.Rigid(func(gtx C) D { return layoutSongOptionRow(gtx, tr.Theme, "Synth", synthBtn.Layout) }),
)
},
)
}),
layout.Rigid(func(gtx C) D {
return t.LoudnessExpander.Layout(gtx, tr.Theme, "Loudness",
func(gtx C) D {

View File

@ -113,7 +113,6 @@ func NewTracker(model *tracker.Model) *Tracker {
Duration: 10 * time.Second,
})
}
t.TrackEditor.scrollTable.Focus()
return t
}