pub struct RateContract { /* private fields */ }Expand description
Timing agreement a stream port advertises and must share to connect.
Pairs a ClockDomain with a LatencyClass and an optional nominal
sample rate in hertz. Two ports may be wired together only when their
contracts are compatible (see is_compatible_with).
Implementations§
Source§impl RateContract
impl RateContract
Sourcepub fn new(
clock_domain: ClockDomain,
latency_class: LatencyClass,
nominal_rate_hz: Option<u32>,
) -> Self
pub fn new( clock_domain: ClockDomain, latency_class: LatencyClass, nominal_rate_hz: Option<u32>, ) -> Self
Builds a contract from an explicit clock domain, latency class, and optional nominal rate.
Sourcepub fn sample_exact(nominal_rate_hz: Option<u32>) -> Self
pub fn sample_exact(nominal_rate_hz: Option<u32>) -> Self
Contract for sample-exact audio: sample clock domain, sample-exact latency, and the given nominal rate.
Sourcepub fn block_local() -> Self
pub fn block_local() -> Self
Contract for block-local processing: block clock domain and block-local latency, with no fixed nominal rate.
Sourcepub fn control() -> Self
pub fn control() -> Self
Contract for interactive control traffic: control clock domain and interactive latency.
Sourcepub fn midi_tick() -> Self
pub fn midi_tick() -> Self
Contract for MIDI-tick traffic: MIDI-tick clock domain and interactive latency.
Sourcepub fn trace_step() -> Self
pub fn trace_step() -> Self
Contract for offline trace stepping: trace-step clock domain and offline-render latency.
Sourcepub fn clock_domain(self) -> ClockDomain
pub fn clock_domain(self) -> ClockDomain
Returns the clock domain this contract runs in.
Sourcepub fn latency_class(self) -> LatencyClass
pub fn latency_class(self) -> LatencyClass
Returns the latency class this contract promises.
Sourcepub fn nominal_rate_hz(self) -> Option<u32>
pub fn nominal_rate_hz(self) -> Option<u32>
Returns the nominal sample rate in hertz, if one is fixed.
Sourcepub fn is_compatible_with(self, other: Self) -> bool
pub fn is_compatible_with(self, other: Self) -> bool
Reports whether self and other may be connected.
Compatible means matching clock domain and latency class; nominal rates must agree only when both are fixed (an unset rate matches any rate).
Sourcepub fn ensure_compatible(self, other: Self) -> Result<()>
pub fn ensure_compatible(self, other: Self) -> Result<()>
Checks compatibility with other, returning a descriptive error when
the two contracts cannot be connected.
Trait Implementations§
Source§impl Clone for RateContract
impl Clone for RateContract
Source§fn clone(&self) -> RateContract
fn clone(&self) -> RateContract
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 RateContract
Source§impl Debug for RateContract
impl Debug for RateContract
impl Eq for RateContract
Source§impl PartialEq for RateContract
impl PartialEq for RateContract
Source§fn eq(&self, other: &RateContract) -> bool
fn eq(&self, other: &RateContract) -> bool
self and other values to be equal, and is used by ==.