# AudioAttributesCompat

Artifact: [androidx.media:media](https://developer.android.com/jetpack/androidx/releases/media) [View Source](https://cs.android.com/search?q=file:androidx/media/AudioAttributesCompat.java+class:androidx.media.AudioAttributesCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

*** ** * ** ***


```
class AudioAttributesCompat : VersionedParcelable
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> androidx.media is deprecated. Please migrate to [androidx.media3](https://developer.android.com/media/media3).

A class to encapsulate a collection of attributes describing information about an audio stream.

`AudioAttributesCompat` supersede the notion of stream types (see for instance `https://developer.android.com/reference/android/media/AudioManager.html#STREAM_MUSIC` or `https://developer.android.com/reference/android/media/AudioManager.html#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: "why" you are playing a sound, what is this sound used for. This is achieved with the "usage" information. Examples of usage are `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_MEDIA()` and `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#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 `
  AudioAttributesCompat` and it is recommended to build any instance with this information supplied, see `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder` for exceptions.
- content type: "what" you are playing. The content type expresses the general category of the content. This information is optional. But in case it is known (for instance `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_MOVIE()` for a movie streaming service or `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#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.
- flags: "how" is playback to be affected, see the flag definitions for the specific playback behaviors they control.

`AudioAttributesCompat` instance is built through its builder, `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder`. Also see `https://developer.android.com/reference/android/media/AudioAttributes.html` for the framework implementation of this class.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder` **This class is deprecated.** androidx.media is deprecated. <br /> |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_MOVIE() = 3` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_MUSIC() = 2` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_SONIFICATION() = 4` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_SPEECH() = 1` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#CONTENT_TYPE_UNKNOWN() = 0` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#FLAG_AUDIBILITY_ENFORCED() = 1` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#FLAG_HW_AV_SYNC() = 16` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_ALARM() = 4` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_ASSISTANCE_ACCESSIBILITY() = 11` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE() = 12` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_ASSISTANCE_SONIFICATION() = 13` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_ASSISTANT() = 16` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_GAME() = 14` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_MEDIA() = 1` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION() = 5` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION_COMMUNICATION_DELAYED() = 9` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION_COMMUNICATION_INSTANT() = 8` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION_COMMUNICATION_REQUEST() = 7` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION_EVENT() = 10` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_NOTIFICATION_RINGTONE() = 6` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_UNKNOWN() = 0` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_VOICE_COMMUNICATION() = 2` **This property is deprecated.** Deprecated in Java |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#USAGE_VOICE_COMMUNICATION_SIGNALLING() = 3` **This property is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[equals](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#equals(java.lang.Object))(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getContentType](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getContentType())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getFlags](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getFlags())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getLegacyStreamType](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getLegacyStreamType())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getUsage](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getUsage())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getVolumeControlStream](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getVolumeControlStream())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[hashCode](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#hashCode())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `[toString](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#toString())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `[unwrap](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#unwrap())()` **This function is deprecated.** Deprecated in Java |
| `java-static https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat?` | `[wrap](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#wrap(java.lang.Object))(aa: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)` **This function is deprecated.** Deprecated in Java |

## Constants

### CONTENT_TYPE_MOVIE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val CONTENT_TYPE_MOVIE = 3: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Content type value to use when the content type is a soundtrack, typically accompanying a movie or TV program.

### CONTENT_TYPE_MUSIC

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val CONTENT_TYPE_MUSIC = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Content type value to use when the content type is music.

### CONTENT_TYPE_SONIFICATION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val CONTENT_TYPE_SONIFICATION = 4: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

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_SPEECH

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val CONTENT_TYPE_SPEECH = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Content type value to use when the content type is speech.

### CONTENT_TYPE_UNKNOWN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val CONTENT_TYPE_UNKNOWN = 0: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Content type value to use when the content type is unknown, or other than the ones defined.

### FLAG_AUDIBILITY_ENFORCED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val FLAG_AUDIBILITY_ENFORCED = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Flag defining a behavior where the audibility of the sound will be ensured by the system.

### FLAG_HW_AV_SYNC

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val FLAG_HW_AV_SYNC = 16: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Flag requesting the use of an output stream supporting hardware A/V synchronization.

### USAGE_ALARM

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_ALARM = 4: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is an alarm (e.g. wake-up alarm).

### USAGE_ASSISTANCE_ACCESSIBILITY

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_ASSISTANCE_ACCESSIBILITY = 11: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is for accessibility, such as with a screen reader.

### USAGE_ASSISTANCE_NAVIGATION_GUIDANCE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is driving or navigation directions.

### USAGE_ASSISTANCE_SONIFICATION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_ASSISTANCE_SONIFICATION = 13: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is sonification, such as with user interface sounds.

### USAGE_ASSISTANT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_ASSISTANT = 16: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use for audio responses to user queries, audio instructions or help utterances.

### USAGE_GAME

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_GAME = 14: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is for game audio.

### USAGE_MEDIA

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_MEDIA = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is media, such as music, or movie soundtracks.

### USAGE_NOTIFICATION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION = 5: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is notification. See other notification usages for more specialized uses.

### USAGE_NOTIFICATION_COMMUNICATION_DELAYED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is notification for a non-immediate type of communication such as e-mail.

### USAGE_NOTIFICATION_COMMUNICATION_INSTANT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is notification for an "instant" communication such as a chat, or SMS.

### USAGE_NOTIFICATION_COMMUNICATION_REQUEST

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is a request to enter/end a communication, such as a VoIP communication or video-conference.

### USAGE_NOTIFICATION_EVENT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION_EVENT = 10: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is to attract the user's attention, such as a reminder or low battery warning.

### USAGE_NOTIFICATION_RINGTONE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_NOTIFICATION_RINGTONE = 6: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is telephony ringtone.

### USAGE_UNKNOWN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_UNKNOWN = 0: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is unknown.

### USAGE_VOICE_COMMUNICATION

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_VOICE_COMMUNICATION = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is voice communications, such as telephony or VoIP.

### USAGE_VOICE_COMMUNICATION_SIGNALLING

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
const val USAGE_VOICE_COMMUNICATION_SIGNALLING = 3: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> Deprecated in Java

Usage value to use when the usage is in-call signalling, such as with a "busy" beep, or DTMF tones.

## Public functions

### equals

```
fun [equals](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#equals(java.lang.Object))(o: Any!): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

### getContentType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [getContentType](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getContentType())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns the content type.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | one of the values that can be set in `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder#setContentType(int)` |

### getFlags

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [getFlags](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getFlags())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns the flags.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a combined mask of all flags |

### getLegacyStreamType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [getLegacyStreamType](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getLegacyStreamType())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns a stream type passed to `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder#setLegacyStreamType(int)`, or best guessing from flags and usage, or -1 if there is no converting logic in framework side (API 21+).

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the stream type {@see AudioManager} |

### getUsage

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [getUsage](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getUsage())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns the usage.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | one of the values that can be set in `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat.Builder#setUsage(int)` |

### getVolumeControlStream

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [getVolumeControlStream](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#getVolumeControlStream())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Returns the stream type matching the given attributes for volume control. Use this method to derive the stream type needed to configure the volume control slider in an `https://developer.android.com/reference/android/app/Activity.html` with `https://developer.android.com/reference/android/app/Activity.html#setVolumeControlStream(int)`. Do not use this method to set the stream type on an audio player object (e.g. `https://developer.android.com/reference/android/media/AudioTrack.html`, `https://developer.android.com/reference/android/media/MediaPlayer.html`) as this is deprecated; use `AudioAttributes` instead.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a valid stream type for `Activity` or stream volume control that matches the attributes, or `https://developer.android.com/reference/android/media/AudioManager.html#USE_DEFAULT_STREAM_TYPE` if there isn't a direct match. Note that `USE_DEFAULT_STREAM_TYPE` is not a valid value for `https://developer.android.com/reference/android/media/AudioManager.html#setStreamVolume(int, int, int)`. |

### hashCode

```
fun [hashCode](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#hashCode())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

### toString

```
fun [toString](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#toString())(): String!
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

### unwrap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
fun [unwrap](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#unwrap())(): Any?
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

If the current SDK level is 21 or higher, return the `https://developer.android.com/reference/android/media/AudioAttributes.html` object inside this `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat`. Otherwise `null`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | the underlying `https://developer.android.com/reference/android/media/AudioAttributes.html` object or null |

### wrap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
java-static fun [wrap](https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat#wrap(java.lang.Object))(aa: Any): AudioAttributesCompat?
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Creates an `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat` given an API 21 `https://developer.android.com/reference/android/media/AudioAttributes.html` object.

| Parameters |
|---|---|
| `aa: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | an instance of `https://developer.android.com/reference/android/media/AudioAttributes.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media/AudioAttributesCompat?` | the new `AudioAttributesCompat`, or `null` on API \<21 |