Beispiel #1
0
        public static DoubleData FloatData2DoubleData(FloatData data)
        {
            int num = data.getValues().Length;

            double[] array  = new double[num];
            float[]  values = data.getValues();
            for (int i = 0; i < values.Length; i++)
            {
                array[i] = (double)values[i];
            }
            return(new DoubleData(array, data.getSampleRate(), data.getFirstSampleNumber()));
        }
        public override Data getData()
        {
            Data data = this.getPredecessor().getData();

            if (null == this.transform || null == data || !(data is FloatData))
            {
                return(data);
            }
            FloatData floatData = (FloatData)data;

            float[] array = floatData.getValues();
            if (array.Length > this.transform[0].Length + 1)
            {
                string text = "dimenstion mismatch";

                throw new IllegalArgumentException(text);
            }
            float[] array2 = new float[this.transform.Length];
            for (int i = 0; i < this.transform.Length; i++)
            {
                for (int j = 0; j < array.Length; j++)
                {
                    float[] array3 = array2;
                    int     num    = i;
                    float[] array4 = array3;
                    array4[num] += this.transform[i][j] * array[j];
                }
            }
            if (array.Length > this.transform[0].Length)
            {
                for (int i = 0; i < this.transform.Length; i++)
                {
                    float[] array5 = array2;
                    int     num    = i;
                    float[] array4 = array5;
                    array4[num] += this.transform[i][array.Length];
                }
            }
            return(new FloatData(array2, floatData.getSampleRate(), floatData.getFirstSampleNumber()));
        }
        public override Data getData()
        {
            object obj = this.readData();

            if ((Data)obj != null)
            {
                if (!(((Data)obj) is Signal))
                {
                    int num  = this.id;
                    int num2 = this.dropEveryNthFrame;
                    if (((num2 != -1) ? (num % num2) : 0) == this.dropEveryNthFrame - 1)
                    {
                        if (this.replaceNthWithPrevious)
                        {
                            if (((Data)obj) is FloatData)
                            {
                                FloatData floatData = (FloatData)this.lastFeature;
                                obj = new FloatData(floatData.getValues(), floatData.getSampleRate(), floatData.getFirstSampleNumber());
                            }
                            else
                            {
                                DoubleData doubleData = (DoubleData)this.lastFeature;
                                obj = new DoubleData(doubleData.getValues(), doubleData.getSampleRate(), doubleData.getFirstSampleNumber());
                            }
                        }
                        else
                        {
                            obj = this.readData();
                        }
                    }
                }
                if (obj != null)
                {
                    if (obj is DataEndSignal)
                    {
                        this.id = -1;
                    }
                    if (obj is FloatData)
                    {
                        object obj2 = obj;
                        Data   data;
                        if (obj2 != null)
                        {
                            if ((data = (obj2 as Data)) == null)
                            {
                                throw new IncompatibleClassChangeError();
                            }
                        }
                        else
                        {
                            data = null;
                        }
                        this.lastFeature = data;
                    }
                    else
                    {
                        this.lastFeature = null;
                    }
                }
                else
                {
                    this.lastFeature = null;
                }
            }
            object obj3 = obj;
            Data   result;

            if (obj3 != null)
            {
                if ((result = (obj3 as Data)) == null)
                {
                    throw new IncompatibleClassChangeError();
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }
        public override Data getData()
        {
            object obj = this.getPredecessor().getData();

            if (((Data)obj) is DoubleData && String.instancehelper_equals(this.convMode, "d2f"))
            {
                DoubleData doubleData = (DoubleData)((Data)obj);
                obj = new FloatData(MatrixUtils.double2float(doubleData.getValues()), doubleData.getSampleRate(), doubleData.getFirstSampleNumber());
            }
            else if (((Data)obj) is FloatData && String.instancehelper_equals(this.convMode, "f2d"))
            {
                FloatData floatData = (FloatData)((Data)obj);
                obj = new DoubleData(MatrixUtils.float2double(floatData.getValues()), floatData.getSampleRate(), floatData.getFirstSampleNumber());
            }
            object obj2 = obj;
            Data   result;

            if (obj2 != null)
            {
                if ((result = (obj2 as Data)) == null)
                {
                    throw new IncompatibleClassChangeError();
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }