Exemplo n.º 1
0
        protected override void PlatformDispose()
        {
            mutex.WaitOne();
            if (usingResource == 1)
            {
                if (_context != IntPtr.Zero)
                {
                    AlNative.alcSuspendContext(_context);
                    checkAlcError();
                }
                AlNative.alcMakeContextCurrent(IntPtr.Zero);
                checkAlcError();

                if (_context != IntPtr.Zero)
                {
                    AlNative.alcDestroyContext(_context);
                    checkAlcError();
                    _context = IntPtr.Zero;
                    AlNative.alcCloseDevice(_device);
                    checkAlcError();
                    _device = IntPtr.Zero;
                }
                usingResource = 0;
            }
            mutex.ReleaseMutex();
        }
Exemplo n.º 2
0
 protected override void PlatformDispose()
 {
     AlNative.alcMakeContextCurrent((IntPtr)0);
     checkAlcError();
     AlNative.alcDestroyContext(_context);
     checkAlcError();
     AlNative.alcCloseDevice(_device);
     checkAlcError();
 }
Exemplo n.º 3
0
 public ALEngine(AudioEngineOptions options)
 {
     _device = AlNative.alcOpenDevice(null);
     checkAlcError();
     _context = AlNative.alcCreateContext(_device, null);
     checkAlcError();
     AlNative.alcMakeContextCurrent(_context);
     checkAlcError();
     _floatSupport = AlNative.alIsExtensionPresent("AL_EXT_FLOAT32");
 }
Exemplo n.º 4
0
        public ALEngine(AudioEngineOptions options)
        {
            mutex.WaitOne();
            usingResource++;
            if (usingResource == 1)
            {
                int[] argument = new int[] { AlNative.ALC_FREQUENCY, options.SampleRate };
                // opens the default device.
                _device = AlNative.alcOpenDevice(null);
                checkAlcError();
                _context = AlNative.alcCreateContext(_device, argument);
                checkAlcError();

                //
                AlNative.alcMakeContextCurrent(_context);
                checkAlcError();
                _floatSupport = AlNative.alIsExtensionPresent("AL_EXT_FLOAT32");
                checkAlError();
            }
            mutex.ReleaseMutex();
        }