Skip to content

controls: make the port-level map_control_to_01 overload reachable#144

Merged
jcelerier merged 1 commit into
mainfrom
fix/map-control-to-01
Jul 5, 2026
Merged

controls: make the port-level map_control_to_01 overload reachable#144
jcelerier merged 1 commit into
mainfrom
fix/map-control-to-01

Conversation

@jcelerier

Copy link
Copy Markdown
Member

The port-level convenience overload

template <avnd::parameter_port T>
  requires requires(T t) { map_control_to_01(t.value); }
static constexpr auto map_control_to_01(const T& ctl)

constrained itself with an unqualified map_control_to_01(t.value) — but T is non-deducible in every value-level overload, so that expression can never resolve and the constraint is unsatisfiable. Consequences:

  • avnd::map_control_to_01(ctl) never participated in overload resolution, and every caller guarding with requires { map_control_to_01(ctl); } silently got false.
  • Concretely, vintage::Controls::read() never initialized the atomic parameter mirror: VST2 hosts read 0 as the initial value of every parameter.

Fix: pass T explicitly in the constraint, matching what the body already does. Verified with a minimal reachability check (static_assert(requires(halp::knob_f32<...> c) { avnd::map_control_to_01(c); }) fails before, passes after) plus the full build and 100-test suite on main. Found via the VST2 editor host test on the avendish-ui branch, where getParameter returned 0 for a control initialized to 0.25.

🤖 Generated with Claude Code

https://claude.ai/code/session_014Zm2k4dsLp2jMa47zyLcSZ

Its constraint called map_control_to_01(t.value) without the explicit
template argument, but T is non-deducible in every value-level overload, so
the constraint was unsatisfiable: avnd::map_control_to_01(ctl) never
resolved and every guarded caller silently got `false` from
`requires { map_control_to_01(ctl); }`. Concretely, vintage's
Controls::read() never initialized the atomic parameter mirror, so VST2
hosts read 0 for every parameter's initial value.

Pass T explicitly in the constraint, matching the body.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Zm2k4dsLp2jMa47zyLcSZ
@jcelerier jcelerier merged commit a0a22a0 into main Jul 5, 2026
23 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