Adaptive sample block size to match FFT sizes

This  change  corrects timing  discrepancies  on  the horizontal  fast
spectrum plot.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6780 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2016-06-17 01:27:00 +00:00
parent 0de0a5dbe8
commit 5c81b808e5
4 changed files with 74 additions and 44 deletions
+9 -5
View File
@@ -11,22 +11,26 @@ extern "C" {
}
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
unsigned samplesPerFFT, unsigned downSampleFactor,
QObject * parent)
unsigned downSampleFactor, QObject * parent)
: AudioDevice (parent)
, m_frameRate (frameRate)
, m_period (periodLengthInSeconds)
, m_downSampleFactor (downSampleFactor)
, m_samplesPerFFT (samplesPerFFT)
, m_samplesPerFFT {max_buffer_size}
, m_ns (999)
, m_buffer ((downSampleFactor > 1) ?
new short [samplesPerFFT * downSampleFactor] : 0)
new short [max_buffer_size * downSampleFactor] : nullptr)
, m_bufferPos (0)
{
(void)m_frameRate; // quell compiler warning
clear ();
}
void Detector::setBlockSize (unsigned n)
{
m_samplesPerFFT = n;
}
bool Detector::reset ()
{
clear ();
@@ -83,7 +87,7 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
if(m_bufferPos==m_samplesPerFFT*m_downSampleFactor) {
qint32 framesToProcess (m_samplesPerFFT * m_downSampleFactor);
qint32 framesAfterDownSample (m_samplesPerFFT);
if(framesToProcess==13824 and dec_data.params.kin>=0 and
if(m_downSampleFactor > 1 && dec_data.params.kin>=0 &&
dec_data.params.kin < (NTMAX*12000 - framesAfterDownSample)) {
fil4_(&m_buffer[0], &framesToProcess, &dec_data.d2[dec_data.params.kin],
&framesAfterDownSample);