Skip to content

Gate SSG pseudo-stereo on the same pan detection as FM - #21

Merged
bubio merged 1 commit into
mainfrom
fix/pseudo-stereo-ssg-gate
Sep 21, 2026
Merged

bubio merged 1 commit into
mainfrom
fix/pseudo-stereo-ssg-gate

Conversation

@bubio

@bubio bubio commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

疑似ステレオ (Haas コーラス) の適用条件を FM と SSG で揃えました。

  • SSG のゲート漏れ — mixOutputFrame の SSG 経路が fmPanDetected を見ておらず、PAN を振った OPNA 曲でも SSG にだけコーラスがかかり続けていました。FM 経路 (generateFMSamples) と同じ条件に統一しています。
  • セーブステート — fmPanDetected はシリアライズされていないため、PAN 書き込み後のステートをロードするとラッチが落ちた状態で復帰し、疑似ステレオが誤って有効になっていました。FMCh.panLeft/panRight は既にステートに含まれているので、ロード後にそこから再構築します (refreshPanDetection())。セーブフォーマットは変更なし、既存ステートもそのまま読めます。
  • コーラスの遅延ラインは、CD ミックスの遅延ラインと同じ理由でロード時にクリアします。

PAN を振った後センターへ戻す曲はロードでラッチが落ちますが、直後のレジスタ書き込みで立ち直ります。

Test plan

  • swift test — 930 tests / 43 suites パス (新規 YM2608 pseudo-stereo gating 5 件を含む)
  • 新規テスト: センター時は L/R に差が出る / PAN 検出後は差が出ない / 疑似ステレオ OFF でも PAN 判定は走る / セーブステート往復でラッチが再構築される / PAN 前のステートはラッチが立たない
  • scripts/regression_compare.py — 20 PASS / FAIL 0

🤖 Generated with Claude Code

The Haas widener was applied to the SSG mix whenever pseudo-stereo was
enabled, ignoring fmPanDetected. A tune that pans its FM channels — so
one that authored its own stereo image — still had its SSG part widened
underneath that image. Use the same gate the FM path uses.

fmPanDetected is not part of the save state, so a state captured after a
pan write came back with the latch clear and the widener wrongly active.
Rebuild it from the restored FMCh pan bits, which the FMSynthesizer blob
already carries: no format change, and older states load as before. The
chorus delay lines are dropped on load for the same reason the CD-mix
ones are.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bubio
bubio merged commit 5bbbe59 into main Sep 21, 2026
3 checks passed
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