Class AudioSource
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
audioDeviceIAudioDeviceplaymodePlayMode
Properties
AudioClip
The audio clip of the audio source
public AudioClip AudioClip { get; set; }
Property Value
Gain
The gain (volume) of the audio source
public float Gain { get; set; }
Property Value
PlayMode
The play mode of the audio source
public PlayMode PlayMode { get; set; }
Property Value
Range
The range of the audio source
public Vector3 Range { get; set; }
Property Value
SourceId
The ID of the audio source
public int SourceId { get; set; }
Property Value
State
The state of the audio source
public AudioSourceState State { get; set; }
Property Value
Methods
GetElement()
Returns the game element associated with the audio source
public GameElement GetElement()
Returns
OnCollide(Collision)
Handles the collision event (not used in this implementation)
public void OnCollide(Collision collision)
Parameters
collisionCollision
OnDispose(BaseScene, IRenderDevice)
Disposes the audio source
public void OnDispose(BaseScene scene, IRenderDevice renderer)
Parameters
sceneBaseScenerendererIRenderDevice
OnInit(BaseScene, Viewport, IRenderDevice)
Initializes the audio source and sets the start parameters
public void OnInit(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
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
sceneBaseSceneviewportViewportrendererIRenderDevicecameraCamera
OnShadowPass(BaseScene, Viewport, IRenderDevice)
Handles the shadow pass rendering (not used in this implementation)
public void OnShadowPass(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
OnUpdate(BaseScene, float)
Handles the update of the audio source
public void OnUpdate(BaseScene scene, float dt)
Parameters
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
audioClipAudioClip
SetElement(GameElement)
Sets the game element associated with the audio source
public void SetElement(GameElement gameElement)
Parameters
gameElementGameElement
SetGain(float)
Sets the gain (volume) of the audio source
public void SetGain(float value)
Parameters
valuefloat
SetPlayMode(PlayMode)
Sets the play mode for the audio source
public void SetPlayMode(PlayMode playMode)
Parameters
playModePlayMode
SetRange(Vector3)
Sets the range of the audio source
public void SetRange(Vector3 value)
Parameters
valueVector3
Stop()
Stops the audio source
public void Stop()