SignalUtils::ReadFromCircularBuffer Function

void ReadFromCircularBuffer(TVec *Buffer, TVec *Dst, TCircularBufferState &State, int ForwardStep = - 1);

Copy data from circular buffer.

#NameTypeDescription
1BufferTVec *
2DstTVec *
3StateTCircularBufferState &
4ForwardStep = - 1int
Remarks:

Copies Dst.Length samples from Buffer to Dst. If there is not Dst.Length samples available, the BufferUnderflow flag will be set in the State variable. The routine advances ReadPosition of the buffer to the position where the next data is to be read from. ForwardStep defines the number of samples to advance the read cursor. If the ForwardStep is -1, the read cursor is advanced Dst.Length samples.

Examples
#include "MtxExpr.h"
#include "Units.MtxExpr.h"
#include "Units.SignalUtils.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxExpr;
using namespace Dew::Signal;
using namespace Dew::Signal::Units::SignalUtils;

void Example()
{
    Vector b(0);
    Vector c(0);
    Vector h(0);

    int n = 6;
    int i;
    TCircularBufferState State;

    Vector h1 = Ramp(30, TMtxFloatPrecision::mvDouble, 0, 1);
    c.Size(h1);
    c.SetZero();

    h.Size(h1);
    h.SetZero();

    InitCircularBuffer(11, 2, State);
    int h1Length = h1.Length/n;
    for (i = 0; i < h1Length; i++)
    {
        h1.SetSubRange(i * n, n);
        h.SetSubRange(i * n, n);
        c.SetSubRange(i * n, n);
        WriteToCircularBuffer(b, h1, State, false);
        n = PeekCircularBuffer(State);
        MonitorCircularBuffer(b, h, State, TMonitorMode::mmFromStart);
        ReadFromCircularBuffer(b, c, State, -1);
    }
    h1.SetFullRange();
    h.SetFullRange();
    c.SetFullRange();
}
See Also: SignalUtils::InitCircularBuffer, SignalUtils::WriteToCircularBuffer, SignalUtils::ResizeCircularBuffer, SignalUtils::MonitorCircularBuffer, SignalUtils::CircularBuffer
Declared in Dew::Signal::Units::SignalUtils · Dew.Signal/Units.SignalUtils.h · Cross-compiler