feat(player): 迁移自动混音与下一首预加载,实现完整双槽 crossfade#70
Open
laoshuikaixue wants to merge 5 commits into
Open
Conversation
将旧版 SPlayer 的 Automix 能力完整迁移到 SPlayer-Next,同时首次支持歌曲预加载。新实现基于 Rust audio-engine 双槽架构(当前槽 + bounded preload 槽),不影响现有普通播放路径。 变更内容: - native/audio-engine 双槽播放:新增 preload/cancelPreload/crossfadeTo NAPI,preload 保留一个 bounded prepared slot,crossfadeTo 优先复用匹配预载槽。过渡期间旧槽淡出、新槽淡入,完成后释放旧槽资源。 - 迁移旧版音频分析(analysis.rs):BPM/调性/Smart Cut/transition proposal 到 native,通过主进程 worker 暴露 analyzeAudioFile、analyzeAudioFileHead、suggestTransition、suggestLongMix,避免阻塞主线程。分析结果作有界缓存,切歌/队列变化立即失效。 - 渲染层预载编排(preload.ts):根据队列、播放模式、音质解析下一首 URL,优先命中本地缓存;未命中时立即 preload 真实 URL,后台触发缓存下载。 - 渲染层 Automix 调度(automix.ts):复用旧版计划计算,输出 trigger time、crossfade duration、next start seek、initial rate、mix type,position 事件驱动,不新增高频 IPC。 - 中点 UI 提交(transitionCommit):主进程在 crossfade 中点统一提交 UI/歌词/封面/媒体状态/历史记录/预载。过渡期间忽略 native 新槽提前的 position/status,旧曲 UI 持续到 commit 点再切换。 - bassSwap 滤波:native 二阶 biquad 高通包络,旧曲前半段拉到 400Hz、新曲在 crossfade 中点释放回直通,贴合旧版 DJ 互换听感。 - 设置项:preloadNext(默认 true)、automixEnabled(默认 false)、automixMaxAnalyzeTimeSec(默认 60,范围 10-300),补充中英文 i18n 与播放设置项。
- 添加了 default 分支处理未知状态情况 - 返回空字符串避免 undefined 值导致的显示问题 - 确保函数在所有情况下都有明确的返回值
- 修正了 en-US.json 中 showLyricInBar 配置项后的多余逗号 - 修正了 zh-CN.json 中 showLyricInBar 配置项后的多余逗号 - 确保 JSON 文件格式正确性
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
将旧版 SPlayer 的 Automix 能力完整迁移到 SPlayer-Next,同时首次支持歌曲预加载。新实现基于 Rust audio-engine 双槽架构(当前槽 + bounded preload 槽),不影响现有普通播放路径。
变更内容: