-
Notifications
You must be signed in to change notification settings - Fork 1
/
sources.go
38 lines (32 loc) · 995 Bytes
/
sources.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
package main
import (
"strconv"
"github.com/rivo/tview"
)
var (
Sources = []*Source{
NewSource("Dell XPS 13 (9343)", 1.052, 9.7, 48000, 32, "PCM"),
NewSource("Sabaj DA3", 1.98, 3.6, 192000, 32, "PCM"),
NewSource("Apple USB-C to 3.5mm Headphone Adapter (US model A2049)", 1.039, 0.9, 48000, 24, "PCM"),
NewSource("Apple USB-C to 3.5mm Headphone Adapter (EU model A2155)", 0.5, 0.9, 48000, 24, "PCM"),
NewSource("Onkyo A-9010 (TOSLINK)", 27.0, 0.09, 48000, 32, "Software"),
NewSource("Onkyo A-9010 (LINE, max 1V input)", 16.0, 0.09, 48000, 32, "Software"),
}
sourceNum int
source = NewAudioDevice(SOURCE)
)
func chooseSource() error {
done := make(chan int)
list := tview.NewList()
for n, s := range Sources {
list.AddItem(s.Name, "", rune(strconv.Itoa(n)[0]), func() { done <- 0 })
}
app.SetRoot(list, true).Draw()
<-done
source.Name, _ = list.GetItemText(list.GetCurrentItem())
err := source.Set()
if err != nil {
vibeLogger.Fatalln(err)
}
return nil
}