Add driver priority information

Make system default device selected by default.
This commit is contained in:
Atsushi Watanabe
2020-02-15 13:37:49 +09:00
committed by Lukas Herman
parent f3dce689e4
commit 53d55a30e5
4 changed files with 30 additions and 2 deletions
@@ -27,10 +27,19 @@ func init() {
if err != nil {
panic(err)
}
defaultSource, err := pa.DefaultSource()
if err != nil {
panic(err)
}
for _, source := range sources {
priority := driver.PriorityNormal
if defaultSource.ID() == source.ID() {
priority = driver.PriorityHigh
}
driver.GetManager().Register(&microphone{id: source.ID()}, driver.Info{
Label: source.ID(),
DeviceType: driver.Microphone,
Priority: priority,
})
}
}