From c8f61538312b17cf2c06c46678ac0cf9e3646361 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 1 Jun 2023 14:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=8D=87=E9=99=8D=E8=B0=83?= =?UTF-8?q?=E9=A2=84=E8=AE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 2 +- src/common/ipcNames.ts | 4 +- src/common/types/sound_effect.d.ts | 10 ++-- .../winMain/rendererEvent/soundEffect.ts | 12 ++-- .../common/SoundEffectBtn/PitchShifter.vue | 38 ++++++------ .../common/SoundEffectBtn/index.vue | 2 +- src/renderer/store/soundEffect.ts | 59 +++++++++++-------- src/renderer/utils/ipc.ts | 12 ++-- 8 files changed, 73 insertions(+), 66 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index d7c820ca..bf1185e1 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,6 +1,6 @@ ### 新增 -- 新增音效设置(实验性功能),支持10段均衡器设置、内置的一些环境混响音效、音调升降调节、3D立体环绕音效 +- 新增音效设置(实验性功能),支持10段均衡器设置、内置的一些环境混响音效、音调升降调节、3D立体环绕音效(据测试升降调可能会导致意外的CPU占用,调整过升降调后若想完全关闭需将其重置为1.00x并重启软件) - 播放速率设置面板新增是否音调补偿设置,在调整播放速率后,可以选择是否启用音调补偿,默认启用 ### 修复 diff --git a/src/common/ipcNames.ts b/src/common/ipcNames.ts index 9a4b4a99..abce60c2 100644 --- a/src/common/ipcNames.ts +++ b/src/common/ipcNames.ts @@ -94,8 +94,8 @@ const modules = { save_sound_effect_eq_preset: 'save_sound_effect_eq_preset', get_sound_effect_convolution_preset: 'get_sound_effect_convolution_preset', save_sound_effect_convolution_preset: 'save_sound_effect_convolution_preset', - get_sound_effect_pitch_shifter_preset: 'get_sound_effect_pitch_shifter_preset', - save_sound_effect_pitch_shifter_preset: 'save_sound_effect_pitch_shifter_preset', + // get_sound_effect_pitch_shifter_preset: 'get_sound_effect_pitch_shifter_preset', + // save_sound_effect_pitch_shifter_preset: 'save_sound_effect_pitch_shifter_preset', get_hot_key: 'get_hot_key', import_user_api: 'import_user_api', diff --git a/src/common/types/sound_effect.d.ts b/src/common/types/sound_effect.d.ts index 49ebce99..90f9f815 100644 --- a/src/common/types/sound_effect.d.ts +++ b/src/common/types/sound_effect.d.ts @@ -21,10 +21,10 @@ declare namespace LX { mainGain: number sendGain: number } - interface PitchShifterPreset { - id: string - name: string - playbackRate: number - } + // interface PitchShifterPreset { + // id: string + // name: string + // playbackRate: number + // } } } diff --git a/src/main/modules/winMain/rendererEvent/soundEffect.ts b/src/main/modules/winMain/rendererEvent/soundEffect.ts index 2cd03dfc..42e58226 100644 --- a/src/main/modules/winMain/rendererEvent/soundEffect.ts +++ b/src/main/modules/winMain/rendererEvent/soundEffect.ts @@ -18,10 +18,10 @@ export default () => { getStore(STORE_NAMES.SOUND_EFFECT).set('convolutionPreset', params) }) - mainHandle(WIN_MAIN_RENDERER_EVENT_NAME.get_sound_effect_pitch_shifter_preset, async() => { - return getStore(STORE_NAMES.SOUND_EFFECT).get('pitchShifterPreset') as LX.SoundEffect.PitchShifterPreset[] | null ?? [] - }) - mainOn(WIN_MAIN_RENDERER_EVENT_NAME.save_sound_effect_pitch_shifter_preset, ({ params }) => { - getStore(STORE_NAMES.SOUND_EFFECT).set('pitchShifterPreset', params) - }) + // mainHandle(WIN_MAIN_RENDERER_EVENT_NAME.get_sound_effect_pitch_shifter_preset, async() => { + // return getStore(STORE_NAMES.SOUND_EFFECT).get('pitchShifterPreset') as LX.SoundEffect.PitchShifterPreset[] | null ?? [] + // }) + // mainOn(WIN_MAIN_RENDERER_EVENT_NAME.save_sound_effect_pitch_shifter_preset, ({ params }) => { + // getStore(STORE_NAMES.SOUND_EFFECT).set('pitchShifterPreset', params) + // }) } diff --git a/src/renderer/components/common/SoundEffectBtn/PitchShifter.vue b/src/renderer/components/common/SoundEffectBtn/PitchShifter.vue index eccc2d63..54abc90f 100644 --- a/src/renderer/components/common/SoundEffectBtn/PitchShifter.vue +++ b/src/renderer/components/common/SoundEffectBtn/PitchShifter.vue @@ -10,20 +10,20 @@ -
+
diff --git a/src/renderer/components/common/SoundEffectBtn/index.vue b/src/renderer/components/common/SoundEffectBtn/index.vue index d6ba98bb..2eaeb6ff 100644 --- a/src/renderer/components/common/SoundEffectBtn/index.vue +++ b/src/renderer/components/common/SoundEffectBtn/index.vue @@ -11,10 +11,10 @@
+
-
diff --git a/src/renderer/store/soundEffect.ts b/src/renderer/store/soundEffect.ts index d333de15..72d0cdfa 100644 --- a/src/renderer/store/soundEffect.ts +++ b/src/renderer/store/soundEffect.ts @@ -1,5 +1,12 @@ import { reactive, toRaw } from '@common/utils/vueTools' -import { getUserSoundEffectConvolutionPresetList, getUserSoundEffectEQPresetList, getUserSoundEffectPitchShifterPresetList, saveUserSoundEffectConvolutionPresetList, saveUserSoundEffectEQPresetList, saveUserSoundEffectPitchShifterPresetList } from '@renderer/utils/ipc' +import { + getUserSoundEffectConvolutionPresetList, + getUserSoundEffectEQPresetList, + // getUserSoundEffectPitchShifterPresetList, + saveUserSoundEffectConvolutionPresetList, + saveUserSoundEffectEQPresetList, + // saveUserSoundEffectPitchShifterPresetList, +} from '@renderer/utils/ipc' let userEqPresetList: LX.SoundEffect.EQPreset[] | null = null @@ -56,28 +63,28 @@ export const removeUserConvolutionPreset = async(id: string) => { } -let userPitchShifterPresetList: LX.SoundEffect.PitchShifterPreset[] | null = null -export const getUserPitchShifterPresetList = async() => { - if (userEqPresetList == null) { - userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) - } - return userPitchShifterPresetList -} -export const saveUserPitchShifterPreset = async(preset: LX.SoundEffect.PitchShifterPreset) => { - if (userPitchShifterPresetList == null) { - userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) - } - const target = userPitchShifterPresetList.find(p => p.id == preset.id) - if (target) Object.assign(target, preset) - else userPitchShifterPresetList.push(preset) - saveUserSoundEffectPitchShifterPresetList(toRaw(userPitchShifterPresetList)) -} -export const removeUserPitchShifterPreset = async(id: string) => { - if (userPitchShifterPresetList == null) { - userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) - } - const index = userPitchShifterPresetList.findIndex(p => p.id == id) - if (index < 0) return - userPitchShifterPresetList.splice(index, 1) - saveUserSoundEffectPitchShifterPresetList(toRaw(userPitchShifterPresetList)) -} +// let userPitchShifterPresetList: LX.SoundEffect.PitchShifterPreset[] | null = null +// export const getUserPitchShifterPresetList = async() => { +// if (userEqPresetList == null) { +// userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) +// } +// return userPitchShifterPresetList +// } +// export const saveUserPitchShifterPreset = async(preset: LX.SoundEffect.PitchShifterPreset) => { +// if (userPitchShifterPresetList == null) { +// userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) +// } +// const target = userPitchShifterPresetList.find(p => p.id == preset.id) +// if (target) Object.assign(target, preset) +// else userPitchShifterPresetList.push(preset) +// saveUserSoundEffectPitchShifterPresetList(toRaw(userPitchShifterPresetList)) +// } +// export const removeUserPitchShifterPreset = async(id: string) => { +// if (userPitchShifterPresetList == null) { +// userPitchShifterPresetList = reactive(await getUserSoundEffectPitchShifterPresetList()) +// } +// const index = userPitchShifterPresetList.findIndex(p => p.id == id) +// if (index < 0) return +// userPitchShifterPresetList.splice(index, 1) +// saveUserSoundEffectPitchShifterPresetList(toRaw(userPitchShifterPresetList)) +// } diff --git a/src/renderer/utils/ipc.ts b/src/renderer/utils/ipc.ts index fd73e0b7..b3503846 100644 --- a/src/renderer/utils/ipc.ts +++ b/src/renderer/utils/ipc.ts @@ -307,13 +307,13 @@ export const saveUserSoundEffectConvolutionPresetList = (list: LX.SoundEffect.Co rendererSend(WIN_MAIN_RENDERER_EVENT_NAME.save_sound_effect_convolution_preset, list) } -export const getUserSoundEffectPitchShifterPresetList = async() => { - return await rendererInvoke(WIN_MAIN_RENDERER_EVENT_NAME.get_sound_effect_pitch_shifter_preset) -} +// export const getUserSoundEffectPitchShifterPresetList = async() => { +// return await rendererInvoke(WIN_MAIN_RENDERER_EVENT_NAME.get_sound_effect_pitch_shifter_preset) +// } -export const saveUserSoundEffectPitchShifterPresetList = (list: LX.SoundEffect.PitchShifterPreset[]) => { - rendererSend(WIN_MAIN_RENDERER_EVENT_NAME.save_sound_effect_pitch_shifter_preset, list) -} +// export const saveUserSoundEffectPitchShifterPresetList = (list: LX.SoundEffect.PitchShifterPreset[]) => { +// rendererSend(WIN_MAIN_RENDERER_EVENT_NAME.save_sound_effect_pitch_shifter_preset, list) +// } export const allHotKeys = markRaw({ local: [