PulseAudio integration for managing audio devices and streams.
Overview
Provides reactive access to PulseAudio through [AudioService].
All state is exposed via Property fields that automatically update when
PulseAudio state changes.
Reactive Properties
Every field on [AudioService], OutputDevice, InputDevice, and
AudioStream is a Property<T> with two access patterns:
- Snapshot: Call
.get()for the current value - Stream: Call
.watch()for aStream<Item = T>that yields on changes
use AudioService;
use StreamExt;
# async
Live vs Snapshot Instances
Devices from [AudioService] fields (output_devices, default_output, etc.)
are live: their properties update when PulseAudio state changes.
The explicit lookup methods differ:
| Method | Returns | Properties Update? |
|---|---|---|
output_device() |
OutputDevice |
No (snapshot) |
output_device_monitored() |
Arc<OutputDevice> |
Yes (live) |
# use ;
# async
Controlling Devices
OutputDevice and InputDevice have control methods:
# use ;
# async
Configuration
| Method | Effect |
|---|---|
with_daemon() |
Control audio from scripts or other processes |
use AudioService;
# async
D-Bus Interface
When with_daemon() is enabled, the service registers on the session bus.
- Service:
com.wayle.Audio1 - Path:
/com/wayle/Audio - Interface:
com.wayle.Audio1
See dbus.md for the full interface specification.
Service Fields
[AudioService] exposes these reactive properties:
| Field | Type | Description |
|---|---|---|
output_devices |
Vec<Arc<OutputDevice>> |
All sinks (speakers, headphones) |
input_devices |
Vec<Arc<InputDevice>> |
All sources (microphones) |
default_output |
Option<Arc<OutputDevice>> |
Current default sink |
default_input |
Option<Arc<InputDevice>> |
Current default source |
playback_streams |
Vec<Arc<AudioStream>> |
Active playback (apps playing audio) |
recording_streams |
Vec<Arc<AudioStream>> |
Active recording (apps capturing audio) |