Skip to content

AudioAPI reference

Class SilentAudioDevice

Namespace: MicroEngine.Audio
Assembly: MicroEngine.Audio.dll
Guide: Audio

Silent device used headlessly and as a fallback when no audio hardware is present.

C#
public sealed class SilentAudioDevice : IAudioDevice

Inheritance

object ← SilentAudioDevice

Implements

IAudioDevice

Constructors

SilentAudioDevice()

C#
public SilentAudioDevice()

Properties

CurrentMusic

The music started last and not stopped, or null.

C#
public MusicHandle? CurrentMusic { get; }

Property Value

MusicHandle?

IsAvailable

Always false: nothing is heard.

C#
public bool IsAvailable { get; }

Property Value

bool

Played

Names of the sounds played, in order, for checks in tests.

C#
public List<string> Played { get; }

Property Value

List<string>

Methods

LoadMusic(string, AudioClip, bool)

Uploads decoded music and returns its handle.

C#
public MusicHandle LoadMusic(string name, AudioClip clip, bool loop = true)

Parameters

name string

Name reported by Name.

clip AudioClip

The music samples.

loop bool

Whether the music restarts when it reaches its end.

Returns

MusicHandle

LoadMusicStream(string, byte[], string, bool)

Streams compressed music (e.g. “ogg”, “mp3”, “wav”) that the device decodes itself.

C#
public MusicHandle LoadMusicStream(string name, byte[] encoded, string format, bool loop = true)

Parameters

name string

encoded byte[]

format string

loop bool

Returns

MusicHandle

Remarks

Formats depend on the device: the SDL device streams wav and ogg; the raylib device also decodes mp3.

LoadSound(string, AudioClip)

Uploads a sound effect and returns its handle.

C#
public SoundHandle LoadSound(string name, AudioClip clip)

Parameters

name string

clip AudioClip

Returns

SoundHandle

PauseMusic(bool)

Pauses (true) or resumes (false) the current music.

C#
public void PauseMusic(bool paused)

Parameters

paused bool

Play(SoundHandle, float, float, float)

Records the sound’s name in Played.

C#
public void Play(SoundHandle sound, float volume = 1, float pitch = 1, float pan = 0.5)

Parameters

sound SoundHandle

volume float

pitch float

pan float

PlayMusic(MusicHandle, float)

Starts music from the beginning, replacing the music that was playing.

C#
public void PlayMusic(MusicHandle music, float volume = 1)

Parameters

music MusicHandle

volume float

SetMusicVolume(float)

Sets the volume of the current music, 0..1.

C#
public void SetMusicVolume(float volume)

Parameters

volume float

StopMusic()

Stops the music immediately.

C#
public void StopMusic()

Update()

Called once per frame so streaming music keeps playing.

C#
public void Update()