voelin-ui: pick and mix the quick share's sound as the studio does

The "Share screen" dialog had one switch for sound, "Share system audio",
which shared whatever stream.audio_sources held: changing what the
stream carries (an application, the microphone, desktop audio without
Voelin) or how loud meant the Stream Studio or the settings, and a
running share never followed.

The dialog now shows the studio's audio mixer while the switch is on
(off still means no audio at all): the studio's MixerRow for each source
(meter, gain, mute, the menu) and Add, which opens the studio's
PickDialog over the dialog to switch several sources on and off. They
read the main window's StudioBridge, filled without starting the studio
(App::mixer_show). Starting a share hands the sources with their gain
and mute to the capture (CaptureRequest::audio_sources); the stream
announces sound only when there is some. While it runs, the dialog
shows the same rows with the share mixer's meters, about 15 times a
second (the share keeps the timer), and every change of
stream.audio_sources, from the dialog or anywhere else (the settings
change event), goes to the running capture at once through
Capture::follow_audio, which reconfigures the streamer. A share started
without sound has no audio track, so the dialog says so instead.

The studio's rows and meters follow whichever streamer goes out: a quick
share's while one runs, else the studio's encoder. The picker's
application list is let go once neither the dialog nor the studio needs
it. With sample data, VOELIN_OPEN=share:live shares the test pattern
with the sample studio's sources, live at once with sample viewers, and
Stop ends it, as the studio's demo does. On a phone the frame-rate and
bitrate fields of the dialog no longer run past its edge.

Tests: capture_request carries the picked sources with gain and mute,
and nothing with the switch off or no sources; a running capture on the
test pattern follows changed sources, keeps a silent track when all are
removed, and one started without sound stays so. Headless screenshots
of the dialog before and during a share, 1440x900 and 390x844.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 22:45:17 +03:00
1 parent 1c6251e7b7
commit 318850fcd8
14 files changed
+410 -59

No files matched your search

+8 -3
View File
@@ -234,9 +234,13 @@ The audio of our stream is a mix of any number of sources
`[{"kind": "desktop"}, {"kind": "app", "name": "firefox", "gain": 0.5},
{"kind": "microphone", "muted": true}]`. Other kinds are `"window"` and
`"synthetic"` (`frequency`), and an app can be given by `"pid"`. The
default is desktop audio; `[]` shares without sound. The desktop app
reads it when sharing starts (`media::audio_source_specs`).
`media::audio_apps()` lists the applications for a picker.
default is desktop audio; `[]` shares without sound. The app's share
dialog and the Stream Studio pick and mix the sources with the same
mixer rows and picker ([ui.md](ui.md#sound-in-the-quick-share)); a share
hands them to its capture when it starts (`media::audio_source_specs`),
and a running share or studio follows every change of the key through
`Streamer::reconfigure`. `media::audio_apps()` lists the applications
for a picker.
What applications play is captured by `capture::playback::start_playback`:
@@ -979,6 +983,7 @@ has not run on Windows yet.
| Stream mixer (latency, fade on underrun, drift correction, rate conversion, limiter, levels, live source changes), `BlockClock` | `voelin-media` `mix::tests`, `tests/mix_alloc.rs` (no allocation per block) | tested |
| Application audio on PipeWire: desktop without our own stream, by name, by pid, a new player linked live, a quit one dropped, a restarted one matched again, the app list | `voelin-media/tests/pipewire_apps.rs` (private PipeWire, WirePlumber and D-Bus; tones told apart by frequency) | tested with PipeWire 1.0 and WirePlumber 0.4; skipped without them |
| Streamer audio sources (mix levels, gain, mute, live change, microphone tap, window source error, silence) | `voelin-core` `media::tests::audio_sources_change_live`, `audio_sources_from_settings`, `settings::tests::audio_sources` | tested |
| The share dialog's audio: the picked sources (gain, mute) in the capture request, none with "Share system audio" off; a running share following `stream.audio_sources` (a share without sound left so) | `voelin-ui` `streams::tests::the_share_carries_the_picked_audio`, `video::tests::a_share_follows_its_audio_sources`; headless screenshots (`share`, `share:live`) | tested; the dialog itself only in headless screenshots (nothing clicked) |
| X11 `_NET_WM_PID` of the shared window | `tests/x11_capture.rs` under Xvfb (`VOELIN_X11_TEST_DISPLAY`) | tested |
| WASAPI per-process loopback, audio sessions, `HWND` owner | – | type-checked for `x86_64-pc-windows-gnu` only |
| Android per-app and all-but-ours playback capture | `cargo ndk -t arm64-v8a clippy`, `gradlew compileDebugKotlin` | compiles only (no device or emulator here) |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

+23 -4
View File
@@ -181,6 +181,25 @@ game"), which is also what the gateway's directory shows. With sample data
the synthetic camera with background blur, text, colours) and test tones,
on settings in memory, and recordings go to a temporary folder.
### Sound in the quick share
The share dialog (`share`, and `share:live` for a running share) mixes its
sound with the studio's pieces: while "Share system audio" is on (off: no
audio at all) it shows the studio's mixer rows (`MixerRow`: meter, gain,
mute, a menu) for `stream.audio_sources`, and Add opens the studio's picker
(`PickDialog`) over it: the microphone, desktop audio without Voelin, the
shared window's application, any application that plays (on Android the
launchable apps with their icons), several at once. The rows read the
main window's `StudioBridge`, filled without starting the studio
(`App::mixer_show`). Starting a share hands the sources to the capture
(`CaptureRequest::audio_sources`); while it runs the dialog shows the
same rows with the share mixer's meters (about 15 times a second), and
every change of `stream.audio_sources`, from the dialog or anywhere else,
goes to the running capture at once (`Capture::follow_audio`, which calls
`Streamer::reconfigure`). A share started without sound has no audio track
to add sources to. With sample data `share:live` shares the test pattern
with the sample studio's sources, live at once with sample viewers.
## Adding a screen
1. Write the screen in `ui/screens/<name>.slint` from the components
@@ -243,7 +262,7 @@ Environment variables (see `src/dev.rs`):
- `VOELIN_DEMO_UI=1`: sample servers, channels, members, chat with emoji and
a stream, without a server (nothing is stored).
- `VOELIN_OPEN=<what>[,<what>...]`: `home`, `server`, `settings[:voice|keybinds|streaming|privacy|appearance]`,
`about`, `share`, `bookmark`, `emoji`, `client`, `panel`, `no-panel`,
`about`, `share[:live]`, `bookmark`, `emoji`, `client`, `panel`, `no-panel`,
`voice`, `pins`, `topics`, `topic:<id>`, `member`, `watch`, `popout`
(the server page, above), `tab:<home|servers|chat|activity|you>` (phone
layout). With sample data, `watch` plays the local test pattern in the
@@ -296,13 +315,13 @@ the window's size so the pointer is not over the window, and passes
| ![home](screenshots/desktop-home.png) | ![light](screenshots/desktop-light.png) |
| ![settings](screenshots/desktop-settings-voice.png) | ![appearance](screenshots/desktop-settings-appearance.png) |
| ![emoji](screenshots/desktop-emoji-picker.png) | ![volume](screenshots/desktop-client-volume.png) |
| ![share](screenshots/desktop-share-dialog.png) | ![add server](screenshots/desktop-add-server.png) |
| ![about](screenshots/desktop-about.png) | |
| ![share](screenshots/desktop-share-dialog.png) | ![sharing](screenshots/desktop-share-live.png) |
| ![add server](screenshots/desktop-add-server.png) | ![about](screenshots/desktop-about.png) |
| Phone layout | | | | |
|---|---|---|---|---|
| ![chat](screenshots/mobile-chat.png) | ![servers](screenshots/mobile-servers.png) | ![home](screenshots/mobile-home.png) | ![you](screenshots/mobile-you.png) | ![settings](screenshots/mobile-settings.png) |
| ![voice channel](screenshots/mobile-voice.png) | ![activity](screenshots/mobile-activity.png) | ![studio](screenshots/mobile-studio.png) | | |
| ![voice channel](screenshots/mobile-voice.png) | ![activity](screenshots/mobile-activity.png) | ![studio](screenshots/mobile-studio.png) | ![share](screenshots/mobile-share.png) | ![sharing](screenshots/mobile-share-live.png) |
## Limits