mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 04:08:36 -05:00
Apply source formatting for demodulator thread
This commit is contained in:
parent
ea005014ae
commit
10aa9f86dd
@ -16,10 +16,12 @@ DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent) : IOThread(),
|
||||
|
||||
demodInstance = parent;
|
||||
muted.store(false);
|
||||
agcEnabled.store(false);
|
||||
agcEnabled.store(false);
|
||||
|
||||
}
|
||||
|
||||
DemodulatorThread::~DemodulatorThread() {
|
||||
|
||||
}
|
||||
|
||||
void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) {
|
||||
@ -54,7 +56,7 @@ void DemodulatorThread::run() {
|
||||
while (!terminated) {
|
||||
DemodulatorThreadPostIQData *inp;
|
||||
iqInputQueue->pop(inp);
|
||||
// std::lock_guard < std::mutex > lock(inp->m_mutex);
|
||||
// std::lock_guard < std::mutex > lock(inp->m_mutex);
|
||||
|
||||
audioSampleRate = demodInstance->getAudioSampleRate();
|
||||
|
||||
@ -104,9 +106,9 @@ void DemodulatorThread::run() {
|
||||
std::vector<liquid_float_complex> *inputData;
|
||||
|
||||
if (agcEnabled) {
|
||||
inputData = &agcData;
|
||||
inputData = &agcData;
|
||||
} else {
|
||||
inputData = &inp->data;
|
||||
inputData = &inp->data;
|
||||
}
|
||||
|
||||
modemData.sampleRate = inp->sampleRate;
|
||||
@ -142,8 +144,8 @@ void DemodulatorThread::run() {
|
||||
}
|
||||
|
||||
if (ati && audioVisOutputQueue != NULL && audioVisOutputQueue->empty()) {
|
||||
AudioThreadInput *ati_vis = audioVisBuffers.getBuffer();
|
||||
ati_vis->setRefCount(1);
|
||||
AudioThreadInput *ati_vis = audioVisBuffers.getBuffer();
|
||||
ati_vis->setRefCount(1);
|
||||
ati_vis->sampleRate = inp->sampleRate;
|
||||
ati_vis->inputRate = inp->sampleRate;
|
||||
|
||||
@ -173,20 +175,20 @@ void DemodulatorThread::run() {
|
||||
} else {
|
||||
int numAudioWritten = ati->data.size();
|
||||
ati_vis->channels = 1;
|
||||
// if (numAudioWritten > bufSize) {
|
||||
ati_vis->inputRate = audioSampleRate;
|
||||
if (num_vis > numAudioWritten) {
|
||||
num_vis = numAudioWritten;
|
||||
}
|
||||
ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// } else {
|
||||
// if (num_vis > bufSize) {
|
||||
// num_vis = bufSize;
|
||||
// }
|
||||
// ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// }
|
||||
// if (numAudioWritten > bufSize) {
|
||||
ati_vis->inputRate = audioSampleRate;
|
||||
if (num_vis > numAudioWritten) {
|
||||
num_vis = numAudioWritten;
|
||||
}
|
||||
ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// } else {
|
||||
// if (num_vis > bufSize) {
|
||||
// num_vis = bufSize;
|
||||
// }
|
||||
// ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
|
||||
// }
|
||||
|
||||
// std::cout << "Signal: " << agc_crcf_get_signal_level(agc) << " -- " << agc_crcf_get_rssi(agc) << "dB " << std::endl;
|
||||
// std::cout << "Signal: " << agc_crcf_get_signal_level(agc) << " -- " << agc_crcf_get_rssi(agc) << "dB " << std::endl;
|
||||
}
|
||||
|
||||
audioVisOutputQueue->push(ati_vis);
|
||||
@ -207,22 +209,21 @@ void DemodulatorThread::run() {
|
||||
threadQueueControl->pop(command);
|
||||
|
||||
switch (command.cmd) {
|
||||
case DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_ON:
|
||||
squelchEnabled = true;
|
||||
break;
|
||||
case DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_OFF:
|
||||
squelchEnabled = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_ON:
|
||||
squelchEnabled = true;
|
||||
break;
|
||||
case DemodulatorThreadControlCommand::DEMOD_THREAD_CMD_CTL_SQUELCH_OFF:
|
||||
squelchEnabled = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inp->decRefCount();
|
||||
}
|
||||
// end while !terminated
|
||||
// end while !terminated
|
||||
|
||||
outputBuffers.purge();
|
||||
|
||||
@ -230,7 +231,7 @@ void DemodulatorThread::run() {
|
||||
AudioThreadInput *dummy_vis;
|
||||
audioVisOutputQueue->pop(dummy_vis);
|
||||
}
|
||||
audioVisBuffers.purge();
|
||||
audioVisBuffers.purge();
|
||||
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
||||
tCmd.context = this;
|
||||
@ -254,14 +255,13 @@ void DemodulatorThread::setMuted(bool muted) {
|
||||
}
|
||||
|
||||
void DemodulatorThread::setAGC(bool state) {
|
||||
agcEnabled.store(state);
|
||||
agcEnabled.store(state);
|
||||
}
|
||||
|
||||
bool DemodulatorThread::getAGC() {
|
||||
return agcEnabled.load();
|
||||
return agcEnabled.load();
|
||||
}
|
||||
|
||||
|
||||
float DemodulatorThread::getSignalLevel() {
|
||||
return signalLevel.load();
|
||||
}
|
||||
|
@ -33,13 +33,6 @@ public:
|
||||
void setSquelchLevel(float signal_level_in);
|
||||
float getSquelchLevel();
|
||||
|
||||
//
|
||||
//#ifdef __APPLE__
|
||||
// static void *pthread_helper(void *context) {
|
||||
// return ((DemodulatorThread *) context)->threadMain();
|
||||
// }
|
||||
//#endif
|
||||
|
||||
protected:
|
||||
DemodulatorInstance *demodInstance;
|
||||
ReBuffer<AudioThreadInput> outputBuffers;
|
||||
|
Loading…
Reference in New Issue
Block a user