2014-05-18 11:52:39 -04:00
|
|
|
#ifndef INCLUDE_SPECTRUMVIS_H
|
|
|
|
#define INCLUDE_SPECTRUMVIS_H
|
|
|
|
|
|
|
|
#include "dsp/samplesink.h"
|
|
|
|
#include "dsp/fftengine.h"
|
|
|
|
#include "fftwindow.h"
|
|
|
|
#include "util/export.h"
|
|
|
|
|
|
|
|
class GLSpectrum;
|
|
|
|
class MessageQueue;
|
|
|
|
|
|
|
|
class SDRANGELOVE_API SpectrumVis : public SampleSink {
|
|
|
|
public:
|
|
|
|
SpectrumVis(GLSpectrum* glSpectrum = NULL);
|
2015-08-13 23:00:28 -04:00
|
|
|
virtual ~SpectrumVis();
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
void configure(MessageQueue* msgQueue, int fftSize, int overlapPercent, FFTWindow::Function window);
|
|
|
|
|
2015-08-13 23:00:28 -04:00
|
|
|
virtual void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
2015-07-14 19:19:39 -04:00
|
|
|
void feedTriggered(SampleVector::const_iterator triggerPoint, SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
2015-08-13 23:00:28 -04:00
|
|
|
virtual void start();
|
|
|
|
virtual void stop();
|
|
|
|
virtual bool handleMessage(const Message& message);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
FFTEngine* m_fft;
|
|
|
|
FFTWindow m_window;
|
|
|
|
|
|
|
|
std::vector<Complex> m_fftBuffer;
|
|
|
|
std::vector<Real> m_logPowerSpectrum;
|
|
|
|
|
2015-08-13 23:00:28 -04:00
|
|
|
std::size_t m_fftSize;
|
|
|
|
std::size_t m_overlapPercent;
|
|
|
|
std::size_t m_overlapSize;
|
|
|
|
std::size_t m_refillSize;
|
|
|
|
std::size_t m_fftBufferFill;
|
2015-07-14 19:19:39 -04:00
|
|
|
bool m_needMoreSamples;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
GLSpectrum* m_glSpectrum;
|
|
|
|
|
|
|
|
void handleConfigure(int fftSize, int overlapPercent, FFTWindow::Function window);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_SPECTRUMVIS_H
|