Ejemplo n.º 1
0
 public void UpdateDevices()
 {
     VideoDevices.Clear();
     AudioDevices.Clear();
     MpsseDevices.Clear();
     PeachCam.EnumerateDevices();
 }
Ejemplo n.º 2
0
        public void UpdateDevices()
        {
            InputDevices.Clear();
            OutputDevices.Clear();
            VideoDevices.Clear();

            for (int i = 0; i < WaveIn.DeviceCount; i++)
            {
                InputDevices.Add(new InputMenuData {
                    Name = WaveIn.GetCapabilities(i).ProductName
                });
            }

            for (int i = 0; i < WaveOut.DeviceCount; i++)
            {
                OutputDevices.Add(new OutputMenuData {
                    Name = WaveOut.GetCapabilities(i).ProductName
                });
            }

            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            foreach (FilterInfo device in videoDevices)
            {
                VideoDevices.Add(new VideoMenuData {
                    Name = device.Name
                });
            }
        }
Ejemplo n.º 3
0
        internal void UpdateDevices()
        {
            var tDevEnum = Type.GetTypeFromCLSID(
                new Guid("62be5d10-60eb-11d0-bd3b-00a0c911ce86"));
            var          devEnum     = (ICreateDevEnum)Activator.CreateInstance(tDevEnum);
            IEnumMoniker enumMoniker = null;
            var          cat         = new Guid("860bb310-5d01-11d0-bd3b-00a0c911ce86");

            VideoDevices.Clear();
            AudioDevices.Clear();

            devEnum.CreateClassEnumerator(ref cat, out enumMoniker, 0);
            if (enumMoniker != null)
            {
                VideoDevices.AddRange(DisplayDeviceInformation(DeviceType.Video, enumMoniker));
            }

            cat = new Guid("33d9a762-90c8-11d0-bd43-00a0c911ce86");
            devEnum.CreateClassEnumerator(ref cat, out enumMoniker, 0);
            if (enumMoniker != null)
            {
                AudioDevices.AddRange(DisplayDeviceInformation(DeviceType.Audio, enumMoniker));
            }
        }
Ejemplo n.º 4
0
        public void FillData()
        {
            //engine setting
            uint width, height;

            Engine.Instance.Driver.GetDisplayMode(out width, out height);
            SVideoSetting videoSetting = Engine.Instance.VideoSetting;

            //
            DisplayModes.Clear();
            DisplayModes.Add(new DisplayMode()
            {
                WindowMode = true
            });
            _cbDisplayModes.SelectedIndex     = 0;
            _cbDisplayModes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            Resolutions.Clear();
            Resolutions.Add(new Resolution()
            {
                Width = width, Height = height
            });

            _cbResolutions.SelectedIndex     = 0;
            _cbResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //

            RefreshRates.Default();
            _cbRefreshRates.SelectedIndex     = 0;
            _cbRefreshRates.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            VideoDevices.Clear();
            VideoDevices.Add(new VideoDevice()
            {
                Index = 0
            });

            _cbVideoDevices.SelectedIndex     = 0;
            _cbVideoDevices.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MultiSamples.Default();
            _cbMultisamples.SelectedItem      = (from x in MultiSamples where x.Sample == videoSetting.antialias select x).ToArray()[0];
            _cbMultisamples.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbVsyncs.SelectedItem      = (from x in VSyncs where x.On == videoSetting.vsync select x).ToArray()[0];
            _cbVsyncs.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MatResolutions.Clear();
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });

            _cbMatResolutions.SelectedItem      = (from x in MatResolutions where x.Level == videoSetting.textureResolution select x).ToArray()[0];
            _cbMatResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatTextureFilters.SelectedItem      = (from x in MatTextureFilters where x.Filter == videoSetting.textureFiltering select x).ToArray()[0];
            _cbMatTextureFilters.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatProjections.SelectedItem      = (from x in MatProjections where x.On == false select x).ToArray()[0];
            _cbMatProjections.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            ViewDistances.Default();
            _cbViewDistances.SelectedItem      = (from x in ViewDistances where x.Level == videoSetting.viewDistance select x).ToArray()[0];
            _cbViewDistances.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            EnvDetails.Default();
            _cbEnvDetails.SelectedItem      = (from x in EnvDetails where x.Level == videoSetting.envDetail select x).ToArray()[0];
            _cbEnvDetails.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            GroundScenes.Default();
            _cbGroundScenes.SelectedItem      = (from x in GroundScenes where x.Level == videoSetting.groundClutter select x).ToArray()[0];
            _cbGroundScenes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ShadowQualities.Default();
            _cbShadowQuality.SelectedItem      = (from x in ShadowQualities where x.Level == videoSetting.shadowQuality select x).ToArray()[0];
            _cbShadowQuality.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            LiquidDetails.Clear();
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ULTRA
            });
            _cbLiquidDetail.SelectedItem      = (from x in LiquidDetails where x.Level == videoSetting.liquidDetail select x).ToArray()[0];
            _cbLiquidDetail.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SunLightEffects.Clear();
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSunLightEffect.SelectedItem      = (from x in SunLightEffects where x.Level == videoSetting.sunshafts select x).ToArray()[0];
            _cbSunLightEffect.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ParticleDensities.Default();
            _cbParticleDensity.SelectedItem      = (from x in ParticleDensities where x.Level == videoSetting.particleDensity select x).ToArray()[0];
            _cbParticleDensity.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SSAOLevels.Clear();
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSSAO.SelectedItem      = (from x in SSAOLevels where x.Level == videoSetting.SSAO select x).ToArray()[0];
            _cbSSAO.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates the devices.
        /// </summary>
        private void UpdateDevices()
        {
            try
            {
                if (string.IsNullOrEmpty(this.FFmpegPath) || !File.Exists(this.FFmpegPath))
                {
                    return;
                }
            }
            catch { return; }

            var ffmpeg = new ProcessHelper(this.FFmpegPath)
            {
                Arguments = "-hide_banner -list_devices 1 -f dshow -i dummy"
            };

            ffmpeg.Start();
            var lines = ffmpeg.StandardError;

            var gettingVid = false;
            var gettingAud = false;

            AudioDevices.Clear();
            VideoDevices.Clear();

            foreach (var item in lines)
            {
                if (item.Contains("DirectShow video devices"))
                {
                    gettingVid = true;
                    gettingAud = false;
                    continue;
                }
                else if (item.Contains("DirectShow audio devices"))
                {
                    gettingAud = true;
                    gettingVid = false;
                    continue;
                }
                else if (string.IsNullOrEmpty(item) || item.Contains("Alternative name") || item.Contains("exit requested"))
                {
                    continue;
                }

                var quoteIndex = item.IndexOf("\"", StringComparison.Ordinal);
                if (quoteIndex < 0)
                {
                    continue;
                }

                var device = item.Remove(0, quoteIndex + 1);
                quoteIndex = device.IndexOf("\"", StringComparison.Ordinal);
                if (quoteIndex < 0)
                {
                    throw new ArgumentNullException(item);
                }

                device = device.Remove(quoteIndex);

                if (gettingAud)
                {
                    AudioDevices.Add(device);
                }
                if (gettingVid)
                {
                    VideoDevices.Add(device);
                }
            }

            OnDevicesUpdated();
        }