mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 11:49:38 -05:00
Several crash/bug fixes, uninitialized vars
This commit is contained in:
parent
f7821400a1
commit
3fc6f9ad80
@ -65,8 +65,7 @@ void DemodulatorThread::run() {
|
||||
iqAutoGain = agc_crcf_create();
|
||||
agc_crcf_set_bandwidth(iqAutoGain, 0.1);
|
||||
|
||||
AudioThreadInput *ati_vis = new AudioThreadInput;
|
||||
ati_vis->data.reserve(DEMOD_VIS_SIZE);
|
||||
ReBuffer<AudioThreadInput> audioVisBuffers;
|
||||
|
||||
std::cout << "Demodulator thread started.." << std::endl;
|
||||
|
||||
@ -358,8 +357,8 @@ void DemodulatorThread::run() {
|
||||
}
|
||||
|
||||
if (ati && audioVisOutputQueue != NULL && audioVisOutputQueue->empty()) {
|
||||
|
||||
ati_vis->busy_update.lock();
|
||||
AudioThreadInput *ati_vis = audioVisBuffers.getBuffer();
|
||||
ati_vis->setRefCount(1);
|
||||
ati_vis->sampleRate = inp->sampleRate;
|
||||
ati_vis->inputRate = inp->sampleRate;
|
||||
|
||||
@ -404,7 +403,6 @@ void DemodulatorThread::run() {
|
||||
// std::cout << "Signal: " << agc_crcf_get_signal_level(agc) << " -- " << agc_crcf_get_rssi(agc) << "dB " << std::endl;
|
||||
}
|
||||
|
||||
ati_vis->busy_update.unlock();
|
||||
audioVisOutputQueue->push(ati_vis);
|
||||
}
|
||||
|
||||
@ -495,7 +493,7 @@ void DemodulatorThread::run() {
|
||||
AudioThreadInput *dummy_vis;
|
||||
audioVisOutputQueue->pop(dummy_vis);
|
||||
}
|
||||
delete ati_vis;
|
||||
audioVisBuffers.purge();
|
||||
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
||||
tCmd.context = this;
|
||||
|
@ -6,6 +6,8 @@ ScopeVisualProcessor::ScopeVisualProcessor(): fftInData(NULL), fftwOutput(NULL),
|
||||
scopeEnabled.store(true);
|
||||
spectrumEnabled.store(true);
|
||||
fft_average_rate = 0.65;
|
||||
fft_ceil_ma = fft_ceil_maa = 0;
|
||||
fft_floor_ma = fft_floor_maa = 0;
|
||||
}
|
||||
|
||||
ScopeVisualProcessor::~ScopeVisualProcessor() {
|
||||
@ -67,8 +69,6 @@ void ScopeVisualProcessor::process() {
|
||||
return;
|
||||
}
|
||||
|
||||
audioInputData->busy_update.lock();
|
||||
|
||||
ScopeRenderData *renderData = NULL;
|
||||
|
||||
if (scopeEnabled) {
|
||||
@ -117,7 +117,6 @@ void ScopeVisualProcessor::process() {
|
||||
}
|
||||
|
||||
if (spectrumEnabled) {
|
||||
renderData = outputBuffers.getBuffer();
|
||||
iMax = audioInputData->data.size();
|
||||
|
||||
if (audioInputData->channels==1) {
|
||||
@ -157,8 +156,8 @@ void ScopeVisualProcessor::process() {
|
||||
}
|
||||
|
||||
for (i = 0; i < (fftSize/2); i++) {
|
||||
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * fft_average_rate;
|
||||
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * fft_average_rate;
|
||||
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * fft_average_rate;
|
||||
|
||||
if (fft_result_maa[i] > fft_ceil) {
|
||||
fft_ceil = fft_result_maa[i];
|
||||
@ -168,6 +167,11 @@ void ScopeVisualProcessor::process() {
|
||||
}
|
||||
}
|
||||
|
||||
if (fft_floor == fft_ceil) {
|
||||
audioInputData->decRefCount();
|
||||
return;
|
||||
}
|
||||
|
||||
fft_ceil_ma = fft_ceil_ma + (fft_ceil - fft_ceil_ma) * 0.05;
|
||||
fft_ceil_maa = fft_ceil_maa + (fft_ceil_ma - fft_ceil_maa) * 0.05;
|
||||
|
||||
@ -180,6 +184,8 @@ void ScopeVisualProcessor::process() {
|
||||
outSize = (int)floor((float)outSize * ((float)audioInputData->sampleRate/(float)audioInputData->inputRate));
|
||||
}
|
||||
|
||||
renderData = outputBuffers.getBuffer();
|
||||
|
||||
if (renderData->waveform_points.size() != outSize*2) {
|
||||
renderData->waveform_points.resize(outSize*2);
|
||||
}
|
||||
@ -199,6 +205,6 @@ void ScopeVisualProcessor::process() {
|
||||
distribute(renderData);
|
||||
}
|
||||
|
||||
audioInputData->busy_update.unlock();
|
||||
audioInputData->decRefCount();
|
||||
}
|
||||
}
|
||||
|
@ -306,8 +306,8 @@ void SDRPostThread::run() {
|
||||
iirfilt_crcf_execute_block(dcFilter, &dcBuf[0], chanDataSize, &demodDataOut->data[0]);
|
||||
} else {
|
||||
for (int j = 0; j < chanDataSize; j++) {
|
||||
idx += numChannels;
|
||||
demodDataOut->data[j] = dataOut[idx];
|
||||
idx += numChannels;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user