openmixer — generated API reference
    Preparing search index...

    Function buildNativeStripWidthHook

    • Build the import('./software-mixer-loader.js').SoftwareMixerDeps.reconfigureNativeStrip hook over a native mixer: map input channel N → strip N-1, reconfigure that strip's width IN PLACE, and hand back the (post-reconfigure) head-input ports to repoint the channel head onto — folded r = l for the mono case, so both source legs land on the one input_<n> port.

      Honest about failure (live-rig finding): reconfigureStrip reports a failed port swap as false, and a hook that ignored it would read the STALE port names back and silently repoint the head onto ports that no longer (or never) exist — the engine would then believe the width converged while the graph never changed. On failure this logs and returns undefined, so the engine leaves the head where it was and the failure is visible in the rig log instead of a silent no-op.

      Symmetric about the WIDEN direction (#193): the mono-fold r = l is correct ONLY when a mono strip is requested — a narrow strip has one input_<n> port and both source legs fold onto it. On a STEREO (widen) request the strip must expose two DISTINCT input_<n>_L/input_<n>_R ports; if reconfigureStrip reports success but stripInputNames still returns a mono shape, the strip is HALF-WIDENED (the live-rig #193 divergence: channels flipped stereo but in_i_R was never physically created). Folding r = l there would silently point the R source leg at the L port and leave a half-stereo strip diverging from the model. So a half-widen is treated exactly like a failed swap — log loud and return undefined, leaving the head where it was — the same honesty the narrow / failed-swap path already has, never a silent half strip.

      Settles the registry MIRROR before handing the ports back (#202): the reconfigure mutates the daemon's ports synchronously, but the engine's registry mirror — what NativeGraphBackend.connect resolves node.name:port.name against — catches up asynchronously. The engine re-lays the source legs the instant this hook returns, so without a barrier it resolves the brand-new legs against a STALE mirror: in_i_R is "not registered yet" and defers, or (after a stereo→mono→stereo cycle, where the name existed before) it resolves to the id of the ALREADY-DESTROYED port and the link factory rejects it with unknown input port <id>. Either way the R leg silently never lands and the strip is half-stereo — the model says stereo, the graph carries one leg. So the hook waits for the mirror to reflect the flip (settleStripPorts) before the engine may resolve against it. A timeout is reported and the ports are returned anyway: they are physically real, and leaving the head on the destroyed ones would be strictly worse.

      Parameters

      • native: StripWidthNative

        the native strip surface

      • inputs: number

        how many input strips the console carries (hook ignores channels past it)

      • log: (m: string) => void

        where a failed reconfigure is reported

      • Optionalmirror: StripPortMirror

        the registry mirror to settle against (production: the loaded PwGraph). Omitted (loopback / unit tests with no live graph) ⇒ no barrier.

      Returns (
          channel: ChannelId,
          stereo: boolean,
      ) => Promise<{ l: string; r: string } | undefined>

      the width-reconfigure hook for buildSoftwareAdapter