diff --git a/WSJT-X_Quick_Start_Guide.docx b/WSJT-X_Quick_Start_Guide.docx index b452ca037..b3ed855ea 100644 Binary files a/WSJT-X_Quick_Start_Guide.docx and b/WSJT-X_Quick_Start_Guide.docx differ diff --git a/mainwindow.cpp b/mainwindow.cpp index 2df3f15b7..e4ab8bdfb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,6 @@ bool btxok; //True if OK to transmit double outputLatency; //Latency in seconds float c0[2*1800*1500]; - WideGraph* g_pWideGraph = NULL; QString rev="$Rev$"; @@ -891,6 +890,11 @@ void MainWindow::guiUpdate() msgBox(s); } if(!soundOutThread.isRunning()) { + QString t=ui->tx6->text(); + double snr=t.mid(1,5).toDouble(); + if(snr>0.0 or snr < -50.0) snr=99.0; + soundOutThread.setTxSNR(snr); + qDebug() << t << snr; soundOutThread.start(QThread::HighPriority); } } @@ -1264,6 +1268,9 @@ void MainWindow::on_tx6_editingFinished() //tx6 edited { QString t=ui->tx6->text(); msgtype(t, ui->tx6); + double snr=t.mid(1,5).toDouble(); + if(snr>0.0 or snr < -50.0) snr=99.0; + soundOutThread.setTxSNR(snr); } void MainWindow::on_dxCallEntry_textChanged(const QString &t) //dxCall changed diff --git a/soundout.cpp b/soundout.cpp index 12024d068..c1b2a4285 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -12,12 +12,13 @@ extern double outputLatency; typedef struct //Parameters sent to or received from callback function { - int nsps; - int ntrperiod; - int ntxfreq; - bool txOK; - bool txMute; - bool bRestart; + double txsnrdb; + int nsps; + int ntrperiod; + int ntxfreq; + bool txOK; + bool txMute; + bool bRestart; } paUserData; //--------------------------------------------------------------- d2aCallback @@ -35,6 +36,8 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, static double phi=0.0; static double dphi; static double freq; + static double snr; + static double fac; static int ic=0; static short int i2; @@ -44,27 +47,29 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, int mstr = ms % (1000*udata->ntrperiod ); if(mstr<1000) return 0; ic=(mstr-1000)*12; -// qDebug() << "Start at:" << 0.001*mstr << udata->ntxfreq; udata->bRestart=false; } int isym=ic/udata->nsps; if(isym>=85) return 0; freq=udata->ntxfreq + itone[isym]*baud; dphi=twopi*freq/12000.0; -/* - if(ic<10000) qDebug() << "a" << ic << udata->nsps << itone[0] - << itone[1] << itone[2] << itone[3] << itone[4] - << itone[5] << itone[6] << itone[7] << itone[8] - << itone[9] << itone[10] << itone[11] << itone[12] - << itone[13] << itone[14] << itone[15] << itone[16]; - */ - //if(ic<10000) qDebug() << ic << isym << freq << dphi << phi << i2; + if(udata->txsnrdb < 0.0) { + snr=pow(10.0,0.05*(udata->txsnrdb-1.0)); + fac=3000.0; + if(snr>1.0) fac=3000.0/snr; + } - for(int i=0 ; itwopi) phi -= twopi; i2=32767.0*sin(phi); // i2 = 500.0*(i2/32767.0 + 5.0*gran()); //Add noise (tests only!) + if(udata->txsnrdb < 0.0) { + int i4=fac*(gran() + i2*snr/32768.0); + if(i4>32767) i4=32767; + if(i4<-32767) i4=-32767; + i2=i4; + } /* if(udata->txMute) i2=0; if(!udata->txOK) i2=0; @@ -97,6 +102,7 @@ void SoundOutThread::run() return; } + udata.txsnrdb=99.0; udata.nsps=m_nsps; udata.ntrperiod=m_TRperiod; udata.ntxfreq=m_txFreq; @@ -127,6 +133,7 @@ void SoundOutThread::run() qe = quitExecution; if (qe) break; + udata.txsnrdb=m_txsnrdb; udata.nsps=m_nsps; udata.ntrperiod=m_TRperiod; udata.ntxfreq=m_txFreq; @@ -154,3 +161,9 @@ void SoundOutThread::setTxFreq(int n) { m_txFreq=n; } + + +void SoundOutThread::setTxSNR(double snr) +{ + m_txsnrdb=snr; +} diff --git a/soundout.h b/soundout.h index 60f275f9c..16a6b5f93 100644 --- a/soundout.h +++ b/soundout.h @@ -27,16 +27,18 @@ public: void setOutputDevice(qint32 n); void setPeriod(int ntrperiod, int nsps); void setTxFreq(int n); + void setTxSNR(double snr); bool quitExecution; //If true, thread exits gracefully // Private members private: + double m_txsnrdb; //if < 0, add noise to Tx audio qint32 m_nDevOut; //Output device number - bool m_txOK; //Enable Tx audio - bool m_txMute; //Mute temporarily qint32 m_TRperiod; //T/R period (s) qint32 m_nsps; //Samples per symbol (at 12000 Hz) qint32 m_txFreq; + bool m_txOK; //Enable Tx audio + bool m_txMute; //Mute temporarily }; #endif diff --git a/wsjtx.iss b/wsjtx.iss index 525fb8a1b..9b5fd3e94 100644 --- a/wsjtx.iss +++ b/wsjtx.iss @@ -10,7 +10,9 @@ Source: "c:\Users\joe\wsjt\wsjtx_install\wsjtx.exe"; DestDir: "{app}" Source: "c:\Users\joe\wsjt\wsjtx_install\wsjt.ico"; DestDir: "{app}" Source: "c:\Users\joe\wsjt\wsjtx_install\afmhot.dat"; DestDir: "{app}"; Source: "c:\Users\joe\wsjt\wsjtx_install\blue.dat"; DestDir: "{app}"; -Source: "c:\Users\joe\wsjt\wsjtx_install\WSJT-X_Quick_Start_Guide.pdf"; DestDir: "{app}"; +Source: "c:\Users\joe\wsjt\wsjtx_install\met8.21"; DestDir: "{app}"; +Source: "c:\Users\joe\wsjt\wsjtx_install\CALL3.TXT"; DestDir: "{app}"; +Source: "c:\Users\joe\wsjt\wsjtx\WSJT-X_Quick_Start_Guide.pdf"; DestDir: "{app}"; Source: "c:\Users\joe\wsjt\QtSupport\*.dll"; DestDir: "{sys}"; Flags: onlyifdoesntexist Source: "c:\Users\joe\wsjt\wsjtx_install\save\000000_0000.wav"; DestDir: "{app}\save";