コード例 #1
0
        public IALFilter GenFilter()
        {
            uint handle;

            EFX.alGenFilters((IntPtr)1, out handle);
            return(new OpenALFilter(handle));
        }
コード例 #2
0
        public DSPFilter()
        {
            uint handle;

            EFX.alGenFilters((IntPtr)1, out handle);
            Handle = handle;
        }
コード例 #3
0
        public OpenALDevice()
        {
            string envDevice = Environment.GetEnvironmentVariable("FNA_AUDIO_DEVICE_NAME");

            if (String.IsNullOrEmpty(envDevice))
            {
                /* Be sure ALC won't explode if the variable doesn't exist.
                 * But, fail if the device name is wrong. The user needs to know
                 * if their environment variable was incorrect.
                 * -flibit
                 */
                envDevice = String.Empty;
            }
            alDevice = ALC10.alcOpenDevice(envDevice);
            if (CheckALCError() || alDevice == IntPtr.Zero)
            {
                throw new InvalidOperationException("Could not open audio device!");
            }

            int[] attribute = new int[0];
            alContext = ALC10.alcCreateContext(alDevice, attribute);
            if (CheckALCError() || alContext == IntPtr.Zero)
            {
                Dispose();
                throw new InvalidOperationException("Could not create OpenAL context");
            }

            ALC10.alcMakeContextCurrent(alContext);
            if (CheckALCError())
            {
                Dispose();
                throw new InvalidOperationException("Could not make OpenAL context current");
            }

            float[] ori = new float[]
            {
                0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f
            };
            AL10.alListenerfv(AL10.AL_ORIENTATION, ori);
            AL10.alListener3f(AL10.AL_POSITION, 0.0f, 0.0f, 0.0f);
            AL10.alListener3f(AL10.AL_VELOCITY, 0.0f, 0.0f, 0.0f);
            AL10.alListenerf(AL10.AL_GAIN, 1.0f);

            EFX.alGenFilters(1, out INTERNAL_alFilter);

            // FIXME: Remove for FNA 16.11! -flibit
            if (!AL10.alIsExtensionPresent("AL_SOFT_gain_clamp_ex"))
            {
                FNALoggerEXT.LogWarn("AL_SOFT_gain_clamp_ex not found!");
                FNALoggerEXT.LogWarn("Update your OpenAL Soft library!");
            }
        }
コード例 #4
0
ファイル: OpenALDevice.cs プロジェクト: BibleUs/FNA
        public OpenALDevice()
        {
            string envDevice = Environment.GetEnvironmentVariable("FNA_AUDIO_DEVICE_NAME");

            if (String.IsNullOrEmpty(envDevice))
            {
                /* Be sure ALC won't explode if the variable doesn't exist.
                 * But, fail if the device name is wrong. The user needs to know
                 * if their environment variable was incorrect.
                 * -flibit
                 */
                envDevice = String.Empty;
            }
            alDevice = ALC10.alcOpenDevice(envDevice);
            if (CheckALCError() || alDevice == IntPtr.Zero)
            {
                throw new InvalidOperationException("Could not open audio device!");
            }

            int[] attribute = new int[0];
            alContext = ALC10.alcCreateContext(alDevice, attribute);
            if (CheckALCError() || alContext == IntPtr.Zero)
            {
                Dispose();
                throw new InvalidOperationException("Could not create OpenAL context");
            }

            ALC10.alcMakeContextCurrent(alContext);
            if (CheckALCError())
            {
                Dispose();
                throw new InvalidOperationException("Could not make OpenAL context current");
            }

            float[] ori = new float[]
            {
                0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f
            };
            AL10.alListenerfv(AL10.AL_ORIENTATION, ori);
            AL10.alListener3f(AL10.AL_POSITION, 0.0f, 0.0f, 0.0f);
            AL10.alListener3f(AL10.AL_VELOCITY, 0.0f, 0.0f, 0.0f);
            AL10.alListenerf(AL10.AL_GAIN, 1.0f);

            // We do NOT use automatic attenuation! XNA does not do this!
            AL10.alDistanceModel(AL10.AL_NONE);

            EFX.alGenFilters(1, out INTERNAL_alFilter);
        }