Skip to content

A NaN constructor option is the option left out; CabinetSim keeps an echoed macro - #247

Merged
bdbarnett merged 2 commits into
mainfrom
fix-nan-options
Oct 30, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
fix-nan-options

Conversation

@bdbarnett

@bdbarnett bdbarnett commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #145.

A NaN passed for a numeric constructor option reached _build as it was, so 32 effect classes rendered something that was neither the default nor zero. The base Component constructor now drops a NaN option (keyword, or positional where the interpreter can name the arguments) before _build runs, so the option takes its default as each class's documentation says. One rule covers every class.

Four options keep the NaN meaning their class already documents and tests: Glide on DigitalDelay and TapeDelay (the jump), damping on ConvolutionReverb (out of circuit) and interval on ShimmerHall (refused). A class names such an option in _NAN_OWN.

CabinetSim.set_macro snaps a float to the nearest of 128 positions on purpose. A constructor option off the grid is not on that grid, so echoing get_macro() back moved it (46.99 read back as 47). The number get_macro() itself returned is now kept; any other float still snaps. SlapbackDelay already echoes exactly on current main, and the new test holds it there.

Tests: tests/test_nan_options.py renders every effect with each numeric option set to NaN against the option left out, checks the get/set round trip and the audio on both classes, and checks that a chosen float still snaps.

@bdbarnett
bdbarnett merged commit c2fdc92 into main Oct 30, 2026
7 checks passed
@bdbarnett
bdbarnett deleted the fix-nan-options branch October 30, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

A NaN constructor option renders neither the default nor zero; a fractional macro is re-quantised by set_macro

1 participant