2019-12-08 04:09:24 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2023-11-18 06:02:48 -05:00
|
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
|
|
// written by Christian Daniel //
|
|
|
|
// Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
2019-12-08 04:09:24 -05:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_LOCALSINKSINK_H_
|
|
|
|
#define INCLUDE_LOCALSINKSINK_H_
|
|
|
|
|
|
|
|
#include <QObject>
|
2020-07-11 04:37:33 -04:00
|
|
|
#include <QThread>
|
2019-12-08 04:09:24 -05:00
|
|
|
|
|
|
|
#include "dsp/channelsamplesink.h"
|
|
|
|
|
|
|
|
#include "localsinksettings.h"
|
|
|
|
|
|
|
|
class DeviceSampleSource;
|
2020-07-11 04:37:33 -04:00
|
|
|
class LocalSinkWorker;
|
2022-12-03 20:52:02 -05:00
|
|
|
class SpectrumVis;
|
2022-12-10 13:02:38 -05:00
|
|
|
class fftfilt;
|
2019-12-08 04:09:24 -05:00
|
|
|
|
|
|
|
class LocalSinkSink : public QObject, public ChannelSampleSink {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LocalSinkSink();
|
|
|
|
~LocalSinkSink();
|
|
|
|
|
|
|
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
|
|
|
|
|
2022-12-03 20:52:02 -05:00
|
|
|
void setSpectrumSink(SpectrumVis* spectrumSink) { m_spectrumSink = spectrumSink; }
|
2022-12-12 01:50:35 -05:00
|
|
|
void applySettings(const LocalSinkSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
2019-12-08 04:09:24 -05:00
|
|
|
void start(DeviceSampleSource *deviceSource);
|
|
|
|
void stop();
|
|
|
|
bool isRunning() const { return m_running; }
|
2020-06-26 22:59:40 -04:00
|
|
|
void setSampleRate(int sampleRate);
|
2019-12-08 04:09:24 -05:00
|
|
|
|
|
|
|
private:
|
2022-12-03 07:33:38 -05:00
|
|
|
DeviceSampleSource *m_deviceSource;
|
2020-06-24 18:16:01 -04:00
|
|
|
SampleSinkFifo m_sampleFifo;
|
2019-12-08 04:09:24 -05:00
|
|
|
LocalSinkSettings m_settings;
|
2020-07-11 04:37:33 -04:00
|
|
|
LocalSinkWorker *m_sinkWorker;
|
|
|
|
QThread m_sinkWorkerThread;
|
2022-12-03 20:52:02 -05:00
|
|
|
SpectrumVis* m_spectrumSink;
|
|
|
|
SampleVector m_spectrumBuffer;
|
2019-12-08 04:09:24 -05:00
|
|
|
bool m_running;
|
2022-12-05 08:18:31 -05:00
|
|
|
float m_gain; //!< Amplitude gain
|
2022-12-10 13:02:38 -05:00
|
|
|
fftfilt* m_fftFilter;
|
2019-12-08 04:09:24 -05:00
|
|
|
|
|
|
|
uint64_t m_centerFrequency;
|
|
|
|
int64_t m_frequencyOffset;
|
|
|
|
uint32_t m_sampleRate;
|
|
|
|
uint32_t m_deviceSampleRate;
|
|
|
|
|
2020-07-11 04:37:33 -04:00
|
|
|
void startWorker();
|
|
|
|
void stopWorker();
|
2019-12-08 04:09:24 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_LOCALSINKSINK_H_
|