From 5d38203e5813b04097aec8bdc07b9ba6eefe8db7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 15 Oct 2012 19:18:45 +0000 Subject: [PATCH] First successful decode from within WSJT-X. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2664 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- jt9decode.cpp | 6 ++++++ jt9decode.h | 29 +++++++++++++++++++++++++++++ lib/sync9.f90 | 2 +- mainwindow.cpp | 18 +++++++++++++++--- mainwindow.h | 9 +++++++++ wsjtx.pro | 6 ++++-- 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 jt9decode.cpp create mode 100644 jt9decode.h diff --git a/jt9decode.cpp b/jt9decode.cpp new file mode 100644 index 000000000..fe340134d --- /dev/null +++ b/jt9decode.cpp @@ -0,0 +1,6 @@ +#include "jt9decode.h" + +void JT9DecodeThread::run() +{ + qDebug() << "Decode Thread started"; +} diff --git a/jt9decode.h b/jt9decode.h new file mode 100644 index 000000000..638f8a7bd --- /dev/null +++ b/jt9decode.h @@ -0,0 +1,29 @@ +#ifndef JT9DECODE_H +#define JT9DECODE_H +#include +#include + +class JT9DecodeThread : public QThread +{ + Q_OBJECT + +protected: + virtual void run(); + +public: +// Constructs (but does not start) a JT9DecodeThread + JT9DecodeThread() + : quitExecution(false) // Initialize some private members + , m_txOK(false) + { + } + +public: + bool quitExecution; //If true, thread exits gracefully + +// Private members +private: + bool m_txOK; //Enable Tx audio +}; + +#endif // JT9DECODE_H diff --git a/lib/sync9.f90 b/lib/sync9.f90 index b5424522b..30a813919 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -23,7 +23,7 @@ subroutine sync9(ss,tstep,f0a,df3,ntol,nfqso,sync,fpk,ccfred) if(ia.lt.1) ia=1 if(ib.gt.NSMAX) ib=NSMAX endif - print*,ia,ib,df3*ia+1000,df3*ib+1000 + print*,ia,ib,f0a,df3,ntol,nfqso,df3*ia+1000,df3*ib+1000 sbest=0. lagmax=2.5/tstep + 0.9999 diff --git a/mainwindow.cpp b/mainwindow.cpp index 43ac2d8e7..987bee00f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -143,6 +143,10 @@ MainWindow::MainWindow(QWidget *parent) : watcher2 = new QFutureWatcher; connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished())); + future3 = new QFuture; + watcher3 = new QFutureWatcher; + connect(watcher3, SIGNAL(finished()),this,SLOT(decoderFinished())); + // Assign input device and start input thread soundInThread.setInputDevice(m_paInDevice); soundInThread.start(QThread::HighestPriority); @@ -732,7 +736,13 @@ void MainWindow::diskWriteFinished() //diskWriteFinished { qDebug() << "diskWriteFinished"; } - //Delete ../save/*.wav + +void MainWindow::decoderFinished() //decoderFinished +{ + qDebug() << "Decoder Finished"; +} + +//Delete ../save/*.wav void MainWindow::on_actionDelete_all_wav_files_in_SaveDir_triggered() { int i; @@ -804,7 +814,7 @@ void MainWindow::on_actionAvailable_suffixes_and_add_on_prefixes_triggered() void MainWindow::on_DecodeButton_clicked() //Decode request { - qDebug() << "A" << g_pWideGraph->QSOfreq() << m_tol; + decode(); } void MainWindow::freezeDecode(int n) //freezeDecode() @@ -814,7 +824,10 @@ void MainWindow::freezeDecode(int n) //freezeDecode() void MainWindow::decode() //decode() { +// jt9DecodeThread.start(QThread::NormalPriority); + *future3 = QtConcurrent::run(decoder_, &m_TRperiod); + watcher3->setFuture(*future2); } @@ -1391,4 +1404,3 @@ void MainWindow::on_TxFreqSpinBox_valueChanged(int n) m_txFreq=n; soundOutThread.setTxFreq(n); } - diff --git a/mainwindow.h b/mainwindow.h index 655d6d355..ebdf1e963 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -7,6 +7,7 @@ #include #include "soundin.h" #include "soundout.h" +#include "jt9decode.h" #include "commons.h" #include "sleep.h" @@ -32,6 +33,7 @@ public slots: void dataSink(int k); void diskDat(); void diskWriteFinished(); + void decoderFinished(); void freezeDecode(int n); void guiUpdate(); void doubleClickOnCall(QString hiscall, bool ctrl); @@ -166,8 +168,10 @@ private: QFuture* future1; QFuture* future2; + QFuture* future3; QFutureWatcher* watcher1; QFutureWatcher* watcher2; + QFutureWatcher* watcher3; QProcess proc_m65; @@ -188,6 +192,7 @@ private: SoundInThread soundInThread; //Instantiate the audio threads SoundOutThread soundOutThread; + JT9DecodeThread jt9DecodeThread; //---------------------------------------------------- private functions void readSettings(); @@ -215,8 +220,12 @@ void symspec_(int* k, int* ntrperiod, int* nsps, int* ndiskdat, int* nb, int* m_NBslider, float* px, float s[], float red[], float* f0a, float* df3, int* nhsym, int* nzap, float* slimit, uchar lstrong[]); + void genjt9_(char* msg, int* minutes, char* msgsent, int itone[], int len1, int len2); + +void decoder_(int* ntrperiod); + int ptt_(int* nport, int* itx, int* iptt); } diff --git a/wsjtx.pro b/wsjtx.pro index 0f927fbb5..7c52b1918 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -6,7 +6,7 @@ QT += core gui network CONFIG += qwt thread -#CONFIG += console +CONFIG += console TARGET = wsjtx VERSION = 0.2 @@ -35,7 +35,8 @@ QMAKE_EXTRA_COMPILERS += gfortran SOURCES += main.cpp mainwindow.cpp plotter.cpp about.cpp \ soundin.cpp soundout.cpp devsetup.cpp \ widegraph.cpp getfile.cpp \ - displaytext.cpp getdev.cpp + displaytext.cpp getdev.cpp \ + jt9decode.cpp win32 { SOURCES += killbyname.cpp @@ -44,6 +45,7 @@ SOURCES += killbyname.cpp HEADERS += mainwindow.h plotter.h soundin.h soundout.h \ about.h devsetup.h widegraph.h getfile.h \ commons.h sleep.h displaytext.h \ + jt9decode.h DEFINES += __cplusplus