pub struct AudioEmulator { /* private fields */ }Expand description
Implementations§
Source§impl AudioEmulator
impl AudioEmulator
Sourcepub fn new(source: AudioSource) -> Self
pub fn new(source: AudioSource) -> Self
Create a new audio emulator with the given source
Sourcepub fn with_config(source: AudioSource, config: AudioEmulatorConfig) -> Self
pub fn with_config(source: AudioSource, config: AudioEmulatorConfig) -> Self
Create with custom configuration
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Get the configured sample rate
Sourcepub fn samples_generated(&self) -> u64
pub fn samples_generated(&self) -> u64
Get the number of samples generated so far
Sourcepub fn generate_samples(&mut self, duration_seconds: f32) -> Vec<f32>
pub fn generate_samples(&mut self, duration_seconds: f32) -> Vec<f32>
Generate samples for the specified duration in seconds
Sourcepub fn generate_n_samples(&mut self, num_samples: usize) -> Vec<f32>
pub fn generate_n_samples(&mut self, num_samples: usize) -> Vec<f32>
Generate exactly N samples
Sourcepub fn generate_mock_js(&self, samples: &[f32]) -> String
pub fn generate_mock_js(&self, samples: &[f32]) -> String
Generate JavaScript code to inject into page for mocking getUserMedia
Trait Implementations§
Source§impl Clone for AudioEmulator
impl Clone for AudioEmulator
Source§fn clone(&self) -> AudioEmulator
fn clone(&self) -> AudioEmulator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioEmulator
impl RefUnwindSafe for AudioEmulator
impl Send for AudioEmulator
impl Sync for AudioEmulator
impl Unpin for AudioEmulator
impl UnsafeUnpin for AudioEmulator
impl UnwindSafe for AudioEmulator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more