1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

96kHz USB Filter FFT.

This commit is contained in:
Hexameron 2014-08-12 13:34:23 +01:00
parent 30dab49869
commit e17018f6e4

View File

@ -37,7 +37,7 @@ USBDemod::USBDemod(AudioFifo* audioFifo, SampleSink* sampleSink) :
m_audioBufferFill = 0;
m_undersampleCount = 0;
USBFilter = new fftfilt(0.01, m_Bandwidth / 48000.0, usbFftLen);
USBFilter = new fftfilt(0.01, m_Bandwidth / 96000.0, usbFftLen);
// if (!USBFilter) segfault;
}
@ -63,14 +63,12 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
for(SampleVector::const_iterator it = begin; it < end; ++it) {
a = it->real();
b = it->imag();
it++; // TODO: Assumes 96kHz; Expect breakage.
a += it->real();
b += it->imag();
// TODO: Assumes 96kHz; Expect breakage.
c = Complex(a / 65536.0, b / 65536.0);
n_out = USBFilter->run(c, &sideband, true);
for (int i = 0; i < n_out; i++) {
Real demod = (sideband[i].real() + sideband[i].imag()) * 0.7 * 32768.0;
for (int i = 0; i < n_out; i+=2) {
Real demod = (sideband[i].real() + sideband[i].imag()) * 32768.0;
// Downsample by 4x for audio display
if (!(m_undersampleCount++ & 3))
@ -113,7 +111,7 @@ bool USBDemod::handleMessage(Message* cmd)
} else if(MsgConfigureUSBDemod::match(cmd)) {
MsgConfigureUSBDemod* cfg = (MsgConfigureUSBDemod*)cmd;
m_Bandwidth = cfg->getBandwidth();
USBFilter->create_filter(0.3 / 48.0, m_Bandwidth / 48000.0);
USBFilter->create_filter(0.3 / 96.0, m_Bandwidth / 96000.0);
m_volume = cfg->getVolume();
m_volume *= m_volume * 0.1;
cmd->completed();