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,9 +240,10 @@ namespace MoonWorks.Audio
{
if (disposing)
{
// TODO: dispose managed state (managed objects)
foreach (var weakReference in streamingSounds)
for (var i = streamingSounds.Count - 1; i >= 0; i--)
{
var weakReference = streamingSounds[i];
if (weakReference.TryGetTarget(out var streamingSound))
{
streamingSound.Dispose();
@ -251,6 +252,8 @@ namespace MoonWorks.Audio
streamingSounds.Clear();
}
FAudio.FAudioVoice_DestroyVoice(ReverbVoice);
FAudio.FAudioVoice_DestroyVoice(MasteringVoice);
FAudio.FAudio_Release(Handle);
IsDisposed = true;