sample-buffer

wayland/running-median/sample-buffer

Create a sample buffer.
sample-buffer
@/sample-buffer
Create a sample buffer.
Sizenumber
Size of internal buffer. Must be a constant integer. Any changes during program execution will be ignored. Maximum size is 255. Odd sizes results in a 'real' middle element and will be a bit faster. Even sizes takes the average of the two middle elements as median.
sample-buffer
Buffer
Size
Buffer@/sample-buffer
To use the node in your project you should have the wayland/running-median library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require "https://github.com/WaylandM/RunningMedian"

#include <RunningMedian.h>

node {
    meta {
        using Type = RunningMedian*;
    }

    uint8_t mem[sizeof(RunningMedian)];

    void evaluate(Context ctx) {
        if (!isSettingUp())
            return;

        uint8_t sampleSize = getValue<input_Size>(ctx);

        Type samples = new (mem) RunningMedian(sampleSize);

        emitValue<output_Buffer>(ctx, samples);

    }
}