コード例 #1
0
 // deinitialize
 internal static void Deinitialize()
 {
     if (OpenAlContext != IntPtr.Zero)
     {
         SoundManager.StopAllSounds(true);
         SoundManager.UnuseAllSoundsBuffers();
         Alc.alcMakeContextCurrent(IntPtr.Zero);
         Alc.alcDestroyContext(OpenAlContext);
         OpenAlContext = IntPtr.Zero;
     }
     if (OpenAlDevice != IntPtr.Zero)
     {
         Alc.alcCloseDevice(OpenAlDevice);
         OpenAlDevice = IntPtr.Zero;
     }
 }
コード例 #2
0
ファイル: Sounds.cs プロジェクト: kms7094/OpenBVE
 /// <summary>Deinitializes audio.</summary>
 internal static void Deinitialize()
 {
     StopAllSounds();
     UnloadAllBuffers();
     if (OpenAlContext != IntPtr.Zero)
     {
         Alc.alcMakeContextCurrent(IntPtr.Zero);
         Alc.alcDestroyContext(OpenAlContext);
         OpenAlContext = IntPtr.Zero;
     }
     if (OpenAlDevice != IntPtr.Zero)
     {
         Alc.alcCloseDevice(OpenAlDevice);
         OpenAlDevice = IntPtr.Zero;
     }
 }
コード例 #3
0
        protected override void ShutdownLibrary()
        {
            if (thread != null)
            {
                needAbortThread = true;
                Thread.Sleep(50);
                thread.Abort();
            }

            if (realChannels != null)
            {
                foreach (OpenALRealChannel realChannel in realChannels)
                {
                    if (realChannel.alSource != 0)
                    {
                        Al.alDeleteSources(1, ref realChannel.alSource);
                        realChannel.alSource = 0;
                    }
                }
            }

            try
            {
                Alc.alcMakeContextCurrent(IntPtr.Zero);
                Alc.alcDestroyContext(alContext);
                Alc.alcCloseDevice(alDevice);
            }
            catch { }

            if (realChannels != null)
            {
                realChannels.Clear();
                realChannels = null;
            }

            if (criticalSection != null)
            {
                criticalSection.Dispose();
                criticalSection = null;
            }

            instance = null;
        }