.. _api_AudioSource: AudioSource =========== Inherited: None .. _api_AudioSource_description: 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. .. _api_AudioSource_public: Public Methods -------------- +------------------------------------+--------------------------------------------------------------+ | bool | :ref:`autoPlay` () const | +------------------------------------+--------------------------------------------------------------+ | :ref:`AudioClip` * | :ref:`clip` () const | +------------------------------------+--------------------------------------------------------------+ | bool | :ref:`loop` () const | +------------------------------------+--------------------------------------------------------------+ | void | :ref:`play` () | +------------------------------------+--------------------------------------------------------------+ | void | :ref:`setAutoPlay` (bool play) | +------------------------------------+--------------------------------------------------------------+ | void | :ref:`setClip` (AudioClip * clip) | +------------------------------------+--------------------------------------------------------------+ | void | :ref:`setLoop` (bool loop) | +------------------------------------+--------------------------------------------------------------+ | void | :ref:`stop` () | +------------------------------------+--------------------------------------------------------------+ .. _api_AudioSource_static: Static Methods -------------- None .. _api_AudioSource_methods: Methods Description ------------------- .. _api_AudioSource_autoPlay: bool **AudioSource::autoPlay** () const Returns true if auto-play is enabled; otherwise, returns false. **See also** setAutoPlay(). ---- .. _api_AudioSource_clip: :ref:`AudioClip` * **AudioSource::clip** () const Returns the audio clip associated with the audio source. **See also** setClip(). ---- .. _api_AudioSource_loop: bool **AudioSource::loop** () const Returns true if looping is enabled; otherwise, returns false. **See also** setLoop(). ---- .. _api_AudioSource_play: void **AudioSource::play** () Plays the audio clip in the specific position in 3D space. ---- .. _api_AudioSource_setAutoPlay: void **AudioSource::setAutoPlay** (bool *play*) Sets the auto *play* state. **See also** autoPlay(). ---- .. _api_AudioSource_setClip: void **AudioSource::setClip** (:ref:`AudioClip` * *clip*) Sets the audio *clip* for the audio source. **See also** *clip*(). ---- .. _api_AudioSource_setLoop: void **AudioSource::setLoop** (bool *loop*) Sets the *loop* state. **See also** *loop*(). ---- .. _api_AudioSource_stop: void **AudioSource::stop** () Stops the audio source.