AudioSource

Inherited: NativeBehaviour

Description

The AudioSource class provides methods to manage the playback of audio clips. It allows users to set audio clips, control playback, and adjust parameters like auto-play and looping.

Public Methods

bool

autoPlay () const

AudioClip *

clip () const

bool

loop () const

void

play ()

void

setAutoPlay (bool play)

void

setClip (AudioClip * clip)

void

setLoop (bool loop)

void

stop ()

Static Methods

None

Methods Description

bool AudioSource::autoPlay () const

Returns true if auto-play is enabled; otherwise, returns false.

See also setAutoPlay().


:ref:`AudioClip<api_AudioClip>`* AudioSource::clip () const

Returns the audio clip associated with the audio source.

See also setClip().


bool AudioSource::loop () const

Returns true if looping is enabled; otherwise, returns false.

See also setLoop().


void AudioSource::play ()

Plays the audio clip in the specific position in 3D space.


void AudioSource::setAutoPlay (bool play)

Sets the auto play state.

See also autoPlay().


void AudioSource::setClip (AudioClip * clip)

Sets the audio clip for the audio source.

See also *clip*().


void AudioSource::setLoop (bool loop)

Sets the loop state.

See also *loop*().


void AudioSource::stop ()

Stops the audio source.