CubicSDR/src/demod/DemodulatorPreThread.h

90 lines
2.2 KiB
C
Raw Normal View History

// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
2014-11-16 16:51:45 -05:00
#pragma once
#include <queue>
#include <vector>
#include <atomic>
#include <memory>
2014-11-16 16:51:45 -05:00
#include "CubicSDRDefs.h"
2014-12-11 19:07:21 -05:00
#include "DemodDefs.h"
#include "DemodulatorWorkerThread.h"
class DemodulatorInstance;
2015-07-29 20:57:02 -04:00
class DemodulatorPreThread : public IOThread {
2014-11-16 16:51:45 -05:00
public:
2017-08-27 05:11:30 -04:00
DemodulatorPreThread(DemodulatorInstance* parent);
virtual ~DemodulatorPreThread();
virtual void run();
2015-11-17 20:47:00 -05:00
void setDemodType(std::string demodType);
std::string getDemodType();
2015-01-08 21:12:49 -05:00
void setFrequency(long long sampleRate);
long long getFrequency();
void setSampleRate(long long sampleRate);
long long getSampleRate();
void setBandwidth(int bandwidth);
int getBandwidth();
void setAudioSampleRate(int rate);
int getAudioSampleRate();
bool isInitialized();
virtual void terminate();
Modem *getModem();
ModemKit *getModemKit();
std::string readModemSetting(std::string setting);
void writeModemSetting(std::string setting, std::string value);
ModemSettings readModemSettings();
void writeModemSettings(ModemSettings settings);
2014-11-16 16:51:45 -05:00
protected:
2017-08-27 05:11:30 -04:00
DemodulatorInstance* parent;
msresamp_crcf iqResampler;
double iqResampleRatio;
std::vector<liquid_float_complex> resampledData;
2014-11-16 16:51:45 -05:00
2015-11-17 19:32:47 -05:00
Modem *cModem;
ModemKit *cModemKit;
std::atomic_llong currentSampleRate, newSampleRate;
std::atomic_llong currentFrequency, newFrequency;
std::atomic_int currentBandwidth, newBandwidth;
std::atomic_int currentAudioSampleRate, newAudioSampleRate;
std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged;
ModemSettings modemSettingsBuffered;
std::atomic_bool modemSettingsChanged;
nco_crcf freqShifter;
int shiftFrequency;
2015-07-19 23:19:10 -04:00
std::atomic_bool initialized;
2015-11-17 20:47:00 -05:00
std::atomic_bool demodTypeChanged;
std::string demodType;
std::string newDemodType;
2014-11-30 23:33:55 -05:00
2014-12-16 21:30:03 -05:00
DemodulatorWorkerThread *workerThread;
std::thread *t_Worker;
2014-11-30 23:33:55 -05:00
DemodulatorThreadWorkerCommandQueuePtr workerQueue;
DemodulatorThreadWorkerResultQueuePtr workerResults;
DemodulatorThreadInputQueuePtr iqInputQueue;
DemodulatorThreadPostInputQueuePtr iqOutputQueue;
2014-11-16 16:51:45 -05:00
};