From fa5b99b46afdcebda01b9df9f0fa6908ff413d1b Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 12 Jan 2022 17:02:48 -0500 Subject: [PATCH] add stuff for diagnosis of hang problem --- src/engine/playback.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index ec623fb5f..0cdcb08fa 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -510,6 +510,7 @@ void DivEngine::processRow(int i, bool afterDelay) { divider=((effect&0x3)<<8)|effectVal; if (divider<10) divider=10; for (int i=0; irate/divider; disCont[i].clockDrift=0; } break; @@ -898,27 +899,37 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi memset(metroTick,0,size); int attempts=0; - while (++attempts<1000) { + logI("--------\n"); + while (++attempts<100) { + logI("ATTEMPT %d\n",attempts); bool allDone=true; bool getOut=true; // 1. check whether we are done with all buffers for (int i=0; i0) { getOut=false; + logD("no getOut because runLeft[%d]=%d\n",i,runLeft[i]); break; } } - if (getOut) break; + if (getOut) { + logD("GETTING OUT\n"); + break; + } // 2. check whether we gonna tick for (int i=0; i0) { allDone=false; + logD("not allDone because disCont[%d].cycles=%d\n",i,disCont[i].cycles); break; } } if (allDone) { // we have to tick + logD("ticking\n"); unsigned int realPos=(runPos[0]*size)/runtotal[0]; if (realPos>=size) realPos=size-1; if (song.hilightA>0) { @@ -937,18 +948,28 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi // 3. fill buffers as needed for (int i=0; idisCont[i].cycles) total=disCont[i].cycles; + if (total>disCont[i].cycles) { + logD("total set to cycles: %d\n",disCont[i].cycles); + total=disCont[i].cycles; + } else { + logD("total is %d\n",total); + } runLeft[i]-=total; disCont[i].cycles-=total; disCont[i].acquire(runPos[i],total); runPos[i]+=total; + logD("runPos is %d\n",runPos[i]); } } logD("attempts: %d\n",attempts); - if (attempts>=1000) { - logE("hang detected! stopping!\n"); + if (attempts>=100) { + logE("hang detected! stopping! at %d seconds %d micro\n",totalSeconds,totalTicks); freelance=false; playing=false; extValuePresent=false;