Example #1
0
        //OpenAL
        private static void PrepareOpenAL()
        {
            alAudioDevice  = ALC.OpenDevice(null);
            alAudioContext = ALC.CreateContext(alAudioDevice, null);

            if (!ALC.MakeContextCurrent(alAudioContext))
            {
                throw new InvalidOperationException("Unable to make context current");
            }

            Console.WriteLine("Created OpenAL context.");

            //Require float32 support.
            const string Float32Extension = "AL_EXT_float32";

            if (!AL.IsExtensionPresent(Float32Extension))
            {
                throw new Exception($"This program requires '{Float32Extension}' OpenAL extension to function.");
            }

            CheckALErrors();

            Console.WriteLine("OpenAL is ready.");
        }
Example #2
0
 private static void UnloadOpenAL()
 {
     ALC.DestroyContext(alAudioContext);
     ALC.CloseDevice(alAudioDevice);
 }