默认禁用 使用设备能处理的最大声道数输出音频 设置,修复高级音频API与自定义音频输出设备功能冲突的提示显示
This commit is contained in:
@@ -36,12 +36,16 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from '@common/utils/vueTools'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { convolutions } from '@renderer/plugins/player'
|
||||
import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/setting'
|
||||
import { convolutions, setMediaDeviceId } from '@renderer/plugins/player'
|
||||
import AddConvolutionPresetBtn from './AddConvolutionPresetBtn.vue'
|
||||
import { getUserConvolutionPresetList, removeUserConvolutionPreset } from '@renderer/store/soundEffect'
|
||||
|
||||
const updateConvolution = val => {
|
||||
const updateConvolution = async val => {
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') {
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
const target = convolutions.find(c => c.source == val)
|
||||
const setting = {
|
||||
'player.soundEffect.convolution.fileName': val,
|
||||
@@ -61,6 +65,7 @@ const handleUpdateSendGain = (value) => {
|
||||
}
|
||||
|
||||
const handleSetPreset = (item) => {
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') saveMediaDeviceId('default')
|
||||
updateSetting({
|
||||
'player.soundEffect.convolution.fileName': item.source,
|
||||
'player.soundEffect.convolution.mainGain': item.mainGain,
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
<script setup>
|
||||
// import { reactive } from '@common/utils/vueTools'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { setMediaDeviceId } from '@renderer/plugins/player'
|
||||
import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/setting'
|
||||
|
||||
// const setting = reactive({
|
||||
// enabled: false,
|
||||
@@ -35,8 +36,12 @@ import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
// speed: 25,
|
||||
// })
|
||||
|
||||
const updateEnabled = (enabled) => {
|
||||
const updateEnabled = async(enabled) => {
|
||||
// console.log(enabled)
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') {
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
updateSetting({ 'player.soundEffect.panner.enable': enabled })
|
||||
}
|
||||
|
||||
|
||||
@@ -25,14 +25,19 @@
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from '@common/utils/vueTools'
|
||||
import { freqs, freqsPreset } from '@renderer/plugins/player'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { freqs, freqsPreset, setMediaDeviceId } from '@renderer/plugins/player'
|
||||
import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/setting'
|
||||
import AddEQPresetBtn from './AddEQPresetBtn.vue'
|
||||
import { getUserEQPresetList, removeUserEQPreset } from '@renderer/store/soundEffect'
|
||||
|
||||
const labels = freqs.map(num => num < 1000 ? num : `${num / 1000}k`)
|
||||
|
||||
const handleUpdate = (key, value) => {
|
||||
const handleUpdate = async(key, value) => {
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') {
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
|
||||
value = Math.round(value)
|
||||
// values[index] = value
|
||||
updateSetting({ [`player.soundEffect.biquadFilter.hz${key}`]: value })
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from '@common/utils/vueTools'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { setMediaDeviceId } from '@renderer/plugins/player'
|
||||
import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/setting'
|
||||
// import AddPitchShifterPresetBtn from './AddPitchShifterPresetBtn.vue'
|
||||
// import { getUserPitchShifterPresetList, removeUserPitchShifterPreset } from '@renderer/store/soundEffect'
|
||||
// import { semitones } from '@renderer/plugins/player'
|
||||
@@ -37,7 +38,11 @@ import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
|
||||
const playbackRate = computed(() => appSetting['player.soundEffect.pitchShifter.playbackRate'])
|
||||
|
||||
const handleSetPreset = (value) => {
|
||||
const handleSetPreset = async(value) => {
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') {
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
updateSetting({ 'player.soundEffect.pitchShifter.playbackRate': value })
|
||||
}
|
||||
|
||||
@@ -48,7 +53,7 @@ const handleSetPreset = (value) => {
|
||||
|
||||
const handleUpdatePlaybackRate = (value) => {
|
||||
value = parseFloat((Math.round(value) / 100).toFixed(2))
|
||||
handleSetPreset(value)
|
||||
void handleSetPreset(value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
<BiquadFilter />
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="showTip" :class="$style.tip">{{ $t('player__sound_effect_features_tip') }}</p>
|
||||
<!-- </main> -->
|
||||
</material-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from '@common/utils/vueTools'
|
||||
import { ref, watch } from '@common/utils/vueTools'
|
||||
// import useNextTogglePlay from '@renderer/utils/compositions/useNextTogglePlay'
|
||||
// import useToggleDesktopLyric from '@renderer/utils/compositions/useToggleDesktopLyric'
|
||||
// import { musicInfo, playMusicInfo } from '@renderer/store/player/state'
|
||||
@@ -33,6 +34,7 @@ import BiquadFilter from './BiquadFilter.vue'
|
||||
import AudioPanner from './AudioPanner.vue'
|
||||
import AudioConvolution from './AudioConvolution.vue'
|
||||
import PitchShifter from './PitchShifter.vue'
|
||||
import { appSetting } from '@renderer/store/setting'
|
||||
|
||||
defineProps({
|
||||
teleport: {
|
||||
@@ -43,6 +45,12 @@ defineProps({
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
const showTip = ref(false)
|
||||
|
||||
watch(visible, (visible) => {
|
||||
if (visible) showTip.value = appSetting['player.mediaDeviceId'] != 'default'
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -134,4 +142,12 @@ const visible = ref(false)
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
padding: 0 15px 15px;
|
||||
margin-top: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1.25;
|
||||
color: var(--color-font);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -80,8 +80,8 @@ export default {
|
||||
confirmButtonText: t('confirm_button_text'),
|
||||
})
|
||||
if (!confirm) return
|
||||
saveMediaDeviceId('default')
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
setEnableAudioVisualization(newSetting)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ dd
|
||||
.gap-top
|
||||
base-checkbox(id="setting_player_showTaskProgess" :model-value="appSetting['player.isShowTaskProgess']" :label="$t('setting__play_task_bar')" @update:model-value="updateSetting({'player.isShowTaskProgess': $event})")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_player_isMaxOutputChannelCount" :model-value="appSetting['player.isMaxOutputChannelCount']" :label="$t('setting__play_max_output_channel_count')" @update:model-value="updateSetting({'player.isMaxOutputChannelCount': $event})")
|
||||
base-checkbox(id="setting_player_isMaxOutputChannelCount" :model-value="isMaxOutputChannelCount" :label="$t('setting__play_max_output_channel_count')" @update:model-value="handleUpdateMaxOutputChannelCount")
|
||||
.gap-top
|
||||
base-checkbox(id="setting_player_isMediaDeviceRemovedStopPlay" :model-value="appSetting['player.isMediaDeviceRemovedStopPlay']" :label="$t('setting__play_mediaDevice_remove_stop_play')" @update:model-value="updateSetting({'player.isMediaDeviceRemovedStopPlay': $event})")
|
||||
|
||||
@@ -42,10 +42,10 @@ dd(:aria-label="$t('setting__play_mediaDevice_title')")
|
||||
|
||||
<script>
|
||||
import { ref, onBeforeUnmount, watch } from '@common/utils/vueTools'
|
||||
import { hasInitedAdvancedAudioFeatures } from '@renderer/plugins/player'
|
||||
import { hasInitedAdvancedAudioFeatures, setMediaDeviceId } from '@renderer/plugins/player'
|
||||
import { dialog } from '@renderer/plugins/Dialog'
|
||||
import { useI18n } from '@renderer/plugins/i18n'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
import { appSetting, saveMediaDeviceId, updateSetting } from '@renderer/store/setting'
|
||||
import { setPowerSaveBlocker } from '@renderer/core/player/utils'
|
||||
import { isPlay } from '@renderer/store/player/state'
|
||||
import { TRY_QUALITYS_LIST } from '@renderer/core/music/utils'
|
||||
@@ -86,8 +86,10 @@ export default {
|
||||
confirmButtonText: t('confirm_button_text'),
|
||||
})
|
||||
if (confirm) {
|
||||
appSetting['player.audioVisualization'] = false
|
||||
appSetting['player.mediaDeviceId'] = mediaDeviceId.value
|
||||
updateSetting({
|
||||
'player.audioVisualization': false,
|
||||
'player.mediaDeviceId': mediaDeviceId.value,
|
||||
})
|
||||
} else {
|
||||
mediaDeviceId.value = appSetting['player.mediaDeviceId']
|
||||
}
|
||||
@@ -108,6 +110,25 @@ export default {
|
||||
updateSetting({ 'player.powerSaveBlocker': enabled })
|
||||
}
|
||||
|
||||
const isMaxOutputChannelCount = ref(appSetting['player.isMaxOutputChannelCount'])
|
||||
const handleUpdateMaxOutputChannelCount = async(enabled) => {
|
||||
isMaxOutputChannelCount.value = enabled
|
||||
if (appSetting['player.mediaDeviceId'] != 'default') {
|
||||
const confirm = await dialog.confirm({
|
||||
message: t('setting__play_advanced_audio_features_tip'),
|
||||
cancelButtonText: t('cancel_button_text'),
|
||||
confirmButtonText: t('confirm_button_text'),
|
||||
})
|
||||
if (!confirm) {
|
||||
isMaxOutputChannelCount.value = false
|
||||
return
|
||||
}
|
||||
await setMediaDeviceId('default').catch(_ => _)
|
||||
saveMediaDeviceId('default')
|
||||
}
|
||||
updateSetting({ 'player.isMaxOutputChannelCount': enabled })
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
appSetting,
|
||||
@@ -116,6 +137,8 @@ export default {
|
||||
mediaDeviceId,
|
||||
handleMediaDeviceIdChnage,
|
||||
handleUpdatePowerSaveBlocker,
|
||||
isMaxOutputChannelCount,
|
||||
handleUpdateMaxOutputChannelCount,
|
||||
playQualityList,
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user