FFTDataDistributor.h 797 Bytes
Newer Older
1 2 3
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+

4 5 6 7 8 9
#pragma once

#include "VisualProcessor.h"
#include "DemodDefs.h"
#include <cmath>
#include <cstring>
10
#include <atomic>
11 12 13 14

class FFTDataDistributor : public VisualProcessor<DemodulatorThreadIQData, DemodulatorThreadIQData> {
public:
    FFTDataDistributor();
15
    void setFFTSize(unsigned int size);
16 17 18 19
    void setLinesPerSecond(unsigned int lines);
    unsigned int getLinesPerSecond();

protected:
20
    virtual void process();
21 22 23
    
    DemodulatorThreadIQData inputBuffer, tempBuffer;
    ReBuffer<DemodulatorThreadIQData> outputBuffers;
24 25
    std::atomic<unsigned int> fftSize;
   
26 27
    unsigned int linesPerSecond;
    double lineRateAccum;
28 29 30
    size_t bufferMax = 0;
    size_t bufferOffset = 0;
    size_t bufferedItems = 0;
31
};