Esempio n. 1
0
        public SignalRingBuffer Clone()
        {
            var copy = new SignalRingBuffer(Capacity, _rate);

            Buffer.BlockCopy(_fInternalBuffer, 0, copy._fInternalBuffer, 0, sizeof(double) * Capacity);
            copy._fHead         = _fHead;
            copy._fTail         = _fTail;
            copy.Length         = Length;
            copy._fSizeUntilCut = _fSizeUntilCut;
            copy._timeBufEnd    = new TimeStamp(_timeBufEnd);
            copy.IgnoreOverflow = IgnoreOverflow;
            copy.SizeFixed      = SizeFixed;
            return(copy);
        }
Esempio n. 2
0
        public bool InitBuffer(int queueSamples = -1)
        {
            try {
                if (Queue == null || Queue.Samplerate != Samplerate || (queueSamples >= 0 && Queue.Capacity < queueSamples))
                {
                    Queue = new SignalRingBuffer(queueSamples < 0 ? NodeSystemSettings.Instance.SystemHost.GetDefaultRingBufferSize(Samplerate) : queueSamples, Samplerate);
                }

                //if (Buffer == null || Buffer.Samplerate != Samplerate || (bufferSamples >= 0 && Buffer.Length < bufferSamples)) {
                //    Buffer = TimeLocatedBuffer.Default(Samplerate);
                //}

                Queue.Clear();

                return(true);
            } catch (Exception e) {
                NodeSystemSettings.Instance.SystemHost.ReportError(Parent, $"InitBuffer of {Parent.Name}: {e}");
                return(false);
            }
        }
Esempio n. 3
0
 internal void LoadBuffer(SignalRingBuffer buf)
 {
     Queue.LoadState(buf);
 }
Esempio n. 4
0
 public void InitBuffer()
 {
     Queue = new SignalRingBuffer(NodeSystemSettings.Instance.SystemHost.GetDefaultRingBufferSize(_samplerate), _samplerate);
 }