AudioSource

csharp
public sealed class AudioSource : Behaviour

Namespace NodeWorld.Flux.

An Audio Source of the world: plays its clip, in 2D or 3D, as Unity's. The server has none.

Properties

clip

csharp
public AudioClip clip { get; set; }

The clip the source plays: set it, then Play.

isPlaying

csharp
public bool isPlaying { get; }

The source is playing.

loop

csharp
public bool loop { get; set; }

The clip starts again when it ends.

mute

csharp
public bool mute { get; set; }

Silences the source; it keeps playing.

playOnAwake

csharp
public bool playOnAwake { get; set; }

The source plays as soon as its object becomes active.

priority

csharp
public int priority { get; set; }

Priority among the sources: 0 the highest, 256 the lowest.

volume

csharp
public float volume { get; set; }

Volume, 0 to 1.

pitch

csharp
public float pitch { get; set; }

Pitch and speed of the clip (1: as it is).

time

csharp
public float time { get; set; }

Playback position (s).

spatialBlend

csharp
public float spatialBlend { get; set; }

2D (0) to 3D (1): a 3D sound comes from its object and fades with the distance.

minDistance

csharp
public float minDistance { get; set; }

Distance (m) within which a 3D sound is at full volume.

maxDistance

csharp
public float maxDistance { get; set; }

Distance (m) beyond which a 3D sound no longer fades.

Methods

Play

csharp
public void Play()

Plays the clip from its start.

PlayDelayed

csharp
public void PlayDelayed(float delay)

Plays the clip after delay seconds.

Stop

csharp
public void Stop()

Stops the clip.

Pause

csharp
public void Pause()

Pauses the clip.

UnPause

csharp
public void UnPause()

Plays a paused clip on from where it was.

PlayOneShot

csharp
public void PlayOneShot(AudioClip clip, float volumeScale = 1f)

Plays clip once, over what the source plays, with the source's settings and volumeScale times its volume.

GetSpectrumData

csharp
public void GetSpectrumData(float[] samples, int channel, FFTWindow window)

The spectrum of what this source plays (FFT, samples.Length a power of two from 64 to 8192).

GetOutputData

csharp
public void GetOutputData(float[] samples, int channel)

The last samples this source played (waveform), samples.Length of them.