mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-07-12 05:44:08 -04:00
Crash fixes, apply FIR filter to stereo output
This commit is contained in:
@@ -37,26 +37,8 @@ void DemodulatorWorkerThread::threadMain() {
|
||||
result.resample_ratio = (float) (filterCommand.bandwidth) / (float) filterCommand.inputRate;
|
||||
result.audio_resample_ratio = (float) (filterCommand.audioSampleRate) / (float) filterCommand.bandwidth;
|
||||
|
||||
float fc = 0.5 * ((double) filterCommand.bandwidth / (double) filterCommand.inputRate); // filter cutoff frequency
|
||||
|
||||
if (fc <= 0) {
|
||||
fc = 0;
|
||||
}
|
||||
|
||||
if (fc >= 0.5) {
|
||||
fc = 0.5;
|
||||
}
|
||||
|
||||
float ft = 0.05f; // filter transition
|
||||
float As = 60.0f; // stop-band attenuation [dB]
|
||||
float mu = 0.0f; // fractional timing offset
|
||||
|
||||
// estimate required filter length and generate filter
|
||||
unsigned int h_len = estimate_req_filter_len(ft, As);
|
||||
float h[h_len];
|
||||
liquid_firdes_kaiser(h_len, fc, As, mu, h);
|
||||
|
||||
result.fir_filter = firfilt_crcf_create(h, h_len);
|
||||
result.resampler = msresamp_crcf_create(result.resample_ratio, As);
|
||||
result.audio_resampler = msresamp_rrrf_create(result.audio_resample_ratio, As);
|
||||
result.stereo_resampler = msresamp_rrrf_create(result.audio_resample_ratio, As);
|
||||
|
||||
Reference in New Issue
Block a user