Changed Detector to only pass multiples of 4 frames to

48kHz to 12kHz down sampler routine.

Added assert to disallow stereo processing of i/p samples
until fil4.f90 can deal with interleaved stereo streams.

Added QProcess error to jt9 error handler, not that anything
is done with the error code yet but at least it can be examined
in the debugger if required.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3583 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2013-09-28 00:58:36 +00:00
parent de98c4114e
commit bc99eb2061
3 changed files with 15 additions and 10 deletions

View File

@ -35,26 +35,31 @@ void Detector::clear ()
// jt9com_.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0])));
jt9com_.kin = 0;
// fill buffer with zeros (G4WJS commented out becuase it might cause decoder hangs)
// fill buffer with zeros (G4WJS commented out because it might cause decoder hangs)
// qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
}
qint64 Detector::writeData (char const * data, qint64 maxSize)
{
bool overrun (false);
int excess (0);
if (m_monitoring)
{
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames
qint64 framesAcceptable (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]) - jt9com_.kin);
qint64 framesAccepted (qMin (static_cast<qint64> (maxSize / bytesPerFrame ()), framesAcceptable));
if (framesAccepted < static_cast<qint64> (maxSize / bytesPerFrame ()))
overrun = framesAccepted < static_cast<qint64> (maxSize / bytesPerFrame ());
if (overrun)
{
qDebug () << "dropped " << maxSize / sizeof (jt9com_.d2[0]) - framesAccepted << " frames of data on the floor!";
}
Q_ASSERT (2 == bytesPerFrame ()); // only mono until fil4 can do stereo
excess = framesAccepted % 4;
qint32 m_n1,m_n2;
m_n1 = framesAccepted;
m_n1 = framesAccepted - excess;
fil4_((qint16 *)data, &m_n1, m_translate, &m_n2);
store ((char const *) m_translate, m_n2, &jt9com_.d2[jt9com_.kin]);
@ -90,9 +95,9 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
jt9com_.kin = 0;
}
return maxSize; // we drop any data past the end of
// the buffer on the floor until the
// next period starts
return maxSize - (overrun ? 0 : excess * bytesPerFrame ());
// we drop any data past the end of the buffer on
// the floor until the next period starts
}
unsigned Detector::secondInPeriod () const

View File

@ -160,7 +160,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
this, SLOT(readFromStdout()));
connect(&proc_jt9, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(jt9_error()));
this, SLOT(jt9_error(QProcess::ProcessError)));
connect(&proc_jt9, SIGNAL(readyReadStandardError()),
this, SLOT(readFromStderr()));
@ -1386,7 +1386,7 @@ void MainWindow::decode() //decode()
decodeBusy(true);
}
void MainWindow::jt9_error() //jt9_error
void MainWindow::jt9_error(QProcess::ProcessError e) //jt9_error
{
if(!m_killAll) {
msgBox("Error starting or running\n" + m_appDir + "/jt9 -s");

View File

@ -66,7 +66,7 @@ public slots:
void doubleClickOnCall2(bool shift, bool ctrl);
void readFromStdout();
void readFromStderr();
void jt9_error();
void jt9_error(QProcess::ProcessError);
void setXIT(int n);
void setFreq4(int rxFreq, int txFreq);