From 4dbeb175001d5bebb837af9d0483e53da527672f Mon Sep 17 00:00:00 2001 From: "Edson W. R. Pereira" Date: Sun, 24 Mar 2013 22:34:57 +0000 Subject: [PATCH] Change to soundout.cpp to get output audio working under Linux. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3088 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 17 +++++++++++------ soundout.cpp | 6 ++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0cb64d21d..b7e57adf7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1247,8 +1247,9 @@ void MainWindow::guiUpdate() if(m_auto) { QFile f("txboth"); - if(f.exists() and fmod(tsec,m_TRperiod)<1.0 + 85.0*m_nsps/12000.0) + if(f.exists() and fmod(tsec,m_TRperiod) < (1.0 + 85.0*m_nsps/12000.0)) { bTxTime=true; + } if(bTxTime and m_iptt==0 and !btxMute) { #define NEW @@ -1333,16 +1334,20 @@ void MainWindow::guiUpdate() m_restart=false; } + // If PTT was just raised, start a countdown for raising TxOK: - if(m_iptt==1 && iptt0==0) nc1=-9; // TxDelay = 0.8 s - if(nc1 <= 0) nc1++; + if(m_iptt == 1 && iptt0 == 0) { + nc1=-9; // TxDelay = 0.8 s + } + if(nc1 <= 0) { + nc1++; + } if(nc1 == 0) { ui->xThermo->setValue(0.0); //Set Thermo to zero m_monitoring=false; soundInThread.setMonitoring(false); btxok=true; m_transmitting=true; - QFile f("ALL.TXT"); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); QTextStream out(&f); @@ -1453,7 +1458,7 @@ QString MainWindow::rig_command() void MainWindow::startTx2() { if(!soundOutThread.isRunning()) { -// qDebug() << "startTx2"; + //qDebug() << "startTx2"; if(!soundOutThread.isRunning()) { QString t=ui->tx6->text(); @@ -1461,6 +1466,7 @@ void MainWindow::startTx2() if(snr>0.0 or snr < -50.0) snr=99.0; soundOutThread.setTxSNR(snr); soundOutThread.start(QThread::HighPriority); + //qDebug() << "soundOutThread.start()"; } ui->xThermo->setValue(0.0); //Set Thermo to zero @@ -1468,7 +1474,6 @@ void MainWindow::startTx2() soundInThread.setMonitoring(false); btxok=true; m_transmitting=true; -// qDebug() << btxok << m_transmitting << m_monitoring; /* QFile f("ALL.TXT"); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); diff --git a/soundout.cpp b/soundout.cpp index d6548e06b..2ada27eb1 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -77,8 +77,13 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, } if(!btxok or btxMute) i2=0; *wptr++ = i2; //left +#ifdef unix + *wptr++ = i2; //right +#endif + ic++; } + //qDebug() << "PA Callback"; return 0; } @@ -146,6 +151,7 @@ void SoundOutThread::run() qint64 ms = QDateTime::currentMSecsSinceEpoch(); m_SamFacOut=udata.ncall*FRAMES_PER_BUFFER*1000.0/(48000.0*(ms-ms0-50)); } + //qDebug() << "btxok = " << btxok << "btxMute = " << btxMute; msleep(100); } Pa_StopStream(outStream);