Пример #1
0
        public void Enqueue(float x, float t)
        {
            Templer sample = new Templer(x, t);

            if (rawSampleList == null)
            {
                rawSampleList = new List <Templer>();
            }
            rawSampleList.Add(sample);
            sampleNo++;

            // Determine max and min
            if (sampleNo <= 2f)
            {
                yMax = x;
                yMin = x;
            }
            else if (x > yMax)
            {
                yMax = x;
            }
            else if (x < yMin)
            {
                yMin = x;
            }

            // Get auto range
            autoScaleResolution = Mathf.Max(Mathf.Abs(yMin), Mathf.Abs(yMax)) * 2f;
        }
Пример #2
0
        public static List <Templer> LoadSamplesFromCSV(string filename)
        {
            List <Templer> sampleList = new List <Templer>();

            string fileData = File.ReadAllText(Path.Combine(writePath, filename));

            string[] lines = fileData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            for (int i = 1; i < lines.Length - 1; i++)
            {
                string[] vs = lines[i].Trim().Split(',');
                try
                {
                    Templer gs = new Templer(float.Parse(vs[1]), float.Parse(vs[0]));
                    sampleList.Add(gs);
                }
                catch { }
            }
            return(sampleList);
        }