public void Send(IInputFormParameters parameters)
        {
            if (parameters is TransformTypeParameters)
            {
                var typePar = (parameters as TransformTypeParameters);
                model.Transformation.SetWindowType(typePar.Type.GetValue());

                if (typePar.Type.GetValue() == WindowType.NoWin)
                {
                    paramsView = new InputFormView(this, new TransformContext(model.Transformation.GetTransformConfigs()));
                }
                else
                {
                    if (model.Transformation.GetTransformConfigs() is WindowedTransformStuff)
                    {
                        var stuff = model.Transformation.GetTransformConfigs() as WindowedTransformStuff;
                        paramsView = new InputFormView(this, new WindowTransformContext(stuff));
                    }
                    else
                    {
                        var stuff = new WindowedTransformStuff(model.Transformation.GetTransformConfigs());
                        paramsView = new InputFormView(this, new WindowTransformContext(stuff));
                    }
                }
                paramsView.View();
            }
            else if (parameters is WindowTransformParameters)
            {
                var par = parameters as WindowTransformParameters;
                model.Transformation.SetConfigs(new WindowedTransformStuff(par.Start.GetValue(), par.Step.GetValue(), par.Count.GetValue(),
                                                                           par.WinSize.GetValue(), par.WinStep.GetValue()));
            }
            else if (parameters is TransformParameters)
            {
                var par = parameters as TransformParameters;
                model.Transformation.SetConfigs(new TransformStuff(par.Start.GetValue(), par.Step.GetValue(), par.Count.GetValue()));
            }
            else
            {
                throw new FormatException("Parameters aren't transform configurations!");
            }
        }
Пример #2
0
        public Spectrum Transform(WindowedTransformStuff stuff, ISignal signal, IWindowFilter filter)
        {
            var times = signal.GetLength() / stuff.WinStep - 1;
            var spec  = new Spectrum(stuff.CountFreq, times, signal.GetActualLength());

            //var log = new Logger("windowed_transform.log");
            //log.WriteLog(String.Format("Times: {0}", times));
            //log.Flush();

            var c = 128;

            for (var i = 0; i < times; i++)
            {
                var tr = Transform(stuff, filter.GetFiltered(signal, c, stuff.WinSize)).GetFreqsAtTime(0);
                spec.SetAtTime(i, tr);

                c += stuff.WinStep;
            }

            return(spec);
        }
Пример #3
0
 public WindowTransformParameters(WindowedTransformStuff current) : base(current)
 {
     WinSize = new IntParam("Размер окна: ", "Окно", current.WinSize);
     WinStep = new IntParam("Сдвиг окна: ", "Сдвиг окна", current.WinStep);
 }
Пример #4
0
 public void Transform(WindowedTransformStuff material)
 {
     transform.Transform(material, GetSum());
     TransformChanged();
 }
Пример #5
0
 public WindowTransformContext(WindowedTransformStuff current) : base(new WindowTransformParameters(current))
 {
 }