Skip to content

fix(rig-builder): amp swap not reloading live engine; drop stale 8x input-drive fallback - #59

Open
Duali98 wants to merge 1 commit into
got-feedBack:mainfrom
Duali98:fix/amp-live-reload-and-input-drive
Open

fix(rig-builder): amp swap not reloading live engine; drop stale 8x input-drive fallback#59
Duali98 wants to merge 1 commit into
got-feedBack:mainfrom
Duali98:fix/amp-live-reload-and-input-drive

Conversation

@Duali98

@Duali98 Duali98 commented Jul 27, 2026

Copy link
Copy Markdown

The per-song "Swap..." gear-replace handler (rbConfirmGearSwap) persisted a gear swap correctly (via /gear/replace_with) but never reloaded the currently-listening preview afterward. Other edit paths in the same editor (bypass toggle, master-chain edits) already force a live reload after a structural change; this one path was missed. Net effect: the swap was saved to the tone DB immediately, but the live audio engine kept playing the old amp/gear until the user left the song and reopened it (which forces a fresh fetch) - reported as "you have to go to another page and when you come back thats when it gets loaded."

Also fixes a related regression: nam_chain_input_drive's server-side default was already lowered from 8.0 (~+18dB) to 1.0 after players reported over-distorted/blown-out amp tones, but the frontend's own fallback constant (used whenever a chain loads before the async /settings fetch resolves - e.g. right after app/plugin startup) still hardcoded the old 8.0. That silently re-introduced the over-drive bug on a race-condition timing, which also compounds through rbPostAmpMakeupForChain's post-amp makeup gain (computed as a ratio against this same value).

Changes

  • rbConfirmGearSwap: after a successful swap, refetch + reload the live preview when the swapped tone is the one currently playing (rbReloadPreview(presetId)), mirroring the pattern already used by rbToggleBypass / rbAfterMasterEdit.
  • rbConfiguredChainInputDrive(): fallback changed from 8.0 to 1.0 to match the corrected server default in routes.py. Updated the surrounding comment, which was stale and still described the old default.

Test plan

  • Open a song, Listen a tone, use the per-song "Swap..." panel to replace the amp - confirm the new amp is audible immediately without leaving/reopening the song.
  • Confirm a song loaded immediately after app/plugin startup (before /settings has resolved) does not sound over-driven/distorted.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the input drive fallback to prevent excessive drive levels while settings are loading.
    • Updated live tone previews during gear changes so edited presets reflect recalculated settings immediately.
    • Improved gear-switching reliability by preventing preview refresh errors from interrupting the process.

…nput-drive fallback

The per-song "Swap..." gear-replace handler (rbConfirmGearSwap) persisted a
gear swap correctly but never reloaded the currently-listening preview, so
the engine kept playing the OLD amp/gear until the user left the song and
reopened it. Other edit paths (bypass toggle, master-chain edits) already
force a live reload after a structural change; this one was missed. Now
refetches and reloads the preview when the swapped tone is the one playing.

Also: nam_chain_input_drive's server default was already lowered from 8.0
(~+18dB) to 1.0 after players reported over-distorted amps, but the
frontend's own fallback (used whenever a chain loads before the async
/settings fetch resolves, e.g. right after app/plugin startup) still hardcoded
the old 8.0 - silently re-introducing the over-drive bug on a race-condition
timing. Fallback now matches the corrected server default.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 73c1f3a9-e877-4616-aa2a-5d4b17d3572d

📥 Commits

Reviewing files that changed from the base of the PR and between 8126051 and b5e8a53.

📒 Files selected for processing (1)
  • screen.js

📝 Walkthrough

Walkthrough

Changes

Audio runtime behavior

Layer / File(s) Summary
Correct initial input-drive fallback
screen.js
The cached nam_chain_input_drive value now falls back to 1.0 while the settings cache is unavailable.
Refresh listening preview after gear swaps
screen.js
Gear swaps reload the edited listening tone’s preview payload and ignore reload failures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GearSwap
  participant rbReloadPreview
  participant Engine
  GearSwap->>rbReloadPreview: reload affected preset preview
  rbReloadPreview->>Engine: refetch recomputed model payload
Loading

Suggested reviewers: jafz2001, ifritisz

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main fixes: live engine reload on amp swaps and replacing the stale input-drive fallback.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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