From 61e3ffadc679b8a0022c3986216d2bb391a0daae Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 25 Sep 2012 16:04:38 +0000 Subject: [PATCH] Further mods toward implementing JT8 modes. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2596 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- commons.h | 29 ++++++++++++++++++++++------- getfile.cpp | 10 +++++----- libm65/specjtms.f90 | 1 + mainwindow.cpp | 6 +++--- plotter.cpp | 8 ++++---- soundin.cpp | 31 ++++++++++++++++++++++--------- widegraph.cpp | 22 +--------------------- widegraph.h | 4 ---- widegraph.ui | 35 ++++++++++++++++------------------- 9 files changed, 74 insertions(+), 72 deletions(-) diff --git a/commons.h b/commons.h index 8e63324f2..87a369ac8 100644 --- a/commons.h +++ b/commons.h @@ -5,15 +5,30 @@ extern "C" { -extern struct { //This is "common/mscom/..." in Fortran - short int d2[120*12000]; //Raw data from soundcard - float s1[215]; - float s2[215]; +extern struct { + short int d2[1800*12000]; //This is "common/jt8com/..." in fortran + float ss[184*32768]; + float savg[32768]; + double fcenter; //USB dial freq (kHz) + int nutc; //UTC as integer, HHMM + int mousedf; //User-selected DF + int mousefqso; //User-selected QSO freq (kHz) + int nagain; //1 ==> decode only at fQSO +/- Tol + int ndepth; //How much hinted decoding to do? + int ndiskdat; //1 ==> data read from *.tf2 or *.iq file + int newdat; //1 ==> new data, must do long FFT + int nfa; //Low decode limit (kHz) + int nfb; //High decode limit (kHz) + int ntol; //+/- decoding range around fQSO (Hz) + int map65RxLog; //Flags to control log files + int nfsample; //Input sample rate + int ntrperiod; + int nsave; //Number of s3(64,63) spectra saved int kin; - int ndiskdat; int kline; - int nutc; -} mscom_; + char datetime[20]; +} jt8com_; + } #endif // COMMONS_H diff --git a/getfile.cpp b/getfile.cpp index e7f49abf6..aa583ffe8 100644 --- a/getfile.cpp +++ b/getfile.cpp @@ -12,12 +12,12 @@ void getfile(QString fname, bool xpol, int dbDgrd) FILE* fp=fopen(name,"rb"); int npts=30*48000; - memset(mscom_.d2,0,2*npts); + memset(jt8com_.d2,0,2*npts); if(fp != NULL) { // Read (and ignore) a 44-byte WAV header; then read data - fread(mscom_.d2,1,44,fp); - int nrd=fread(mscom_.d2,2,npts,fp); + fread(jt8com_.d2,1,44,fp); + int nrd=fread(jt8com_.d2,2,npts,fp); fclose(fp); } } @@ -75,9 +75,9 @@ void savewav(QString fname) hdr.ndata=2*npts; fwrite(&hdr,sizeof(hdr),1,fp); -// memcpy(mscom_.d2,buf,2*npts); +// memcpy(jt8com_.d2,buf,2*npts); // fwrite(buf,2,npts,fp); - fwrite(mscom_.d2,2,npts,fp); + fwrite(jt8com_.d2,2,npts,fp); fclose(fp); } // free(buf); diff --git a/libm65/specjtms.f90 b/libm65/specjtms.f90 index e39b7be64..60a0dce9a 100644 --- a/libm65/specjtms.f90 +++ b/libm65/specjtms.f90 @@ -9,6 +9,7 @@ subroutine specjtms(k,px,pxsmo,spk0,f0) complex cx(MAXFFT),cx2(MAXFFT) logical first common/mscom/id(1440000),s1(215),s2(215),kin,ndiskdat,kline,nutc + common/jt8com/nn(1800*12000),ss(184,32768),savg(32768) data first/.true./ save diff --git a/mainwindow.cpp b/mainwindow.cpp index d6ab848f9..abecd209b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -362,15 +362,15 @@ void MainWindow::dataSink(int k) if(m_diskData) { ndiskdat=1; - mscom_.ndiskdat=1; + jt8com_.ndiskdat=1; } else { ndiskdat=0; - mscom_.ndiskdat=0; + jt8com_.ndiskdat=0; } float d,sq=0; for(int i=0; i<2048; i++) { - d=mscom_.d2[k-2048+i]; + d=jt8com_.d2[k-2048+i]; sq += d*d; } px=10.0*log10(sq/2048.0) - 23.0; diff --git a/plotter.cpp b/plotter.cpp index 4ea210b77..1b62894a6 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -221,10 +221,10 @@ void CPlotter::draw(float s[], int i0, float splot[]) //draw() void CPlotter::UTCstr() { int ihr,imin,isec; - if(mscom_.ndiskdat != 0) { - ihr=mscom_.nutc/10000; - imin=(mscom_.nutc/100) % 100; - isec=mscom_.nutc % 100; + if(jt8com_.ndiskdat != 0) { + ihr=jt8com_.nutc/10000; + imin=(jt8com_.nutc/100) % 100; + isec=jt8com_.nutc % 100; } else { qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; imin=ms/60000; diff --git a/soundin.cpp b/soundin.cpp index 874fbec61..b6a34b51e 100644 --- a/soundin.cpp +++ b/soundin.cpp @@ -1,20 +1,33 @@ #include "soundin.h" #include -#define NFFT 32768 #define FRAMES_PER_BUFFER 1024 extern "C" { #include extern struct { - short int d2[120*12000]; //This is "common/mscom/..." in fortran - float s1[215]; - float s2[215]; + short int d2[1800*12000]; //This is "common/jt8com/..." in fortran + float ss[184*32768]; + float savg[32768]; + double fcenter; //USB dial freq (kHz) + int nutc; //UTC as integer, HHMM + int mousedf; //User-selected DF + int mousefqso; //User-selected QSO freq (kHz) + int nagain; //1 ==> decode only at fQSO +/- Tol + int ndepth; //How much hinted decoding to do? + int ndiskdat; //1 ==> data read from *.tf2 or *.iq file + int newdat; //1 ==> new data, must do long FFT + int nfa; //Low decode limit (kHz) + int nfb; //High decode limit (kHz) + int ntol; //+/- decoding range around fQSO (Hz) + int map65RxLog; //Flags to control log files + int nfsample; //Input sample rate + int ntrperiod; + int nsave; //Number of s3(64,63) spectra saved int kin; - int ndiskdat; int kline; - int nutc; -} mscom_; + char datetime[20]; +} jt8com_; } typedef struct @@ -53,9 +66,9 @@ extern "C" int a2dCallback( const void *inputBuffer, void *outputBuffer, nbytes=2*framesToProcess; //Bytes per frame k=udata->kin; - memcpy(&mscom_.d2[k],inputBuffer,nbytes); //Copy all samples to d2 + memcpy(&jt8com_.d2[k],inputBuffer,nbytes); //Copy all samples to d2 udata->kin += framesToProcess; - mscom_.kin=udata->kin; + jt8com_.kin=udata->kin; return paContinue; } diff --git a/widegraph.cpp b/widegraph.cpp index a708773c1..b39be7470 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -37,8 +37,7 @@ WideGraph::WideGraph(QWidget *parent) : m_waterfallAvg = settings.value("WaterfallAvg",10).toInt(); ui->waterfallAvgSpinBox->setValue(m_waterfallAvg); ui->freqOffsetSpinBox->setValue(settings.value("FreqOffset",0).toInt()); - m_bForceCenterFreq=settings.value("ForceCenterFreqBool",false).toBool(); - m_dForceCenterFreq=settings.value("ForceCenterFreqMHz",144.125).toDouble(); + m_dForceCenterFreq=settings.value("ForceCenterFreqMHz",473.000).toDouble(); // ui->cbFcenter->setChecked(m_bForceCenterFreq); ui->fCenterLineEdit->setText(QString::number(m_dForceCenterFreq)); settings.endGroup(); @@ -65,7 +64,6 @@ void WideGraph::saveSettings() settings.setValue("FreqSpan",ui->freqSpanSpinBox->value()); settings.setValue("WaterfallAvg",ui->waterfallAvgSpinBox->value()); settings.setValue("FreqOffset",ui->widePlot->freqOffset()); - settings.setValue("ForceCenterFreqBool",m_bForceCenterFreq); settings.setValue("ForceCenterFreqMHz",m_dForceCenterFreq); settings.endGroup(); } @@ -262,29 +260,11 @@ void WideGraph::setMode65(int n) ui->widePlot->setMode65(n); } -/* -void WideGraph::on_cbFcenter_stateChanged(int n) -{ - m_bForceCenterFreq = (n!=0); - if(m_bForceCenterFreq) { - ui->fCenterLineEdit->setEnabled(true); - ui->pbSetRxHardware->setEnabled(true); - } else { - ui->fCenterLineEdit->setDisabled(true); - ui->pbSetRxHardware->setDisabled(true); - } -} -*/ - void WideGraph::on_fCenterLineEdit_editingFinished() { m_dForceCenterFreq=ui->fCenterLineEdit->text().toDouble(); } -void WideGraph::on_pbSetRxHardware_clicked() -{ -} - void WideGraph::initIQplus() { } diff --git a/widegraph.h b/widegraph.h index bbcf03367..116cf8fe5 100644 --- a/widegraph.h +++ b/widegraph.h @@ -14,10 +14,7 @@ public: explicit WideGraph(QWidget *parent = 0); ~WideGraph(); - bool m_bForceCenterFreq; - qint32 m_mult570; double m_dForceCenterFreq; - double m_cal570; void dataSink2(float s[], int nkhz, int ihsym, int ndiskdata, uchar lstrong[]); @@ -59,7 +56,6 @@ private slots: void on_autoZeroPushButton_clicked(); // void on_cbFcenter_stateChanged(int arg1); void on_fCenterLineEdit_editingFinished(); - void on_pbSetRxHardware_clicked(); void on_cbSpec2d_toggled(bool checked); private: diff --git a/widegraph.ui b/widegraph.ui index b3f44eb44..f26e7107e 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -83,13 +83,13 @@ - kHz + Hz - -24 + -500 - 24 + 500 1 @@ -149,19 +149,19 @@ - kHz + Hz - 5 + 20 - 90 + 1000 5 - 60 + 200 @@ -363,10 +363,17 @@ + + + + USB Dial Freq (kHz) + + + - false + true @@ -381,17 +388,7 @@ - 1296.065 - - - - - - - false - - - Set Rx Freq + 473.000