Expand description
Cross-platform crate to control system audio volume.
This crate provides a unified AudioDevice type that works on Linux,
Windows, and macOS. The correct backend is selected automatically at
compile time; no feature flags or sub-crate imports are required.
| Platform | Backend | System library required |
|---|---|---|
| Linux | PulseAudio | libpulse-dev |
| Windows | WASAPI | built-in |
| macOS | CoreAudio | built-in |
§Example
use volumecontrol::AudioDevice;
fn main() -> Result<(), volumecontrol::AudioError> {
let device = AudioDevice::from_default()?;
println!("{device}"); // e.g. "Speakers ({0.0.0.00000000}.{…})"
println!("Current volume: {}%", device.get_vol()?);
Ok(())
}Structs§
- Audio
Device - A cross-platform audio output device.
- Device
Info - Metadata for an available audio device returned by
crate::AudioDevice::list.
Enums§
- Audio
Error - Error type for all volumecontrol operations.