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
This commit is contained in:
Edson W. R. Pereira 2013-03-24 22:34:57 +00:00
parent d1273a7572
commit 4dbeb17500
2 changed files with 17 additions and 6 deletions

View File

@ -1247,8 +1247,9 @@ void MainWindow::guiUpdate()
if(m_auto) { if(m_auto) {
QFile f("txboth"); 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; bTxTime=true;
}
if(bTxTime and m_iptt==0 and !btxMute) { if(bTxTime and m_iptt==0 and !btxMute) {
#define NEW #define NEW
@ -1333,16 +1334,20 @@ void MainWindow::guiUpdate()
m_restart=false; m_restart=false;
} }
// If PTT was just raised, start a countdown for raising TxOK: // If PTT was just raised, start a countdown for raising TxOK:
if(m_iptt==1 && iptt0==0) nc1=-9; // TxDelay = 0.8 s if(m_iptt == 1 && iptt0 == 0) {
if(nc1 <= 0) nc1++; nc1=-9; // TxDelay = 0.8 s
}
if(nc1 <= 0) {
nc1++;
}
if(nc1 == 0) { if(nc1 == 0) {
ui->xThermo->setValue(0.0); //Set Thermo to zero ui->xThermo->setValue(0.0); //Set Thermo to zero
m_monitoring=false; m_monitoring=false;
soundInThread.setMonitoring(false); soundInThread.setMonitoring(false);
btxok=true; btxok=true;
m_transmitting=true; m_transmitting=true;
QFile f("ALL.TXT"); QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f); QTextStream out(&f);
@ -1453,7 +1458,7 @@ QString MainWindow::rig_command()
void MainWindow::startTx2() void MainWindow::startTx2()
{ {
if(!soundOutThread.isRunning()) { if(!soundOutThread.isRunning()) {
// qDebug() << "startTx2"; //qDebug() << "startTx2";
if(!soundOutThread.isRunning()) { if(!soundOutThread.isRunning()) {
QString t=ui->tx6->text(); QString t=ui->tx6->text();
@ -1461,6 +1466,7 @@ void MainWindow::startTx2()
if(snr>0.0 or snr < -50.0) snr=99.0; if(snr>0.0 or snr < -50.0) snr=99.0;
soundOutThread.setTxSNR(snr); soundOutThread.setTxSNR(snr);
soundOutThread.start(QThread::HighPriority); soundOutThread.start(QThread::HighPriority);
//qDebug() << "soundOutThread.start()";
} }
ui->xThermo->setValue(0.0); //Set Thermo to zero ui->xThermo->setValue(0.0); //Set Thermo to zero
@ -1468,7 +1474,6 @@ void MainWindow::startTx2()
soundInThread.setMonitoring(false); soundInThread.setMonitoring(false);
btxok=true; btxok=true;
m_transmitting=true; m_transmitting=true;
// qDebug() << btxok << m_transmitting << m_monitoring;
/* /*
QFile f("ALL.TXT"); QFile f("ALL.TXT");
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);

View File

@ -77,8 +77,13 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
} }
if(!btxok or btxMute) i2=0; if(!btxok or btxMute) i2=0;
*wptr++ = i2; //left *wptr++ = i2; //left
#ifdef unix
*wptr++ = i2; //right
#endif
ic++; ic++;
} }
//qDebug() << "PA Callback";
return 0; return 0;
} }
@ -146,6 +151,7 @@ void SoundOutThread::run()
qint64 ms = QDateTime::currentMSecsSinceEpoch(); qint64 ms = QDateTime::currentMSecsSinceEpoch();
m_SamFacOut=udata.ncall*FRAMES_PER_BUFFER*1000.0/(48000.0*(ms-ms0-50)); m_SamFacOut=udata.ncall*FRAMES_PER_BUFFER*1000.0/(48000.0*(ms-ms0-50));
} }
//qDebug() << "btxok = " << btxok << "btxMute = " << btxMute;
msleep(100); msleep(100);
} }
Pa_StopStream(outStream); Pa_StopStream(outStream);