class DiscardableSound
Defined at line 102 of file ../../src/media/sounds/soundplayer/sound.h
Container for raw LPCM sound in a VMO. A |DiscardableSound| is created from a file descriptor.
Full initialization requires |SetSize|, |SetStreamType| and |SetRestoreCallback| to be called.
Public Methods
void DiscardableSound (fbl::unique_fd fd)
Defined at line 104 of file ../../src/media/sounds/soundplayer/sound.h
void DiscardableSound ()
Defined at line 106 of file ../../src/media/sounds/soundplayer/sound.h
void ~DiscardableSound ()
Defined at line 108 of file ../../src/media/sounds/soundplayer/sound.h
int fd ()
Defined at line 110 of file ../../src/media/sounds/soundplayer/sound.h
zx_status_t SetSize (size_t size)
Sets the size and creates the VMO, or, if this method has already been called successfully,
verifies that the given size matches the size as it was previously set. In the former case,
an error is returned if the VMO creation fails. In the latter case, |ZX_ERR_INTERNAL| is
returned if the sizes don't match.
This method must be called once before |LockForRead| or |LockForWrite| are called.
Defined at line 114 of file ../../src/media/sounds/soundplayer/sound.cc
void SetRestoreCallback (fit::closure callback)
Sets the callback that restores the VMO when |LockForRead| is called and the VMO has been
discarded.
If |LockForRead| is called before this method is called, no restoration will occur.
Defined at line 131 of file ../../src/media/sounds/soundplayer/sound.h
zx_status_t SetStreamType (fuchsia::media::AudioStreamType stream_type)
Sets the stream type, or, if this method has already be called successfully, verifies that the
given stream type matches the stream type as it was previously set. In the former case,
|ZX_OK| is always returned. In the later case, |ZX_ERR_INTERNAL| is returned if the stream
types don't match.
Defined at line 137 of file ../../src/media/sounds/soundplayer/sound.cc
Protected Methods
void ApplyLockForRead ()
////////////////////////////////////////////////////////////////////////////////////////////////
DiscardableSound definitions.
Defined at line 79 of file ../../src/media/sounds/soundplayer/sound.cc
void ApplyLockForWrite ()
Defined at line 94 of file ../../src/media/sounds/soundplayer/sound.cc
void Removelock ()
Defined at line 105 of file ../../src/media/sounds/soundplayer/sound.cc
void Restore ()
Restores the locked VMO using the restore callback. This is protected (rather than private) to
enable testing.
Defined at line 146 of file ../../src/media/sounds/soundplayer/sound.cc