Bugfixes:

Detector no longer collects samples when transmitting or not
monitoring. This was causingissues with the waterfall after tx periods
and was a waste of CPU cycles.

Correct the missing window title on the waterfall window.

Stop and restart the output audio stream if the configuration of
device or channels changes in the setup dialog. This defect was
causing spurious transmissions after changing configuration.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3543 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2013-08-11 01:30:05 +00:00
parent b6559fae7c
commit 3bd43db55c
4 changed files with 43 additions and 35 deletions

View File

@ -37,43 +37,50 @@ void Detector::clear ()
qint64 Detector::writeData (char const * data, qint64 maxSize) qint64 Detector::writeData (char const * data, qint64 maxSize)
{ {
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames if (m_monitoring)
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 ()))
{ {
qDebug () << "dropped " << maxSize / sizeof (jt9com_.d2[0]) - framesAccepted << " frames of data on the floor!"; Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ()))); // no torn frames
}
store (data, framesAccepted, &jt9com_.d2[jt9com_.kin]); qint64 framesAcceptable (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]) - jt9com_.kin);
qint64 framesAccepted (qMin (static_cast<qint64> (maxSize / bytesPerFrame ()), framesAcceptable));
unsigned lastSignalIndex (jt9com_.kin / m_framesPerSignal); if (framesAccepted < static_cast<qint64> (maxSize / bytesPerFrame ()))
jt9com_.kin += framesAccepted;
unsigned currentSignalIndex (jt9com_.kin / m_framesPerSignal);
if (currentSignalIndex != lastSignalIndex && m_monitoring)
{
Q_EMIT framesWritten (currentSignalIndex * m_framesPerSignal);
}
if (!secondInPeriod ())
{
if (!m_starting)
{ {
// next samples will be in new period so wrap around to qDebug () << "dropped " << maxSize / sizeof (jt9com_.d2[0]) - framesAccepted << " frames of data on the floor!";
// start of buffer }
//
// we don't bother calling reset () since we expect to fill store (data, framesAccepted, &jt9com_.d2[jt9com_.kin]);
// the whole buffer and don't need to waste cycles zeroing
jt9com_.kin = 0; unsigned lastSignalIndex (jt9com_.kin / m_framesPerSignal);
m_starting = true; jt9com_.kin += framesAccepted;
unsigned currentSignalIndex (jt9com_.kin / m_framesPerSignal);
if (currentSignalIndex != lastSignalIndex && m_monitoring)
{
Q_EMIT framesWritten (currentSignalIndex * m_framesPerSignal);
}
if (!secondInPeriod ())
{
if (!m_starting)
{
// next samples will be in new period so wrap around to
// start of buffer
//
// we don't bother calling reset () since we expect to fill
// the whole buffer and don't need to waste cycles zeroing
jt9com_.kin = 0;
m_starting = true;
}
}
else if (m_starting)
{
m_starting = false;
} }
} }
else if (m_starting) else
{ {
m_starting = false; jt9com_.kin = 0;
} }
return maxSize; // we drop any data past the end of return maxSize; // we drop any data past the end of

View File

@ -216,7 +216,8 @@ void DevSetup::accept()
// Check to see whether SoundInThread must be restarted, // Check to see whether SoundInThread must be restarted,
// and save user parameters. // and save user parameters.
m_restartSoundIn = m_restartSoundOut = false; m_restartSoundIn = false;
m_restartSoundOut = false;
if (m_audioInputDevice != m_audioInputDevices[ui->comboBoxSndIn->currentIndex ()]) if (m_audioInputDevice != m_audioInputDevices[ui->comboBoxSndIn->currentIndex ()])
{ {

View File

@ -822,7 +822,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
} }
if(dlg.m_restartSoundOut) { if(dlg.m_restartSoundOut) {
transmit (); Q_EMIT stopAudioOutputStream ();
Q_EMIT startAudioOutputStream (m_audioOutputDevice, AudioDevice::Mono == m_audioOutputChannel ? 1 : 2);
} }
} }
m_catEnabled=dlg.m_catEnabled; m_catEnabled=dlg.m_catEnabled;

View File

@ -9,14 +9,13 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui(new Ui::WideGraph), ui(new Ui::WideGraph),
m_settings (settings) m_settings (settings)
{ {
installEventFilter (parent); ui->setupUi(this);
setWindowTitle ("Wide Graph"); setWindowTitle ("Wide Graph");
setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint); setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
setMaximumWidth (MAX_SCREENSIZE); setMaximumWidth (MAX_SCREENSIZE);
setMaximumHeight (880); setMaximumHeight (880);
ui->setupUi(this);
ui->widePlot->setCursor(Qt::CrossCursor); ui->widePlot->setCursor(Qt::CrossCursor);
ui->widePlot->setMaximumHeight(800); ui->widePlot->setMaximumHeight(800);
ui->widePlot->m_bCurrent=false; ui->widePlot->m_bCurrent=false;