pub struct AudioContext<'a> {
    pub(crate) environment_callback: &'a retro_environment_t,
    pub(crate) interfaces: Arc<RwLock<InterfaceList>>,
    pub(crate) audio_sample_batch_callback: &'a retro_audio_sample_batch_t,
    pub(crate) audio_sample_callback: &'a retro_audio_sample_t,
}
Expand description

Functions that are safe to be called in Core::on_write_audio.

For a description of the callbacks see CoreWrapper.

Fields§

§environment_callback: &'a retro_environment_t§interfaces: Arc<RwLock<InterfaceList>>§audio_sample_batch_callback: &'a retro_audio_sample_batch_t§audio_sample_callback: &'a retro_audio_sample_t

Implementations§

Renders multiple audio frames in one go if AudioContext::audio_sample_batch_callback has been set.

One frame is defined as a sample of left and right channels, interleaved. I.e. let buf: [u16; 4] = [ l, r, l, r ]; would be 2 frames.

Only one of the audio callbacks must ever be used.

Renders a single audio frame if AudioContext::audio_sample_callback has been set. Should only be used if implementation generates a single sample at a time. Format is signed 16-bit native endian.

Only one of the audio callbacks must ever be used.

Trait Implementations§

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.