Table of Contents

Class AudioSource

Namespace
LibGFX.Audio
Assembly
LibGFX.dll

Represents an audio source

public class AudioSource : IGameBehavior
Inheritance
AudioSource
Implements
Inherited Members

Constructors

AudioSource(IAudioDevice, PlayMode)

Creates a new audio source

public AudioSource(IAudioDevice audioDevice, PlayMode playmode = PlayMode.Loop)

Parameters

audioDevice IAudioDevice
playmode PlayMode

Properties

AudioClip

The audio clip of the audio source

public AudioClip AudioClip { get; set; }

Property Value

AudioClip

Gain

The gain (volume) of the audio source

public float Gain { get; set; }

Property Value

float

PlayMode

The play mode of the audio source

public PlayMode PlayMode { get; set; }

Property Value

PlayMode

Range

The range of the audio source

public Vector3 Range { get; set; }

Property Value

Vector3

SourceId

The ID of the audio source

public int SourceId { get; set; }

Property Value

int

State

The state of the audio source

public AudioSourceState State { get; set; }

Property Value

AudioSourceState

Methods

GetElement()

Returns the game element associated with the audio source

public GameElement GetElement()

Returns

GameElement

OnCollide(Collision)

Handles the collision event (not used in this implementation)

public void OnCollide(Collision collision)

Parameters

collision Collision

OnDispose(BaseScene, IRenderDevice)

Disposes the audio source

public void OnDispose(BaseScene scene, IRenderDevice renderer)

Parameters

scene BaseScene
renderer IRenderDevice

OnInit(BaseScene, Viewport, IRenderDevice)

Initializes the audio source and sets the start parameters

public void OnInit(BaseScene scene, Viewport viewport, IRenderDevice renderer)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

OnRender(BaseScene, Viewport, IRenderDevice, Camera)

Handles the rendering of the audio source (not used in this implementation)

public void OnRender(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice
camera Camera

OnShadowPass(BaseScene, Viewport, IRenderDevice)

Handles the shadow pass rendering (not used in this implementation)

public void OnShadowPass(BaseScene scene, Viewport viewport, IRenderDevice renderer)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

OnUpdate(BaseScene, float)

Handles the update of the audio source

public void OnUpdate(BaseScene scene, float dt)

Parameters

scene BaseScene
dt float

Pause()

Pauses the audio source

public void Pause()

Play()

Plays the audio source

public void Play()

SetAudioClip(AudioClip)

Sets the audio clip for the audio source

public void SetAudioClip(AudioClip audioClip)

Parameters

audioClip AudioClip

SetElement(GameElement)

Sets the game element associated with the audio source

public void SetElement(GameElement gameElement)

Parameters

gameElement GameElement

SetGain(float)

Sets the gain (volume) of the audio source

public void SetGain(float value)

Parameters

value float

SetPlayMode(PlayMode)

Sets the play mode for the audio source

public void SetPlayMode(PlayMode playMode)

Parameters

playMode PlayMode

SetRange(Vector3)

Sets the range of the audio source

public void SetRange(Vector3 value)

Parameters

value Vector3

Stop()

Stops the audio source

public void Stop()