java.lang.Object | |
↳ | com.h6ah4i.android.media.compat.AudioAttributes |
A class to encapsulate a collection of attributes describing information about an audio stream.
AudioAttributes
supersede the notion of stream types (see for
instance STREAM_MUSIC
or
STREAM_ALARM
) for defining the behavior of audio
playback. Attributes allow an application to specify more information than is
conveyed in a stream type by allowing the application to define:
USAGE_MEDIA
and USAGE_ALARM
. These two examples are the
closest to stream types, but more detailed use cases are available. Usage
information is more expressive than a stream type, and allows certain
platforms or routing policies to use this information for more refined volume
or routing decisions. Usage is the most important information to supply in
AudioAttributes
and it is recommended to build any instance with
this information supplied, see AudioAttributes.Builder
for
exceptions.CONTENT_TYPE_MOVIE
for a movie streaming
service or CONTENT_TYPE_MUSIC
for a music playback application) this
information might be used by the audio framework to selectively configure
some audio post-processing blocks.
AudioAttributes
are used for example in one of the
AudioTrack constructors (see
AudioTrack#AudioTrack(AudioAttributes, AudioFormat, int, int, int)),
to configure a IBasicMediaPlayer
(see
setAudioAttributes(AudioAttributes)
or a
android.app.Notification (see
audioAttributes
). An
AudioAttributes
instance is built through its builder,
AudioAttributes.Builder
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | AudioAttributes.Builder | Builder class for AudioAttributes objects. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CONTENT_TYPE_MOVIE | Content type value to use when the content type is a soundtrack, typically accompanying a movie or TV program. | |||||||||
int | CONTENT_TYPE_MUSIC | Content type value to use when the content type is music. | |||||||||
int | CONTENT_TYPE_SONIFICATION | Content type value to use when the content type is a sound used to accompany a user action, such as a beep or sound effect expressing a key click, or event, such as the type of a sound for a bonus being received in a game. | |||||||||
int | CONTENT_TYPE_SPEECH | Content type value to use when the content type is speech. | |||||||||
int | CONTENT_TYPE_UNKNOWN | Content type value to use when the content type is unknown, or other than the ones defined. | |||||||||
int | FLAG_AUDIBILITY_ENFORCED | Flag defining a behavior where the audibility of the sound will be ensured by the system. | |||||||||
int | FLAG_HW_AV_SYNC | Flag requesting the use of an output stream supporting hardware A/V synchronization. | |||||||||
int | USAGE_ALARM | Usage value to use when the usage is an alarm (e.g. | |||||||||
int | USAGE_ASSISTANCE_ACCESSIBILITY | Usage value to use when the usage is for accessibility, such as with a screen reader. | |||||||||
int | USAGE_ASSISTANCE_NAVIGATION_GUIDANCE | Usage value to use when the usage is driving or navigation directions. | |||||||||
int | USAGE_ASSISTANCE_SONIFICATION | Usage value to use when the usage is sonification, such as with user interface sounds. | |||||||||
int | USAGE_GAME | Usage value to use when the usage is for game audio. | |||||||||
int | USAGE_MEDIA | Usage value to use when the usage is media, such as music, or movie soundtracks. | |||||||||
int | USAGE_NOTIFICATION | Usage value to use when the usage is notification. | |||||||||
int | USAGE_NOTIFICATION_COMMUNICATION_DELAYED | Usage value to use when the usage is notification for a non-immediate type of communication such as e-mail. | |||||||||
int | USAGE_NOTIFICATION_COMMUNICATION_INSTANT | Usage value to use when the usage is notification for an "instant" communication such as a chat, or SMS. | |||||||||
int | USAGE_NOTIFICATION_COMMUNICATION_REQUEST | Usage value to use when the usage is a request to enter/end a communication, such as a VoIP communication or video-conference. | |||||||||
int | USAGE_NOTIFICATION_EVENT | Usage value to use when the usage is to attract the user's attention, such as a reminder or low battery warning. | |||||||||
int | USAGE_NOTIFICATION_RINGTONE | Usage value to use when the usage is telephony ringtone. | |||||||||
int | USAGE_UNKNOWN | Usage value to use when the usage is unknown. | |||||||||
int | USAGE_VOICE_COMMUNICATION | Usage value to use when the usage is voice communications, such as telephony or VoIP. | |||||||||
int | USAGE_VOICE_COMMUNICATION_SIGNALLING | Usage value to use when the usage is in-call signalling, such as with a "busy" beep, or DTMF tones. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Creator<AudioAttributes> | CREATOR |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | describeContents() | ||||||||||
boolean | equals(Object o) | ||||||||||
int |
getContentType()
Return the content type.
| ||||||||||
int |
getFlags()
Return the flags.
| ||||||||||
int |
getUsage()
Return the usage.
| ||||||||||
int | hashCode() | ||||||||||
String | toString() | ||||||||||
void | writeToParcel(Parcel dest, int flags) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Content type value to use when the content type is a soundtrack, typically accompanying a movie or TV program.
Content type value to use when the content type is music.
Content type value to use when the content type is a sound used to accompany a user action, such as a beep or sound effect expressing a key click, or event, such as the type of a sound for a bonus being received in a game. These sounds are mostly synthesized or short Foley sounds.
Content type value to use when the content type is speech.
Content type value to use when the content type is unknown, or other than the ones defined.
Flag defining a behavior where the audibility of the sound will be ensured by the system.
Flag requesting the use of an output stream supporting hardware A/V synchronization.
Usage value to use when the usage is an alarm (e.g. wake-up alarm).
Usage value to use when the usage is for accessibility, such as with a screen reader.
Usage value to use when the usage is driving or navigation directions.
Usage value to use when the usage is sonification, such as with user interface sounds.
Usage value to use when the usage is for game audio.
Usage value to use when the usage is media, such as music, or movie soundtracks.
Usage value to use when the usage is notification. See other notification usages for more specialized uses.
Usage value to use when the usage is notification for a non-immediate type of communication such as e-mail.
Usage value to use when the usage is notification for an "instant" communication such as a chat, or SMS.
Usage value to use when the usage is a request to enter/end a communication, such as a VoIP communication or video-conference.
Usage value to use when the usage is to attract the user's attention, such as a reminder or low battery warning.
Usage value to use when the usage is telephony ringtone.
Usage value to use when the usage is unknown.
Usage value to use when the usage is voice communications, such as telephony or VoIP.
Usage value to use when the usage is in-call signalling, such as with a "busy" beep, or DTMF tones.
Return the content type.
setContentType(int)
Return the flags.