From 4591920bf6d77d513b25f867a817fe87849452a2 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 7 Mar 2023 13:41:15 -0800 Subject: [PATCH] ReverbEffect is now an AudioResource --- src/Audio/ReverbEffect.cs | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/Audio/ReverbEffect.cs b/src/Audio/ReverbEffect.cs index 303bda7..42fab2c 100644 --- a/src/Audio/ReverbEffect.cs +++ b/src/Audio/ReverbEffect.cs @@ -4,14 +4,12 @@ using System.Runtime.InteropServices; namespace MoonWorks.Audio { // 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; public IntPtr Voice => voice; - private bool disposedValue; - - public ReverbEffect(AudioDevice audioDevice) + public ReverbEffect(AudioDevice audioDevice) : base(audioDevice) { /* Init reverb */ @@ -97,32 +95,9 @@ namespace MoonWorks.Audio } } - protected virtual void Dispose(bool disposing) + protected override void Destroy() { - if (!disposedValue) - { - 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); + FAudio.FAudioVoice_DestroyVoice(Voice); } } }