예제 #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;
        }