Class AudioSpaceComponent

Inheritance Relationships

Base Types

Class Documentation

class AudioSpaceComponent : public csp::multiplayer::ComponentBase, public csp::multiplayer::IAudioControlComponent, public csp::multiplayer::IEnableableComponent, public csp::multiplayer::IPositionComponent, public csp::multiplayer::IThirdPartyComponentRef

Adds spatial audio to a SpaceEntity.

This component creates immersive soundscapes by playing audio that reacts to the user’s position in the space. Whether it’s background music, sound effects, or voiceovers, the AudioSpaceComponent makes sound more engaging by positioning it in 3D space.

Public Functions

AudioSpaceComponent(csp::common::LogSystem *LogSystem, SpaceEntity *Parent)

Constructs the audio space component, and associates it with the specified Parent space entity.

Parameters

Parent – The Space entity that owns this component.

AudioPlaybackState GetPlaybackState() const

Gets the current playback state of the audio of this audio component.

Returns

The current playback state of the audio of this audio component.

void SetPlaybackState(AudioPlaybackState Value)

Sets the new playback state of the audio of this audio component.

Parameters

Value – The new playback state of the audio of this audio component.

const csp::common::String &GetAudioAssetId() const

Gets the asset ID for this audio asset.

Returns

The ID of this audio asset.

void SetAudioAssetId(const csp::common::String &Value)

Sets the asset ID for this audio asset.

Parameters

Value – The ID for this audio asset.

const csp::common::String &GetAssetCollectionId() const

Gets the ID of the asset collection associated with this component.

Note

To retrieve this component’s audio asset, both the Asset ID and the Asset Collection ID are required.

Returns

The ID of the asset collection associated with this component.

void SetAssetCollectionId(const csp::common::String &Value)

Sets the ID of the asset collection associated with this component.

Note

To retrieve this component’s audio asset, both the Asset ID and the Asset Collection ID are required.

Parameters

Value – The ID of the asset collection associated with this component.

bool GetIsLoopPlayback() const

Checks if the audio playback is looping.

Returns

True if the audio loops (i.e. starts from the beginning when ended), false otherwise.

void SetIsLoopPlayback(bool Value)

Sets if the audio playback is looping.

Parameters

Value – True if the audio loops (i.e. starts from the beginning when ended), false otherwise.

float GetTimeSincePlay() const

Gets the timestamp recorded from the moment when the audio clip started playing, in Unix timestamp format.

Returns

The timestamp recorded from the moment when the audio clip started playing, in Unix timestamp format.

void SetTimeSincePlay(float Value)

Sets the timestamp recorded from the moment when the audio clip started playing, in Unix timestamp format.

Parameters

Value – The timestamp recorded from the moment when the audio clip started playing, in Unix timestamp format.

Public Static Functions

static const ComponentSchema &GetSchema()