mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Implement mock real-time input for MAP65: read data from a .tf2 file, with
appropriate delays to approximate real-time data rate.
This commit is contained in:
parent
d34ba9010b
commit
60b0c5b984
@ -62,6 +62,7 @@ set (libm65_FSRCS
|
||||
packjt.f90
|
||||
pfxdump.f90
|
||||
polfit.f90
|
||||
read_tf2.f90
|
||||
recvpkt.f90
|
||||
rfile3a.f90
|
||||
s3avg.f90
|
||||
|
@ -164,10 +164,16 @@ void SoundInThread::run() //SoundInThread::run()
|
||||
{
|
||||
quitExecution = false;
|
||||
|
||||
QFile f("mockRTfiles.txt");
|
||||
m_mockRT=f.exists();
|
||||
|
||||
if(m_mockRT) {
|
||||
inputMockRT(); //"Mock realtime" input from a .tf2 file
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_net) {
|
||||
// qDebug() << "Start inputUDP()";
|
||||
inputUDP();
|
||||
// qDebug() << "Finished inputUDP()";
|
||||
inputUDP(); //Network input from Linrad (or equivalent)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -449,3 +455,59 @@ void SoundInThread::inputUDP()
|
||||
}
|
||||
delete udpSocket;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------- inputMockRT()
|
||||
void SoundInThread::inputMockRT()
|
||||
{
|
||||
bool qe = quitExecution;
|
||||
int ntr0=99;
|
||||
int k=0;
|
||||
int nsec;
|
||||
int ntr;
|
||||
int nhsym0=0;
|
||||
int iz=174;
|
||||
int nBusy=0;
|
||||
int mstr=0;
|
||||
int mswait=0;
|
||||
|
||||
// Main loop for mock realtime input of data from .tf2 files
|
||||
while (!qe) {
|
||||
qe = quitExecution;
|
||||
if (qe) break;
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch(); // Time according to this computer
|
||||
mstr = ms % (1000*m_TRperiod);
|
||||
nsec = (ms % 86400000l) / 1000;
|
||||
ntr = nsec % m_TRperiod;
|
||||
|
||||
// Reset buffer pointer and symbol number at start of minute
|
||||
if(ntr < ntr0 or !m_monitoring or m_TRperiod!=m_TRperiod0) {
|
||||
k=0;
|
||||
nhsym0=0;
|
||||
m_TRperiod0=m_TRperiod;
|
||||
}
|
||||
ntr0=ntr;
|
||||
|
||||
if(m_monitoring) {
|
||||
// If buffer will not overflow, move data into datcom_
|
||||
if ((k+iz) <= 60*96000) {
|
||||
if(k>mstr*96) {
|
||||
mswait=(k-mstr*96)/96;
|
||||
msleep(mswait);
|
||||
}
|
||||
read_tf2_(&k);
|
||||
}
|
||||
m_hsym=(k-2048)*11025.0/(2048.0*m_rate);
|
||||
if(m_hsym != nhsym0) {
|
||||
if(m_dataSinkBusy) {
|
||||
nBusy++;
|
||||
} else {
|
||||
m_dataSinkBusy=true;
|
||||
emit readyForFFT(k); //Signal to compute new FFTs
|
||||
}
|
||||
nhsym0=m_hsym;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ public slots:
|
||||
|
||||
private:
|
||||
void inputUDP();
|
||||
void inputMockRT();
|
||||
|
||||
double m_fAdd;
|
||||
bool m_net;
|
||||
@ -63,6 +64,7 @@ private:
|
||||
bool m_bForceCenterFreq;
|
||||
bool m_IQswap;
|
||||
bool m_10db;
|
||||
bool m_mockRT;
|
||||
double m_dForceCenterFreq;
|
||||
qint32 m_nrx;
|
||||
qint32 m_hsym;
|
||||
@ -77,6 +79,7 @@ private:
|
||||
extern "C" {
|
||||
void recvpkt_(int* nsam, quint16* iblk, qint8* nrx, int* k, double s1[],
|
||||
double s2[], double s3[]);
|
||||
void read_tf2_(int* k);
|
||||
}
|
||||
|
||||
#endif // SOUNDIN_H
|
||||
|
Loading…
Reference in New Issue
Block a user