mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 06:38:44 -05:00
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:
parent
132ee32568
commit
d98153f558
19
Detector.cpp
19
Detector.cpp
@ -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 = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0])));
|
||||||
jt9com_.kin = 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);
|
// qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 Detector::writeData (char const * data, qint64 maxSize)
|
qint64 Detector::writeData (char const * data, qint64 maxSize)
|
||||||
{
|
{
|
||||||
|
bool overrun (false);
|
||||||
|
int excess (0);
|
||||||
if (m_monitoring)
|
if (m_monitoring)
|
||||||
{
|
{
|
||||||
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames
|
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames
|
||||||
|
|
||||||
qint64 framesAcceptable (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]) - jt9com_.kin);
|
qint64 framesAcceptable (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]) - jt9com_.kin);
|
||||||
qint64 framesAccepted (qMin (static_cast<qint64> (maxSize / bytesPerFrame ()), framesAcceptable));
|
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!";
|
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;
|
qint32 m_n1,m_n2;
|
||||||
m_n1 = framesAccepted;
|
m_n1 = framesAccepted - excess;
|
||||||
fil4_((qint16 *)data, &m_n1, m_translate, &m_n2);
|
fil4_((qint16 *)data, &m_n1, m_translate, &m_n2);
|
||||||
store ((char const *) m_translate, m_n2, &jt9com_.d2[jt9com_.kin]);
|
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;
|
jt9com_.kin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxSize; // we drop any data past the end of
|
return maxSize - (overrun ? 0 : excess * bytesPerFrame ());
|
||||||
// the buffer on the floor until the
|
// we drop any data past the end of the buffer on
|
||||||
// next period starts
|
// the floor until the next period starts
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Detector::secondInPeriod () const
|
unsigned Detector::secondInPeriod () const
|
||||||
|
@ -160,7 +160,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
this, SLOT(readFromStdout()));
|
this, SLOT(readFromStdout()));
|
||||||
|
|
||||||
connect(&proc_jt9, SIGNAL(error(QProcess::ProcessError)),
|
connect(&proc_jt9, SIGNAL(error(QProcess::ProcessError)),
|
||||||
this, SLOT(jt9_error()));
|
this, SLOT(jt9_error(QProcess::ProcessError)));
|
||||||
|
|
||||||
connect(&proc_jt9, SIGNAL(readyReadStandardError()),
|
connect(&proc_jt9, SIGNAL(readyReadStandardError()),
|
||||||
this, SLOT(readFromStderr()));
|
this, SLOT(readFromStderr()));
|
||||||
@ -1386,7 +1386,7 @@ void MainWindow::decode() //decode()
|
|||||||
decodeBusy(true);
|
decodeBusy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::jt9_error() //jt9_error
|
void MainWindow::jt9_error(QProcess::ProcessError e) //jt9_error
|
||||||
{
|
{
|
||||||
if(!m_killAll) {
|
if(!m_killAll) {
|
||||||
msgBox("Error starting or running\n" + m_appDir + "/jt9 -s");
|
msgBox("Error starting or running\n" + m_appDir + "/jt9 -s");
|
||||||
|
@ -66,7 +66,7 @@ public slots:
|
|||||||
void doubleClickOnCall2(bool shift, bool ctrl);
|
void doubleClickOnCall2(bool shift, bool ctrl);
|
||||||
void readFromStdout();
|
void readFromStdout();
|
||||||
void readFromStderr();
|
void readFromStderr();
|
||||||
void jt9_error();
|
void jt9_error(QProcess::ProcessError);
|
||||||
void setXIT(int n);
|
void setXIT(int n);
|
||||||
void setFreq4(int rxFreq, int txFreq);
|
void setFreq4(int rxFreq, int txFreq);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user