#[non_exhaustive]pub enum AudioSourceSpec {
Microphone(Option<String>),
System,
Test(TestTone),
File {
path: PathBuf,
looping: bool,
},
None,
}Expand description
A parsed audio source specifier.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Microphone(Option<String>)
An input device, by the id the microphone listing reports.
None opens the default microphone.
System
Everything the machine is playing. macOS only.
Test(TestTone)
A generated tone, for publishing without a microphone.
File
An audio file, decoded and encoded like any other PCM source.
None
Publish no audio.
Implementations§
Source§impl AudioSourceSpec
impl AudioSourceSpec
Sourcepub async fn open(&self) -> Result<Option<AudioSource>, Error>
pub async fn open(&self) -> Result<Option<AudioSource>, Error>
Opens the source this specifier names, or returns None for None.
A microphone opens with the default capture config and no echo
cancellation. Build the config yourself and call
AudioSource::microphone to attach a canceller. The test tones are
stereo.
Cancellation safe.
§Errors
Fails with Error::InvalidConfig for a source this build cannot
open, such as a microphone without the capture feature or a file
without the file feature, and with Error::Device if the device
or the file does not open.
Trait Implementations§
Source§impl Clone for AudioSourceSpec
impl Clone for AudioSourceSpec
Source§impl Debug for AudioSourceSpec
impl Debug for AudioSourceSpec
Source§impl<'de> Deserialize<'de> for AudioSourceSpec
impl<'de> Deserialize<'de> for AudioSourceSpec
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for AudioSourceSpec
impl Display for AudioSourceSpec
impl Eq for AudioSourceSpec
Source§impl FromStr for AudioSourceSpec
impl FromStr for AudioSourceSpec
Source§fn from_str(spec: &str) -> Result<Self, ParseSpecError>
fn from_str(spec: &str) -> Result<Self, ParseSpecError>
Parses an audio source specifier.
An unknown kind is a device name, such as hw:0,1. Fails for file:
without a path and for an unknown test tone.
Source§type Err = ParseSpecError
type Err = ParseSpecError
Source§impl PartialEq for AudioSourceSpec
impl PartialEq for AudioSourceSpec
Source§impl Serialize for AudioSourceSpec
impl Serialize for AudioSourceSpec
impl StructuralPartialEq for AudioSourceSpec
Auto Trait Implementations§
impl Freeze for AudioSourceSpec
impl RefUnwindSafe for AudioSourceSpec
impl Send for AudioSourceSpec
impl Sync for AudioSourceSpec
impl Unpin for AudioSourceSpec
impl UnsafeUnpin for AudioSourceSpec
impl UnwindSafe for AudioSourceSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.