Table of Contents

Class AudioSource

Namespace
Bonsai.Audio
Assembly
Bonsai.Audio.dll

Represents a source of spatialized audio which can be used to define and control the audio landscape surrounding the listener.

public class AudioSource : IDisposable
Inheritance
AudioSource
Implements
Inherited Members

Constructors

AudioSource()

Initializes a new instance of the AudioSource class.

public AudioSource()

Properties

Direction

Gets or sets the direction vector of the audio source.

public Vector3 Direction { get; set; }

Property Value

Vector3

Gain

Gets or sets the volume amplification applied to the audio source.

public float Gain { get; set; }

Property Value

float

Remarks

Each division by 2 equals an attenuation of -6 dB, and each multiplication by 2 an amplification by +6 dB. A value of 1.0 means the source is unchanged, and zero is interpreted as zero volume.

Id

Gets the name of the audio source. This is an OpenAL buffer reference which can be used to call audio source manipulation functions.

public int Id { get; }

Property Value

int

Looping

Gets or sets a value indicating whether the audio source is looping.

public bool Looping { get; set; }

Property Value

bool

Pitch

Gets or sets the pitch to be applied to the audio source.

public float Pitch { get; set; }

Property Value

float

Position

Gets or sets the location of the audio source in three-dimensional space.

public Vector3 Position { get; set; }

Property Value

Vector3

Relative

Gets or sets a value indicating whether the audio source uses coordinates relative to the listener.

public bool Relative { get; set; }

Property Value

bool

State

Gets information about the current source state.

public ALSourceState State { get; }

Property Value

ALSourceState

Velocity

Gets or sets the velocity of the audio source in three-dimensional space.

public Vector3 Velocity { get; set; }

Property Value

Vector3

Methods

Dispose()

Releases all resources used by the AudioSource class.

public void Dispose()

Pause()

Pauses the source and sets its state to OpenTK.Audio.OpenAL.ALSourceState.Paused.

public void Pause()

Play()

Plays, replays, or resumes the source and sets its state to OpenTK.Audio.OpenAL.ALSourceState.Playing. If the source is already playing, the source will restart at the beginning.

public void Play()

Rewind()

Stops the source and sets its state to OpenTK.Audio.OpenAL.ALSourceState.Initial.

public void Rewind()

Stop()

Stops the source and sets its state to OpenTK.Audio.OpenAL.ALSourceState.Stopped.

public void Stop()