pub struct AudioService {
pub output_devices: Property<Vec<Arc<OutputDevice>>>,
pub input_devices: Property<Vec<Arc<InputDevice>>>,
pub default_output: Property<Option<Arc<OutputDevice>>>,
pub default_input: Property<Option<Arc<InputDevice>>>,
pub playback_streams: Property<Vec<Arc<AudioStream>>>,
pub recording_streams: Property<Vec<Arc<AudioStream>>>,
/* private fields */
}Expand description
Pipewire Audio management service. See crate-level docs for usage patterns.
Fields§
§output_devices: Property<Vec<Arc<OutputDevice>>>All PulseAudio sinks: speakers, headphones, Bluetooth outputs, virtual sinks.
input_devices: Property<Vec<Arc<InputDevice>>>All PulseAudio sources: microphones, monitor sources, virtual inputs.
default_output: Property<Option<Arc<OutputDevice>>>Current default sink, or None if unset.
default_input: Property<Option<Arc<InputDevice>>>Current default source, or None if unset.
playback_streams: Property<Vec<Arc<AudioStream>>>Applications currently playing audio.
recording_streams: Property<Vec<Arc<AudioStream>>>Applications currently recording audio.
Implementations§
Source§impl AudioService
impl AudioService
Sourcepub async fn new() -> Result<Arc<Self>, Error>
pub async fn new() -> Result<Arc<Self>, Error>
Creates a new audio service instance with default configuration.
Initializes PulseAudio connection and discovers available devices and streams.
§Errors
Returns error if PulseAudio connection fails or service initialization fails.
Sourcepub fn builder() -> AudioServiceBuilder
pub fn builder() -> AudioServiceBuilder
Creates a builder for configuring an AudioService.
Sourcepub async fn output_device(&self, key: DeviceKey) -> Result<OutputDevice, Error>
pub async fn output_device(&self, key: DeviceKey) -> Result<OutputDevice, Error>
Returns a snapshot of the output device’s current state.
The returned OutputDevice properties will not update after this call.
For live updates, see output_device_monitored.
§Errors
Returns Error::DeviceNotFound if no sink exists with this key.
Sourcepub async fn output_device_monitored(
&self,
key: DeviceKey,
) -> Result<Arc<OutputDevice>, Error>
pub async fn output_device_monitored( &self, key: DeviceKey, ) -> Result<Arc<OutputDevice>, Error>
Returns a live-updating output device instance.
The returned OutputDevice properties update automatically when
PulseAudio state changes. Monitoring stops when the Arc is dropped.
§Errors
Returns Error::DeviceNotFound if no sink exists with this key.
Sourcepub async fn input_device(&self, key: DeviceKey) -> Result<InputDevice, Error>
pub async fn input_device(&self, key: DeviceKey) -> Result<InputDevice, Error>
Returns a snapshot of the input device’s current state.
§Errors
Returns Error::DeviceNotFound if no source exists with this key.
Sourcepub async fn input_device_monitored(
&self,
key: DeviceKey,
) -> Result<Arc<InputDevice>, Error>
pub async fn input_device_monitored( &self, key: DeviceKey, ) -> Result<Arc<InputDevice>, Error>
Returns a live-updating input device instance.
§Errors
Returns Error::DeviceNotFound if no source exists with this key.
Sourcepub async fn audio_stream(&self, key: StreamKey) -> Result<AudioStream, Error>
pub async fn audio_stream(&self, key: StreamKey) -> Result<AudioStream, Error>
Returns a snapshot of the audio stream’s current state.
§Errors
Returns Error::StreamNotFound if no stream exists with this key.
Sourcepub async fn audio_stream_monitored(
&self,
key: StreamKey,
) -> Result<Arc<AudioStream>, Error>
pub async fn audio_stream_monitored( &self, key: StreamKey, ) -> Result<Arc<AudioStream>, Error>
Returns a live-updating audio stream instance.
§Errors
Returns Error::StreamNotFound if no stream exists with this key.