audio disposal is friggin haunted man
parent
6d1acc37e9
commit
005dcb864a
|
@ -292,15 +292,30 @@ namespace MoonWorks.Audio
|
||||||
{
|
{
|
||||||
Thread.Join();
|
Thread.Join();
|
||||||
|
|
||||||
// dispose all voices first
|
// dispose all source voices first
|
||||||
foreach (var resource in resources)
|
foreach (var resource in resources)
|
||||||
{
|
{
|
||||||
if (resource.Target is Voice voice)
|
if (resource.Target is SourceVoice voice)
|
||||||
{
|
{
|
||||||
voice.Dispose();
|
voice.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dispose all submix voices except the faux mastering voice
|
||||||
|
foreach (var resource in resources)
|
||||||
|
{
|
||||||
|
if (resource.Target is SubmixVoice voice && voice != fauxMasteringVoice)
|
||||||
|
{
|
||||||
|
voice.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dispose the faux mastering voice
|
||||||
|
fauxMasteringVoice.Dispose();
|
||||||
|
|
||||||
|
// dispose the true mastering voice
|
||||||
|
FAudio.FAudioVoice_DestroyVoice(trueMasteringVoice);
|
||||||
|
|
||||||
// destroy all other audio resources
|
// destroy all other audio resources
|
||||||
foreach (var resource in resources)
|
foreach (var resource in resources)
|
||||||
{
|
{
|
||||||
|
@ -313,7 +328,6 @@ namespace MoonWorks.Audio
|
||||||
resources.Clear();
|
resources.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
FAudio.FAudioVoice_DestroyVoice(trueMasteringVoice);
|
|
||||||
FAudio.FAudio_Release(Handle);
|
FAudio.FAudio_Release(Handle);
|
||||||
|
|
||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
|
|
|
@ -109,9 +109,6 @@ namespace MoonWorks
|
||||||
Logger.LogInfo("Cleaning up game...");
|
Logger.LogInfo("Cleaning up game...");
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
||||||
Logger.LogInfo("Closing audio thread...");
|
|
||||||
AudioDevice.Dispose();
|
|
||||||
|
|
||||||
Logger.LogInfo("Unclaiming window...");
|
Logger.LogInfo("Unclaiming window...");
|
||||||
GraphicsDevice.UnclaimWindow(MainWindow);
|
GraphicsDevice.UnclaimWindow(MainWindow);
|
||||||
|
|
||||||
|
@ -121,6 +118,9 @@ namespace MoonWorks
|
||||||
Logger.LogInfo("Disposing graphics device...");
|
Logger.LogInfo("Disposing graphics device...");
|
||||||
GraphicsDevice.Dispose();
|
GraphicsDevice.Dispose();
|
||||||
|
|
||||||
|
Logger.LogInfo("Closing audio thread...");
|
||||||
|
AudioDevice.Dispose();
|
||||||
|
|
||||||
SDL.SDL_Quit();
|
SDL.SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue