CubicSDR/src/process/ScopeVisualProcessor.h

54 lines
1.3 KiB
C
Raw Normal View History

// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
2015-07-31 21:44:25 -04:00
#pragma once
#include "VisualProcessor.h"
#include "AudioThread.h"
#include "ScopePanel.h"
2015-07-31 21:44:25 -04:00
class ScopeRenderData: public ReferenceCounter {
public:
std::vector<float> waveform_points;
ScopePanel::ScopeMode mode;
int inputRate;
int sampleRate;
2015-07-31 21:44:25 -04:00
int channels;
bool spectrum;
int fft_size;
double fft_floor, fft_ceil;
2015-07-31 21:44:25 -04:00
};
typedef ThreadQueue<ScopeRenderData *> ScopeRenderDataQueue;
class ScopeVisualProcessor : public VisualProcessor<AudioThreadInput, ScopeRenderData> {
public:
ScopeVisualProcessor();
~ScopeVisualProcessor();
void setup(int fftSize_in);
void setScopeEnabled(bool scopeEnable);
void setSpectrumEnabled(bool spectrumEnable);
2015-07-31 21:44:25 -04:00
protected:
void process();
ReBuffer<ScopeRenderData> outputBuffers;
std::atomic_bool scopeEnabled;
std::atomic_bool spectrumEnabled;
std::vector<liquid_float_complex> fftInData;
std::vector<liquid_float_complex> fftOutput;
fftplan fftPlan;
2016-01-28 15:49:31 -05:00
unsigned int fftSize;
int desiredInputSize;
2016-01-28 15:49:31 -05:00
unsigned int maxScopeSamples;
double fft_ceil_ma, fft_ceil_maa;
double fft_floor_ma, fft_floor_maa;
double fft_average_rate;
std::vector<double> fft_result;
std::vector<double> fft_result_ma;
std::vector<double> fft_result_maa;
2015-07-31 21:44:25 -04:00
};