1
0
mirror of https://github.com/cjcliffe/CubicSDR.git synced 2025-03-26 14:18:32 -04:00

Merge pull request from cjcliffe/gfx-optimize1

Patch for broken bandwidth select / demod waterfall
This commit is contained in:
Charles J. Cliffe 2015-01-23 11:14:43 -05:00
commit f1f71c6080
3 changed files with 39 additions and 24 deletions

View File

@ -369,12 +369,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demod->setDemodulatorType(dSelection);
}
unsigned int demodBw = (unsigned int) ceil((float) demod->getParams().bandwidth * 2.5);
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.5);
if (demodBw > wxGetApp().getSampleRate() / 2) {
demodBw = wxGetApp().getSampleRate() / 2;
}
if (demodBw < 80000) {
demodBw = 80000;
if (demodBw < 50000) {
demodBw = 50000;
}
demodWaterfallCanvas->setBandwidth(demodBw);
demodSpectrumCanvas->setBandwidth(demodBw);

View File

@ -106,7 +106,7 @@ void DemodulatorPreThread::threadMain() {
}
}
if (inp->sampleRate != tempParams.sampleRate) {
if (inp->sampleRate != tempParams.sampleRate && inp->sampleRate) {
tempParams.sampleRate = inp->sampleRate;
rateChanged = true;
}
@ -218,17 +218,25 @@ void DemodulatorPreThread::threadMain() {
case DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS:
msresamp_crcf_destroy(iqResampler);
iqResampler = result.iqResampler;
audioResampler = result.audioResampler;
stereoResampler = result.stereoResampler;
iqResampleRatio = result.iqResampleRatio;
audioResampleRatio = result.audioResamplerRatio;
if (result.iqResampler) {
iqResampler = result.iqResampler;
iqResampleRatio = result.iqResampleRatio;
}
params.audioSampleRate = result.audioSampleRate;
params.bandwidth = result.bandwidth;
params.sampleRate = result.sampleRate;
if (result.audioResampler) {
audioResampler = result.audioResampler;
audioResampleRatio = result.audioResamplerRatio;
stereoResampler = result.stereoResampler;
params.audioSampleRate = result.audioSampleRate;
}
if (params.bandwidth) {
params.bandwidth = result.bandwidth;
}
if (params.sampleRate) {
params.sampleRate = result.sampleRate;
}
break;
default:
break;

View File

@ -24,9 +24,6 @@ void DemodulatorWorkerThread::threadMain() {
commandQueue->pop(command);
switch (command.cmd) {
case DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS:
if (!filterCommand.bandwidth || !filterCommand.audioSampleRate) {
break;
}
filterChanged = true;
filterCommand = command;
break;
@ -40,18 +37,28 @@ void DemodulatorWorkerThread::threadMain() {
if (filterChanged && !terminated) {
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
result.audioResamplerRatio = (double) (filterCommand.audioSampleRate) / (double) filterCommand.bandwidth;
float As = 60.0f; // stop-band attenuation [dB]
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
result.audioResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
result.stereoResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
if (filterCommand.sampleRate && filterCommand.bandwidth) {
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
}
if (filterCommand.bandwidth && filterCommand.audioSampleRate) {
result.audioResamplerRatio = (double) (filterCommand.audioSampleRate) / (double) filterCommand.bandwidth;
result.audioResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
result.stereoResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
result.audioSampleRate = filterCommand.audioSampleRate;
}
if (filterCommand.bandwidth) {
result.bandwidth = filterCommand.bandwidth;
}
if (filterCommand.sampleRate) {
result.sampleRate = filterCommand.sampleRate;
}
result.audioSampleRate = filterCommand.audioSampleRate;
result.bandwidth = filterCommand.bandwidth;
result.sampleRate = filterCommand.sampleRate;
resultQueue->push(result);
}