Skip to content

Refactor audio settings and enhance plugin management#52

Merged
Milkitic merged 19 commits into
masterfrom
dev/refactor
Jul 14, 2026
Merged

Refactor audio settings and enhance plugin management#52
Milkitic merged 19 commits into
masterfrom
dev/refactor

Conversation

@Milkitic

Copy link
Copy Markdown
Owner

No description provided.

Milkitic and others added 19 commits July 11, 2026 22:15
Add async StopCurrentDeviceAsync that retries up to 3 times with logging and delay to handle transient StopDevice failures; update callers to await the async stop. Make IAudioEngine.OutputWaveFormat nullable and update AudioEngineWrapper to return null when no device is active. Add unit test to verify retry behavior and extend the playback engine test harness with StopFailuresRemaining to simulate transient failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce a NeedsShutdown property and TryShutdownPlugin helper to ensure plugins are shut down reliably. Set NeedsShutdown after successful Initialize, attempt shutdown on Initialize/Startup failures, and always call TryShutdownPlugin during unload. On shutdown exception, the flag remains true so UnloadPlugins can retry cleanup. Replaced the previous IsStarted flag with NeedsShutdown to track required cleanup.
Move many Sync runtime sources out of Runtime/ into top-level folders and rename related files. Perform widespread using reorder/cleanup, trailing-newline fixes and minor formatting improvements (multi-line properties/params, wrapped exception messages). Change RtssOsdWriter sync primitive and small API/constructor tweaks (SkinManager ctor reordering). Update AsyncLock inner implementation and make several small readability/consistency adjustments across the codebase. No functional logic changes intended—primarily refactoring and style/structure cleanup.
Introduce Pause/Resume on LoopProvider and make LoopProviderManager pause/resume providers instead of removing/adding them so mixer inputs stay alive. LoopSampleProvider gained an IsPaused flag and returns SignalKeepAlive while zeroing output when paused; Reset clears the paused state. Dispose now ensures provider is unpaused. Added LoopProviderTests verifying pause preserves source position and that pausing keeps mixer input alive.
由于之前的 lazer 会话可能留下过时的 ClientType,现在在 SkinManager 初始化时使用 _syncSessionContext.ClientType 进行校正,并确保 Lazer 皮肤加载使用正确的来源。同时更新 osu.Game.Rulesets.KeyAsio 子模块到最新版本。
将BalanceFactor的默认值从0.3333333调整为0.2,以提供更合适的默认平衡效果,避免初始设置下平衡过于偏向一侧。
原来的实现使用了等功率平衡(sin/cos),这适用于声像定位但不适用于立体声平衡控制。新的实现使用等幅度平衡,在中间位置左右声道均为0dB,调整平衡时仅衰减对侧声道,符合专业音频的平衡行为。
将 `BalanceMode.MidSide` 重命名为 `BalanceMode.ProMixFocus`,更新所有引用、本地化字符串和序列化迁移逻辑。新增 YAML 配置向后兼容处理,自动将旧配置中的 `MidSide` 迁移为 `ProMixFocus`。更新平衡模式描述以反映新的品牌声场聚焦算法。
重新设计 BalanceMode 枚举,移除 BinauralMix 和 CrossMix 模式,新增 LinearStereoPan 模式。更新 ProfessionalBalanceProvider 算法,为 ConstantPower 和 LinearStereoPan 分别实现等功率和线性声像算法。更新所有本地化资源,修正模式名称和描述,将“Stereo Width”重命名为“Pan Strength”以更准确反映功能。添加 YAML 配置向后兼容迁移,自动将旧配置中的 BinauralMix 映射为 LinearStereoPan,CrossMix 映射为 ConstantPower。调整属性设置顺序以确保状态一致性。破坏性变更:移除了 BinauralMix 和 CrossMix 模式,现有配置将自动迁移。
删除 AntiClipStrategy 枚举及 ProfessionalBalanceProvider 中的防削波逻辑,将削波保护责任完全交由最终的 MasterLimiterProvider 统一管理。简化构造函数和调用接口,移除所有 AntiClipStrategy 参数传递。清理相关注释和性能对比表格,精简 ProMixFocus 向量化处理路径。此重构不改变外部行为,所有防削波功能由混音器末端统一保障。
移除 `KeyboardBindingInitializer` 中对 `SyncSessionContext.IsAudioPaused` 的依赖,因为该状态在稳定内存时序下会短暂进入暂停状态,不应用于丢弃物理按键事件。同时清理不再使用的 `SyncSessionContext` 注入和相关字段。
由于 osu! stable 和 lazer 的皮肤系统不同,之前共用的皮肤选择字段在切换客户端时会导致混乱。现拆分为 SelectedSkinNameStable 和 SelectedSkinNameLazer,并在 SkinManager 中根据当前客户端类型自动选择对应字段
@Milkitic
Milkitic merged commit 91597d0 into master Jul 14, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28f72d1d45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

var loopProvider = kvp.Value;

loopProvider.AddTo(mixer);
loopProvider.Resume();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reattach paused loops when the mixer changes

When resuming, this now only clears the paused flag and ignores the mixer argument. If audio settings are reloaded while a slider loop is paused—especially a sample-rate change, where AudioEngine.StartDeviceCore replaces EffectMixer—the LoopProvider is still attached to the old mixer, so resuming never adds it to the new mixer and the loop remains silent until it is recreated. Please reattach when the mixer instance has changed, or recover via AddTo(mixer) without letting the old mixer recycle the provider chain.

Useful? React with 👍 / 👎.

@Milkitic
Milkitic deleted the dev/refactor branch July 14, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant