Files
Voile/Voile/Source/Systems/AudioSystem.cs

39 lines
1.2 KiB
C#

namespace Voile.Audio
{
public abstract class AudioSystem : IStartableSystem, IUpdatableSystem, IDisposable
{
public void Start() => Initialize();
public void Update(double deltaTime) => Update();
public void Dispose()
{
Shutdown();
GC.SuppressFinalize(this);
}
protected abstract void Initialize();
protected abstract void Update();
protected abstract void Shutdown();
// BUS
public abstract void CreateBus(string busName);
public abstract void SetBusVolume(string busName, float volume);
public abstract float GetBusVolume(string busName);
// SOUND
public abstract void PlaySound(Sound sound, float pitch, float volume, string bus = "Master");
public void PlaySound(Sound sound, string bus = "Master") => PlaySound(sound, 1.0f, 1.0f, bus);
public SoundInstance CreateInstance(Sound sound)
{
var instance = new SoundInstance(this, sound);
return instance;
}
// EFFECTS
public abstract void AddBusEffect<T>(T effect, string bus = "Master") where T : AudioEffect;
private LehmerRandom _random = new LehmerRandom();
}
}