# SpatialAudioTrackBuilder

Artifact: [androidx.xr.scenecore:scenecore](https://developer.android.com/jetpack/androidx/releases/xr-scenecore) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/SpatialAudioTrack.kt+class:androidx.xr.scenecore.SpatialAudioTrackBuilder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
public static class SpatialAudioTrackBuilder
```

<br />

*** ** * ** ***

Provides spatial audio extensions on the platform `https://developer.android.com/reference/android/media/AudioTrack.Builder.html` class.

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrackBuilder` | `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrackBuilder#INSTANCE()` |

| ### Public methods |
|---|---|
| `static final void` | `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrackBuilder#setPointSourceParams(androidx.xr.runtime.Session,android.media.AudioTrack.Builder,androidx.xr.scenecore.PointSourceParams,androidx.xr.scenecore.Entity)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.Builder.html builder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/PointSourceParams params, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/Entity entity )` Sets the `https://developer.android.com/reference/androidx/xr/scenecore/PointSourceParams` on the provided `https://developer.android.com/reference/android/media/AudioTrack.Builder.html`. |
| `static final void` | `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrackBuilder#setSoundFieldAttributes(androidx.xr.runtime.Session,android.media.AudioTrack.Builder,androidx.xr.scenecore.SoundFieldAttributes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.Builder.html builder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes attributes )` Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes` on the provided `https://developer.android.com/reference/android/media/AudioTrack.Builder.html`. |

## Public fields

### INSTANCE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public static @NonNull SpatialAudioTrackBuilder INSTANCE
```

## Public methods

### setPointSourceParams

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public static final void setPointSourceParams(
    @NonNull Session session,
    @NonNull AudioTrack.Builder builder,
    @NonNull PointSourceParams params,
    @NonNull Entity entity
)
```

Sets the `https://developer.android.com/reference/androidx/xr/scenecore/PointSourceParams` on the provided `https://developer.android.com/reference/android/media/AudioTrack.Builder.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session` | The current `https://developer.android.com/reference/androidx/xr/runtime/Session` instance. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.Builder.html builder` | The Builder on which to set the attributes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/PointSourceParams params` | The source params to be set. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/Entity entity` | The `https://developer.android.com/reference/androidx/xr/scenecore/Entity` from which the sound will be played. |

### setSoundFieldAttributes

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
public static final void setSoundFieldAttributes(
    @NonNull Session session,
    @NonNull AudioTrack.Builder builder,
    @NonNull SoundFieldAttributes attributes
)
```

Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes` on the provided `https://developer.android.com/reference/android/media/AudioTrack.Builder.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/Session session` | The current `https://developer.android.com/reference/androidx/xr/runtime/Session` instance. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.Builder.html builder` | The Builder on which to set the attributes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes attributes` | The source attributes to be set. |