Add volume changing logic
This commit is contained in:
@@ -247,6 +247,16 @@ func SetAllSinkVolumes(level float64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ConvertVolume converts a desired volume percentage (0%, 25%, 33%, 90%, etc) to
|
||||
// the float64 value needed to pass to SetAllSinkVolumes 0..1.0
|
||||
// Percentages should be passed as integers. 25% -> 25
|
||||
func ConvertVolume(volPerc int) float64 {
|
||||
if volPerc == 0 {
|
||||
return 0.0
|
||||
}
|
||||
return float64(volPerc) / 100.0
|
||||
}
|
||||
|
||||
// parseSinks parses the output of `wpctl status` and extracts audio sinks.
|
||||
func parseSinks(data []byte) ([]Sink, error) {
|
||||
var sinks []Sink
|
||||
|
||||
Reference in New Issue
Block a user