mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-31 04:42:25 -04:00
Merge pull request #40 from cjcliffe/gfx-optimize1
Patch for broken bandwidth select / demod waterfall
This commit is contained in:
commit
f1f71c6080
@ -369,12 +369,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
demod->setDemodulatorType(dSelection);
|
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) {
|
if (demodBw > wxGetApp().getSampleRate() / 2) {
|
||||||
demodBw = wxGetApp().getSampleRate() / 2;
|
demodBw = wxGetApp().getSampleRate() / 2;
|
||||||
}
|
}
|
||||||
if (demodBw < 80000) {
|
if (demodBw < 50000) {
|
||||||
demodBw = 80000;
|
demodBw = 50000;
|
||||||
}
|
}
|
||||||
demodWaterfallCanvas->setBandwidth(demodBw);
|
demodWaterfallCanvas->setBandwidth(demodBw);
|
||||||
demodSpectrumCanvas->setBandwidth(demodBw);
|
demodSpectrumCanvas->setBandwidth(demodBw);
|
||||||
|
@ -106,7 +106,7 @@ void DemodulatorPreThread::threadMain() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inp->sampleRate != tempParams.sampleRate) {
|
if (inp->sampleRate != tempParams.sampleRate && inp->sampleRate) {
|
||||||
tempParams.sampleRate = inp->sampleRate;
|
tempParams.sampleRate = inp->sampleRate;
|
||||||
rateChanged = true;
|
rateChanged = true;
|
||||||
}
|
}
|
||||||
@ -218,17 +218,25 @@ void DemodulatorPreThread::threadMain() {
|
|||||||
case DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS:
|
case DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS:
|
||||||
msresamp_crcf_destroy(iqResampler);
|
msresamp_crcf_destroy(iqResampler);
|
||||||
|
|
||||||
iqResampler = result.iqResampler;
|
|
||||||
audioResampler = result.audioResampler;
|
|
||||||
stereoResampler = result.stereoResampler;
|
|
||||||
|
|
||||||
iqResampleRatio = result.iqResampleRatio;
|
if (result.iqResampler) {
|
||||||
audioResampleRatio = result.audioResamplerRatio;
|
iqResampler = result.iqResampler;
|
||||||
|
iqResampleRatio = result.iqResampleRatio;
|
||||||
|
}
|
||||||
|
|
||||||
params.audioSampleRate = result.audioSampleRate;
|
if (result.audioResampler) {
|
||||||
params.bandwidth = result.bandwidth;
|
audioResampler = result.audioResampler;
|
||||||
params.sampleRate = result.sampleRate;
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -24,9 +24,6 @@ void DemodulatorWorkerThread::threadMain() {
|
|||||||
commandQueue->pop(command);
|
commandQueue->pop(command);
|
||||||
switch (command.cmd) {
|
switch (command.cmd) {
|
||||||
case DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS:
|
case DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS:
|
||||||
if (!filterCommand.bandwidth || !filterCommand.audioSampleRate) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
filterChanged = true;
|
filterChanged = true;
|
||||||
filterCommand = command;
|
filterCommand = command;
|
||||||
break;
|
break;
|
||||||
@ -40,18 +37,28 @@ void DemodulatorWorkerThread::threadMain() {
|
|||||||
if (filterChanged && !terminated) {
|
if (filterChanged && !terminated) {
|
||||||
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
|
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]
|
float As = 60.0f; // stop-band attenuation [dB]
|
||||||
|
|
||||||
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
|
if (filterCommand.sampleRate && filterCommand.bandwidth) {
|
||||||
result.audioResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
|
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
|
||||||
result.stereoResampler = msresamp_rrrf_create(result.audioResamplerRatio, As);
|
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);
|
resultQueue->push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user