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.
public sealed class SilentAudioDevice : IAudioDeviceInheritance
Implements
Constructors
SilentAudioDevice()
public SilentAudioDevice()Properties
CurrentMusic
The music started last and not stopped, or null.
public MusicHandle? CurrentMusic { get; }Property Value
IsAvailable
Always false: nothing is heard.
public bool IsAvailable { get; }Property Value
Played
Names of the sounds played, in order, for checks in tests.
public List<string> Played { get; }Property Value
Methods
LoadMusic(string, AudioClip, bool)
Uploads decoded music and returns its handle.
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
LoadMusicStream(string, byte[], string, bool)
Streams compressed music (e.g. “ogg”, “mp3”, “wav”) that the device decodes itself.
public MusicHandle LoadMusicStream(string name, byte[] encoded, string format, bool loop = true)Parameters
name string
encoded byte[]
format string
loop bool
Returns
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.
public SoundHandle LoadSound(string name, AudioClip clip)Parameters
name string
clip AudioClip
Returns
PauseMusic(bool)
Pauses (true) or resumes (false) the current music.
public void PauseMusic(bool paused)Parameters
paused bool
Play(SoundHandle, float, float, float)
Records the sound’s name in Played.
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.
public void PlayMusic(MusicHandle music, float volume = 1)Parameters
music MusicHandle
volume float
SetMusicVolume(float)
Sets the volume of the current music, 0..1.
public void SetMusicVolume(float volume)Parameters
volume float
StopMusic()
Stops the music immediately.
public void StopMusic()Update()
Called once per frame so streaming music keeps playing.
public void Update()