Ctrl+K

Sound3DPlayer

Declaration

public class Strawberry.Components.Audio.Sound3DPlayer

Used to play a sound in 3d space. The sound will be played at Entity's Transform.Position

Inherits: Strawberry.Core.BaseComponent

Properties

SoundBuffer

The sound buffer to play

SoundBuffer SoundBuffer { get set }

Volume

Gets or sets the volume by which the sound will be played (Default is 1) Can be changed using the Voice3D object returned by Play()

float Volume { get set }

Frequency

Gets or sets the frequency ratio (pitch) by which the sound will be played (Default is 1) Can be changed using the Voice3D object returned by Play()

float Frequency { get set }

Follow

Gets or sets whether the position of all the active voices will be updated to follow the Transform's position.

bool Follow { get set }

Methods

OnComponentAdded override

void OnComponentAdded(BaseComponent component)

Parameters:

Name Type Description
component Strawberry.Core.BaseComponent

OnUpdate override

void OnUpdate()

Play

Plays the sound buffer

Voice3D Play(int priority = 0)

Parameters:

Name Type Description
priority System.Int32 = 0 The priority of the sound. If the available sources of the sound manager is full, the sound with the lowest priority will be replaced

Returns: If the sound get's to the playing list, the voice object to control the options, if the sound manager is full, null

Stop

Stops all the sounds currently played by this component

void Stop()

IsPlaying

Whether the any sound that is played by this component is currently playing.

bool IsPlaying()

Returns: True if at least one voice is still playing. otherwise false