pub struct Capture {
engine: Arc<Engine>,
recording: Arc<Recording>,
max_capture: Duration,
segmenter: Option<JoinHandle<()>>,
finish_tx: Option<Sender<FinishTake>>,
answer_rx: Option<Receiver<Result<Outcome, Error>>>,
progress_rx: Option<Receiver<WindowProgress>>,
cancel: CancelToken,
}Expand description
One take in flight: the recording it grows, its segmenter, and the
channels finish hands on.
Release is tied to the value rather than to a method, so a caller that panics mid-take cannot leave the take’s threads running.
Fields§
§engine: Arc<Engine>§recording: Arc<Recording>§max_capture: Duration§segmenter: Option<JoinHandle<()>>The take’s segmenter. Taken by finish, which hands it to the
ticket; joined by Drop on the abandon path.
finish_tx: Option<Sender<FinishTake>>Dropping it aborts the segmenter: the take is over and its queued work should not run on.
answer_rx: Option<Receiver<Result<Outcome, Error>>>The take’s aggregate answer, once every segment and the tail
have run and the join has been normalized. Taken by finish.
progress_rx: Option<Receiver<WindowProgress>>Per-segment progress while the recording is still open. Taken by the host at recording start; the stream outlives the handoff to the ticket because the segmenter owns its sender throughout.
cancel: CancelTokenThis take’s cancel token, shared by every job the segmenter queues. The ticket carries a clone, so abandoning the take after finish aborts its outstanding work.
Implementations§
Source§impl Capture
impl Capture
Sourcepub fn level(&self) -> f32
pub fn level(&self) -> f32
Loudest input since the last read, in dBFS. The read is take-and-reset - it answers “peak over the window you just polled” and clears, which is what a level meter drawing one bar per window wants; a read that held the all-time peak would freeze such a meter on the first syllable.
Still a lock-free atomic, so it is safe to call from a render loop. The mutating read means two pollers steal windows from each other: one reader is the assumed caller.
Sourcepub fn meter(&self) -> CaptureMeter
pub fn meter(&self) -> CaptureMeter
The shareable polling view of this capture: level and cap
truncation, the two reads a recording loop wants. Capture
itself is Send but not Sync - it holds channel receivers -
so a host that polls a live capture from an async task borrows
this handle across awaits instead of the capture.
Sourcepub fn take_progress(&mut self) -> Option<Receiver<WindowProgress>>
pub fn take_progress(&mut self) -> Option<Receiver<WindowProgress>>
Take this take’s progress stream, if it has not been taken. Steps arrive as segments settle while the recording is still open, and again once finish has submitted the tail and the total is known.
Sourcepub fn finish_with(self, options: NormalizeOptions) -> Result<Ticket, Error>
pub fn finish_with(self, options: NormalizeOptions) -> Result<Ticket, Error>
Stop recording and queue what was captured, overriding the configured normalizer options for this recording only.
With a take already pipelining, this submits the tail and hands back a ticket over the AGGREGATE: the segmenter waits for every segment already queued, joins the raw texts, and normalizes the join once on the worker. The returned ticket resolves when the whole transcript does.
Sourcepub fn max_capture(&self) -> Duration
pub fn max_capture(&self) -> Duration
The cap this take is bounded by. A host feeding the take itself has to enforce it: a take fed by frames has no loop at all.
Sourcepub fn was_truncated(&self) -> bool
pub fn was_truncated(&self) -> bool
Whether the take reached Config::max_capture and stopped
itself. A host polling the level reads this so it can submit the
take instead of holding a seat whose take is no longer running.
Sourcefn stop_recording(&mut self)
fn stop_recording(&mut self)
Stop the take: the recording’s stop flag is what tells a pusher the take is over. The captured samples stay where they are: the segmenter holds the recording and reads the tail out of it at finish.