# AudioAttributes.Builder

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/AudioAttributes.java+class:androidx.media3.common.AudioAttributes.Builder)

*** ** * ** ***


```
class AudioAttributes.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#Builder()()` Creates a new builder for `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#build()()` Creates an `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes` instance from this builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setAllowedCapturePolicy(int)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.AudioAllowedCapturePolicy allowedCapturePolicy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setAllowedCapturePolicy(int)`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setContentType(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.AudioContentType contentType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setContentType(int)` |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setFlags(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.AudioFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setFlags(int)` |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setHapticChannelsMuted(boolean)(hapticChannelsMuted: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setHapticChannelsMuted(boolean)`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setIsContentSpatialized(boolean)(isContentSpatialized: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setIsContentSpatialized(boolean)`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setSpatializationBehavior(int)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.SpatializationBehavior spatializationBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setSpatializationBehavior(int)`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes.Builder#setUsage(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.AudioUsage usage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setUsage(int)` |

## Public constructors

### Builder

```
Builder()
```

Creates a new builder for `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes`.

By default the content type is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#AUDIO_CONTENT_TYPE_UNKNOWN()`, usage is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#USAGE_MEDIA()`, capture policy is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#ALLOW_CAPTURE_BY_ALL()`, no flags are set and haptic channels are muted.

## Public functions

### build

```
fun build(): AudioAttributes!
```

Creates an `https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes` instance from this builder.

### setAllowedCapturePolicy

```
@CanIgnoreReturnValue
fun setAllowedCapturePolicy(
    @C.AudioAllowedCapturePolicy allowedCapturePolicy: Int
): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setAllowedCapturePolicy(int)`.

### setContentType

```
@CanIgnoreReturnValue
fun setContentType(@C.AudioContentType contentType: Int): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setContentType(int)`

### setFlags

```
@CanIgnoreReturnValue
fun setFlags(@C.AudioFlags flags: Int): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setFlags(int)`

### setHapticChannelsMuted

```
@CanIgnoreReturnValue
@UnstableApi
fun setHapticChannelsMuted(hapticChannelsMuted: Boolean): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setHapticChannelsMuted(boolean)`.

### setIsContentSpatialized

```
@CanIgnoreReturnValue
@UnstableApi
fun setIsContentSpatialized(isContentSpatialized: Boolean): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setIsContentSpatialized(boolean)`.

### setSpatializationBehavior

```
@CanIgnoreReturnValue
fun setSpatializationBehavior(
    @C.SpatializationBehavior spatializationBehavior: Int
): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setSpatializationBehavior(int)`.

### setUsage

```
@CanIgnoreReturnValue
fun setUsage(@C.AudioUsage usage: Int): AudioAttributes.Builder!
```

See `https://developer.android.com/reference/android/media/AudioAttributes.Builder.html#setUsage(int)`