Skip to content

Allow to read devices names directly from audio server (Pipewire, Pulseaudio etc. instead of backend-ALSA) #1126

@SimonDevStack

Description

@SimonDevStack
use cpal::traits::{DeviceTrait, HostTrait};
fn main() {
    let host = cpal::default_host();
    match host.input_devices() {
        Ok(devices) => {
            for x in devices {
                println!("{}", x.description().unwrap());
            }
        }
        Err(_) => println!("No devices were found"),
    }
}

The following code prints this garbage data:

Rate Converter Plugin Using Libav/FFmpeg Library
Rate Converter Plugin Using Samplerate Library
Rate Converter Plugin Using Speex Resampler
JACK Audio Connection Kit
Open Sound System
PipeWire Sound Server
PulseAudio Sound Server
Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
Plugin for channel upmix (4,6,8)
Plugin for channel downmix (stereo) with a simple spacialization
Default ALSA Output (currently PipeWire Media Server)
HDA ATI HDMI
HD-Audio Generic
HD-Audio Generic, ALC897 Analog
HD-Audio Generic, ALC897 Analog
HD-Audio Generic
HD-Audio Generic, ALC897 Analog
HD-Audio Generic, ALC897 Analog
HD-Audio Generic, ALC897 Alt Analog
HD-Audio Generic, ALC897 Alt Analog

I'm looking for a way to get meaningful data like with the pactl list sources short commend which provides useful output:

118	bluez_input.00:02:3C:AC:F5:B9	PipeWire	float32le 1ch 48000Hz	SUSPENDED
121	bluez_output.00:02:3C:AC:F5:B9.monitor	PipeWire	float32le 2ch 48000Hz	SUSPENDED```

specifically the `bluez_output.00:02:3C:AC:F5:B9.monitor`, `bluez_input.00:02:3C:AC:F5:B9	PipeWire` format 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions