CubicSDR/src/demod/DemodulatorPreThread.h

86 lines
2.1 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 "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:
DemodulatorPreThread(DemodulatorInstance *parent);
2014-12-16 21:30:03 -05:00
~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:
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;
long long currentSampleRate, newSampleRate;
long long currentFrequency, newFrequency;
int currentBandwidth, newBandwidth;
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
2014-12-16 21:30:03 -05:00
DemodulatorThreadWorkerCommandQueue *workerQueue;
DemodulatorThreadWorkerResultQueue *workerResults;
DemodulatorThreadInputQueue* iqInputQueue;
DemodulatorThreadPostInputQueue* iqOutputQueue;
2014-11-16 16:51:45 -05:00
};