pub struct SourceController {
pub handler: Handler,
}Expand description
This handles devices which takes in audio (e.g., microphone), so this is appropriate when manipulating recording devices such as microphone volume.
Fields§
§handler: HandlerImplementations§
Source§impl SourceController
impl SourceController
Sourcepub fn create() -> Result<Self, ControllerError>
pub fn create() -> Result<Self, ControllerError>
Examples found in repository?
examples/server_info.rs (line 3)
1fn main() {
2 let mut handler =
3 pulsectl::controllers::SourceController::create().expect("Failed to create handler");
4 let server_info = handler
5 .get_server_info()
6 .expect("Failed to get server info");
7
8 // Get information similar to the output of `pactl info` command
9 println!("User Name: {:?}", server_info.user_name);
10 println!("Host Name: {:?}", server_info.host_name);
11 println!("Server Name: {:?}", server_info.server_name);
12 println!("Server Version: {:?}", server_info.server_version);
13 println!(
14 "Default Sample Specification: {:?}",
15 server_info.sample_spec
16 );
17 println!("Default Channel Map: {:?}", server_info.channel_map);
18 println!("Default Sink: {:?}", server_info.default_sink_name);
19 println!("Default Source: {:?}", server_info.default_source_name);
20 println!("Cookie: {:?}", server_info.cookie);
21}Sourcepub fn get_server_info(&mut self) -> Result<ServerInfo, ControllerError>
pub fn get_server_info(&mut self) -> Result<ServerInfo, ControllerError>
Examples found in repository?
examples/server_info.rs (line 5)
1fn main() {
2 let mut handler =
3 pulsectl::controllers::SourceController::create().expect("Failed to create handler");
4 let server_info = handler
5 .get_server_info()
6 .expect("Failed to get server info");
7
8 // Get information similar to the output of `pactl info` command
9 println!("User Name: {:?}", server_info.user_name);
10 println!("Host Name: {:?}", server_info.host_name);
11 println!("Server Name: {:?}", server_info.server_name);
12 println!("Server Version: {:?}", server_info.server_version);
13 println!(
14 "Default Sample Specification: {:?}",
15 server_info.sample_spec
16 );
17 println!("Default Channel Map: {:?}", server_info.channel_map);
18 println!("Default Sink: {:?}", server_info.default_sink_name);
19 println!("Default Source: {:?}", server_info.default_source_name);
20 println!("Cookie: {:?}", server_info.cookie);
21}Trait Implementations§
Source§impl AppControl<ApplicationInfo> for SourceController
impl AppControl<ApplicationInfo> for SourceController
fn list_applications(&mut self) -> Result<Vec<ApplicationInfo>, ControllerError>
fn get_app_by_index( &mut self, index: u32, ) -> Result<ApplicationInfo, ControllerError>
fn increase_app_volume_by_percent(&mut self, index: u32, delta: f64)
fn decrease_app_volume_by_percent(&mut self, index: u32, delta: f64)
fn move_app_by_index( &mut self, stream_index: u32, device_index: u32, ) -> Result<bool, ControllerError>
fn move_app_by_name( &mut self, stream_index: u32, device_name: &str, ) -> Result<bool, ControllerError>
fn set_app_mute( &mut self, index: u32, mute: bool, ) -> Result<bool, ControllerError>
Source§impl DeviceControl<DeviceInfo> for SourceController
impl DeviceControl<DeviceInfo> for SourceController
fn get_default_device(&mut self) -> Result<DeviceInfo, ControllerError>
fn set_default_device(&mut self, name: &str) -> Result<bool, ControllerError>
fn list_devices(&mut self) -> Result<Vec<DeviceInfo>, ControllerError>
fn get_device_by_index( &mut self, index: u32, ) -> Result<DeviceInfo, ControllerError>
fn get_device_by_name( &mut self, name: &str, ) -> Result<DeviceInfo, ControllerError>
fn set_device_volume_by_index(&mut self, index: u32, volume: &ChannelVolumes)
fn set_device_volume_by_name(&mut self, name: &str, volume: &ChannelVolumes)
fn increase_device_volume_by_percent(&mut self, index: u32, delta: f64)
fn set_device_mute_by_index(&mut self, index: u32, mute: bool)
fn set_device_mute_by_name(&mut self, name: &str, mute: bool)
fn decrease_device_volume_by_percent(&mut self, index: u32, delta: f64)
Auto Trait Implementations§
impl Freeze for SourceController
impl !RefUnwindSafe for SourceController
impl !Send for SourceController
impl !Sync for SourceController
impl Unpin for SourceController
impl UnsafeUnpin for SourceController
impl !UnwindSafe for SourceController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more