Ejemplo n.º 1
0
        public static void Initialize()
        {
            // We should only have one of these!
            if (ALDevice != null)
            {
                System.Console.WriteLine("ALDevice already exists, overwriting!");
            }

            bool disableSound = Environment.GetEnvironmentVariable(
                "FNA_AUDIO_DISABLE_SOUND"
                ) == "1";

            if (disableSound)
            {
                ALDevice = new NullDevice();
            }
            else
            {
                try
                {
                    ALDevice = new OpenALDevice();
                }
                catch (DllNotFoundException e)
                {
                    System.Console.WriteLine("OpenAL not found! Need FNA.dll.config?");
                    throw e;
                }
                catch (Exception)
                {
                    /* We ignore and device creation exceptions,
                     * as they are handled down the line with Instance != null
                     */
                }
            }

            // Populate device list
            if (ALDevice != null)
            {
                Renderers      = ALDevice.GetDevices();
                Microphone.All = ALDevice.GetCaptureDevices();

                InstancePool        = new List <SoundEffectInstance>();
                DynamicInstancePool = new List <DynamicSoundEffectInstance>();
                ActiveMics          = new List <Microphone>();
            }
            else
            {
                Renderers      = new ReadOnlyCollection <RendererDetail>(new List <RendererDetail>());
                Microphone.All = new ReadOnlyCollection <Microphone>(new List <Microphone>());
            }
        }
Ejemplo n.º 2
0
        public static void Initialize()
        {
            // We should only have one of these!
            if (ALDevice != null)
            {
                FNALoggerEXT.LogWarn("ALDevice already exists, overwriting!");
            }

            bool disableSound = Environment.GetEnvironmentVariable(
                "FNA_AUDIO_DISABLE_SOUND"
                ) == "1";

            if (disableSound)
            {
                ALDevice = new NullALDevice();
            }
            else
            {
                ALDevice = FNAPlatform.CreateALDevice();
            }

            // Populate device info
            if (ALDevice != null)
            {
                ALDevice.SetMasterVolume(MasterVolume);
                ALDevice.SetDopplerScale(DopplerScale);
                ALDevice.SetSpeedOfSound(SpeedOfSound);

                Renderers      = ALDevice.GetDevices();
                Microphone.All = ALDevice.GetCaptureDevices();

                InstancePool        = new List <SoundEffectInstance>();
                DynamicInstancePool = new List <DynamicSoundEffectInstance>();
                ActiveMics          = new List <Microphone>();
                AppDomain.CurrentDomain.ProcessExit += Dispose;
            }
            else
            {
                Renderers      = new ReadOnlyCollection <RendererDetail>(new List <RendererDetail>());
                Microphone.All = new ReadOnlyCollection <Microphone>(new List <Microphone>());
            }
        }
Ejemplo n.º 3
0
		public static void Initialize()
		{
			// We should only have one of these!
			if (ALDevice != null)
			{
				FNAPlatform.Log("ALDevice already exists, overwriting!");
			}

			bool disableSound = Environment.GetEnvironmentVariable(
				"FNA_AUDIO_DISABLE_SOUND"
			) == "1";

			if (disableSound)
			{
				ALDevice = new NullDevice();
			}
			else
			{
				ALDevice = FNAPlatform.CreateALDevice();
			}

			// Populate device list
			if (ALDevice != null)
			{
				Renderers = ALDevice.GetDevices();
				Microphone.All = ALDevice.GetCaptureDevices();

				InstancePool = new List<SoundEffectInstance>();
				DynamicInstancePool = new List<DynamicSoundEffectInstance>();
				ActiveMics = new List<Microphone>();
			}
			else
			{
				Renderers = new ReadOnlyCollection<RendererDetail>(new List<RendererDetail>());
				Microphone.All = new ReadOnlyCollection<Microphone>(new List<Microphone>());
			}
		}
Ejemplo n.º 4
0
        public static void Initialize()
        {
            // We should only have one of these!
            if (ALDevice != null)
            {
                FNAPlatform.Log("ALDevice already exists, overwriting!");
            }

            bool disableSound = Environment.GetEnvironmentVariable(
                "FNA_AUDIO_DISABLE_SOUND"
                ) == "1";

            if (disableSound)
            {
                ALDevice = new NullDevice();
            }
            else
            {
                ALDevice = FNAPlatform.CreateALDevice();
            }

            // Populate device list
            if (ALDevice != null)
            {
                Renderers      = ALDevice.GetDevices();
                Microphone.All = ALDevice.GetCaptureDevices();

                InstancePool        = new List <SoundEffectInstance>();
                DynamicInstancePool = new List <DynamicSoundEffectInstance>();
                ActiveMics          = new List <Microphone>();
            }
            else
            {
                Renderers      = new ReadOnlyCollection <RendererDetail>(new List <RendererDetail>());
                Microphone.All = new ReadOnlyCollection <Microphone>(new List <Microphone>());
            }
        }
Ejemplo n.º 5
0
        public static void Initialize()
        {
            // We should only have one of these!
            if (ALDevice != null)
            {
                System.Console.WriteLine("ALDevice already exists, overwriting!");
            }

            bool disableSound = Environment.GetEnvironmentVariable(
                "FNA_AUDIO_DISABLE_SOUND"
            ) == "1";

            if (disableSound)
            {
                ALDevice = new NullDevice();
            }
            else
            {
                try
                {
                    ALDevice = new OpenALDevice();
                }
                catch(DllNotFoundException e)
                {
                    System.Console.WriteLine("OpenAL not found! Need FNA.dll.config?");
                    throw e;
                }
                catch(Exception)
                {
                    /* We ignore and device creation exceptions,
                     * as they are handled down the line with Instance != null
                     */
                }
            }

            // Populate device list
            if (ALDevice != null)
            {
                Renderers = ALDevice.GetDevices();
                Microphone.All = ALDevice.GetCaptureDevices();

                InstancePool = new List<SoundEffectInstance>();
                DynamicInstancePool = new List<DynamicSoundEffectInstance>();
                ActiveMics = new List<Microphone>();
            }
            else
            {
                Renderers = new ReadOnlyCollection<RendererDetail>(new List<RendererDetail>());
                Microphone.All = new ReadOnlyCollection<Microphone>(new List<Microphone>());
            }
        }