Struct sqa_engine::Sender
[−]
[src]
pub struct Sender<T> { pub buf: T, pub sample_rate: u64, // some fields omitted }
Corresponds to, and controls, a Player
in the audio thread.
Fields
buf: T
The buffer to write to (or not) - will be a bounded_spsc_queue::Producer<f32>
or ()
.
sample_rate: u64
The sample rate of this sender. Can differ from the output sample rate.
Methods
impl<T> Sender<T>
[src]
fn set_active(&mut self, active: bool)
Set whether this stream will play samples or not.
This essentially halts all processing related to the sender's Player
.
fn unpause(&mut self)
Start playing the stream, from this moment on.
This calls set_start_time()
with the current time, and calls set_active(true)
.
fn play_from_time(&mut self, time: u64)
Start playing the stream, as if it was supposed to start at a given time.
This calls set_start_time()
with the given time, and calls set_active(true)
.
fn set_master_volume(&mut self, vol: Box<Parameter<f32>>)
fn master_volume(&self) -> Parameter<f32>
fn set_volume(&mut self, vol: Box<Parameter<f32>>)
Set the volume of this stream.
fn volume(&self) -> Parameter<f32>
Get the volume of this stream.
fn active(&self) -> bool
Get whether this stream will play samples or not.
fn alive(&self) -> bool
Query whether this stream is alive. If this function returns false
, any other action on this stream has no effect - the stream
is no longer being processed.
fn reset_position(&mut self)
Resets this stream's position to 0.
This will also reset its start_time
to the current time as a preventative measure against calling this function without doing so
while the stream is playing.
fn position_samples(&self) -> u64
Get the stream's position in samples.
This position starts at 0 when the stream starts, and is incremented every time the stream delivers samples.
It is compared to the start_time
, meaning that you MUST NOT change one without changing the other (otherwise, the stream will
think it's out of sync). In fact, you can't!
fn position(&self) -> Duration
Get the stream's position as a Duration
.
fn output_patch(&self) -> usize
Get this stream's output patch (which channel number this stream is patched to)
fn set_output_patch(&mut self, patch: usize)
Set this stream's output patch (which channel number this stream is patched to)
An invalid output patch will cause the stream to deactivate (active
will be set to false).
fn set_start_time(&mut self, st: u64)
Set this stream's start time - the time, from the system's monotonic clock, that it starts playing at.
The stream will maintain its playback position relative to this start time, skipping frames as needed to catch up.
To get the current time from the system's monotonic clock, call Sender::precise_time_ns
.
fn make_plain(&self) -> PlainSender
Make a PlainSender
from this sender.
fn uuid(&self) -> Uuid
Get this sender's UUID.
fn precise_time_ns() -> u64
A wrapper around time::precise_time_ns()
.
Trait Implementations
impl<T> Drop for Sender<T>
[src]
fn drop(&mut self)
If this sender was the original: deactivates the stream, setting alive
to false.