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
This commit is contained in:
Joe Taylor 2012-09-25 16:04:38 +00:00
parent 2afd4513c8
commit ad7f10843e
9 changed files with 74 additions and 72 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -1,20 +1,33 @@
#include "soundin.h"
#include <stdexcept>
#define NFFT 32768
#define FRAMES_PER_BUFFER 1024
extern "C" {
#include <portaudio.h>
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;
}

View File

@ -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()
{
}

View File

@ -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:

View File

@ -83,13 +83,13 @@
</size>
</property>
<property name="suffix">
<string> kHz</string>
<string> Hz</string>
</property>
<property name="minimum">
<number>-24</number>
<number>-500</number>
</property>
<property name="maximum">
<number>24</number>
<number>500</number>
</property>
<property name="singleStep">
<number>1</number>
@ -149,19 +149,19 @@
</size>
</property>
<property name="suffix">
<string> kHz</string>
<string> Hz</string>
</property>
<property name="minimum">
<number>5</number>
<number>20</number>
</property>
<property name="maximum">
<number>90</number>
<number>1000</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>60</number>
<number>200</number>
</property>
</widget>
</item>
@ -363,10 +363,17 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>USB Dial Freq (kHz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fCenterLineEdit">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -381,17 +388,7 @@
</size>
</property>
<property name="text">
<string>1296.065</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSetRxHardware">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Set Rx Freq</string>
<string>473.000</string>
</property>
</widget>
</item>