Cleanup file save function for submode and period vars

This commit is contained in:
Jordan Sherer 2019-11-02 23:24:52 -04:00
parent 2d7317aea4
commit 4fc50629e6

View File

@ -2638,12 +2638,12 @@ void MainWindow::dataSink(qint64 frames)
if(!m_diskData) { //Always save; may delete later if(!m_diskData) { //Always save; may delete later
if(m_mode=="FT8") { if(m_mode=="FT8") {
int n=now.time().second() % m_TRperiod; int n=now.time().second() % period;
if(n<(m_TRperiod/2)) n=n+m_TRperiod; if(n<(period/2)) n=n+period;
auto const& period_start=now.addSecs(-n); auto const& period_start=now.addSecs(-n);
m_fnameWE=m_config.save_directory().absoluteFilePath (period_start.toString("yyMMdd_hhmmss")); m_fnameWE=m_config.save_directory().absoluteFilePath (period_start.toString("yyMMdd_hhmmss"));
} else { } else {
auto const& period_start = now.addSecs (-(now.time ().minute () % (m_TRperiod / 60)) * 60); auto const& period_start = now.addSecs (-(now.time ().minute () % (period / 60)) * 60);
m_fnameWE=m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmm")); m_fnameWE=m_config.save_directory ().absoluteFilePath (period_start.toString ("yyMMdd_hhmm"));
} }
m_fileToSave.clear (); m_fileToSave.clear ();
@ -2653,8 +2653,8 @@ void MainWindow::dataSink(qint64 frames)
// the following is potential a threading hazard - not a good // the following is potential a threading hazard - not a good
// idea to pass pointer to be processed in another thread // idea to pass pointer to be processed in another thread
m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file, m_saveWAVWatcher.setFuture (QtConcurrent::run (std::bind (&MainWindow::save_wave_file,
this, m_fnameWE, &dec_data.d2[0], m_TRperiod, m_config.my_callsign(), this, m_fnameWE, &dec_data.d2[0], period, m_config.my_callsign(),
m_config.my_grid(), m_mode, m_nSubMode, m_freqNominal, m_hisCall, m_hisGrid))); m_config.my_grid(), m_mode, submode, m_freqNominal, m_hisCall, m_hisGrid)));
} }
} }