Add live peak meters (pavucontrol-style level bars)
Each row on Playback, Output Devices and Input Devices gets a level bar under its slider. A meter is a small capture pw_stream on WirePlumber's pw_core with the properties pipewire-pulse gives pavucontrol's peak streams (stream.monitor, target.object, stream.capture.sink for sinks); its process callback folds samples into a peak that a 40 ms GUI timer reads, maps with the slider's cubic curve and decays smoothly. - Only the visible tab is metered; output/stream meters are passive. - stream.monitor nodes (ours and pavucontrol's) are hidden from the tabs. - moonmix-probe gains `meter <id>`; the smoke test now plays noise and checks the stream and sink meters see it. - Screenshot mode holds the meters still before capturing, since a constantly redrawing window never yields a frame under broadway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92ae5cdbfe
commit
f08f241edb
17 files changed
+503
-18
No files matched your search
@@ -24,6 +24,10 @@ on top of libpipewire-0.3. It never runs `wpctl`, `pactl`, `pw-cli`,
|
||||
- **Recording**: capture streams, same controls, input device selector.
|
||||
- **Output Devices** / **Input Devices**: sinks and sources with volume, mute
|
||||
and a *Default* toggle that shows and sets the default device.
|
||||
- **Live peak meters** under each slider on Playback, Output Devices and
|
||||
Input Devices, on the same cubic scale as the slider. Only the visible
|
||||
tab is metered; meters on outputs and app streams are passive, so they
|
||||
never keep an idle device running.
|
||||
- Volumes in percent exactly like pavucontrol/wpctl: the cubic mapping of
|
||||
PipeWire's linear `channelVolumes`, up to 150%, with the dB value next to
|
||||
it. One slider moves all channels, keeping the channel balance.
|
||||
@@ -32,7 +36,7 @@ on top of libpipewire-0.3. It never runs `wpctl`, `pactl`, `pw-cli`,
|
||||
show up immediately.
|
||||
|
||||
Not yet included: the Configuration tab (card profiles), per-channel
|
||||
sliders, peak meters, monitor sources in Input Devices.
|
||||
sliders, monitor sources in Input Devices, meters for recording streams.
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -62,7 +66,13 @@ flowchart LR
|
||||
route, which is where pavucontrol's numbers live. The **default-nodes-api**
|
||||
plugin reads and sets the default sink and source. To move a stream,
|
||||
moonmix sets `target.object` in the `default` metadata, as pipewire-pulse
|
||||
does for pavucontrol. The C layer sends MoonBit one callback per change,
|
||||
does for pavucontrol. Peak meters are small capture `pw_stream`s on
|
||||
WirePlumber's own `pw_core`, created with the properties pipewire-pulse
|
||||
gives pavucontrol's peak streams (`stream.monitor`, `target.object`,
|
||||
`stream.capture.sink` for sinks); their `process` callback only folds
|
||||
samples into a peak value that a 40 ms GUI timer reads and resets. Nodes
|
||||
with `stream.monitor` (ours and pavucontrol's) are hidden from the tabs.
|
||||
The C layer sends MoonBit one callback per change,
|
||||
`(kind, id)`. MoonBit then pulls node properties and volumes through small
|
||||
accessor functions, so no C structs cross the FFI boundary.
|
||||
- **One main loop.** WirePlumber and GTK4 both run on the default GLib main
|
||||
@@ -128,6 +138,7 @@ $P volume alsa_output.pci-0000_00_1f.3.analog-stereo 40
|
||||
$P mute 57 1 # node id or node.name
|
||||
$P default bluez_output.XX_XX.1
|
||||
$P move <stream-id> <sink-id-or-name>
|
||||
$P meter <id> # peak over ~1.5 s; exit 6 if silent
|
||||
```
|
||||
|
||||
## Testing
|
||||
@@ -140,8 +151,9 @@ tools/smoke-test.sh /tmp/shot # needs pipewire, wireplumber, pw-cat, gtk4-
|
||||
|
||||
`tools/smoke-test.sh` starts a private PipeWire and WirePlumber in a temp
|
||||
`XDG_RUNTIME_DIR`. The instance has two null sinks, a loopback virtual
|
||||
microphone, and one playback and one capture stream created with `pw-cat`; the CLI is used only
|
||||
by the test harness. The script runs every probe action and checks its effect,
|
||||
microphone, one playback stream of noise and one capture stream created with `pw-cat`; the CLI is used only
|
||||
by the test harness. The script runs every probe action and checks its effect, checks that peak
|
||||
meters on the stream and its sink see the signal,
|
||||
then starts the GUI under GTK's broadway backend. With `MOONMIX_SCREENSHOT`
|
||||
set, the GUI renders each tab offscreen to a PNG and exits.
|
||||
|
||||
|
||||
Reference in new issue
Block a user