ReverbEffect is now an AudioResource

pull/47/head
cosmonaut 2023-03-07 13:41:15 -08:00
parent d17fb55810
commit 4591920bf6
1 changed files with 4 additions and 29 deletions

View File

@ -4,14 +4,12 @@ using System.Runtime.InteropServices;
namespace MoonWorks.Audio namespace MoonWorks.Audio
{ {
// sound instances can send their audio to this voice to add reverb // sound instances can send their audio to this voice to add reverb
public unsafe class ReverbEffect : IDisposable public unsafe class ReverbEffect : AudioResource
{ {
private IntPtr voice; private IntPtr voice;
public IntPtr Voice => voice; public IntPtr Voice => voice;
private bool disposedValue; public ReverbEffect(AudioDevice audioDevice) : base(audioDevice)
public ReverbEffect(AudioDevice audioDevice)
{ {
/* Init reverb */ /* Init reverb */
@ -97,32 +95,9 @@ namespace MoonWorks.Audio
} }
} }
protected virtual void Dispose(bool disposing) protected override void Destroy()
{ {
if (!disposedValue) FAudio.FAudioVoice_DestroyVoice(Voice);
{
if (disposing)
{
// TODO: dispose managed state (managed objects)
}
FAudio.FAudioVoice_DestroyVoice(voice);
disposedValue = true;
}
}
~ReverbEffect()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: false);
}
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
} }
} }
} }