5 releases

0.3.2 Aug 15, 2021
0.3.1 Aug 14, 2021
0.3.0 Aug 14, 2021
0.2.14 Aug 13, 2021
0.2.13 Aug 13, 2021

#1095 in Audio

Download history 308/week @ 2024-03-13 352/week @ 2024-03-20 313/week @ 2024-03-27 334/week @ 2024-04-03 344/week @ 2024-04-10 395/week @ 2024-04-17 321/week @ 2024-04-24 369/week @ 2024-05-01 328/week @ 2024-05-08 285/week @ 2024-05-15 379/week @ 2024-05-22 367/week @ 2024-05-29 317/week @ 2024-06-05 341/week @ 2024-06-12 418/week @ 2024-06-19 322/week @ 2024-06-26

1,437 downloads per month
Used in 3 crates

GPL-3.0-or-later

48KB
987 lines

Rust PulseAudio API

docs crates.io CI

pulsectl is a high level wrapper around the PulseAudio bindings supplied by libpulse-binding to make application development easier. It provides simple access to sinks, inputs, sources and outputs allowing one to write audio control programs with ease. This library is only capable of modifying PulseAudio data (e.g., changing volume, routing applications, and muting).

This is a fork of JojiiOfficial/pulsectl-rust-fork which is then a fork of krruzic/pulsectl-rust.

Example

List all currently connected playback devices.

use pulsectl::controllers::SinkController;
use pulsectl::controllers::DeviceControl;

// create handler that calls functions on playback devices and apps
let mut handler = SinkController::create().unwrap();

let devices = handler
    .list_devices()
    .expect("Could not get list of playback devices.");
    
println!("Playback Devices: ");
for dev in devices.clone() {
    println!(
        "[{}] {}, Volume: {}",
        dev.index,
        dev.description.as_ref().unwrap(),
        dev.volume.print()
    );
}

For more detailed examples, check the examples directory.

Dependencies

~2.5MB
~51K SLoC