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>
19 lines
599 B
MoonBit
19 lines
599 B
MoonBit
///|
|
|
test "meter_level uses the cubic volume curve and clamps" {
|
|
assert_eq(@model.meter_level(0.0), 0.0)
|
|
assert_eq(@model.meter_level(-0.5), 0.0)
|
|
assert_eq(@model.meter_level(1.0), 1.0)
|
|
assert_eq(@model.meter_level(1.7), 1.0)
|
|
assert_true((@model.meter_level(0.125) - 0.5).abs() < 1.0e-9)
|
|
}
|
|
|
|
///|
|
|
test "meter_step rises at once and decays slowly" {
|
|
assert_eq(@model.meter_step(0.2, 0.9), 0.9)
|
|
assert_true(
|
|
(@model.meter_step(0.9, 0.0) - (0.9 - @model.METER_DECAY)).abs() < 1.0e-9,
|
|
)
|
|
assert_eq(@model.meter_step(0.5, 0.48), 0.48)
|
|
assert_eq(@model.meter_step(0.01, 0.0), 0.0)
|
|
}
|