From ccb924566e0c8ca2d552bbdb9c84838621e60b1c Mon Sep 17 00:00:00 2001 From: fuleyi Date: Tue, 3 Dec 2024 09:31:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20pipewire=E4=B8=8B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8D=95=E5=A3=B0=E9=81=93=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pipewire下支持单声道设置 Log: pipewire下支持单声道设置 pms: TASK-369199 --- pulse/misc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pulse/misc.go b/pulse/misc.go index 32683c8..1b45680 100644 --- a/pulse/misc.go +++ b/pulse/misc.go @@ -174,3 +174,15 @@ func (cm ChannelMap) CanFade() bool { return true } } + +// 音频支持单声道设置,仅在pipewire下有效果 +func (cv CVolume) SetMono(volume float64, enable bool) CVolume { + var v Volume + v.paVolume = C.pa_volume_t(volume * C.PA_VOLUME_NORM) + var channels uint32 = 1 + if !enable { + channels = 32 + } + C.pa_cvolume_set(&cv.core, C.unsigned(channels), v.paVolume) + return cv +}