Skip to main content

Play

Struct Play 

Source
pub struct Play {
Show 14 fields pub resampling: ResamplingQuality, pub bus: BusId, pub gain: f32, pub pan: f32, pub looping: Loop, pub fade_in: Fade, pub priority: u8, pub rate: f32, pub pitch: f32, pub variation: Variation, pub start: TimePosition, pub instances: Option<Instances>, pub position: Option<[f32; 2]>, pub emitter: Option<Emitter>,
}
Expand description

How a voice starts playing.

Fields§

§resampling: ResamplingQuality

Interpolation quality fixed at voice creation. Default sinc; Linear has no anti-alias filter and is cheaper. Integral unit-speed samples stay exact.

§bus: BusId§gain: f32

Linear gain, at least 0. Default 1.

§pan: f32

-1 (left) to 1 (right). Default 0.

§looping: Loop§fade_in: Fade§priority: u8

Decides which voice gives way when too many play. Default 128.

§rate: f32

Playback rate, which changes speed and pitch together: 2 plays twice as fast and an octave higher. 1/16..=8. Default 1.

§pitch: f32

Pitch offset in semitones on top of the rate; fractions are cents, so 0.01 is one cent. -48..=48. Rate, pitch and Variation::pitch together span 1/1024..=512 times the speed. Default 0.

§variation: Variation

Random variation of pitch and gain, drawn from the mixer’s seed.

§start: TimePosition

Where in the sound to start, in seconds or source frames; a negative position counts from the end of a sound of known length. A stream seeks there before the voice is sent. Default the start.

§instances: Option<Instances>

Limits on how many voices of this sound play at once and how often it starts.

§position: Option<[f32; 2]>

The sound’s position relative to the listener, such as the camera’s centre, in the units of MixerConfig::space. It sets the voice’s pan, replacing Play::pan, and a distance gain on top of Play::gain. Default none.

§emitter: Option<Emitter>

Optional 3D point emitter. Takes precedence over pan; cannot combine with position.

Trait Implementations§

Source§

impl Clone for Play

Source§

fn clone(&self) -> Play

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 Copy for Play

Source§

impl Debug for Play

Source§

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

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

impl Default for Play

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Play

§

impl RefUnwindSafe for Play

§

impl Send for Play

§

impl Sync for Play

§

impl Unpin for Play

§

impl UnsafeUnpin for Play

§

impl UnwindSafe for Play

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.