Skip to main content

DacConfig

Struct DacConfig 

Source
pub struct DacConfig {
Show 20 fields pub buffer_target_ms: u32, pub buffer_capacity_ms: u32, pub start_threshold_ms: u32, pub processing_buffer_target_ms: u32, pub require_verified_rate: bool, pub clock_settle_delay_ms: Option<u64>, pub dsd_big_endian: Option<bool>, pub dsd_subslot: Option<u8>, pub padded_24bit: Option<bool>, pub quirks: Vec<QuirkOverride>, pub allow_unsynchronized_async: bool, pub disable_feedback: bool, pub capture_feedback_trace: bool, pub realtime_priority: bool, pub hand_back: HandBack, pub bus_queue_ms: u32, pub transfers_in_flight: u32, pub cancel_in_flight_on_flush: bool, pub startup_volume: StartupVolume, pub require_hardware_volume: bool,
}
Expand description

Every tunable of a session. DacConfig::default() is what the library was tuned with.

Fields§

§buffer_target_ms: u32

Depth the host should keep the ring at: DacStream::writable_bytes reports room up to this much. Absorbs a stall upstream (storage, network, scheduling) shorter than this. Default 250 ms.

§buffer_capacity_ms: u32

Hard capacity of the ring; write never accepts more. Default 500 ms.

§start_threshold_ms: u32

How much audio the ring must hold before the stream starts, and before a flushed ring resumes. Never above the target. Default 100 ms.

§processing_buffer_target_ms: u32

The recommended ring depth while software gain is not 1.0, so a host that processes audio itself sees changes sooner. Default 100 ms.

§require_verified_rate: bool

Refuse to stream unless the DAC confirms the sampling frequency it was told. Default true. Turning it off lets a DAC with a broken clock readback play, but the stream is then never reported bit-perfect.

§clock_settle_delay_ms: Option<u64>

Wait after programming the clock. None uses the device’s quirk value, else 20 ms.

§dsd_big_endian: Option<bool>

Native DSD byte order on the wire. None follows the device quirk (little-endian when there is none).

§dsd_subslot: Option<u8>

Subslot size (1, 2 or 4) for native DSD alternate settings. None follows the device quirk, else the descriptor.

§padded_24bit: Option<bool>

Prefer the 4-byte subslot for 24-bit PCM. None follows the device quirk (off when there is none).

§quirks: Vec<QuirkOverride>

Quirks added to the built-in table for this session.

§allow_unsynchronized_async: bool

Allow streaming an asynchronous endpoint that has no explicit feedback source. By default negotiate and open_stream refuse it with Error::ImplicitFeedbackUnsupported. Allowed, it streams at the nominal rate, host-paced, and any drift between the DAC’s clock and the host’s timing ends in underruns or overruns on the DAC; the stream is never bit-perfect (DacStream::bit_perfect_blocker says why). Default false.

§disable_feedback: bool

Disable explicit and implicit feedback for diagnosis. Default false. Asynchronous nominal playback still requires allow_unsynchronized_async.

§capture_feedback_trace: bool

Retain a bounded USB feedback support trace, including raw explicit feedback bytes. Ask the listener to enable it before opening a session.

§realtime_priority: bool

Ask for SCHED_FIFO (nice -16 as a fallback) on the output thread. Android only; ignored elsewhere. Default true.

§hand_back: HandBack

What to do with the hardware volume level on close.

§bus_queue_ms: u32

How much audio, in milliseconds, is kept queued on the USB bus: the transfers in flight together carry about this much. The same for every service interval and encoding. It is what a pause or a flush still plays out, and the headroom against a late output thread. 4 to 64, default 16. A transfer carries bus_queue_ms / transfers_in_flight of audio (2 ms by default), at most 32 packets, and the packets in flight never reach 256 (255 at most): when the configured depth would, that cap wins and less is queued.

§transfers_in_flight: u32

How many isochronous transfers are in flight at once. 2 to 16, default 8. See bus_queue_ms.

§cancel_in_flight_on_flush: bool

Cancel the transfers already on the bus when the stream is flushed, so the audio of the old position is not heard after a seek or a track change. The output thread cancels them, waits for the host controller to hand every one back, and resumes with wire-correct silence until the ring has refilled. Cancelled transfers are not lost audio, not underruns, do not clear bit-perfect, and their music is not counted as played. pause never cancels. false lets the queue play out (up to bus_queue_ms). Default true.

§startup_volume: StartupVolume

What Dac::open does with the DAC’s hardware volume before any stream can start. Default: lower it to at most -40 dB.

§require_hardware_volume: bool

open_stream fails with Error::VolumeUnavailable when the DAC has no usable hardware volume control, so the host can ask the user to allow fixed-level output and open the DAC again with this off. negotiate and capabilities work either way. Default true.

Implementations§

Source§

impl DacConfig

Source

pub fn validate(&self) -> Result<()>

Checks the combination of values.

Trait Implementations§

Source§

impl Clone for DacConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DacConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DacConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for DacConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DacConfig

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.