新增 设置-播放设置-使用设备能处理的最大声道数输出音频 设置(#1873)

This commit is contained in:
lyswhut
2024-05-02 12:33:07 +08:00
parent 793b5a679c
commit e4de4b8c1b
12 changed files with 70 additions and 9 deletions
@@ -0,0 +1,14 @@
import { watch } from '@common/utils/vueTools'
import { setMaxOutputChannelCount } from '@renderer/plugins/player'
import { appSetting } from '@renderer/store/setting'
export default () => {
// console.log(appSetting['player.soundEffect.panner.enable'])
setMaxOutputChannelCount(appSetting['player.isMaxOutputChannelCount'])
watch(() => appSetting['player.isMaxOutputChannelCount'], (val) => {
setMaxOutputChannelCount(val)
})
}
@@ -41,16 +41,16 @@ export default () => {
})
}
const handleDeviceChangeStopPlay = (label: string) => {
const handleDeviceChange = (label: string) => {
// console.log(device)
// console.log(appSetting['player.isMediaDeviceRemovedStopPlay'], isPlay.value, label, prevDeviceLabel)
if (
appSetting['player.isMediaDeviceRemovedStopPlay'] &&
isPlay.value &&
label != prevDeviceLabel
) {
window.lx.isPlayedStop = true
pause()
if (label != prevDeviceLabel) {
window.app_event.playerDeviceChanged()
if (appSetting['player.isMediaDeviceRemovedStopPlay'] && isPlay.value) {
window.lx.isPlayedStop = true
pause()
}
}
}
@@ -58,7 +58,7 @@ export default () => {
const mediaDeviceId = appSetting['player.mediaDeviceId']
const device = await getMediaDevice(mediaDeviceId)
handleDeviceChangeStopPlay(device.label)
handleDeviceChange(device.label)
if (device.deviceId == mediaDeviceId) prevDeviceLabel = device.label
else void setMediaDevice(device.deviceId, device.label)
@@ -32,6 +32,7 @@ import { HOTKEY_PLAYER } from '@common/hotKey'
import { playNext, pause, playPrev, togglePlay, collectMusic, uncollectMusic, dislikeMusic } from '@renderer/core/player'
import usePlaybackRate from './usePlaybackRate'
import useSoundEffect from './useSoundEffect'
import useMaxOutputChannelCount from './useMaxOutputChannelCount'
import { setPowerSaveBlocker } from '@renderer/core/player/utils'
@@ -43,6 +44,7 @@ export default () => {
usePlayEvent()
useLyric()
useVolume()
useMaxOutputChannelCount()
useSoundEffect()
usePlaybackRate()
useWatchList()