Skip to content

feat(nam): make NAM a top-level tab with a model browser - #301

Draft
OpenSauce wants to merge 11 commits into
mainfrom
wip/nam-tab
Draft

OpenSauce wants to merge 11 commits into
mainfrom
wip/nam-tab

Conversation

@OpenSauce

Copy link
Copy Markdown
Owner

Summary

NAM becomes a top-level tab while staying an ordinary StageConfig::Nam stage in the chain, so presets, chain_state and the engine are unchanged. The Amp tab's NAM card shrinks to a link row. The hover-menu picker from #294 and the iced_aw dependency are removed.

 INPUT  AMP  +NAM  EFFECTS  CABINET

+<NAM tab>          rustortion-ui/src/components/nam_browser/
+  <list pane>      filter [×] · folder tree of every model · folder, count, Open Folder, Rescan
+  <stage pane>     switcher (2+ NAM stages) · ⏻ name × · cab/IR line · gains, mix · model details
 <Amp tab>
-  <NAM card>       hover-menu picker, folder row, cab line, sliders, metadata
+  <NAM row>        ↑ ↓ × ⏻  "NAM 2 · model"  [Open] → NAM tab
 <signal strip>
-  NAM block → Amp tab
+  NAM block → NAM tab

What clicking a model does:

on(ModelClicked(key))
  if a NAM stage is selected
    if it already holds key: nothing
    else swap its model              # existing stage-rebuild path
  else if the chain is full: nothing
  else
    flush pending slider edits       # chain indices are about to shift
    insert Nam(key) after the last Amp-category stage
    select it

Where things live:

rustortion-ui/src/components/nam_browser/
├── tree.rs        # pure: folder tree, literal case-insensitive filter, visible rows
├── selection.rs   # pure: which NAM stage is selected, the four pane states
├── mod.rs         # NamBrowser UI state: filter, open folders, selection
└── view.rs        # the tab
rustortion-core/src/nam/registry.rs    # + catalog(): every key with its native rate, one lock

Model names wrap and are never clipped. Rows whose native rate differs from the engine rate are dimmed with the rate shown.

Evidence

  • Before: make test 334 passed. SharedApp::update had no tests.
    After: make test 368 passed, make lint clean. SharedApp::update is now driven through a mock backend:

    clicking_a_model_with_no_nam_stage_inserts_one_after_the_amp_stages
    a_pending_slider_edit_is_sent_before_the_insert_shifts_indices
    clicking_a_model_on_a_full_chain_with_no_nam_stage_does_nothing
    removing_an_earlier_stage_keeps_the_same_nam_stage_selected
    the_stage_shown_when_the_nam_tab_opens_stays_shown_after_a_reorder
    filter_is_a_literal_case_insensitive_substring
    chain_layout_changes_persist_the_collapsed_state
    
  • git diff main is empty for rustortion-core/src/{preset,amp,audio} and rustortion-plugin/src/params.rs.

  • make plugin built the CLAP and VST3 bundles at the seventh commit. It was not re-run after the last four fix commits (two of them comment-only or test-only).

  • No screenshots: nothing here has been seen on screen yet. This stays a draft until the hand-test passes.

Hand-test, standalone:

  • Empty chain → NAM tab → click a model: a NAM row appears in the Amp tab after the Amp stages; the sound changes
  • Click a second model: it swaps; the row and the signal strip keep one NAM entry
  • × in the NAM tab removes the stage; the pane returns to "No model loaded"; a click loads again
  • Amp tab: move the NAM row above and below a Noise Gate; "Open" jumps to the NAM tab
  • Add Stage → NAM: a switcher appears; each entry loads independently; the one shown survives a reorder
  • NAM_Starter preset: "No model loaded" with ⏻, × and the sliders present
  • A preset naming a missing model: the stored name plus "model not found", nothing highlighted
  • Oversampling 2×: every row dims and shows its rate
  • Filter: 6505+, [amp]; clear with ×; a preset hotkey bound to a digit or to Enter does not fire while typing
  • 800×600: both panes usable, long names wrap, the folder path sits above Open Folder / Rescan
  • 中文: no English left in the NAM tab
  • Click-insert NAM into a preset with collapsed Effects cards, Update, restart: the same cards are collapsed
  • The ▸ ▾ ⏻ glyphs render; the slim Amp-tab row lines up with the cards around it

Hand-test, plugin host:

  • Load, swap, two NAM stages
  • The filter takes keys inside the host, and × clears it
  • Save the project, reopen: the model is restored and shown in the NAM tab
  • A project saved before this branch shows its NAM stage in the NAM tab

Merge Danger

Door: two-way

No file-format, chain_state or host-parameter change. Reverting restores the old card, and presets saved on this branch load on main unchanged.

Blast Radius: GUI

The standalone and the plugin share this GUI, so both change. Unverified until the hand-test: layout at 800×600 and in the 900×700 plugin editor, and keyboard focus for the filter inside plugin hosts.

Known gaps, deliberately left:

  • The footer reads "1 models" for a single model, and a filter with no matches shows an empty list with no message. Each needs new i18n keys.
  • The folder holding the loaded model is forced open, so clicking its header does nothing visible.
  • Model rows that cannot be clicked (a 64-stage chain with no NAM stage) look enabled.
  • The catalog and tree are rebuilt every frame, which is fine at a hundred models and worth caching at thousands.
  • screenshots/rustortion.png and screenshots/rustortion.zh-CN.png still show the old tab bar.

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