Skip to content

Commit

Permalink
feat: pipewire下支持单声道设置
Browse files Browse the repository at this point in the history
pipewire下支持单声道设置

Log: pipewire下支持单声道设置
pms: TASK-369199
  • Loading branch information
fly602 committed Dec 3, 2024
1 parent dddda54 commit ccb9245
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pulse/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit ccb9245

Please sign in to comment.