Beispiel #1
0
            /// <summary>
            /// Setting the Mouse Sound Effects on this Label,
            /// Notice: when you are using this method, all the
            /// Events Clicks will be removed from the 
            /// LabelControl, so you should add them again.
            /// </summary>
            /// <param name="theValue">
            /// the Noise.
            /// No Noise, No Hand.
            /// </param>
            public override void SetLabelSoundEffects(Noises theValue)
            {
                MESoundEffects = theValue;
                //---------------------------------
                FieldInfo f1 = typeof(Control).GetField("EventClick",
                BindingFlags.Static | BindingFlags.NonPublic);

                object obj = f1.GetValue(this);
                PropertyInfo pi = this.GetType().GetProperty("Events",
                    BindingFlags.NonPublic | BindingFlags.Instance);

                EventHandlerList list = (EventHandlerList)pi.GetValue(this, null);
                list.RemoveHandler(obj, list[obj]);
                //---------------------------------
                f1 = typeof(Control).GetField("EventMouseEnter",
                BindingFlags.Static | BindingFlags.NonPublic);

                obj = f1.GetValue(this);
                pi = this.GetType().GetProperty("Events",
                    BindingFlags.NonPublic | BindingFlags.Instance);

                list = (EventHandlerList)pi.GetValue(this, null);
                list.RemoveHandler(obj, list[obj]);
                //---------------------------------
                switch (this.MESoundEffects)
                {
                    case Noises.ClickNoise:
                        this.Click      -= this.LinkStartLabelControl_MouseClick;
                        this.MouseEnter -= this.LinkStartLabelControl_MouseEnter;
                        this.MouseLeave -= this.LinkStartLabelControl_MouseLeave;
                        this.Click      += this.LinkStartLabelControl_MouseClick;
                        this.MouseEnter += this.LinkStartLabelControl_MouseEnter;
                        this.MouseLeave += this.LinkStartLabelControl_MouseLeave;
                        break;
                    default:
                        break;
                }
            }
Beispiel #2
0
 public virtual void SetLabelSoundEffects(Noises theValue)
 {
 }
Beispiel #3
0
        public static double Simulate(Specimen spec)
        {
            var fkf  = spec.ToFedKf();
            var meas = new double[4];

            var n = DirectCosinsMatrix;
            //var nt = n.Transpose();
            //var c = SensorsOutputCovariances.Inverse();
            //var pseudoInverse = (nt * n).Inverse() * nt;

            var err = 0.0;
            int lng = Math.Min(Signals.RowCount, MaxSimLength);

            var results = new Vector3[lng];

            results[0] = new Vector3 {
                X = 0.0, Y = 0.0, Z = 0.0
            };

            for (int i = 0; i < lng; i++)
            {
                var sigRow   = Signals.Row(i);
                var noiseRow = Noises.Row(i);
                var targRow  = Targets.Row(i);
                meas[0] = sigRow[0] + noiseRow[0];
                meas[1] = sigRow[1] + noiseRow[1];
                meas[2] = sigRow[2] + noiseRow[2];
                meas[3] = sigRow[3] + noiseRow[3];

                DenseMatrix inps;
                if (i > 0)
                {
                    inps = n * results[i - 1].ToMatrix();
                }
                else
                {
                    inps = new DenseMatrix(4, 1, 0.0);
                }
                var res = fkf.Step(meas, inps.ToColumnWiseArray());

                var errs = new double[] { res[0, 0] - targRow[0], res[1, 0] - targRow[1], res[2, 0] - targRow[2] };
                err       += (errs[0] * errs[0]) + (errs[1] * errs[1]) + (errs[2] * errs[2]);
                results[i] = new Vector3 {
                    X = res[0, 0], Y = res[1, 0], Z = res[2, 0]
                };

                if (PrintSimResults)
                {
                    Console.WriteLine(res.ToColumnWiseArray().Print());
                }

                if (double.IsNaN(err))
                {
                    return(double.NaN);
                }
            }

            if (PrintSimResults)
            {
                FileParser.Write3ColonFile(@"Data\Evaluations1000.csv", results);
            }

            return(1 / err * lng);
        }
Beispiel #4
0
        /// <summary>
        /// Возвращает аудио с шумом
        /// </summary>
        /// <param name="noise">Тип шума</param>
        /// <returns></returns>
        public static Stream GetNoiseStream(Noises noise)
        {
            Assembly assembly;

            assembly = Assembly.GetExecutingAssembly();
            switch (noise)
            {
            case Noises.Blue:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.blue.wav"));
            }

            case Noises.Brown:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.brown.wav"));
            }

            case Noises.Bus:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.bus.wav"));
            }

            case Noises.Cafeteria:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.cafeteria.wav"));
            }

            case Noises.Grey:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.grey.wav"));
            }

            case Noises.Kids:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.kids.wav"));
            }

            case Noises.MachineGun:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.machinegun.wav"));
            }

            case Noises.Pink:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.pink.wav"));
            }

            case Noises.Violet:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.violet.wav"));
            }

            case Noises.White:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.white.wav"));
            }

            case Noises.WhiteGaussian:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.whitegaussian.wav"));
            }

            default:
            {
                return(assembly.GetManifestResourceStream("SpeechEndpointDetection.Noises.white.wav"));
            }
            }
        }