1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-14 15:33:34 -04:00

Copy audio to UDP/RTP: adapt decimation filter to codec also

This commit is contained in:
f4exb
2019-02-17 13:32:17 +01:00
parent 010f6b7ec6
commit d98c4cd3ac
6 changed files with 58 additions and 20 deletions
+5 -6
View File
@@ -37,14 +37,13 @@ AudioFilter::~AudioFilter()
{}
void AudioFilter::setDecimFilters(int sr, uint32_t decim)
void AudioFilter::setDecimFilters(int srHigh, int srLow, float fcHigh, float fcLow)
{
int downSR = sr / (decim == 0 ? 1 : decim);
double fcH = (0.45 * downSR) / (sr <= 0 ? 1 : sr); // high cut frequency normalized to SR
double fcL = 300.0 / downSR; // low cut frequency normalized to downsampled SR
double fcNormHigh = fcHigh / srHigh;
double fcNormLow = fcLow / srLow;
calculate2(false, fcH, m_lpva, m_lpvb);
calculate2(true, fcL, m_hpva, m_hpvb);
calculate2(false, fcNormHigh, m_lpva, m_lpvb);
calculate2(true, fcNormLow, m_hpva, m_hpvb);
m_filterLP.setCoeffs(m_lpva, m_lpvb);
m_filterHP.setCoeffs(m_hpva, m_hpvb);