pub struct RecorderState {
pub started_at: Mutex<Option<Instant>>,
pub sample_rate: u32,
pub max_samples: usize,
pub format: Mutex<RecordFormat>,
/* private fields */
}Expand description
Handle shared between audio callback and UI thread.
- Callback:
buffer.lock()and pushes f32 interleaved samples. - UI: calls
stop()to swap out the buffer and spawn encoder.
Fields§
§started_at: Mutex<Option<Instant>>§sample_rate: u32§max_samples: usize§format: Mutex<RecordFormat>Which container to write when the user stops recording.
Defaults to FLAC; toggled by the f key in the TUI.
Implementations§
Source§impl RecorderState
impl RecorderState
pub fn new(sample_rate: u32) -> Arc<Self>
pub fn is_recording(&self) -> bool
pub fn elapsed_seconds(&self) -> f32
pub fn start(&self)
Sourcepub fn push_frame(&self, l: f32, r: f32)
pub fn push_frame(&self, l: f32, r: f32)
Called from the audio callback for every output frame.
Sourcepub fn stop_and_encode(&self, dir: &Path) -> Result<PathBuf>
pub fn stop_and_encode(&self, dir: &Path) -> Result<PathBuf>
Stop capture and spawn the encoder thread. Returns target path.
pub fn toggle_format(&self) -> RecordFormat
pub fn current_format(&self) -> RecordFormat
Auto Trait Implementations§
impl !Freeze for RecorderState
impl !RefUnwindSafe for RecorderState
impl Send for RecorderState
impl Sync for RecorderState
impl Unpin for RecorderState
impl UnsafeUnpin for RecorderState
impl UnwindSafe for RecorderState
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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