Trait spectrusty::audio::AudioFrame
source · pub trait AudioFrame<B>where
B: Blep,{
fn ensure_audio_frame_time(&self, blep: &mut B, sample_rate: u32, cpu_hz: f64);
fn get_audio_frame_end_time(&self) -> i32;
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§
sourcefn ensure_audio_frame_time(&self, blep: &mut B, sample_rate: u32, cpu_hz: f64)
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.
sourcefn get_audio_frame_end_time(&self) -> i32
fn get_audio_frame_end_time(&self) -> i32
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§
sourcefn end_audio_frame(&self, blep: &mut B) -> usize
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.