# Print output for @column tags ?>
public
final
class
PlaybackParams
extends Object
implements
Parcelable
| java.lang.Object | |
| ↳ | android.media.PlaybackParams |
Structure for common playback params.
Used by AudioTrack AudioTrack#getPlaybackParams() and
AudioTrack#setPlaybackParams(PlaybackParams)
to control playback behavior.
audio fallback mode: select out-of-range parameter handling.
PlaybackParams#AUDIO_FALLBACK_MODE_DEFAULT:
System will determine best handling. PlaybackParams#AUDIO_FALLBACK_MODE_MUTE:
Play silence for params normally out of range.PlaybackParams#AUDIO_FALLBACK_MODE_FAIL:
Return IllegalArgumentException from
AudioTrack.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:
AudioTrack#setPlaybackRate(int).Constants | |
|---|---|
int |
AUDIO_FALLBACK_MODE_DEFAULT
|
int |
AUDIO_FALLBACK_MODE_FAIL
|
int |
AUDIO_FALLBACK_MODE_MUTE
|
Inherited constants |
|---|
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 | |
|---|---|
public static final int AUDIO_FALLBACK_MODE_DEFAULT
Constant Value: 0 (0x00000000)
public static final int AUDIO_FALLBACK_MODE_FAIL
Constant Value: 2 (0x00000002)
public static final int AUDIO_FALLBACK_MODE_MUTE
Constant Value: 1 (0x00000001)
public PlaybackParams ()
public 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. |
public 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(android.os.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.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public int getAudioFallbackMode ()
Retrieves the audio fallback mode.
| Returns | |
|---|---|
int |
audio fallback mode
Value is AUDIO_FALLBACK_MODE_DEFAULT, AUDIO_FALLBACK_MODE_MUTE, or AUDIO_FALLBACK_MODE_FAIL |
| Throws | |
|---|---|
IllegalStateException |
if the audio fallback mode is not set. |
public float getPitch ()
Retrieves the pitch factor.
| Returns | |
|---|---|
float |
pitch |
| Throws | |
|---|---|
IllegalStateException |
if pitch is not set. |
public float getSpeed ()
Retrieves the speed factor.
| Returns | |
|---|---|
float |
speed |
| Throws | |
|---|---|
IllegalStateException |
if speed is not set. |
public PlaybackParams setAudioFallbackMode (int audioFallbackMode)
Sets the audio fallback mode.
| Parameters | |
|---|---|
audioFallbackMode |
int: Value is AUDIO_FALLBACK_MODE_DEFAULT, AUDIO_FALLBACK_MODE_MUTE, or AUDIO_FALLBACK_MODE_FAIL |
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance. |
public PlaybackParams setPitch (float pitch)
Sets the pitch factor.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance. |
| Throws | |
|---|---|
IllegalArgumentException |
if the pitch is negative. |
public PlaybackParams setSpeed (float speed)
Sets the speed factor.
| Returns | |
|---|---|
PlaybackParams |
this PlaybackParams instance. |
public 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.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |