mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-21 19:55:20 -05:00
Trying a fixed audio input buffer size
This commit is contained in:
parent
1892f39df3
commit
ecde374cee
@ -81,11 +81,13 @@ void SoundInput::start(QAudioDeviceInfo const& device, int framesPerBuffer, Audi
|
|||||||
|
|
||||||
qDebug () << "SoundIn default buffer size (bytes):" << m_stream->bufferSize ();
|
qDebug () << "SoundIn default buffer size (bytes):" << m_stream->bufferSize ();
|
||||||
m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer));
|
m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer));
|
||||||
|
m_stream->setBufferSize (m_stream->format ().bytesForFrames (3456 * 4 * 5));
|
||||||
qDebug () << "SoundIn selected buffer size (bytes):" << m_stream->bufferSize ();
|
qDebug () << "SoundIn selected buffer size (bytes):" << m_stream->bufferSize ();
|
||||||
if (sink->initialize (QIODevice::WriteOnly, channel))
|
if (sink->initialize (QIODevice::WriteOnly, channel))
|
||||||
{
|
{
|
||||||
m_stream->start (sink);
|
m_stream->start (sink);
|
||||||
audioError ();
|
audioError ();
|
||||||
|
cummulative_lost_usec_ = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -159,7 +161,9 @@ void SoundInput::reset (bool report_dropped_frames)
|
|||||||
{
|
{
|
||||||
if (m_stream)
|
if (m_stream)
|
||||||
{
|
{
|
||||||
if (report_dropped_frames)
|
if (cummulative_lost_usec_ >= 0 // don't report first time as we
|
||||||
|
// don't yet known latency
|
||||||
|
&& report_dropped_frames)
|
||||||
{
|
{
|
||||||
auto lost_usec = m_stream->elapsedUSecs () - m_stream->processedUSecs () - cummulative_lost_usec_;
|
auto lost_usec = m_stream->elapsedUSecs () - m_stream->processedUSecs () - cummulative_lost_usec_;
|
||||||
Q_EMIT dropped_frames (m_stream->format ().framesForDuration (lost_usec), lost_usec);
|
Q_EMIT dropped_frames (m_stream->format ().framesForDuration (lost_usec), lost_usec);
|
||||||
|
@ -56,6 +56,7 @@ void Detector::clear ()
|
|||||||
|
|
||||||
qint64 Detector::writeData (char const * data, qint64 maxSize)
|
qint64 Detector::writeData (char const * data, qint64 maxSize)
|
||||||
{
|
{
|
||||||
|
qDebug () << "Detector::writeData: size:" << maxSize;
|
||||||
static unsigned mstr0=999999;
|
static unsigned mstr0=999999;
|
||||||
qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||||
unsigned mstr = ms0 % int(1000.0*m_period); // ms into the nominal Tx start time
|
unsigned mstr = ms0 % int(1000.0*m_period); // ms into the nominal Tx start time
|
||||||
@ -119,8 +120,7 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
|
|||||||
remaining -= numFramesProcessed;
|
remaining -= numFramesProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we drop any data past the end of the buffer on the floor until
|
||||||
|
// the next period starts
|
||||||
return maxSize; // we drop any data past the end of the buffer on
|
return maxSize;
|
||||||
// the floor until the next period starts
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user