diff --git a/CMakeLists.txt b/CMakeLists.txt index cb3cdf8e2..79355857e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,6 +278,7 @@ set (wsjt_FSRCS lib/decjt9.f90 lib/deep4.f90 lib/deg2grid.f90 + lib/degrade_snr.f90 lib/demod64a.f90 lib/determ.f90 lib/downsam9.f90 diff --git a/Configuration.cpp b/Configuration.cpp index 668188a87..c03b34a3a 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -357,7 +357,6 @@ public: Q_SLOT void reject () override; Q_SLOT void done (int) override; - private: typedef QList AudioDevices; @@ -521,6 +520,7 @@ private: qint32 id_interval_; qint32 ntrials_; qint32 aggressive_; + double degrade_; bool id_after_73_; bool tx_QSY_allowed_; bool spot_to_psk_reporter_; @@ -601,6 +601,7 @@ QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;} qint32 Configuration::id_interval () const {return m_->id_interval_;} qint32 Configuration::ntrials() const {return m_->ntrials_;} qint32 Configuration::aggressive() const {return m_->aggressive_;} +double Configuration::degrade() const {return m_->degrade_;} bool Configuration::id_after_73 () const {return m_->id_after_73_;} bool Configuration::tx_QSY_allowed () const {return m_->tx_QSY_allowed_;} bool Configuration::spot_to_psk_reporter () const {return m_->spot_to_psk_reporter_;} @@ -1026,6 +1027,7 @@ void Configuration::impl::initialize_models () ui_->CW_id_interval_spin_box->setValue (id_interval_); ui_->sbNtrials->setValue (ntrials_); ui_->sbAggressive->setValue (aggressive_); + ui_->sbDegrade->setValue (degrade_); ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true); ui_->save_path_display_label->setText (save_directory_.absolutePath ()); ui_->azel_path_display_label->setText (azel_directory_.absolutePath ()); @@ -1158,7 +1160,6 @@ void Configuration::impl::read_settings () id_interval_ = settings_->value ("IDint", 0).toInt (); ntrials_ = settings_->value ("nTrials", 6).toInt (); aggressive_ = settings_->value ("Aggressive", 0).toInt (); - save_directory_ = settings_->value ("SaveDir", default_save_directory_.absolutePath ()).toString (); azel_directory_ = settings_->value ("AzElDir", default_azel_directory_.absolutePath ()).toString (); @@ -1741,6 +1742,7 @@ void Configuration::impl::accept () id_interval_ = ui_->CW_id_interval_spin_box->value (); ntrials_ = ui_->sbNtrials->value (); aggressive_ = ui_->sbAggressive->value (); + degrade_ = ui_->sbDegrade->value (); id_after_73_ = ui_->CW_id_after_73_check_box->isChecked (); tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked (); monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked (); diff --git a/Configuration.hpp b/Configuration.hpp index e441fa47e..b011d5cf5 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -93,6 +93,7 @@ public: qint32 id_interval () const; qint32 ntrials() const; qint32 aggressive() const; + double degrade() const; bool id_after_73 () const; bool tx_QSY_allowed () const; bool spot_to_psk_reporter () const; diff --git a/Configuration.ui b/Configuration.ui index e7b3123bf..11284cbe1 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -20,7 +20,7 @@ Select tab to change configuration parameters. - 0 + 7 @@ -2127,7 +2127,7 @@ Right click for insert and delete options. Advanced - + @@ -2268,6 +2268,33 @@ Right click for insert and delete options. + + + + + + Degrade S/N of .wav file: + + + sbDegrade + + + + + + + dB + + + 1 + + + 0.100000000000000 + + + + + @@ -2286,7 +2313,7 @@ Right click for insert and delete options. - + Qt::Vertical @@ -2468,12 +2495,12 @@ soundcard changes - - - - + + + + diff --git a/lib/fqso_first.f90 b/lib/fqso_first.f90 new file mode 100644 index 000000000..d75dac9b8 --- /dev/null +++ b/lib/fqso_first.f90 @@ -0,0 +1,31 @@ +subroutine fqso_first(nfqso,ntol,ca,ncand) + +! If a candidate was found within +/- ntol of nfqso, move it into ca(1). + + type candidate + real freq + real dt + real sync + end type candidate + type(candidate) ca(300),cb + + dmin=1.e30 + i0=0 + do i=1,ncand + d=abs(ca(i)%freq-nfqso) + if(d.lt.dmin) then + i0=i + dmin=d + endif + enddo + + if(dmin.lt.float(ntol)) then + cb=ca(i0) + do i=i0,2,-1 + ca(i)=ca(i-1) + enddo + ca(1)=cb + endif + + return +end subroutine fqso_first diff --git a/mainwindow.cpp b/mainwindow.cpp index 1a68e2a7f..fabc9731e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1531,6 +1531,9 @@ void MainWindow::diskDat() //diskDat() int kstep=3456; m_diskData=true; + float db=m_config.degrade(); + if(db > 0.0) degrade_snr_(jt9com_.d2,&jt9com_.kin,&db); + for(int n=1; n<=m_hsymStop; n++) { // Do the waterfall spectra k=(n+1)*kstep; if(k > jt9com_.kin) break; diff --git a/mainwindow.h b/mainwindow.h index 91a02f5e5..7b39dc523 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -604,6 +604,7 @@ extern "C" { float* width); void fast_decode_(short id2[], int narg[], char msg[], int len); + void degrade_snr_(short d2[], int* n, float* db); } #endif // MAINWINDOW_H