pub struct StreamInstant { /* private fields */ }Expand description
A monotonic time instance associated with a stream, retrieved from either:
- A timestamp provided to the stream’s underlying audio data callback or
- The same time source used to generate timestamps for a stream’s underlying audio data callback.
StreamInstant represents a duration since an unspecified origin point. The origin
is guaranteed to occur at or before the stream starts, and remains consistent for the
lifetime of that stream. Different streams may have different origins.
§Host StreamInstant Sources
| Host | Source |
|---|---|
| alsa | snd_pcm_status_get_htstamp |
| coreaudio | mach_absolute_time |
| wasapi | QueryPerformanceCounter |
| asio | timeGetTime |
| emscripten | AudioContext.getOutputTimestamp |
Implementations§
Source§impl StreamInstant
impl StreamInstant
Sourcepub fn duration_since(&self, earlier: &Self) -> Option<Duration>
pub fn duration_since(&self, earlier: &Self) -> Option<Duration>
The amount of time elapsed from another instant to this one.
Returns None if earlier is later than self.
Sourcepub fn add(&self, duration: Duration) -> Option<Self>
pub fn add(&self, duration: Duration) -> Option<Self>
Returns the instant in time after the given duration has passed.
Returns None if the resulting instant would exceed the bounds of the underlying data
structure.
Sourcepub fn sub(&self, duration: Duration) -> Option<Self>
pub fn sub(&self, duration: Duration) -> Option<Self>
Returns the instant in time one duration ago.
Returns None if the resulting instant would underflow. As a result, it is important to
consider that on some platforms the StreamInstant may begin at 0 from the moment the
source stream is created.
pub fn new(secs: i64, nanos: u32) -> Self
Trait Implementations§
Source§impl Clone for StreamInstant
impl Clone for StreamInstant
Source§fn clone(&self) -> StreamInstant
fn clone(&self) -> StreamInstant
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more