Skip to content

Commit

Permalink
fixed seek issue (quantisation)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Grahn committed Oct 27, 2023
1 parent da3cbf5 commit 42b63cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ var tLavg=0;
var tLcount=0;
var onLoopTimerUpdate=function(){
let tMedia=myGetCurrentTime();
if(tMedia<timeA) loopMeas.splice(0);
if(tMedia<timeA && !intro.checked || tMedia>=timeB){
//quantise loop based on tapped tempo
let curDate=Date.now()/1000; //[s]
Expand All @@ -421,9 +422,6 @@ var onLoopTimerUpdate=function(){
timeB=toNearest5ms(timeA+Math.round((timeB-timeA)/beatNormal)*beatNormal-tLavg);
if(timeB-tBOld!=0) updateLoopUI();
}
else{
tLavg=tLcount=0;
}
}
mySetCurrentTime(timeA);
}
Expand Down Expand Up @@ -792,6 +790,7 @@ var cancelABLoop=function(){
tapButton.disabled=false;
quant.disabled=true;
quant.checked=false;
loopMeas.splice(0);
toggleQuant(quant, help);
}

Expand All @@ -812,16 +811,15 @@ var resetUI=function(){
beatNormal=0;
rate=1.0;
aonly.disabled=false;
quant.disabled=true;
quant.checked=false;
toggleQuant(quant, help);
tLavg=tLcount=0;
}

var onRateChange=function(e){
rate=myGetPlaybackRate();
$("#speed").slider("value",rate);
$("#speed .ui-slider-handle").text(rate);
loopMeas.splice(0);
tLavg=tLcount=0;
if (beatNormal) {
tapButton.innerHTML=Math.round(60/beatNormal*rate).toString();
}
Expand Down Expand Up @@ -1102,7 +1100,6 @@ var onPlayerStateChange=function(e, id, ta, tb, s){ //event object, video id loo
$("#timeInputs").show();
loopButton.innerHTML="&emsp;";
loopButton.style.backgroundImage=crossMarkUrl;
if(beatNormal) quant.disabled=false;
}
vidId=id;
}
Expand Down Expand Up @@ -1261,7 +1258,6 @@ var onBmkSelectYT=function(i){
$("#timeInputs").show();
loopButton.innerHTML="&emsp;";
loopButton.style.backgroundImage=crossMarkUrl;
if(beatNormal) quant.disabled=false;
annotButton.disabled=false;
if(ytPlayer.getPlayerState()==YT.PlayerState.PLAYING && !loopTimer.length)
loopTimer.push(setInterval(onLoopTimerUpdate, 5));
Expand All @@ -1288,7 +1284,6 @@ var onLoopDownYT=function(){
updateLoopUI();
quant.disabled=(beatNormal ? false : true);
$("#timeInputs").show();
if(beatNormal) quant.disabled=false;
if(ytPlayer.getPlayerState()==YT.PlayerState.PLAYING && !loopTimer.length)
loopTimer.push(setInterval(onLoopTimerUpdate, 5));
}
Expand Down Expand Up @@ -1449,7 +1444,6 @@ var onBmkSelectVT=function(i){
$("#timeInputs").show();
loopButton.innerHTML="&emsp;";
loopButton.style.backgroundImage=crossMarkUrl;
if(beatNormal) quant.disabled=false;
annotButton.disabled=false;
if(!myVideo.paused && !loopTimer.length)
loopTimer.push(setInterval(onLoopTimerUpdate, 5));
Expand Down Expand Up @@ -1514,7 +1508,6 @@ var onLoopDownVT=function(){
updateLoopUI();
quant.disabled=(beatNormal ? false : true);
$("#timeInputs").show();
if(beatNormal) quant.disabled=false;
if(!myVideo.paused && !loopTimer.length)
loopTimer.push(setInterval(onLoopTimerUpdate, 5));
}
Expand Down Expand Up @@ -1550,7 +1543,6 @@ var toggleIntro=function(t,h){

var toggleQuant=function(t,h){
myBlur();
loopMeas.splice(0);
if(t.checked){
if(h.checked) t.title=quantTitleChecked;
}else{
Expand Down
Binary file modified zip/ABLoopPlayer.zip
Binary file not shown.

0 comments on commit 42b63cf

Please sign in to comment.