pub enum PlayerRequest {
    AddSoundFromFile {
        id: u32,
        file: ClientEnd<FileMarker>,
        responder: PlayerAddSoundFromFileResponder,
    },
    AddSoundBuffer {
        id: u32,
        buffer: Buffer,
        stream_type: AudioStreamType,
        control_handle: PlayerControlHandle,
    },
    RemoveSound {
        id: u32,
        control_handle: PlayerControlHandle,
    },
    PlaySound {
        id: u32,
        usage: AudioRenderUsage,
        responder: PlayerPlaySoundResponder,
    },
    StopPlayingSound {
        id: u32,
        control_handle: PlayerControlHandle,
    },
}
Expand description

Allows clients to play fire-and-forget sounds.

Variants§

§

AddSoundFromFile

Adds a sound to the collection maintained for the client, reading the sound from a file. If id identifies an existing sound in the collection, the service will close the connection. Returns the duration of the sound or an error status returned from an I/O operation.

Currently, only PCM WAV files and Ogg/Opus files are supported.

Fields

§id: u32
§file: ClientEnd<FileMarker>
§

AddSoundBuffer

Adds a sound, in the form of a buffer containing raw PCM samples, to the collection maintained for the client. The service will retain a handle to the buffer’s VMO until the sound is removed and is no longer playing or until the connection is closed.

If id identifies an existing sound in the collection, the service will close the connection.

Fields

§id: u32
§buffer: Buffer
§stream_type: AudioStreamType
§control_handle: PlayerControlHandle
§

RemoveSound

Removes a sound from the collection maintained for the client. A sound can be removed even if a PlaySound method is pending for that sound.

If id doesn’t identify an existing sound in the collection, the service will do nothing. This is tolerated so that clients don’t have to wait for the response from AddSoundFromFile before playing and removing the sound.

Removing an unneeded sound frees the resources associated with that sound, principally the VMO required to store the uncompressed sound.

Fields

§id: u32
§control_handle: PlayerControlHandle
§

PlaySound

Plays the existing sound identified by id using a renderer with usage usage. The sound is played as soon as possible. The reply is sent when the sound is finished playing. If id doesn’t identify an existing sound in the collection, the method returns PlaySoundError.NO_SUCH_SOUND. The most recent PlaySound call for a given valid id can be stopped using StopPlayingSound, in which case, this method returns PlaySoundError.STOPPED.

Fields

§id: u32
§usage: AudioRenderUsage
§

StopPlayingSound

Stops playback of the sound identified by id invoked by the the most recent call to PlaySound for that sound. If id doesn’t identify an existing sound in the collection or if the sound is not currently playing, this method does nothing. If more than one PlaySound method is currently pending for that sound, only the most recent is stopped.

Fields

§id: u32
§control_handle: PlayerControlHandle

Implementations§

source§

impl PlayerRequest

source

pub fn into_add_sound_from_file( self ) -> Option<(u32, ClientEnd<FileMarker>, PlayerAddSoundFromFileResponder)>

source

pub fn into_add_sound_buffer( self ) -> Option<(u32, Buffer, AudioStreamType, PlayerControlHandle)>

source

pub fn into_remove_sound(self) -> Option<(u32, PlayerControlHandle)>

source

pub fn into_play_sound( self ) -> Option<(u32, AudioRenderUsage, PlayerPlaySoundResponder)>

source

pub fn into_stop_playing_sound(self) -> Option<(u32, PlayerControlHandle)>

source

pub fn method_name(&self) -> &'static str

Name of the method defined in FIDL

Trait Implementations§

source§

impl Debug for PlayerRequest

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
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more