pub struct AudioSink {
pub state: AudioSinkState,
/* private fields */
}
Expand description
Receives audio samples to be processed for voice-activity and used as reference by the synchronization process
Fields§
§state: AudioSinkState
Implementations§
Source§impl AudioSink
impl AudioSink
Sourcepub fn default() -> Result<Self, String>
pub fn default() -> Result<Self, String>
Creates a new AudioSink
instance ready to accept sample data
Sourcepub fn send_samples(
self: &mut AudioSink,
samples: &[i16],
) -> Result<(), AudioSinkError>
pub fn send_samples( self: &mut AudioSink, samples: &[i16], ) -> Result<(), AudioSinkError>
Recieve incoming samples
Voice-activity data is processed on the fly in chunks. Remaining
samples are buffered until the next invocation or the AudioSink
is closed.
Sourcepub fn close(self: &mut AudioSink) -> Result<(), AudioSinkError>
pub fn close(self: &mut AudioSink) -> Result<(), AudioSinkError>
Closes the AudioSink
This flushes any remaining samples and finishes processing voice-activity.
AudioSink
will no longer accept samples once closed.
Sourcepub fn voice_activity(&mut self) -> VoiceActivity
pub fn voice_activity(&mut self) -> VoiceActivity
Returns voice-activity data, closing the AudioSink
if it has not been already
Sourcepub fn expected_sample_rate() -> usize
pub fn expected_sample_rate() -> usize
Returns sample rate (per second) expected by the voice detector.
Auto Trait Implementations§
impl Freeze for AudioSink
impl RefUnwindSafe for AudioSink
impl !Send for AudioSink
impl !Sync for AudioSink
impl Unpin for AudioSink
impl UnwindSafe for AudioSink
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> 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