Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AudioSource

Add this in your code:

#include <engine/audio/audio_source.h>

Description

Component to play audio clips.

Public methods


Play

Play audio.

void Play()

Resume

Resume audio.

void Resume()

Pause

Pause audio.

void Pause()

Stop

Stop audio.

void Stop()

SetVolume

Set volume.

Parameters:

  • volume: New volume value
void SetVolume(float volume)

SetPanning

Set panning.

Parameters:

  • panning: New panning value
void SetPanning(float panning)

SetPanning

Set is looping.

Parameters:

  • isLooping: New is looping value
void SetLoop(bool isLooping)

GetVolume

Get volume.

float GetVolume() const

GetPanning

Get panning.

float GetPanning() const

IsPlaying

Get is playing.

bool IsPlaying() const

IsLooping

Get is looping.

bool IsLooping() const

GetAudioClip

Get audio clip.

const std::shared_ptr<AudioClip>& GetAudioClip()

SetAudioClip

Set audio clip.

void SetAudioClip(const std::shared_ptr<AudioClip>& audioClip)