aboutsummaryrefslogtreecommitdiff
path: root/visualization
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-06-18 22:33:48 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-06-18 22:33:48 +0800
commita25823bbc28bfb93f1330d7421bd2589c01386c1 (patch)
treeaa5ceffaff372b1f18d51bd5ab702ae977f2293c /visualization
parent9e228490ffc7deb2969fa5e2b5fd81d763986eed (diff)
downloadQMidiPlayer-a25823bbc28bfb93f1330d7421bd2589c01386c1.tar.xz
Precise playback (no more slowdown).
Also the visualization should now sync better.
Diffstat (limited to 'visualization')
-rw-r--r--visualization/qmpvisualization.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index c1208f2..1452ca9 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -420,7 +420,6 @@ void qmpVisualization::updateVisualization3D()
fonthdpi.render(-49,stairpiano?56-i*7:63-i*8,stairpiano*i*2+0.1,0xFFFFFFFF,ALIGN_RIGHT,.008,0.01);
fonthdpi.render(-49.05,stairpiano?56.05-i*7:63.05-i*8,stairpiano*i*2+0.2,0xFF000000,ALIGN_RIGHT,.008,0.01);
}
- if(playing)ctk+=(int)1e6/((double)api->getRawTempo()/api->getDivision())*sm->smGetDelta();
while(pool.size()&&elb<pool.size()&&((double)ctk-pool[elb]->tce)*lpt>viewdist*2)++elb;
sm->smRenderEnd();
if(showparticle&&!horizontal)
@@ -662,7 +661,6 @@ void qmpVisualization::updateVisualization2D()
sm->smRenderQuad(&nq);
}
}
- if(playing)ctk+=(int)1e6/((double)api->getRawTempo()/api->getDivision())*sm->smGetDelta();
}
bool qmpVisualization::update()
{
@@ -671,6 +669,7 @@ bool qmpVisualization::update()
api->playerSeek(api->getCurrentPlaybackPercentage()+(sm->smGetKeyState(SMK_SHIFT)?5:1));
if(sm->smGetKeyState(SMK_LEFT)==SMKST_HIT)
api->playerSeek(api->getCurrentPlaybackPercentage()-(sm->smGetKeyState(SMK_SHIFT)?5:1));
+ if(playing)ctk+=1e6/api->getRawTempo()*api->getDivision()*sm->smGetDelta();
if(!flat)
updateVisualization3D();
sm->smRenderBegin2D();