mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-24 21:28:41 -05:00
Repaired a defect in the calculation of delay before starting audio streams
This commit is contained in:
parent
62f9b32758
commit
8d6c7649e0
@ -18,6 +18,7 @@
|
|||||||
#include <QAudioOutput>
|
#include <QAudioOutput>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "revision_utils.hpp"
|
#include "revision_utils.hpp"
|
||||||
#include "Audio/BWFFile.hpp"
|
#include "Audio/BWFFile.hpp"
|
||||||
@ -52,7 +53,12 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTimer::singleShot (int ((((start - (QDateTime::currentMSecsSinceEpoch () / 1000) % 60) + 60) % 60) * 1000), Qt::PreciseTimer, this, &Record::start_recording);
|
auto now = QDateTime::currentDateTimeUtc ();
|
||||||
|
auto time = now.time ();
|
||||||
|
auto then = now;
|
||||||
|
then.setTime (QTime {time.hour (), time.minute (), start});
|
||||||
|
auto delta_ms = (now.msecsTo (then) + (60 * 1000)) % (60 * 1000);
|
||||||
|
QTimer::singleShot (int (delta_ms), Qt::PreciseTimer, this, &Record::start_recording);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +119,12 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTimer::singleShot (int ((((start - (QDateTime::currentMSecsSinceEpoch () / 1000) % 60) + 60) % 60) * 1000), Qt::PreciseTimer, this, &Playback::start_playback);
|
auto now = QDateTime::currentDateTimeUtc ();
|
||||||
|
auto time = now.time ();
|
||||||
|
auto then = now;
|
||||||
|
then.setTime (QTime {time.hour (), time.minute (), start});
|
||||||
|
auto delta_ms = (now.msecsTo (then) + (60 * 1000)) % (60 * 1000);
|
||||||
|
QTimer::singleShot (int (delta_ms), Qt::PreciseTimer, this, &Playback::start_playback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user