This commit is contained in:
legop3
2026-03-17 03:22:47 -04:00
parent fec9782e3b
commit ad664f2d32
4 changed files with 11 additions and 3 deletions
BIN
View File
Binary file not shown.
Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+11 -3
View File
@@ -85,9 +85,17 @@ func (c *WSClient) applyMixerGain(control string, gain float64) {
db = -60.0
}
dbArg := fmt.Sprintf("%.2fdB", db)
if err := c.trySetMixerControl(control, dbArg); err != nil {
c.log.Printf("audio-levels: amixer set %s=%s failed: %v", control, dbArg, err)
// amixer treats a leading "-" value as an option; set via percent to avoid getopt ambiguity.
percent := int(math.Round((db + 60.0) / 72.0 * 100.0))
if percent < 0 {
percent = 0
}
if percent > 100 {
percent = 100
}
percentArg := fmt.Sprintf("%d%%", percent)
if err := c.trySetMixerControl(control, percentArg); err != nil {
c.log.Printf("audio-levels: amixer set %s=%s failed: %v", control, percentArg, err)
}
}