PlaybackParams
public
final
class
PlaybackParams
extends Object
implements
Parcelable
| java.lang.Object | |
| ↳ | android.media.PlaybackParams |
Structure for common playback params.
Used by AudioTrack getPlaybackParams() and
setPlaybackParams(PlaybackParams)
to control playback behavior.
audio fallback mode: select out-of-range parameter handling.
-
AUDIO_FALLBACK_MODE_DEFAULT: System will determine best handling. -
AUDIO_FALLBACK_MODE_MUTE: Play silence for params normally out of range. -
AUDIO_FALLBACK_MODE_FAIL: ReturnIllegalArgumentExceptionfromAudioTrack.setPlaybackParams(PlaybackParams).
pitch: increases or decreases the tonal frequency of the audio content. It is expressed as a multiplicative factor, where normal pitch is 1.0f.
speed: increases or decreases the time to play back a set of audio or video frames. It is expressed as a multiplicative factor, where normal speed is 1.0f.
Different combinations of speed and pitch may be used for audio playback; some common ones:
- Pitch equals 1.0f. Speed change will be done with pitch preserved, often called timestretching.
- Pitch equals speed. Speed change will be done by resampling,
similar to
setPlaybackRate(int).
Summary
Constants | |
|---|---|
int |
AUDIO_FALLBACK_MODE_DEFAULT
|
int |
AUDIO_FALLBACK_MODE_FAIL
|
int |
AUDIO_FALLBACK_MODE_MUTE
|
Inherited constants |
|---|
android.os.Parcelable
|
Fields | |
|---|---|
public
static
final
Creator<PlaybackParams> |
CREATOR
|
Public constructors | |
|---|---|
PlaybackParams()
|
|
Public methods | |
|---|---|
PlaybackParams
|
allowDefaults()
Allows defaults to be returned for properties not set. |
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
int
|
getAudioFallbackMode()
Retrieves the audio fallback mode. |
float
|
getPitch()
Retrieves the pitch factor. |
float
|
getSpeed()
Retrieves the speed factor. |
PlaybackParams
|
setAudioFallbackMode(int audioFallbackMode)
Sets the audio fallback mode. |
PlaybackParams
|
setPitch(float pitch)
Sets the pitch factor. |
PlaybackParams
|
setSpeed(float speed)
Sets the speed factor. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
|---|---|
java.lang.Object
| |
android.os.Parcelable
| |
Constants
AUDIO_FALLBACK_MODE_DEFAULT
int AUDIO_FALLBACK_MODE_DEFAULT
Constant Value: 0 (0x00000000)
AUDIO_FALLBACK_MODE_FAIL
int AUDIO_FALLBACK_MODE_FAIL
Constant Value: 2 (0x00000002)
AUDIO_FALLBACK_MODE_MUTE
int AUDIO_FALLBACK_MODE_MUTE
Constant Value: 1 (0x00000001)
Fields
Public constructors
Public methods
allowDefaults
PlaybackParams allowDefaults ()
Allows defaults to be returned for properties not set.
Otherwise a IllegalArgumentException exception
is raised when getting those properties
which have defaults but have never been set.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance.
|
describeContents
int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(Parcel, int),
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR bit.
| Returns | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
getAudioFallbackMode
int getAudioFallbackMode ()
Retrieves the audio fallback mode.
| Returns | |
|---|---|
int |
audio fallback mode |
| Throws | |
|---|---|
IllegalStateException |
if the audio fallback mode is not set. |
getPitch
float getPitch ()
Retrieves the pitch factor.
| Returns | |
|---|---|
float |
pitch |
| Throws | |
|---|---|
IllegalStateException |
if pitch is not set. |
getSpeed
float getSpeed ()
Retrieves the speed factor.
| Returns | |
|---|---|
float |
speed |
| Throws | |
|---|---|
IllegalStateException |
if speed is not set. |
setAudioFallbackMode
PlaybackParams setAudioFallbackMode (int audioFallbackMode)
Sets the audio fallback mode.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance.
|
setPitch
PlaybackParams setPitch (float pitch)
Sets the pitch factor.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance. |
| Throws | |
|---|---|
|
if the pitch is negative |
setSpeed
PlaybackParams setSpeed (float speed)
Sets the speed factor.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance.
|
writeToParcel
void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel:
The Parcel in which the object should be written. |
flags |
int:
Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
|
Interfaces
- AudioManager.OnAudioFocusChangeListener
- AudioRecord.OnRecordPositionUpdateListener
- AudioRecord.OnRoutingChangedListener
- AudioRouting
- AudioRouting.OnRoutingChangedListener
- AudioTrack.OnPlaybackPositionUpdateListener
- AudioTrack.OnRoutingChangedListener
- ImageReader.OnImageAvailableListener
- ImageWriter.OnImageReleasedListener
- JetPlayer.OnJetEventListener
- MediaCodec.OnFrameRenderedListener
- MediaDrm.OnEventListener
- MediaDrm.OnExpirationUpdateListener
- MediaDrm.OnKeyStatusChangeListener
- MediaPlayer.OnBufferingUpdateListener
- MediaPlayer.OnCompletionListener
- MediaPlayer.OnErrorListener
- MediaPlayer.OnInfoListener
- MediaPlayer.OnPreparedListener
- MediaPlayer.OnSeekCompleteListener
- MediaPlayer.OnTimedMetaDataAvailableListener
- MediaPlayer.OnTimedTextListener
- MediaPlayer.OnVideoSizeChangedListener
- MediaRecorder.OnErrorListener
- MediaRecorder.OnInfoListener
- MediaScannerConnection.MediaScannerConnectionClient
- MediaScannerConnection.OnScanCompletedListener
- MediaSync.OnErrorListener
- RemoteControlClient.OnGetPlaybackPositionListener
- RemoteControlClient.OnMetadataUpdateListener
- RemoteControlClient.OnPlaybackPositionUpdateListener
- RemoteController.OnClientUpdateListener
- SoundPool.OnLoadCompleteListener
Classes
- AsyncPlayer
- AudioAttributes
- AudioAttributes.Builder
- AudioDeviceCallback
- AudioDeviceInfo
- AudioFormat
- AudioFormat.Builder
- AudioManager
- AudioManager.AudioRecordingCallback
- AudioRecord
- AudioRecord.Builder
- AudioRecordingConfiguration
- AudioTimestamp
- AudioTrack
- AudioTrack.Builder
- CamcorderProfile
- CameraProfile
- DrmInitData
- DrmInitData.SchemeInitData
- ExifInterface
- FaceDetector
- FaceDetector.Face
- Image
- Image.Plane
- ImageReader
- ImageWriter
- JetPlayer
- MediaActionSound
- MediaCodec
- MediaCodec.BufferInfo
- MediaCodec.Callback
- MediaCodec.CryptoInfo
- MediaCodec.CryptoInfo.Pattern
- MediaCodecInfo
- MediaCodecInfo.AudioCapabilities
- MediaCodecInfo.CodecCapabilities
- MediaCodecInfo.CodecProfileLevel
- MediaCodecInfo.EncoderCapabilities
- MediaCodecInfo.VideoCapabilities
- MediaCodecList
- MediaCrypto
- MediaDataSource
- MediaDescription
- MediaDescription.Builder
- MediaDrm
- MediaDrm.CryptoSession
- MediaDrm.KeyRequest
- MediaDrm.KeyStatus
- MediaDrm.ProvisionRequest
- MediaExtractor
- MediaFormat
- MediaMetadata
- MediaMetadata.Builder
- MediaMetadataEditor
- MediaMetadataRetriever
- MediaMuxer
- MediaMuxer.OutputFormat
- MediaPlayer
- MediaPlayer.TrackInfo
- MediaRecorder
- MediaRecorder.AudioEncoder
- MediaRecorder.AudioSource
- MediaRecorder.OutputFormat
- MediaRecorder.VideoEncoder
- MediaRecorder.VideoSource
- MediaRouter
- MediaRouter.Callback
- MediaRouter.RouteCategory
- MediaRouter.RouteGroup
- MediaRouter.RouteInfo
- MediaRouter.SimpleCallback
- MediaRouter.UserRouteInfo
- MediaRouter.VolumeCallback
- MediaScannerConnection
- MediaSync
- MediaSync.Callback
- MediaSyncEvent
- MediaTimestamp
- PlaybackParams
- Rating
- RemoteControlClient
- RemoteControlClient.MetadataEditor
- RemoteController
- RemoteController.MetadataEditor
- Ringtone
- RingtoneManager
- SoundPool
- SoundPool.Builder
- SyncParams
- ThumbnailUtils
- TimedMetaData
- TimedText
- ToneGenerator
- VolumeProvider
Exceptions


