Cleanup fixes

main
cosmonaut 2022-02-22 16:44:39 -08:00
parent 977b1fd163
commit 7a754e1c90
1 changed files with 9 additions and 6 deletions

View File

@ -240,17 +240,20 @@ namespace MoonWorks.Audio
{ {
if (disposing) if (disposing)
{ {
// TODO: dispose managed state (managed objects) for (var i = streamingSounds.Count - 1; i >= 0; i--)
foreach (var weakReference in streamingSounds) {
{ var weakReference = streamingSounds[i];
if (weakReference.TryGetTarget(out var streamingSound))
if (weakReference.TryGetTarget(out var streamingSound))
{ {
streamingSound.Dispose(); streamingSound.Dispose();
} }
} }
streamingSounds.Clear(); streamingSounds.Clear();
} }
FAudio.FAudioVoice_DestroyVoice(ReverbVoice);
FAudio.FAudioVoice_DestroyVoice(MasteringVoice);
FAudio.FAudio_Release(Handle); FAudio.FAudio_Release(Handle);
IsDisposed = true; IsDisposed = true;