SilentAudio
namespace Griff.Runtime;
public sealed class SilentAudio : IAudioAudio that does nothing: for tests and headless runs. It remembers its volume settings, and keeps time for the music it was asked to play as if it were heard, so beat clocks still count.
Properties
Section titled “Properties”public string? Music { get; }MusicLength
Section titled “MusicLength”public double MusicLength { get; set; }How long the music lasts, for a test to pretend; 0 (the default) never ends.
MusicTempo
Section titled “MusicTempo”public float MusicTempo { get; set; }The music’s tempo, for a test to pretend (a metronome’s says its own).
MusicTime
Section titled “MusicTime”public double MusicTime { get; }MusicVolume
Section titled “MusicVolume”public float MusicVolume { get; set; }public bool Muted { get; set; }SoundVolume
Section titled “SoundVolume”public float SoundVolume { get; set; }Volume
Section titled “Volume”public float Volume { get; set; }Methods
Section titled “Methods”Advance
Section titled “Advance”public void Advance(float seconds)CrossfadeMusic
Section titled “CrossfadeMusic”public void CrossfadeMusic(string music, float seconds, float volume = 0.6f, bool loop = true)FadeOutMusic
Section titled “FadeOutMusic”public void FadeOutMusic(float seconds)public void Play(string sound, float volume = 1f)PlayMetronome
Section titled “PlayMetronome”public void PlayMetronome(float tempo, int beatsPerBar = 4, float volume = 1f)PlayMusic
Section titled “PlayMusic”public void PlayMusic(string music, float volume = 0.6f, bool loop = true)PlayMusicFrom
Section titled “PlayMusicFrom”public void PlayMusicFrom(string music, double seconds, float volume = 0.6f, bool loop = true)StopAll
Section titled “StopAll”public void StopAll()StopMusic
Section titled “StopMusic”public void StopMusic()