fuchsia.media.sounds

PROTOCOLS

Player

Defined in fuchsia.media.sounds/sound_player.fidl

Allows clients to play fire-and-forget sounds.

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.

Currently, only PCM WAV files are supported.

Request

NameType
id uint32
file_channel handle<channel>

Response

NameType
result Player_AddSoundFromFile_Result

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.

Request

NameType
id uint32
buffer fuchsia.mem/Buffer
stream_type fuchsia.media/AudioStreamType

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.

Request

NameType
id uint32

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 return PlaySoundError.NO_SUCH_SOUND.

Request

NameType
id uint32
usage fuchsia.media/AudioRenderUsage

Response

NameType
result Player_PlaySound_Result

STRUCTS

SomeLongAnonymousPrefix0

generated

anonymous struct

NameTypeDescriptionDefault
id uint32 No default
file_channel handle<channel> No default

Player_AddSoundFromFile_Response

generated

NameTypeDescriptionDefault

SomeLongAnonymousPrefix1

generated

anonymous struct

NameTypeDescriptionDefault
result Player_AddSoundFromFile_Result No default

SomeLongAnonymousPrefix2

generated

anonymous struct

NameTypeDescriptionDefault
id uint32 No default
buffer fuchsia.mem/Buffer No default
stream_type fuchsia.media/AudioStreamType No default

SomeLongAnonymousPrefix3

generated

anonymous struct

NameTypeDescriptionDefault
id uint32 No default

SomeLongAnonymousPrefix4

generated

anonymous struct

NameTypeDescriptionDefault
id uint32 No default
usage fuchsia.media/AudioRenderUsage No default

Player_PlaySound_Response

generated

NameTypeDescriptionDefault

SomeLongAnonymousPrefix5

generated

anonymous struct

NameTypeDescriptionDefault
result Player_PlaySound_Result No default

ENUMS

PlaySoundError

Type: uint32

Defined in fuchsia.media.sounds/sound_player.fidl

Error type for Player.PlaySound.

NameValueDescription
NO_SUCH_SOUND 1

The id passed to PlaySound is not recognized.

UNIONS

Player_AddSoundFromFile_Result

generated

NameTypeDescription
response Player_AddSoundFromFile_Response
err zx/status

Player_PlaySound_Result

generated

NameTypeDescription
response Player_PlaySound_Response
err PlaySoundError