From 5da7e84f549c812032b795c2bd87659220beed3a Mon Sep 17 00:00:00 2001
From: Joe Taylor <k1jt@arrl.org>
Date: Mon, 17 Oct 2016 16:51:14 +0000
Subject: [PATCH] Correct a timing issue for saving MSK144 files in short (e.g.
 5 s) sequences.  Save after Alt-V even if Save = None.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7191 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
---
 mainwindow.cpp | 9 ++++++---
 mainwindow.h   | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1cf255c96..a7ab25479 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -808,6 +808,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
   m_ntx = 1;
   m_fCPUmskrtd=0.0;
   m_bFastDone=false;
+  m_bAltV=false;
   ui->txrb1->setChecked(true);
 
   if(m_mode.startsWith ("WSPR") and m_pctx>0)  {
@@ -1300,7 +1301,7 @@ void MainWindow::fastSink(qint64 frames)
 
   float fracTR=float(k)/(12000.0*m_TRperiod);
   decodeNow=false;
-  if(fracTR>0.98) {
+  if(fracTR>0.92) {
     m_dataAvailable=true;
     fast_decode_done();
     m_bFastDone=true;
@@ -1323,6 +1324,7 @@ void MainWindow::fastSink(qint64 frames)
       decode();
     }
   }
+
   if(decodeNow or m_bFastDone) {
     if(!m_diskData) {
       QDateTime now {QDateTime::currentDateTimeUtc()};
@@ -1331,7 +1333,8 @@ void MainWindow::fastSink(qint64 frames)
       auto const& period_start = now.addSecs (-n);
       m_fnameWE = m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmmss"));
       m_fileToSave.clear ();
-      if(m_saveAll or (m_bDecoded and m_saveDecoded) or (m_mode!="MSK144")) {
+      if(m_saveAll or m_bAltV or (m_bDecoded and m_saveDecoded) or (m_mode!="MSK144")) {
+        m_bAltV=false;
         // the following is potential a threading hazard - not a good
         // idea to pass pointer to be processed in another thread
         m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file,
@@ -1575,7 +1578,7 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
     case Qt::Key_V:
       if(e->modifiers() & Qt::AltModifier) {
         m_fileToSave = m_fnameWE;
-        m_bDecoded=true;  //###
+        m_bAltV=true;
         return;
       }
       break;
diff --git a/mainwindow.h b/mainwindow.h
index b93cb5f3e..4b0238986 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -418,6 +418,7 @@ private:
   bool    m_bRefSpec;
   bool    m_bUseRef;
   bool    m_bFastDone;
+  bool    m_bAltV;
   float   m_pctZap;
   int			m_ihsym;
   int			m_nzap;