SoundFieldAudioComponent


class SoundFieldAudioComponent : Component


Provides spatial audio playback for a sound field associated with an Entity.

It provides an AudioOutputProvider which can be used to configure an ExoPlayer.Builder instance for sound field audio playback. The characteristics of the sound field are defined by SoundFieldAttributes.

This component can only be attached to one Entity at a time.

Summary

Public companion functions

SoundFieldAudioComponent
create(session: Session, attributes: SoundFieldAttributes)

Creates a SoundFieldAudioComponent for the given session and initializes it with the provided attributes.

Protected functions

open Boolean
onAttach(entity: Entity)

Called by the framework when this component is being added to an Entity.

open Unit
onDetach(entity: Entity)

Called by the framework when this component is being removed from an Entity.

Public properties

AudioOutputProvider

An AudioOutputProvider that can be used to configure an androidx.media3.exoplayer.ExoPlayer.Builder for ambisonics audio playback.

Public companion functions

create

Added in 1.0.0-alpha15
fun create(session: Session, attributes: SoundFieldAttributes): SoundFieldAudioComponent

Creates a SoundFieldAudioComponent for the given session and initializes it with the provided attributes.

Protected functions

onAttach

protected open fun onAttach(entity: Entity): Boolean

Called by the framework when this component is being added to an Entity.

This method is triggered when Entity.addComponent is invoked. Implementations should override this method to perform setup logic or to validate if the component is compatible with the provided entity.

Parameters
entity: Entity

The Entity to which this component is being attached.

Returns
Boolean

true if the component was successfully attached; false if the entity does not support this component or if attachment failed.

onDetach

protected open fun onDetach(entity: Entity): Unit

Called by the framework when this component is being removed from an Entity.

This method is triggered when Entity.removeComponent is invoked. Implementations should override this method to release resources or undo any changes made during onAttach.

Parameters
entity: Entity

The Entity from which this component is being detached.

Public properties

audioOutputProvider

Added in 1.0.0-alpha15
val audioOutputProviderAudioOutputProvider

An AudioOutputProvider that can be used to configure an androidx.media3.exoplayer.ExoPlayer.Builder for ambisonics audio playback.