pub struct Audio { /* private fields */ }Expand description
The audio service, from cx.audio(). Cloning it is cheap.
Implementations§
Source§impl Audio
impl Audio
Sourcepub fn default_sink(&self) -> ReadSignal<Option<Sink>>
pub fn default_sink(&self) -> ReadSignal<Option<Sink>>
The default sink. None while there is no audio server or the
server has no sink. Every caller gets the same signal.
Sourcepub fn change_volume(&self, percent: i32)
pub fn change_volume(&self, percent: i32)
Changes the default sink’s volume by percent, louder when
positive, and keeps it within 0-100%, so a step from above 100%
lands on 100%. Every channel moves by the same amount, keeping their
balance, except that one reaching 0% or 100% stops there. With no
sink or no server it does nothing.
Sourcepub fn toggle_mute(&self)
pub fn toggle_mute(&self)
Mutes the default sink, or unmutes it. With no sink or no server it does nothing.
Sourcepub fn sinks(&self) -> ReadSignal<Vec<AudioNode>>
pub fn sinks(&self) -> ReadSignal<Vec<AudioNode>>
Every sink, in the server’s order. Empty while there is no server.
Sourcepub fn sources(&self) -> ReadSignal<Vec<AudioNode>>
pub fn sources(&self) -> ReadSignal<Vec<AudioNode>>
Every source except sinks’ monitors, in the server’s order.
Sourcepub fn default_source(&self) -> ReadSignal<Option<AudioNode>>
pub fn default_source(&self) -> ReadSignal<Option<AudioNode>>
The default source, where a call’s microphone sound comes from.
Sourcepub fn streams(&self) -> ReadSignal<Vec<AudioStream>>
pub fn streams(&self) -> ReadSignal<Vec<AudioStream>>
Every app playing sound, in the server’s order.
Sourcepub fn set_default_sink(&self, name: &str)
pub fn set_default_sink(&self, name: &str)
Makes the sink called name the default.
Sourcepub fn set_default_source(&self, name: &str)
pub fn set_default_source(&self, name: &str)
Makes the source called name the default.
Sourcepub fn set_sink_volume(&self, name: &str, percent: u32)
pub fn set_sink_volume(&self, name: &str, percent: u32)
Sets every channel of the sink called name to percent, at most
100.
Sourcepub fn set_sink_mute(&self, name: &str, muted: bool)
pub fn set_sink_mute(&self, name: &str, muted: bool)
Mutes the sink called name, or unmutes it.
Sourcepub fn set_source_volume(&self, name: &str, percent: u32)
pub fn set_source_volume(&self, name: &str, percent: u32)
Sets every channel of the source called name to percent, at most
100.
Sourcepub fn set_source_mute(&self, name: &str, muted: bool)
pub fn set_source_mute(&self, name: &str, muted: bool)
Mutes the source called name, or unmutes it, as a microphone
button does.
Sourcepub fn set_stream_volume(&self, index: u32, percent: u32)
pub fn set_stream_volume(&self, index: u32, percent: u32)
Sets every channel of the stream numbered index to percent, at
most 100.
Sourcepub fn set_stream_mute(&self, index: u32, muted: bool)
pub fn set_stream_mute(&self, index: u32, muted: bool)
Mutes the stream numbered index, or unmutes it.
Sourcepub fn move_stream(&self, index: u32, sink: &str)
pub fn move_stream(&self, index: u32, sink: &str)
Moves the stream numbered index to play to the sink called sink.