Repository navigation
feat(audio): play on multiple outputs, with a live mute per output - #27
Merged
Merged
Conversation
Moves the Apply Device Settings click handler body into a named function so another control can re-run the exact same flow (stop, setDevice, restore input/monitor state, start, save) instead of copying it. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opt-in desktop setting "Play on multiple outputs" (off by default), stored in desktop-config. With it on, the engine opens every output channel the device advertises (for example ASIO4ALL with both a headset and the Realtek speakers ticked) and copies the finished stereo mix, after master gain, to every further pair. Each output pair also gets a live play/mute checkbox. Mutes are saved by output channel name, so they survive ASIO4ALL reordering channels, and apply without reopening the device. Toggling the switch reopens the device through the normal Apply flow, with no relaunch. - DeviceSetup: a single outputChannelsToOpen() helper feeds the duplex skip check, the open, the verify, and the split open, so the masks can't disagree. - Engine: duplex mixes into the first pair only. Metering and the loop ring still read that pair. fanOutStereoMix() (OutputFanout.h) then writes or clears every extra channel and silences the muted ones. - Main: the setDevice handler adds multiOutput from desktop-config, so every renderer caller gets it. Saved mutes are pushed to the engine at startup and on every change, and only while the switch is on. Intended contract changes: new addon exports set/getMutedOutputChannels; new IPC and preload audio:getMultiOutput / setMultiOutput / setMutedOutputChannels. The fallbacks snapshot was regenerated (UPDATE_SNAPSHOT=1) for those three handlers, and the handler count went from 111 to 114. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ml-6 and text-amber-300/80 are missing from the shipped tailwind.min.css, so the output list rendered unindented in a build that doesn't regenerate the sheet. Use ml-5 and text-amber-300 instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Muting or unmuting an output in "Play on multiple outputs" cut the signal at a block boundary, which clicks mid-note. fanOutStereoMix() now takes the mask it applied last block and ramps any channel whose mute changed (1->0 or 0->1) across the block; steady channels are copied or cleared as before. Each output callback keeps its own previous mask, reset to the current mask in its about-to-start so a muted output doesn't leak a block when the device starts. OutputFanout.h no longer needs JUCE (std::copy/fill), so it now has a real buffer test in tests/engine_units/output_fanout_test.cpp: copy to every pair, steady mutes, fade out/in, source-pair mute after the copies, odd/mono channel counts, the 64-channel mask limit and the degenerate cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in main or the renderer called it: main is the source of truth for the saved mutes (desktop-config). Removes the binding, the engine getter and the export. Intended contract change: tests/contracts/addon-exports.json loses getMutedOutputChannels (hand-edited so the native addon never loads locally; CI's contract-check confirms it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ulti-output open
Three problems with the multi-output mutes:
- Turning the switch on pushed the saved mutes at once, while the device
still had only its first pair open, so a muted headset pair silenced
the app until Apply. Mutes now reach the engine only from setDevice,
and only after a successful open with every output; any other open
clears them. There is no startup push any more.
- Mutes were one global list of bare channel names. WASAPI names
channels generically ("Output channel 1"), so a mute followed the user
onto another device. desktop-config now keeps mutedOutputChannelsByDevice,
keyed "<outputType>|<outputDevice>" (the setDevice payload's values).
getMultiOutput / setMutedOutputChannels take that device; a list saved
for another device is never pushed. The unreleased mutedOutputChannels
array is ignored.
- A device that can't open every output fails closed in the engine, and
with the setting saved, every Apply and startup restore failed with no
audio. setDevice now retries with the first pair only and returns
multiOutputFallback + multiOutputError; the setting stays on.
The renderer sends the form's output device with each mute and loads
that device's mutes when a probe lists its outputs. A mute click now
updates the state before the await, and saves run in click order, so
two quick clicks no longer overwrite each other.
The setDevice object/legacy call moved into openDeviceObject() so the
fallback reuses it. IPC channel and preload method names are unchanged;
the fallbacks snapshot did not change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ips no-op reopens
Toggling "Play on multiple outputs" re-ran Apply, which always ended in
startAudio(), so a user who had pressed Stop got audio back. It also
reopened the device when saving the setting failed and nothing changed.
applyDeviceForm() takes { startAudio } (default true, so the Apply
button is unchanged); the toggle passes the current running state and
returns early when the saved value didn't change. Apply's status line
now says when main fell back to the first output pair
(multiOutputFallback).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tputs # Conflicts: # tests/engine_units/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--- fix(renderer): use Tailwind classes the bundled sheet already has
ml-6 and text-amber-300/80 are missing from the shipped tailwind.min.css,
so the output list rendered unindented in a build that doesn't regenerate
the sheet. Use ml-5 and text-amber-300 instead.
--- feat(audio): play on multiple outputs, with a live mute per output
Opt-in desktop setting "Play on multiple outputs" (off by default),
stored in desktop-config. With it on, the engine opens every output
channel the device advertises (for example ASIO4ALL with both a headset
and the Realtek speakers ticked) and copies the finished stereo mix,
after master gain, to every further pair. Each output pair also gets a
live play/mute checkbox. Mutes are saved by output channel name, so
they survive ASIO4ALL reordering channels, and apply without reopening
the device. Toggling the switch reopens the device through the normal
Apply flow, with no relaunch.
skip check, the open, the verify, and the split open, so the masks
can't disagree.
loop ring still read that pair. fanOutStereoMix() (OutputFanout.h)
then writes or clears every extra channel and silences the muted ones.
every renderer caller gets it. Saved mutes are pushed to the engine at
startup and on every change, and only while the switch is on.
Intended contract changes: new addon exports set/getMutedOutputChannels;
new IPC and preload audio:getMultiOutput / setMultiOutput /
setMutedOutputChannels. The fallbacks snapshot was regenerated
(UPDATE_SNAPSHOT=1) for those three handlers, and the handler count
went from 111 to 114.
--- refactor(renderer): name the Apply device handler applyDeviceForm
Moves the Apply Device Settings click handler body into a named function
so another control can re-run the exact same flow (stop, setDevice,
restore input/monitor state, start, save) instead of copying it. No
behaviour change.
🤖 Generated with Claude Code