mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	96kHz USB Filter FFT.
This commit is contained in:
		
							parent
							
								
									30dab49869
								
							
						
					
					
						commit
						e17018f6e4
					
				@ -37,7 +37,7 @@ USBDemod::USBDemod(AudioFifo* audioFifo, SampleSink* sampleSink) :
 | 
				
			|||||||
	m_audioBufferFill = 0;
 | 
						m_audioBufferFill = 0;
 | 
				
			||||||
	m_undersampleCount = 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;
 | 
						// 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) {
 | 
						for(SampleVector::const_iterator it = begin; it < end; ++it) {
 | 
				
			||||||
		a = it->real();
 | 
							a = it->real();
 | 
				
			||||||
		b = it->imag();
 | 
							b = it->imag();
 | 
				
			||||||
		it++;	// TODO: Assumes 96kHz; Expect breakage.
 | 
							// TODO: Assumes 96kHz; Expect breakage.
 | 
				
			||||||
		a += it->real();
 | 
					 | 
				
			||||||
		b += it->imag();
 | 
					 | 
				
			||||||
		c = Complex(a / 65536.0, b / 65536.0);
 | 
							c = Complex(a / 65536.0, b / 65536.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		n_out = USBFilter->run(c, &sideband, true);
 | 
							n_out = USBFilter->run(c, &sideband, true);
 | 
				
			||||||
		for (int i = 0; i < n_out; i++) {
 | 
							for (int i = 0; i < n_out; i+=2) {
 | 
				
			||||||
			Real demod = (sideband[i].real() + sideband[i].imag()) * 0.7 * 32768.0;
 | 
								Real demod = (sideband[i].real() + sideband[i].imag()) * 32768.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Downsample by 4x for audio display
 | 
								// Downsample by 4x for audio display
 | 
				
			||||||
			if (!(m_undersampleCount++ & 3))
 | 
								if (!(m_undersampleCount++ & 3))
 | 
				
			||||||
@ -113,7 +111,7 @@ bool USBDemod::handleMessage(Message* cmd)
 | 
				
			|||||||
	} else if(MsgConfigureUSBDemod::match(cmd)) {
 | 
						} else if(MsgConfigureUSBDemod::match(cmd)) {
 | 
				
			||||||
		MsgConfigureUSBDemod* cfg = (MsgConfigureUSBDemod*)cmd;
 | 
							MsgConfigureUSBDemod* cfg = (MsgConfigureUSBDemod*)cmd;
 | 
				
			||||||
		m_Bandwidth = cfg->getBandwidth();
 | 
							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 = cfg->getVolume();
 | 
				
			||||||
		m_volume *= m_volume * 0.1;
 | 
							m_volume *= m_volume * 0.1;
 | 
				
			||||||
		cmd->completed();
 | 
							cmd->completed();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user