예제 #1
0
        internal static double[] GetSignalSample(ISignalGenerator generator, double time)
        {
            var result = new List <double>();

            for (int i = 0; i < time; i++)
            {
                result.Add(generator.GetSignal(i));
            }

            return(result.ToArray());
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sampleRate"> Number of samples per second</param>
        /// <param name="seconds">Length of signal</param>
        /// <param name="hertz">Cycles per second</param>
        /// <param name="sigGen">Signal Generator</param>
        public Sample(int sampleRate, double seconds, double hertz, ISignalGenerator sigGen)
        {
            _sampleRate = sampleRate;
            _seconds    = seconds;
            _hertz      = hertz;


            if (sigGen != null)
            {
                _samples = sigGen.GetSignal(SampleCount, CycleCount);
            }
            else
            {
                _samples = new List <double>(CycleCount); // Create empty sample list
            }
            _sampleIDX = 0;
        }