Пример #1
0
 public static void Terminate()
 {
     if (Environment.Is64BitProcess)
     {
         Alc64.alcCloseDevice(alcDeviceHandle);
     }
     else
     {
         Alc32.alcCloseDevice(alcDeviceHandle);
     }
 }
Пример #2
0
        public AlcManager()
        {
            alcDeviceHandle = Alc64.alcOpenDevice(null);
            if (alcDeviceHandle == IntPtr.Zero)
            {
                // TODO: Named devices
                throw new Exception("Could not find audio device.");
            }

            List <int> attributes = new List <int> {
                4105, 0,
            };

            if (Alc64.alcIsExtensionPresent(alcDeviceHandle, "ALC_EXT_EFX"))
            {
                int[] alcInteger = new int[1];
                Alc64.alcGetIntegerv(alcDeviceHandle, 131065, 1, alcInteger);
                attributes.Add(131065);
                attributes.Add(alcInteger[0]);
            }
            attributes.Add(0);

            alcContextHandle = Alc64.alcCreateContext(alcDeviceHandle, attributes.ToArray());

            if (alcContextHandle == IntPtr.Zero)
            {
                Alc64.alcCloseDevice(alcDeviceHandle);
                throw new Exception("Failed to create ALC context.");
            }

            Alc64.alcMakeContextCurrent(alcContextHandle);

#if DEBUG
            sw.Stop();
            Console.WriteLine("Initializing ALC took {0} milliseconds.", sw.ElapsedMilliseconds);
#endif
        }
Пример #3
0
 public void Close()
 {
     Alc64.alcCloseDevice(alcDeviceHandle);
 }