mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-29 12:52:28 -04:00
Save all files, then possibly remove after decoding finishes.
Some code cleanup; remove unused code. Add sub-mode number to wsjtx_rx.log. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2767 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
b25352e5b5
commit
696fc34512
@ -15,9 +15,6 @@ subroutine decoder(ss,c0)
|
|||||||
integer*2 id2
|
integer*2 id2
|
||||||
integer ii(1)
|
integer ii(1)
|
||||||
complex c0(NDMAX)
|
complex c0(NDMAX)
|
||||||
! common/jt9com/ss0(184,NSMAX),savg(NSMAX),id2(NMAX),nutc0,ndiskdat, &
|
|
||||||
! ntr,nfqso,newdat,npts80,nfb,ntol,kin,nzhsym,nsynced,ndecoded
|
|
||||||
! common/jt9comB/ss(184,NSMAX),c0
|
|
||||||
common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfb,ntol, &
|
common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfb,ntol, &
|
||||||
kin,nzhsym,nsave,nagain,ndepth,nrxlog,nfsample,datetime
|
kin,nzhsym,nsave,nagain,ndepth,nrxlog,nfsample,datetime
|
||||||
common/tracer/limtrace,lu
|
common/tracer/limtrace,lu
|
||||||
@ -35,13 +32,6 @@ subroutine decoder(ss,c0)
|
|||||||
first=.false.
|
first=.false.
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! if(newdat.ne.0) then
|
|
||||||
! ss=ss0
|
|
||||||
! c0=c00
|
|
||||||
! nutc=nutc0
|
|
||||||
! npts8=npts80
|
|
||||||
! endif
|
|
||||||
|
|
||||||
ntrMinutes=ntrperiod/60
|
ntrMinutes=ntrperiod/60
|
||||||
newdat=1
|
newdat=1
|
||||||
nsynced=0
|
nsynced=0
|
||||||
@ -55,27 +45,27 @@ subroutine decoder(ss,c0)
|
|||||||
nsps=6912
|
nsps=6912
|
||||||
df3=1500.0/2048.0
|
df3=1500.0/2048.0
|
||||||
fmt='(i4.4,i4,i5,f6.1,f8.0,f6.1,3x,a22)'
|
fmt='(i4.4,i4,i5,f6.1,f8.0,f6.1,3x,a22)'
|
||||||
fmt14='(i4.4,i4,i5,f6.1,f8.0,f6.1,i8,3x,a22)'
|
fmt14='(i4.4,i4,i5,f6.1,f8.0,f6.1,i3,i8,3x,a22)'
|
||||||
else if(ntrMinutes.eq.2) then
|
else if(ntrMinutes.eq.2) then
|
||||||
nsps=15360
|
nsps=15360
|
||||||
df3=1500.0/2048.0
|
df3=1500.0/2048.0
|
||||||
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
||||||
fmt14='(i4.4,i4,i5,f6.1,f8.1,f6.2,i8,3x,a22)'
|
fmt14='(i4.4,i4,i5,f6.1,f8.1,f6.2,i3,i8,3x,a22)'
|
||||||
else if(ntrMinutes.eq.5) then
|
else if(ntrMinutes.eq.5) then
|
||||||
nsps=40960
|
nsps=40960
|
||||||
df3=1500.0/6144.0
|
df3=1500.0/6144.0
|
||||||
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
||||||
fmt14='(i4.4,i4,i5,f6.1,f8.1,f6.2,i8,3x,a22)'
|
fmt14='(i4.4,i4,i5,f6.1,f8.1,f6.2,i3,i8,3x,a22)'
|
||||||
else if(ntrMinutes.eq.10) then
|
else if(ntrMinutes.eq.10) then
|
||||||
nsps=82944
|
nsps=82944
|
||||||
df3=1500.0/12288.0
|
df3=1500.0/12288.0
|
||||||
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
||||||
fmt14='(i4.4,i4,i5,f6.1,f8.2,f6.2,i8,3x,a22)'
|
fmt14='(i4.4,i4,i5,f6.1,f8.2,f6.2,i3,i8,3x,a22)'
|
||||||
else if(ntrMinutes.eq.30) then
|
else if(ntrMinutes.eq.30) then
|
||||||
nsps=252000
|
nsps=252000
|
||||||
df3=1500.0/32768.0
|
df3=1500.0/32768.0
|
||||||
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
||||||
fmt14='(i4.4,i4,i5,f6.1,f8.2,f6.2,i8,3x,a22)'
|
fmt14='(i4.4,i4,i5,f6.1,f8.2,f6.2,i3,i8,3x,a22)'
|
||||||
endif
|
endif
|
||||||
if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code###
|
if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code###
|
||||||
|
|
||||||
@ -125,7 +115,7 @@ subroutine decoder(ss,c0)
|
|||||||
|
|
||||||
if(msg.ne.' ') then
|
if(msg.ne.' ') then
|
||||||
write(*,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
|
write(*,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
|
||||||
write(14,fmt14) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,nlim,msg
|
write(14,fmt14) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,ntrMinutes,nlim,msg
|
||||||
fgood=f
|
fgood=f
|
||||||
nsynced=1
|
nsynced=1
|
||||||
ndecoded=1
|
ndecoded=1
|
||||||
@ -141,7 +131,7 @@ subroutine decoder(ss,c0)
|
|||||||
1020 format(a33)
|
1020 format(a33)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
write(*,1010) nsum,nsave
|
write(*,1010) nsynced,ndecoded
|
||||||
1010 format('<DecodeFinished>',2i4)
|
1010 format('<DecodeFinished>',2i4)
|
||||||
flush(6)
|
flush(6)
|
||||||
|
|
||||||
|
@ -178,10 +178,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
watcher2 = new QFutureWatcher<void>;
|
watcher2 = new QFutureWatcher<void>;
|
||||||
connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished()));
|
connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished()));
|
||||||
|
|
||||||
future3 = new QFuture<void>;
|
|
||||||
watcher3 = new QFutureWatcher<void>;
|
|
||||||
connect(watcher3, SIGNAL(finished()),this,SLOT(decoderFinished()));
|
|
||||||
|
|
||||||
soundInThread.setInputDevice(m_paInDevice);
|
soundInThread.setInputDevice(m_paInDevice);
|
||||||
soundInThread.start(QThread::HighestPriority);
|
soundInThread.start(QThread::HighestPriority);
|
||||||
soundOutThread.setOutputDevice(m_paOutDevice);
|
soundOutThread.setOutputDevice(m_paOutDevice);
|
||||||
@ -381,7 +377,7 @@ void MainWindow::dataSink(int k)
|
|||||||
m_pctZap=nzap*100.0/m_nsps;
|
m_pctZap=nzap*100.0/m_nsps;
|
||||||
t.sprintf(" Rx noise: %5.1f %5.1f %% ",px,m_pctZap);
|
t.sprintf(" Rx noise: %5.1f %5.1f %% ",px,m_pctZap);
|
||||||
lab3->setText(t);
|
lab3->setText(t);
|
||||||
ui->xThermo->setValue((double)px); //Update the thermometer
|
ui->xThermo->setValue((double)px); //Update thermometer
|
||||||
if(m_monitoring || m_diskData) {
|
if(m_monitoring || m_diskData) {
|
||||||
g_pWideGraph->dataSink2(s,red,df3,ihsym,m_diskData,lstrong);
|
g_pWideGraph->dataSink2(s,red,df3,ihsym,m_diskData,lstrong);
|
||||||
}
|
}
|
||||||
@ -390,19 +386,20 @@ void MainWindow::dataSink(int k)
|
|||||||
m_dataAvailable=true;
|
m_dataAvailable=true;
|
||||||
jt9com_.npts8=(ihsym*m_nsps)/16;
|
jt9com_.npts8=(ihsym*m_nsps)/16;
|
||||||
jt9com_.newdat=1;
|
jt9com_.newdat=1;
|
||||||
|
jt9com_.nagain=0;
|
||||||
jt9com_.nzhsym=m_hsymStop;
|
jt9com_.nzhsym=m_hsymStop;
|
||||||
QDateTime t = QDateTime::currentDateTimeUtc();
|
QDateTime t = QDateTime::currentDateTimeUtc();
|
||||||
m_dateTime=t.toString("yyyy-MMM-dd hh:mm");
|
m_dateTime=t.toString("yyyy-MMM-dd hh:mm");
|
||||||
decode(); //Start the decoder
|
decode(); //Start decoder
|
||||||
if(!m_diskData and m_saveAll) {
|
if(!m_diskData) { //Always save; may delete later
|
||||||
int ihr=t.time().toString("hh").toInt();
|
int ihr=t.time().toString("hh").toInt();
|
||||||
int imin=t.time().toString("mm").toInt();
|
int imin=t.time().toString("mm").toInt();
|
||||||
imin=imin - (imin%(m_TRperiod/60));
|
imin=imin - (imin%(m_TRperiod/60));
|
||||||
QString t2;
|
QString t2;
|
||||||
t2.sprintf("%2.2d%2.2d",ihr,imin);
|
t2.sprintf("%2.2d%2.2d",ihr,imin);
|
||||||
QString fname=m_saveDir + "/" + t.date().toString("yyMMdd") + "_" +
|
m_fname=m_saveDir + "/" + t.date().toString("yyMMdd") + "_" +
|
||||||
t2 + ".wav";
|
t2 + ".wav";
|
||||||
*future2 = QtConcurrent::run(savewav, fname, m_TRperiod);
|
*future2 = QtConcurrent::run(savewav, m_fname, m_TRperiod);
|
||||||
watcher2->setFuture(*future2);
|
watcher2->setFuture(*future2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,24 +756,6 @@ void MainWindow::diskWriteFinished() //diskWriteFinished
|
|||||||
// qDebug() << "diskWriteFinished";
|
// qDebug() << "diskWriteFinished";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::decoderFinished() //decoderFinished
|
|
||||||
{
|
|
||||||
jt9com_.newdat=0;
|
|
||||||
QFile f("decoded.txt");
|
|
||||||
f.open(QIODevice::ReadOnly);
|
|
||||||
QTextStream in(&f);
|
|
||||||
QString line;
|
|
||||||
for(int i=0; i<99999; i++) {
|
|
||||||
line=in.readLine();
|
|
||||||
if(line.length()<=0) break;
|
|
||||||
ui->decodedTextBrowser->append(line);
|
|
||||||
}
|
|
||||||
f.close();
|
|
||||||
ui->DecodeButton->setStyleSheet("");
|
|
||||||
decodeBusy(false);
|
|
||||||
if(m_loopall) on_actionOpen_next_in_directory_triggered();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Delete ../save/*.wav
|
//Delete ../save/*.wav
|
||||||
void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered()
|
void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered()
|
||||||
{
|
{
|
||||||
@ -901,7 +880,6 @@ void MainWindow::decode() //decode()
|
|||||||
jt9com_.ndepth=m_ndepth;
|
jt9com_.ndepth=m_ndepth;
|
||||||
jt9com_.ndiskdat=0;
|
jt9com_.ndiskdat=0;
|
||||||
if(m_diskData) jt9com_.ndiskdat=1;
|
if(m_diskData) jt9com_.ndiskdat=1;
|
||||||
|
|
||||||
jt9com_.nfa=1000; //### temporary ###
|
jt9com_.nfa=1000; //### temporary ###
|
||||||
jt9com_.nfb=2000;
|
jt9com_.nfb=2000;
|
||||||
|
|
||||||
@ -923,17 +901,13 @@ void MainWindow::decode() //decode()
|
|||||||
char *to = (char*)mem_jt9.data();
|
char *to = (char*)mem_jt9.data();
|
||||||
char *from = (char*) jt9com_.ss;
|
char *from = (char*) jt9com_.ss;
|
||||||
int size=sizeof(jt9com_);
|
int size=sizeof(jt9com_);
|
||||||
|
|
||||||
if(jt9com_.newdat==0) {
|
if(jt9com_.newdat==0) {
|
||||||
int noffset = 4*184*22000 + 4*22000 + 4*2*1800*1500 + 2*1800*12000;
|
int noffset = 4*184*22000 + 4*22000 + 4*2*1800*1500 + 2*1800*12000;
|
||||||
to += noffset;
|
to += noffset;
|
||||||
from += noffset;
|
from += noffset;
|
||||||
size -= noffset;
|
size -= noffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(to, from, qMin(mem_jt9.size(), size));
|
memcpy(to, from, qMin(mem_jt9.size(), size));
|
||||||
jt9com_.nagain=0;
|
|
||||||
jt9com_.ndiskdat=0;
|
|
||||||
|
|
||||||
QFile lockFile(m_appDir + "/.lock"); // Allow jt9 to start
|
QFile lockFile(m_appDir + "/.lock"); // Allow jt9 to start
|
||||||
lockFile.remove();
|
lockFile.remove();
|
||||||
@ -958,19 +932,18 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
{
|
{
|
||||||
while(proc_jt9.canReadLine()) {
|
while(proc_jt9.canReadLine()) {
|
||||||
QByteArray t=proc_jt9.readLine();
|
QByteArray t=proc_jt9.readLine();
|
||||||
if(t.indexOf("<QuickDecodeDone>") >= 0) {
|
|
||||||
// m_nsum=t.mid(17,4).toInt();
|
|
||||||
// m_nsave=t.mid(21,4).toInt();
|
|
||||||
// QString t2;
|
|
||||||
// t2.sprintf("Avg: %d",m_nsum);
|
|
||||||
// lab6->setText(t2);
|
|
||||||
}
|
|
||||||
if(t.indexOf("<DecodeFinished>") >= 0) {
|
if(t.indexOf("<DecodeFinished>") >= 0) {
|
||||||
if(m_widebandDecode) {
|
m_bsynced = (t.mid(19,1).toInt()==1);
|
||||||
// g_pMessages->setText(m_messagesText);
|
m_bdecoded = (t.mid(23,1).toInt()==1);
|
||||||
// g_pBandMap->setText(m_bandmapText);
|
bool keepFile=m_saveAll or (m_saveSynced and m_bsynced) or
|
||||||
m_widebandDecode=false;
|
(m_saveDecoded and m_bdecoded);
|
||||||
|
if(!keepFile) {
|
||||||
|
QFile savedFile(m_fname);
|
||||||
|
savedFile.remove();
|
||||||
|
qDebug() << "Removed" << m_fname;
|
||||||
}
|
}
|
||||||
|
jt9com_.nagain=0;
|
||||||
|
jt9com_.ndiskdat=0;
|
||||||
QFile lockFile(m_appDir + "/.lock");
|
QFile lockFile(m_appDir + "/.lock");
|
||||||
lockFile.open(QIODevice::ReadWrite);
|
lockFile.open(QIODevice::ReadWrite);
|
||||||
ui->DecodeButton->setStyleSheet("");
|
ui->DecodeButton->setStyleSheet("");
|
||||||
@ -990,8 +963,6 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_EraseButton_clicked() //Erase
|
void MainWindow::on_EraseButton_clicked() //Erase
|
||||||
{
|
{
|
||||||
ui->decodedTextBrowser->clear();
|
ui->decodedTextBrowser->clear();
|
||||||
|
12
mainwindow.h
12
mainwindow.h
@ -26,7 +26,6 @@ public slots:
|
|||||||
void dataSink(int k);
|
void dataSink(int k);
|
||||||
void diskDat();
|
void diskDat();
|
||||||
void diskWriteFinished();
|
void diskWriteFinished();
|
||||||
void decoderFinished();
|
|
||||||
void freezeDecode(int n);
|
void freezeDecode(int n);
|
||||||
void guiUpdate();
|
void guiUpdate();
|
||||||
void doubleClickOnCall(QString hiscall, bool ctrl);
|
void doubleClickOnCall(QString hiscall, bool ctrl);
|
||||||
@ -158,23 +157,33 @@ private:
|
|||||||
bool m_call3Modified;
|
bool m_call3Modified;
|
||||||
bool m_dataAvailable;
|
bool m_dataAvailable;
|
||||||
bool m_killAll;
|
bool m_killAll;
|
||||||
|
bool m_bsynced;
|
||||||
|
bool m_bdecoded;
|
||||||
|
|
||||||
char m_decoded[80];
|
char m_decoded[80];
|
||||||
|
|
||||||
float m_pctZap;
|
float m_pctZap;
|
||||||
|
|
||||||
QRect m_wideGraphGeom;
|
QRect m_wideGraphGeom;
|
||||||
|
|
||||||
QLabel* lab1; // labels in status bar
|
QLabel* lab1; // labels in status bar
|
||||||
QLabel* lab2;
|
QLabel* lab2;
|
||||||
QLabel* lab3;
|
QLabel* lab3;
|
||||||
QLabel* lab4;
|
QLabel* lab4;
|
||||||
QLabel* lab5;
|
QLabel* lab5;
|
||||||
QLabel* lab6;
|
QLabel* lab6;
|
||||||
|
|
||||||
QMessageBox msgBox0;
|
QMessageBox msgBox0;
|
||||||
|
|
||||||
QFuture<void>* future1;
|
QFuture<void>* future1;
|
||||||
QFuture<void>* future2;
|
QFuture<void>* future2;
|
||||||
QFuture<void>* future3;
|
QFuture<void>* future3;
|
||||||
QFutureWatcher<void>* watcher1;
|
QFutureWatcher<void>* watcher1;
|
||||||
QFutureWatcher<void>* watcher2;
|
QFutureWatcher<void>* watcher2;
|
||||||
QFutureWatcher<void>* watcher3;
|
QFutureWatcher<void>* watcher3;
|
||||||
|
|
||||||
QProcess proc_jt9;
|
QProcess proc_jt9;
|
||||||
|
|
||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_pbdecoding_style1;
|
QString m_pbdecoding_style1;
|
||||||
QString m_pbmonitor_style;
|
QString m_pbmonitor_style;
|
||||||
@ -189,6 +198,7 @@ private:
|
|||||||
QString m_palette;
|
QString m_palette;
|
||||||
QString m_dateTime;
|
QString m_dateTime;
|
||||||
QString m_mode;
|
QString m_mode;
|
||||||
|
QString m_fname;
|
||||||
|
|
||||||
SoundInThread soundInThread; //Instantiate the audio threads
|
SoundInThread soundInThread; //Instantiate the audio threads
|
||||||
SoundOutThread soundOutThread;
|
SoundOutThread soundOutThread;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user