# SpatialAudioTrackTester

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

*** ** * ** ***


```
public final class SpatialAudioTrackTester
```

<br />

*** ** * ** ***

Test utility class for spatial audio extensions.

This class provides a mechanism for tests to inspect and verify spatial audio attributes associated with an `https://developer.android.com/reference/android/media/AudioTrack.html` that are otherwise encapsulated within the SceneCore runtime.

## Summary

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `int` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#isCurrentPointSource(android.media.AudioTrack,androidx.xr.scenecore.Entity)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/Entity entity)` Checks whether the given `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#isCurrentPointSource(android.media.AudioTrack,androidx.xr.scenecore.Entity)` is the current point source for this `https://developer.android.com/reference/android/media/AudioTrack.html`. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#setSoundFieldAttributes(android.media.AudioTrack,androidx.xr.scenecore.SoundFieldAttributes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes soundFieldAttributes )` Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes` associated with this audio track. |
| `final void` | `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#setSpatialSourceType(android.media.AudioTrack,androidx.xr.scenecore.SpatializerConstants.SourceType)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType sourceType )` Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType` of this audio track. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### hashCode

```
public int hashCode()
```

### isCurrentPointSource

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

```
public final boolean isCurrentPointSource(@NonNull AudioTrack track, @NonNull Entity entity)
```

Checks whether the given `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#isCurrentPointSource(android.media.AudioTrack,androidx.xr.scenecore.Entity)` is the current point source for this `https://developer.android.com/reference/android/media/AudioTrack.html`.

This returns `true` if the `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#isCurrentPointSource(android.media.AudioTrack,androidx.xr.scenecore.Entity)` was passed to `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrack#setPointSourceParams(androidx.xr.runtime.Session,android.media.AudioTrack,androidx.xr.scenecore.PointSourceParams,androidx.xr.scenecore.Entity)` as a point source.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track` | The `https://developer.android.com/reference/android/media/AudioTrack.html` from `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrack#setPointSourceParams(androidx.xr.runtime.Session,android.media.AudioTrack,androidx.xr.scenecore.PointSourceParams,androidx.xr.scenecore.Entity)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/Entity entity` | The target `https://developer.android.com/reference/androidx/xr/scenecore/Entity` to check against. |

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester#isCurrentPointSource(android.media.AudioTrack,androidx.xr.scenecore.Entity)` is the current point source for this track, `false` otherwise. |

### setSoundFieldAttributes

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

```
public final void setSoundFieldAttributes(
    @NonNull AudioTrack track,
    @NonNull SoundFieldAttributes soundFieldAttributes
)
```

Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes` associated with this audio track.

This value needs to be set in the `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester` in order to test `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrack#getSoundFieldAttributes(androidx.xr.runtime.Session,android.media.AudioTrack)` because there is currently no way to internally associate an `https://developer.android.com/reference/android/media/AudioTrack.html` with the `https://developer.android.com/reference/android/media/AudioTrack.Builder.html` used to create it.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track` | The `https://developer.android.com/reference/android/media/AudioTrack.html` on which to set the `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes soundFieldAttributes` | The `https://developer.android.com/reference/androidx/xr/scenecore/SoundFieldAttributes` to be set. |

### setSpatialSourceType

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

```
public final void setSpatialSourceType(
    @NonNull AudioTrack track,
    @NonNull SpatializerConstants.SourceType sourceType
)
```

Sets the `https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType` of this audio track.

This value needs to be set in the `https://developer.android.com/reference/androidx/xr/scenecore/testing/SpatialAudioTrackTester` in order to test `https://developer.android.com/reference/androidx/xr/scenecore/SpatialAudioTrack#getSpatialSourceType(androidx.xr.runtime.Session,android.media.AudioTrack)` because there is currently no way to internally associate an `https://developer.android.com/reference/android/media/AudioTrack.html` with the `https://developer.android.com/reference/android/media/AudioTrack.Builder.html` used to create it.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/media/AudioTrack.html track` | The `https://developer.android.com/reference/android/media/AudioTrack.html` on which to set the `https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType sourceType` | The `https://developer.android.com/reference/androidx/xr/scenecore/SpatializerConstants.SourceType` of the provided track. |