pub struct EngineConfig {
pub buffer_size: u32,
pub sample_rate: u32,
}Expand description
Configuration for the audio engine.
Fields§
§buffer_size: u32Audio buffer size in samples. Lower = less latency, more CPU. Typical values: 32, 64, 128, 256, 512.
sample_rate: u32Sample rate in Hz. Typical values: 44100, 48000, 96000.
Implementations§
Source§impl EngineConfig
impl EngineConfig
Sourcepub fn buffer_duration_secs(&self) -> f64
pub fn buffer_duration_secs(&self) -> f64
Buffer duration in seconds.
Sourcepub fn buffer_duration_ms(&self) -> f64
pub fn buffer_duration_ms(&self) -> f64
Buffer duration in milliseconds.
Trait Implementations§
Source§impl Clone for EngineConfig
impl Clone for EngineConfig
Source§fn clone(&self) -> EngineConfig
fn clone(&self) -> EngineConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EngineConfig
Source§impl Debug for EngineConfig
impl Debug for EngineConfig
Source§impl Default for EngineConfig
impl Default for EngineConfig
Source§fn default() -> Self
fn default() -> Self
The numbers to run at when there is no device to ask — --no-audio,
or a backend that would not open.
Deliberately not the general-purpose starting point it looks like. As
soon as a device is open, the config comes from the device via
From<StreamFormat>; reaching for this instead is how an engine ends
up at a rate the stream is not running at. It is here for the case
where nothing is listening, and in that case the numbers only have to
be self-consistent.
Source§impl<'de> Deserialize<'de> for EngineConfig
impl<'de> Deserialize<'de> for EngineConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EngineConfig
Source§impl From<EngineConfig> for AudioRequest
impl From<EngineConfig> for AudioRequest
Source§fn from(config: EngineConfig) -> Self
fn from(config: EngineConfig) -> Self
“Run at exactly this” as a request. Used by callers that already hold concrete numbers — the headless test apps, which open no device at all.
Source§impl From<StreamFormat> for EngineConfig
impl From<StreamFormat> for EngineConfig
Source§fn from(format: StreamFormat) -> Self
fn from(format: StreamFormat) -> Self
The config the engine must be built from once a device has been opened.
buffer_size falls back to the largest block the device may deliver
when the device was left to choose its own: nothing sizes a buffer from
this field any more — the mixer takes max_buffer_frames directly — so
the honest value for a block size we were never told is the worst case
rather than a guess.