Пример #1
0
        public override void PrepareProcessing()
        {
            if (_precTimer == null)
            {
                _precTimer                       = new PrecisionTimer();
                _precTimer.Elapsed              += precTimer_Elapsed;
                _precTimer.Milliseconds          = _attrPeriod.TypedGet();
                _precTimer.ToleranceMilliseconds = 10;
            }

            var sampleCount = _attrSamplerate.TypedGet() * _attrPeriod.TypedGet() / 1000;

            if (_buffer == null || _buffer.Length != sampleCount)
            {
                _buffer = new double[sampleCount];
            }

            _portOut.PrepareProcessing(
                DefaultParameters.DefaultQueueMilliseconds.ToSamples(_portOut.Samplerate),
                DefaultParameters.DefaultBufferMilliseconds.ToSamples(_portOut.Samplerate)
                );

            CalculatePhaseStep();
            _phaseAcc = 0;
        }
Пример #2
0
        public bool Start(DeviceSimulator device)
        {
            if (Recording)
            {
                return(false);
            }

            _device = device;

            if (_precTimer == null)
            {
                _precTimer                       = new PrecisionTimer();
                _precTimer.Elapsed              += _precTimer_Elapsed;
                _precTimer.Milliseconds          = PeriodMs;
                _precTimer.ToleranceMilliseconds = 10;
            }

            _precTimer.Enabled = true;
            Recording          = true;

            return(true);
        }