PlaybackCommand

Enum PlaybackCommand 

Source
pub enum PlaybackCommand {
    Play(SourceId, Arc<PetalSonicAudioData>, SourceConfig, LoopMode),
    Pause(SourceId),
    Stop(SourceId),
    StopAll,
    UpdateConfig(SourceId, SourceConfig),
    Seek(SourceId, f32),
}
Expand description

Commands that can be sent to the audio engine for playback control.

These commands are used internally to communicate between the main thread and the audio processing thread. Most users will interact with playback through PetalSonicWorld methods instead.

§Variants

  • Play: Start playing an audio source with specified configuration and loop mode
  • Pause: Pause a playing audio source
  • Stop: Stop an audio source and reset its position
  • StopAll: Stop all currently playing audio sources
  • UpdateConfig: Update the spatial configuration of a playing source
  • Seek: Seek to a specific position in the audio (0.0 = start, 1.0 = end)

Variants§

§

Play(SourceId, Arc<PetalSonicAudioData>, SourceConfig, LoopMode)

Play a source with given configuration and loop mode Carries the audio data directly to avoid requiring engine to call back into world

§

Pause(SourceId)

Pause a specific source

§

Stop(SourceId)

Stop a specific source

§

StopAll

Stop all playing sources

§

UpdateConfig(SourceId, SourceConfig)

Update the configuration of a source

§

Seek(SourceId, f32)

Seek to a specific position (progress in range [0.0, 1.0])

Trait Implementations§

Source§

impl Debug for PlaybackCommand

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,