Skip to main content

MusicCapture

Struct MusicCapture 

Source
pub struct MusicCapture { /* private fields */ }
Expand description

Control-thread reader for synthesis register writes applied by the audio engine.

Poll Self::try_finish regularly to drain the bounded queue. Capture includes manual, prepared and live OPL writes and note releases at their actual output times. It records registers rather than PCM: fades, post-chip gain, analog mixing, MIDI and PC speaker operations are not representable in DRO. Start before programming instruments for a self-contained replay.

Stopping is acknowledged at an output-frame boundary. Keep rendering until Self::is_finished becomes true, then collect the result on this thread. Overflow permanently invalidates the capture and is reported explicitly. Dropping this reader requests a stop; callback-owned resources remain owned by the engine until it is safely dropped or reconfigured outside rendering.

Implementations§

Source§

impl MusicCapture

Source

pub fn stop(&self)

Request capture stop at the next output-frame boundary. Idempotent.

Source

pub fn is_finished(&self) -> bool

Whether the callback has acknowledged stop or capture overflow.

Source

pub fn is_overflowed(&self) -> bool

Whether the bounded queue has lost an event, invalidating this capture.

Source

pub fn try_finish(&mut self) -> Result<Option<Capture>>

Drain pending writes on this thread and take an acknowledged capture once.

Returns None until a frame boundary acknowledges stop, and after the result has been consumed. Queue overflow returns Error::CaptureOverflow once instead of a truncated capture. All conversion allocations occur here.

Trait Implementations§

Source§

impl Drop for MusicCapture

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.