Crate cpvc

Crate cpvc 

Source
Expand description

cpvc is a simple cross-platform audio control crate

Currently, cpvc supports the following platforms

  • macOS
  • Windows
  • Linux (pulse_audio only)

To access platform specfic modules, you need to be on the specific OS This functionality may change in future versions

  • macOS -> coreaudio
  • windows -> wasapi
  • linux -> pulseaudio

§Controls Example

fn main() {
     
    // Gets current system output device names (human readable ones)
    let devices: Vec<String> = cpvc::get_sound_devices();
 
    // Get current system volume for default output in %
    let current_volume: u8 = cpvc::get_system_volume();
 
    // Set system volume for default output in %
    let volume: u8 = 32;
    let success = cpvc::set_system_volume(volume);
     
    // Mute default output
    let success = cpvc::set_system_volume(0);
}

Modules§

command
error
legacy
pulseaudio

Traits§

VolumeControl

Functions§

get_mute
get_sound_devices
Gathers the human readable device name of each output device detected
get_system_volume
Gathers the current volume in percent of the default output device
set_mute
set_system_volume
Sets the current volume in percent of the default output device