Skip to content

Gain staging - #5

Merged
rations merged 10 commits into
masterfrom
gain-staging
Oct 21, 2026
Merged

rations merged 10 commits into
masterfrom
gain-staging

Conversation

@rations

@rations rations commented Oct 21, 2026

Copy link
Copy Markdown
Owner

No description provided.

rations and others added 10 commits October 4, 2026 11:11
The standalones reserved 8 output-parameter queues, sized for the five
feedback values the processor publishes every block. The processor also
echoes every parameter its MIDI learn table moved, one queue per distinct
id, and the SDK's ParameterChanges::addParameterData grows with `new`
once its reserve is used up. Measured with every learn row firing in one
block, the rations amp fills 11 queues, so the rations standalone
allocated on its audio thread whenever a footswitch burst moved four or
more targets at once. The rack amp fills 6.

- kFeedbackIds/kFeedbackCount move into rationsids.h in both products,
  and the processors write their feedback by walking that list, with a
  static_assert tying the values to the ids. The LV2 wrapper uses the
  same list; its generated TTL is byte-identical.
- All four standalone backends (rations JACK; rack JACK, ASIO, WASAPI)
  reserve kFeedbackSlots (64), the size of the table the queue drains
  into, with a static_assert that feedback plus every learn row fits.
- rations_midicheck (both products) teaches every row its own CC,
  presses them all in one block, and checks one queue per feedback value
  and per moved parameter, and one point per queue. Both checks and the
  static_assert were proved to fail on deliberate faults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
core/inputlevellamp.h judges the peak at the model input against the
window the user chose: lit above -6.0 dBFS and up to 0.0 dBFS, held for
1.0 s so a phrase reads as a steady light. A hot peak turns it off at once
and keeps it off for the same hold, or a hot attack would relight before
any repaint showed it. Gain 0, meaning no capture is hearing anything,
turns it off at once. The edges come from Amped's measured LED and from
the NAM training signal; the hold is a choice and is labelled as one.

CrossfadeEngine::dominantInputGain() gives the input calibration gain of
the branch carrying the larger weight, the same choice activeIndexNorm()
makes, and ChannelRack::soundingInputGain() reads it from the channel
soundingChannel() names. Both give 0 when nothing is bound. The unused
inputLevelDbu() is removed.

rations_lampcheck (both products) asserts the window edges, both holds,
the hold's sample-rate dependence, NaN and inf, and the gain itself
against each capture's stated level read through the capture parser:
1.0 with Calibrate off and for a capture stating none, the exact offset
with it on, the dominant capture's and never a blend across a dial
crossfade, 0 when empty or building, and the right value across a
channel switch. Six injected faults each fail it.

The DSP core keeps a model's input level in a float, so the expectation
rounds the stated level the same way rather than loosening the
tolerance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both processors feed InputLevelLamp the model input as the Input knob
leaves it, times the sounding capture's input calibration gain, and
publish the result every block as kInputLevelOkId (205), a hidden
read-only parameter each controller registers. The tap is ahead of the
gate trigger, and in rations ahead of the PRE pedals, so a Boost is not
counted; in the rack anything a host runs before the amp is.

In rations the new value is also LV2 port 58, input_level_ok. LV2's
versioning rules allow a port to be added under the same URI only if it
is lv2:connectionOptional and the minor version goes up, which
the next release's VERSION has to meet; the latency port moves from 58
to 59. The feedback ports' symbols and names move into rationslv2.h so
the TTL generator writes from the same table rations_lv2check reads the
installed bundle back against; it now asserts each symbol and the
optional flag, and runs an instance with the optional port unconnected.

rations_lampcheck gains a section that loads the built bundle and plays
exact tones: the window edges, both holds (0.997 s at 128 frames), the
Input knob in the peak, Calibrate moving the edge by exactly the
capture's stated level, no shift for a capture stating none, dark with
nothing loaded, and in rations the Boost not counted. rtcheck counts the
lamp inside the channel-stomping run. Each check was proved against an
injected fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gui/make_assets.sh (both products) derives led_green_on.png from
led-on-base.png rather than drawing a second lamp, so the two share one
shape, rim and size. The red LED's green and blue are a fixed tenth of
its red, so the red channel carries all its shading: it is levelled so
the brightest opaque red (measured, not written in) becomes 1, turned
back into colour, multiplied by ACCENT and given the source's alpha. The
script checks the centre lands on ACCENT exactly. The lamp's off state is
the shared led_off.png.

The image is in both products' resource lists and panelrender's
required list, and drawLed takes a geo::LedColor, Red by default, which
also picks the flat fallback colour. Every panel renders pixel-identical
to HEAD; panelrender fails when the new image is missing; every other
asset regenerates byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both editors draw the green lamp to the right of the Input dial at the
dial's height, the author's pick of two rendered candidates (the other
sat beside the Input legend). It is the utility lamps' size, kTopLedR,
and its geometry is asserted clear of the dial, the legend above, the
value row below, the first channel switch's click area, the first
channel dial and the faceplate edge; the asserts were proved to fire.

The editor draws it from kInputLevelOkId and repaints only when the lit
state changes, though the value is reported every block. panelrender
draws it lit. Against HEAD the head page changes only inside the lamp's
own square and every other page is pixel-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One paragraph after the faceplate overview: the lamp lights while the
capture's input peaks between -6 and 0 dBFS, the top of NAM's training
signal; turn Input up until the hardest playing lights it, and dark when
digging in means past full scale. It reads after the Input dial and after
calibration, so it works with and without capture metadata; the built-in
Boost and Chorus do not count, and plug-ins hosted before the amp in the
Rack do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ake typed values

Ported from NAMix 0.9.0 (f699145) into both products' editors, and each
number read out of iPlug2 in the original plug-in's tree:

- The platform bases now report modifier keys and a double-click with
  every press. X11 and Win32 derive the double-click from two ordinary
  presses by one rule (same button, 400 ms, 4 px, timed on the event's
  own clock, wrap-safe); macOS reads AppKit's clickCount. Shift or Ctrl
  is fine control, and on a Mac Command rather than Ctrl, which is
  iPlug2's own mapping there and the only one free, since Control-click
  is a right-click. One PointerMod mask in core/platform/pointermods.h.
- Double-click returns a dial, trim, pedal knob, the cabinet blend or
  Slim to its parameter's default. Slim publishes on release, and a
  double-click has none, so the reset publishes it when it moved.
  Switches ignore the flag; the trims' right-click reset stays.
- Drags accumulate rather than measure from the press, so the gearing
  can change mid-drag without a jump: upstream's DEFAULT_GEARING of four
  head-dial diameters (224 units, was 200) for every dial, ten times
  finer with Shift. The trims' centre snap is skipped under fine, or
  +0.1 dB would be unreachable.
- The wheel is upstream's 1% a notch, 0.1% fine (was 5%). Channel dials
  keep one capture a notch; trims and the dBu box keep their round
  steps, a tenth of them fine.
- The six value rows open the existing text field when clicked, seeded
  and selected; Enter or Tab commits, Escape cancels, out of range
  clamps. geo::kValueFields is the one rect for hit test, drawing and
  panelrender's audit, asserted clear of its neighbours.
- The dBu box no longer parses with strtod, which follows the host's
  LC_NUMERIC and reads "-3.5" as -3 under a comma locale.
  core/typednumber.h takes '.' or ','. Not std::from_chars: its
  floating-point overloads need libc++ 20, which the macOS toolchain may
  not have.

Driven in both editors with real pointer input: on Bass a Shift drag
moves a tenth as far, double-click returns 5.0, three notches give 5.3
and ten fine ones 0.1 more, "7,5" gives 7.5, and the X focus returns to
the host on every exit; a fine trim drag reads +0.2 dB and "-3,5" in the
dBu box -3.5 dBu. The new asserts and audit boxes were faulted before
their pass was believed. Windows is cross-compiled only and macOS
type-checked only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e focus

dclick, sdrag and swheel exercise the new gestures. press sends a key
without first moving the input focus, unlike key, which predates the
editor taking the focus itself and so would hide whether it hands it
back. focus prints who holds the X input focus.

The rig still needs an editorhost, which this tree's build never makes
(SMTG_ENABLE_VST3_HOSTING_EXAMPLES is forced off because it pulls GTK);
point RATIONS_BUILD_DIR at a directory holding one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drag or wheel, Shift or Ctrl (Command on a Mac) for fine control,
double-click for the default, and click a readout to type a value with
either decimal mark. The macOS list asks the tester to check the three,
since none of it can be run there from here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The input-level lamp added an LV2 output port, and LV2 allows that
under the same URI only with a higher minor version, so this cannot be
a 0.6.x. The bundle now declares minor version 14. Pivuan's arm64
package was 0.6.0-pivuan3 and becomes 0.7.0-pivuanN from this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rations
rations merged commit 2edffc6 into master Oct 21, 2026
14 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