AudioFrame

Trait AudioFrame 

Source
pub trait AudioFrame<B: Blep> {
    // Required methods
    fn ensure_audio_frame_time(
        &self,
        blep: &mut B,
        sample_rate: u32,
        cpu_hz: f64,
    );
    fn get_audio_frame_end_time(&self) -> FTs;

    // Provided method
    fn end_audio_frame(&self, blep: &mut B) -> usize { ... }
}
Expand description

A common trait for controllers rendering square-wave audio pulses.

This trait defines common methods to interface Blep implementations.

Required Methods§

Source

fn ensure_audio_frame_time(&self, blep: &mut B, sample_rate: u32, cpu_hz: f64)

Sets up the Blep time rate and ensures there is enough room for the single frame’s audio data.

  • sample_rate is the number of samples per second of the rendered audio,
  • cpu_hz is the number of the emulated CPU cycles (T-states) per second.
Source

fn get_audio_frame_end_time(&self) -> FTs

Returns a timestamp to be passed to Blep to end the frame.

§Panics

Panics if the current frame execution didn’t get to the near of end-of-frame. To check if you can actually call this method, invoke FrameState::is_frame_over.

Provided Methods§

Source

fn end_audio_frame(&self, blep: &mut B) -> usize

Calls Blep::end_frame to finalize the frame and prepare it for rendition.

Returns a number of samples ready to be rendered in a single channel.

§Panics

Panics if the current frame execution didn’t get to the near of end-of-frame. To check if you can actually call this method, invoke FrameState::is_frame_over.

Implementors§