-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatusBar.go
52 lines (45 loc) · 1.18 KB
/
statusBar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"log/slog"
"strconv"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"github.com/gopxl/beep"
"github.com/gopxl/beep/speaker"
)
func makeStatusBar(a fyne.App, w fyne.Window) fyne.CanvasObject {
srEntry := NewNumEntry()
srEntry.SetText(fmt.Sprint(bbSampleRate))
srEntry.OnChanged = func(s string) {
sr, _ := strconv.Atoi(s)
bbSampleRate = beep.SampleRate(sr)
bbCtrl.Streamer = beep.Resample(1, bbSampleRate, sampleRate, bbgen)
slog.Info("new sample rate", "bbSampleRate", bbSampleRate)
}
modeEntry = widget.NewSelect([]string{"Bytebeat", "Floatbeat"}, func(s string) {
mode = s
slog.Info("new mode", "mode", mode)
})
modeEntry.SetSelected(mode)
volSlider := widget.NewSlider(-10, 0)
volSlider.SetValue(0)
volSlider.OnChanged = func(f float64) {
speaker.Lock()
bbVol.Volume = f
speaker.Unlock()
}
volSlider.Step = 0.1
bar := container.NewHBox(
widget.NewLabel("v"+a.Metadata().Version),
widget.NewSeparator(),
volSlider,
widget.NewSeparator(),
modeEntry,
widget.NewSeparator(),
widget.NewLabel("Sample Rate:"),
srEntry,
)
return container.NewBorder(widget.NewSeparator(), nil, nil, nil, bar)
}