예제 #1
0
        public override bool Open(int samples)
        {
            Debug.Assert(timer_ == null);

            if (samples <= 0)
            {
                throw new ArgumentException("Invalid samples.");
            }

            samples_    = samples;
            dataBuffer_ = new BlockingCollection <double>();

            dataGenerators_ = new SinusWaveDataGenerator[Channels];
            for (int i = 0; i < dataGenerators_.Length; ++i)
            {
                dataGenerators_[i] = new SinusWaveDataGenerator(0.5, SamplingRate);
            }

#if USE_MMTIMER
            timer_ = new Common.MMTimer(FakeADCallback, SynchronizationContext.Current)
            {
                Interval = (int)(samples / SamplingRate * 1000.0)
            };
            timer_.Start();
#else
            timer_ = new Timer(FakeADCallback, null, 0, (int)(samples / SamplingRate * 1000.0));
#endif

            return(true);
        }
예제 #2
0
        public override bool Open(int samples)
        {
            if (samples <= 0)
            {
                return(false);
            }

            samples_ = samples;

            dataGenerators_ = new SinusWaveDataGenerator[Channels];
            for (int i = 0; i < dataGenerators_.Length; ++i)
            {
                dataGenerators_[i] = new SinusWaveDataGenerator(0.5, SamplingRate);
            }

            StartSampling();
            return(true);
        }
예제 #3
0
        public override bool Open(int samples)
        {
            Debug.Assert(timer_ == null);

            if (samples <= 0)
            {
                throw new ArgumentException("Invalid samples.");
            }

            samples_    = samples;
            dataBuffer_ = new BlockingCollection <double>();

            dataGenerators_ = new SinusWaveDataGenerator[Channels];
            for (int i = 0; i < dataGenerators_.Length; ++i)
            {
                dataGenerators_[i] = new SinusWaveDataGenerator(0.5, SamplingRate);
            }

            timer_ = new Timer(FakeADCallback, null, 0, (int)(samples / SamplingRate * 1000.0));

            return(true);
        }