Apply source formatting for demodulator thread

This commit is contained in:
Charles J. Cliffe 2015-11-18 21:13:04 -05:00
parent ea005014ae
commit 10aa9f86dd
2 changed files with 63 additions and 70 deletions

View File

@ -19,7 +19,9 @@ DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent) : IOThread(),
agcEnabled.store(false); agcEnabled.store(false);
} }
DemodulatorThread::~DemodulatorThread() { DemodulatorThread::~DemodulatorThread() {
} }
void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) { void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) {
@ -54,7 +56,7 @@ void DemodulatorThread::run() {
while (!terminated) { while (!terminated) {
DemodulatorThreadPostIQData *inp; DemodulatorThreadPostIQData *inp;
iqInputQueue->pop(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(); audioSampleRate = demodInstance->getAudioSampleRate();
@ -173,20 +175,20 @@ void DemodulatorThread::run() {
} else { } else {
int numAudioWritten = ati->data.size(); int numAudioWritten = ati->data.size();
ati_vis->channels = 1; ati_vis->channels = 1;
// if (numAudioWritten > bufSize) { // if (numAudioWritten > bufSize) {
ati_vis->inputRate = audioSampleRate; ati_vis->inputRate = audioSampleRate;
if (num_vis > numAudioWritten) { if (num_vis > numAudioWritten) {
num_vis = numAudioWritten; num_vis = numAudioWritten;
} }
ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis); ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis);
// } else { // } else {
// if (num_vis > bufSize) { // if (num_vis > bufSize) {
// num_vis = bufSize; // num_vis = bufSize;
// } // }
// ati_vis->data.assign(ati->data.begin(), ati->data.begin() + num_vis); // 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); audioVisOutputQueue->push(ati_vis);
@ -219,7 +221,6 @@ void DemodulatorThread::run() {
} }
} }
inp->decRefCount(); inp->decRefCount();
} }
// end while !terminated // end while !terminated
@ -261,7 +262,6 @@ bool DemodulatorThread::getAGC() {
return agcEnabled.load(); return agcEnabled.load();
} }
float DemodulatorThread::getSignalLevel() { float DemodulatorThread::getSignalLevel() {
return signalLevel.load(); return signalLevel.load();
} }

View File

@ -33,13 +33,6 @@ public:
void setSquelchLevel(float signal_level_in); void setSquelchLevel(float signal_level_in);
float getSquelchLevel(); float getSquelchLevel();
//
//#ifdef __APPLE__
// static void *pthread_helper(void *context) {
// return ((DemodulatorThread *) context)->threadMain();
// }
//#endif
protected: protected:
DemodulatorInstance *demodInstance; DemodulatorInstance *demodInstance;
ReBuffer<AudioThreadInput> outputBuffers; ReBuffer<AudioThreadInput> outputBuffers;