Skip to content

Commit

Permalink
ensure loop length >= 1 beat
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Grahn committed Oct 27, 2023
1 parent 7f0d6bc commit 1d9a5d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions ABLoopPlayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<script src="js/main.js"></script>

<link rel="shortcut icon" type="image/x-icon" href="png/favicon.ico">
<link rel="preload" type="image/svg+xml" href="svg/star.svg" as="image"/>
<link rel="preload" type="image/svg+xml" href="svg/jump.svg" as="image"/>
<link rel="preload" type="image/svg+xml" href="svg/trash.svg" as="image"/>
<link rel="preload" type="image/svg+xml" href="svg/comment.svg" as="image"/>
Expand Down
5 changes: 2 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ var onLoopTimerUpdate=function(){
if(tLcount>15) tLcount=15;
//quantise loop based on tapped tempo and average latency
if(quant.checked) {
let n=Math.max(1,Math.round((timeB-timeA)/beatNormal));//no less than one beat
let tBOld=timeB;
timeB=toNearest5ms(timeA+Math.round((timeB-timeA)/beatNormal)*beatNormal-tLavg);
timeB=toNearest5ms(timeA+n*beatNormal-tLavg);
if(timeB-tBOld!=0) updateLoopUI();
}
}
Expand Down Expand Up @@ -1252,7 +1253,6 @@ var initResizableYT=function(){

var onBmkSelectYT=function(i){
myBlur();
cancelABLoop();
if(i==0) return;
$("#slider").slider("option", "max", myGetDuration());
let a,b;
Expand Down Expand Up @@ -1439,7 +1439,6 @@ var mySetPlaybackRateVT=function(r){

var onBmkSelectVT=function(i){
myBlur();
cancelABLoop();
if(i==0) return;
let a,b;
[a,b]=myBookmarks.options[i].text.split("--").map(t => timeStringToSec(t));
Expand Down
Binary file modified zip/ABLoopPlayer.zip
Binary file not shown.

0 comments on commit 1d9a5d6

Please sign in to comment.