aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio/OpenAL
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Audio/OpenAL')
-rw-r--r--Ryujinx.Audio/OpenAL/OpenALAudioOut.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
index 85e2d803..80a070c9 100644
--- a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
+++ b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
@@ -8,7 +8,7 @@ using System.Threading;
namespace Ryujinx.Audio.OpenAL
{
- public class OpenALAudioOut : IAalOutput
+ public class OpenALAudioOut : IAalOutput, IDisposable
{
private const int MaxTracks = 256;
@@ -222,10 +222,17 @@ namespace Ryujinx.Audio.OpenAL
Td.CallReleaseCallbackIfNeeded();
}
- //If it's not slept it will waste cycles
+ //If it's not slept it will waste cycles.
Thread.Sleep(10);
}
while (KeepPolling);
+
+ foreach (Track Td in Tracks.Values)
+ {
+ Td.Dispose();
+ }
+
+ Tracks.Clear();
}
public int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback)
@@ -342,5 +349,18 @@ namespace Ryujinx.Audio.OpenAL
return PlaybackState.Stopped;
}
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose(bool Disposing)
+ {
+ if (Disposing)
+ {
+ KeepPolling = false;
+ }
+ }
}
} \ No newline at end of file