Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/waveform/visualplayposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ double VisualPlayPosition::getAtNextVSync(VSyncThread* vSyncThread) {
if (m_valid) {
VisualPlayPositionData data = m_data.getValue();
int refToVSync = vSyncThread->fromTimerToNextSyncMicros(data.m_referenceTime);
int offset = refToVSync - data.m_callbackEntrytoDac;
int offset = data.m_callbackEntrytoDac;
offset = math_min(offset, m_audioBufferMicros * kMaxOffsetBufferCnt);
double playPos = data.m_enginePlayPos; // load playPos for the first sample in Buffer
// add the offset for the position of the sample that will be transferred to the DAC
Expand All @@ -78,11 +78,9 @@ void VisualPlayPosition::getPlaySlipAtNextVSync(VSyncThread* vSyncThread, double

if (m_valid) {
VisualPlayPositionData data = m_data.getValue();
int refToVSync = vSyncThread->fromTimerToNextSyncMicros(data.m_referenceTime);
int offset = refToVSync - data.m_callbackEntrytoDac;
offset = math_min(offset, m_audioBufferMicros * kMaxOffsetBufferCnt);
double playPos = data.m_enginePlayPos; // load playPos for the first sample in Buffer
playPos += data.m_positionStep * offset * data.m_rate / m_audioBufferMicros;
playPos += data.m_positionStep * data.m_callbackEntrytoDac *
data.m_rate / m_audioBufferMicros;
*pPlayPosition = playPos;
*pSlipPosition = data.m_slipPosition;
}
Expand Down
24 changes: 0 additions & 24 deletions src/waveform/vsyncthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,9 @@ void VSyncThread::run() {
} else { // if (m_vSyncMode == ST_TIMER) {
emit vsyncRender(); // renders the new waveform.

// wait until rendering was scheduled. It might be delayed due a
// pending swap (depends one driver vSync settings)
m_semaVsyncSlot.acquire();

// qDebug() << "ST_TIMER " << lastMicros << restMicros;
int remainingForSwap = m_waitToSwapMicros - static_cast<int>(
m_timer.elapsed().toIntegerMicros());
// waiting for interval by sleep
if (remainingForSwap > 100) {
usleep(remainingForSwap);
}

// swaps the new waveform to front in case of gl-wf
emit vsyncSwap();

// wait until swap occurred. It might be delayed due to driver vSync
// settings.
m_semaVsyncSlot.acquire();

// <- Assume we are VSynced here ->
int lastSwapTime = static_cast<int>(m_timer.restart().toIntegerMicros());
if (remainingForSwap < 0) {
// Our swapping call was already delayed
// The real swap might happens on the following VSync, depending on driver settings
m_droppedFrames++; // Count as Real Time Error
}
// try to stay in right intervals
m_waitToSwapMicros = m_syncIntervalTimeMicros +
((m_waitToSwapMicros - lastSwapTime) % m_syncIntervalTimeMicros);
}
Expand Down
2 changes: 1 addition & 1 deletion src/waveform/waveformwidgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void WaveformWidgetFactory::swap() {
if (glw->context() != QGLContext::currentContext()) {
glw->makeCurrent();
}
glw->swapBuffers();
//glw->swapBuffers();
}
//qDebug() << "swap x" << m_vsyncThread->elapsed();
}
Expand Down
2 changes: 0 additions & 2 deletions src/waveform/widgets/glsimplewaveformwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ GLSimpleWaveformWidget::GLSimpleWaveformWidget(const QString& group, QWidget* pa
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent);

setAutoBufferSwap(false);

m_initSuccess = init();
}

Expand Down
2 changes: 0 additions & 2 deletions src/waveform/widgets/glslwaveformwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ GLSLWaveformWidget::GLSLWaveformWidget(
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent);

setAutoBufferSwap(false);

m_initSuccess = init();
}

Expand Down
2 changes: 0 additions & 2 deletions src/waveform/widgets/glvsynctestwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ GLVSyncTestWidget::GLVSyncTestWidget(const QString& group, QWidget* parent)
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent);

setAutoBufferSwap(false);

m_initSuccess = init();
qDebug() << "GLVSyncTestWidget.isSharing() =" << isSharing();
}
Expand Down
2 changes: 0 additions & 2 deletions src/waveform/widgets/glwaveformwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ GLWaveformWidget::GLWaveformWidget(const QString& group, QWidget* parent)
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_OpaquePaintEvent);

setAutoBufferSwap(false);

m_initSuccess = init();
}

Expand Down