Lines Matching refs:s2

144 var s,dd,dd2,up,x,dx,x2,i,s2=de.s,de2=de.start,de2_prev,de_next;s=de2.s;x=s.x+3;i=de2.ix
146 de2_prev=a_de[i-1];de.st=s2.st;de.lden=false;de.has_val=true;up=up_p(s2,s2.pos.dyn)
154 if(dx<20){x=de.x-20-3;dx=20}}else{x2=s2.x;de_next=a_de[de.ix+1]
209 var up,y,w,tmp,dd=de.dd,de2=de.prev,s2=de.s,st=s2.st,s=de.start.s,x=s.x
217 default:up=s2.multi>=0
220 if(w<20){x=de.x-20-3;w=20}}else{w=s2.x-x-6
221 if(s2.type==C.NOTE)
239 s.ymx=s2.ymx=y
241 s.ymn=s2.ymn=y}
774 Abc.prototype.calculate_beam=function(bm,s1){var s,s2,g,notes,nflags,st,v,two_staves,two_dir,x,y,ys,a,b,stem_err,max_stem_err,p_min,p_max,s_closest,stem_xoff,scale,visible,dy
781 for(s2=s1;;s2=s2.next){if(s2.type==C.NOTE){if(s2.nflags>nflags)
782 nflags=s2.nflags;notes++
783 if(s2.st!=st)
785 if(s2.stem!=s1.stem)
787 if(!visible&&!s2.invis&&(!s2.stemless||s2.trem2))
789 if(s2.beam_end)
791 if(!s2.next){for(;;s2=s2.prev){if(s2.type==C.NOTE)
793 s=sym_dup(s2);s.next=s2.next
795 s.next.prev=s;s2.next=s;s.prev=s2;s.ts_next=s2.ts_next
797 s.ts_next.ts_prev=s;s2.ts_next=s;s.ts_prev=s2
801 s.x=realwidth-12;s2=s;notes++
804 return false;bm.s2=s2
806 return false}else{if(!two_staves){bm.s1=s1;bm.a=(s1.ys-s2.ys)/(s1.xs-s2.xs);bm.b=s1.ys-s1.xs*bm.a+staff_tb[st].y;bm.nflags=nflags
816 s.xs=s.x+x*scale;if(s==s2)
820 else if(!two_dir&&notes>=3&&s_closest!=s1&&s_closest!=s2)
824 a=(s2.ys+staff_tb[s2.st].y-y)/(s2.xs-s1.xs)
827 b=(y+s2.ys+staff_tb[s2.st].y)/2-a*(s2.xs+s1.xs)/2
831 if(s1.stem!=s2.stem&&s1.nflags<s2.nflags)
832 b+=ys*s2.stem
837 for(;s&&s.time<=s2.time;s=s.ts_next){if(s.type!=C.NOTE||s.invis||(s.st!=st&&s.v!=v)){continue}
867 if(s==s2)
899 if(s==s2)
922 if(s==s2)
928 function draw_beams(bm){var s,i,beam_dir,shift,bshift,bstub,bh,da,k,k1,k2,x1,s1=bm.s1,s2=bm.s2
932 if(s.trem2&&n>nflags){if(s.dur>=C.BLEN/2){x1=s.x+6;x2=bm.s2.x-6}else if(s.dur<C.BLEN/4){x1+=5;x2-=6}}
938 if(s1.stem!=s2.stem&&s1.nflags<s2.nflags)
939 beam_dir=s2.stem
941 bh=-bh;draw_beam(s1.xs-shift,s2.xs+shift,0,bh,bm,1);da=0
947 if(s==s2)
949 if(s1.feathered_beam){da=bshift/(s2.xs-s1.xs)
950 if(s1.feathered_beam>0){da=-da;bshift=da*s1.xs}else{bshift=da*s2.xs}
956 for(s=s1;;s=s.next){if(s.type!=C.NOTE||s.nflags<i){if(s==s2)
960 if(s==s2)
964 while(1){if(s==s2)
975 if(k1==k2){if(k1==s1){x1+=bstub}else if(k1==s2){x1-=bstub}else if(k1.beam_br1||(k1.beam_br2&&i>2)){x1+=bstub}else{k=k1.next
986 if(s==s2)
990 else if(s2.tmp)
991 unlksym(s2)
1122 for(;i>old_sf;i--){xygl(x,staffb+shift,"acc3");shift+=p_seq[-i];x+=5.5}}}}else if(s.k_a_acc.length){var acc,last_acc=s.k_a_acc[0].acc,last_shift=100,s2={st:st,nhd:0,notes:[{}]}
1128 x+=3;last_acc=acc.acc;s2.x=x
1129 s2.notes[0].pit=shift/3+18;self.draw_hl(s2)
1141 function draw_rest(s){var s2,i,j,x,y,yb,bx,p_staff=staff_tb[s.st]
1147 s.nflags=-4;s.dots=0;s2=s.ts_next
1148 while(s2.time!=s.time+s.dur&&s2.ts_next)
1149 s2=s2.ts_next
1150 x=s2.x-s2.wl
1151 s2=s
1152 while(!s2.seqst)
1153 s2=s2.ts_prev;s2=s2.ts_prev;x=(x+s2.x+s2.wr)/2
1196 anno_start(g);draw_note(g,!bm.s2)
1197 if(g==bm.s2)
1198 bm.s2=null
1294 function draw_note(s,fl){var s2,i,m,y,staffb,slen,c,nflags,x,y,note,y_tb=new Array(s.nhd+1)
1308 out_stem(x,y,slen,s.grace)}else{out_stem(x,y,slen,s.grace,nflags,cfmt.straightflags)}}else if(s.xstem){s2=s.ts_prev;slen=(s2.stem>0?s2.y:s2.ys)-s.y;slen+=staff_tb[s2.st].y-staffb;out_stem(x,y,slen)}
1334 function slur_multi(s1,s2){if(s1.multi)
1336 if(s2.multi)
1337 return s2.multi
1516 function draw_sls(s,sl,snote){var k,v,i,dir,path=[],enote=sl.note,s2=enote.s
1517 if(last&&s2.time>last.time)
1519 if(tsnext&&s2.time>=tsnext.time){s.p_v.sls.push(sl);s2=s.p_v.s_next.prev
1520 while(s2.next)
1521 s2=s2.next;sl=Object.create(sl);sl.note={s:s2}}
1524 default:dir=s.v!=s2.v?1:slur_direction(s,s2)
1528 if(s.v==s2.v){v=s.v}if(!cur_sy.voices[s.v]||!cur_sy.voices[s2.v]){v=s.v>s2.v?s.v:s2.v}else if(dir*(cur_sy.voices[s.v].range<=cur_sy.voices[s2.v].range?1:-1)>0)
1531 v=s2.v
1532 if(gr1&&!(s2.grace&&s.v==s2.v&&s.time==s2.time)){do{path.push(s);s=s.next}while(s);s=gr1.next}else{path.push(s);if(s.grace)
1536 if(!s2.grace){while(s){if(s.v==v)
1538 if(s==s2)
1541 if(s==s2)
1543 s=s.next}}else{k=s2
1553 if(s==s2)
1584 function draw_tuplet(s1){var s2,s3,g,upstaff,nb_only,some_slur,x1,x2,y1,y2,xm,ym,a,s0,yy,yx,dy,a,dir,r,tp=s1.tp.shift()
1589 for(s2=s1;s2;s2=s2.next){switch(s2.type){case C.GRACE:for(g=s2.extra;g;g=g.next){if(g.sls||g.sl1)
1593 if(s2.sls||s2.sl1)
1594 draw_slurs(s2)
1595 if(s2.st<upstaff)
1596 upstaff=s2.st
1597 if(s2.tp)
1598 draw_tuplet(s2)
1599 if(s2.tpe)
1601 if(s2)
1602 s2.tpe--
1605 if(!s2){error(1,s1,"No end of tuplet in this music line")
1612 if(s1==s2||tp.f[1]==2){nb_only=true}else if(tp.f[1]==1){nb_only=true;draw_slur([s1,s2],null,{ty:dir})}else{if(tp.f[0]!=2&&s1.type==C.NOTE&&s2.type==C.NOTE){nb_only=true
1617 if(s3==s2)
1624 if(nb_only&&!s2.beam_end){for(s3=s2.next;s3;s3=s3.next){if(s3.type==C.NOTE||s3.type==C.REST){if(!s3.beam_br1&&!s3.beam_br2&&s3.nflags>=s2.nflags)
1630 xm=(s2.x+s1.x)/2
1636 if(s1.stem*s2.stem>0){if(s1.stem>0)
1652 if(s2.dur>s2.prev.dur){s3=s2.next
1653 if(!s3||s3.time!=s2.time+s2.dur){for(s3=s2.ts_next;s3;s3=s3.ts_next){if(s3.seqst&&s3.time>=s2.time+s2.dur)
1655 x2=s3?s3.x-s3.wl-5:realwidth-6}else{x2=s2.x+4
1656 r=s2.stem>=0?0:s2.nhd
1657 if(s2.notes[r].shhd>0)
1658 x2+=s2.notes[r].shhd
1659 if(s2.st==upstaff&&s2.stem>0)
1661 if(dir==C.SL_ABOVE){if(s1.st==s2.st){y1=y2=staff_tb[upstaff].topbar+2}else{y1=s1.ymx;y2=s2.ymx}
1667 if(s2.st==upstaff){for(s3=s2;!s3.dur;s3=s3.prev);ym=y_get(upstaff,1,s3.x-4,8)
1670 xm=.5*(x1+x2);ym=.5*(y1+y2);a=(y2-y1)/(x2-x1);s0=3*(s2.notes[s2.nhd].pit-s1.notes[s1.nhd].pit)/(x2-x1)
1681 for(s3=s1;;s3=s3.next){if(!s3.dur||s3.st!=upstaff){if(s3==s2)
1687 if(s3==s2)
1693 if(s3==s2)
1695 y_set(upstaff,true,s3.x,s3.next.x-s3.x,yy)}else if(s3==s2){break}}}else{if(s1.stem<0)
1698 if(s2.st==upstaff){for(s3=s2;!s3.dur;s3=s3.prev);y2=y_get(upstaff,0,s3.x-4,8)}else{y2=0}
1699 xm=.5*(x1+x2);ym=.5*(y1+y2);a=(y2-y1)/(x2-x1);s0=3*(s2.notes[0].pit-s1.notes[0].pit)/(x2-x1)
1710 for(s3=s1;;s3=s3.next){if(!s3.dur||s3.st!=upstaff){if(s3==s2)
1716 if(s3==s2)
1720 for(s3=s1;;s3=s3.next){if(s3.st==upstaff){if(s3==s2)
1725 if(s3==s2)
1732 function draw_note_ties(not1,job){var m,x1,x2,s,y,h,time,not2=not1.tie_n,p=job==2?not1.pit:not2.pit,dir=(not1.tie_ty&0x07)==C.SL_ABOVE?1:-1,s1=not1.s,st=s1.st,s2=not2.s,x2=s2.x,sh=not1.shhd
1742 if(job!=2){for(m=0;m<s2.nhd;m++)
1743 if(s2.notes[m]==not2)
1745 sh=s2.notes[m].shhd
1746 if(dir>0){if(m<s2.nhd&&p+1==s2.notes[m+1].pit)
1747 if(s2.notes[m+1].shhd<sh)
1748 sh=s2.notes[m+1].shhd}else{if(m>0&&p==s2.notes[m-1].pit+1)
1749 if(s2.notes[m-1].shhd<sh)
1750 sh=s2.notes[m-1].shhd}
1759 st=s2.st
1761 default:if(s1!=s2){x2-=s2.wl
1762 if(s2.type==C.BAR)
1820 function draw_all_ties(p_voice){var s,s1,s2,clef_chg,time,x,dx,s_next,m
1821 function draw_ties_g(s1,s2,job){if(s1.type==C.GRACE){for(var g=s1.extra;g;g=g.next){if(g.tie_s)
1822 draw_ties(g,s2,job)}}else{draw_ties(s1,s2,job)}}
1827 s2=s.next
1832 s.next=s2}
1837 s2=s1.tie_s
1838 if(s2.v==s1.v){s_next=s2
1840 while(1){if(!s.next){s2=s
1844 if(s==s2)
1850 if(s==s2)
1852 if(!s){s2=s1
1853 while(s2.next)
1854 s2=s2.next}}
1855 if(!s){draw_ties_g(s1,s2,2);break}
1857 for(s=s1.ts_next;s!=s2;s=s.ts_next){if(s.st!=s1.st)
1863 if(clef_chg||s1.st!=s2.st){clef_chg=false;dx=(s2.x-s1.x)*.4;x=s2.x;s2.x-=dx
1864 if(s2.x>s1.x+32.)
1865 s2.x=s1.x+32.;draw_ties_g(s1,s2,2);s2.x=x;x=s1.x;s1.x+=dx
1866 if(s1.x<s2.x-24.)
1867 s1.x=s2.x-24.;draw_ties(s1,s2,3);s1.x=x
1869 draw_ties_g(s1,s2,s2.type==C.NOTE?0:2)}}
1870 function draw_sym_near(){var p_voice,p_st,s,v,st,y,g,w,i,st,dx,top,bot,ymn,output_sav=output;function set_yab(s1,s2){var y,k=realwidth/YSTEP,i=(s1.x/k)|0,j=(s2.x/k)|0,a=(s1.ys-s2.ys)/(s1.xs-s2.xs),b=s1.ys-s1.xs*a,p_st=staff_tb[s1.st]
1887 if(bm.s2)
1888 set_yab(g,bm.s2)}}
1891 if(bm.s2)
1892 set_yab(s,bm.s2)}
2044 function draw_systems(indent){var s,s2,st,x,x2,res,sy,staves_bar,bar_force,xstaff=[],stl=[],bar_bot=[],bar_height=[],ba=[],sb=[],thb=[]
2076 function draw_bar(s,bot,h){var i,s2,yb,w,bar_type=s.bar_type,st=s.st,p_staff=staff_tb[st],x=s.x
2083 if(s.bar_mrep==1){for(s2=s.prev;s2.type!=C.REST;s2=s2.prev);xygl(s2.x,yb,"mrep")}else{xygl(x,yb,"mrep2")
2122 if(!staves_bar){for(s2=s.ts_next;s2;s2=s2.ts_next){if(s2.time!=s.time)
2124 switch(s2.type){case C.BAR:case C.CLEF:case C.KEY:case C.METER:staves_bar=s2.x
2127 if(!s2)
2149 for(s2=s.ts_next;s2;s2=s2.ts_next){if(s2.type!=C.STBRK)
2155 if(x>=0){s2=s.prev
2156 if(!s2)
2158 x2=s2.type==C.BAR?s2.x:s.x-s.xmx
2180 if(!s.invis){anno_start(s);draw_note(s,!bm.s2);anno_a.push(s)}
2181 if(s==bm.s2)
2182 bm.s2=null
2316 function set_tie_room(){var p_voice,s,s2,v,dx,y,dy
2328 s2=s.next
2329 while(s2&&s2.type!=C.NOTE)
2330 s2=s2.next
2331 if(s2){if(s2.st!=s.st)
2333 dx=s2.x-s.x-10}else{dx=realwidth-s.x-10}
2343 if(s2&&s2.ymx<y)
2344 s2.ymx=y;y_set(s.st,true,s.x+5,dx,y)}
2348 if(s2&&s2.ymn>y)
2349 s2.ymn=y;y_set(s.st,false,s.x+5,dx,y)}}}}
3476 function set_acc_shft(){var s,s2,st,i,acc,st,t,dx_head,notes
3481 for(s2=s;s2;s2=s2.ts_next){if(s2.time!=t||s2.type!=C.NOTE||s2.st!=st)
3485 for(i=0;i<=s2.nhd;i++){if(s2.notes[i].acc){acc=true
3487 if(!acc){s=s2
3491 for(;s!=s2;s=s.ts_next)
3639 Abc.prototype.set_width=function(s){var s2,i,m,xx,w,wlnote,wlw,acc,bar_type,meter,last_acc,n1,n2,esp,tmp
3644 s.wr+=s.xmx+4;for(s2=s.prev;s2;s2=s2.prev){if(w_tb[s2.type]!=0)
3646 if(s2){switch(s2.type){case C.BAR:case C.CLEF:case C.KEY:case C.METER:wlnote+=3
3656 if(s2){switch(s2.type){case C.BAR:case C.CLEF:case C.KEY:case C.METER:wlnote-=3
3674 if(s2){switch(s2.type){case C.NOTE:if(s2.stem>0&&s.stem<0){if(wlw<7)
3676 if((s.y>27&&s2.y>27)||(s.y<-3&&s2.y<-3)){if(wlw<6)
3678 if(s2.tie){if(wlw<14)
3681 case C.CLEF:if(s2.second||s2.clef_small)
3691 if(s2&&s2.type==C.GRACE)
3716 for(s2=s.prev;s2;s2=s2.prev){if(w_tb[s2.type]!=0){if(s2.type==C.GRACE)
3826 function set_space(s,ptime){var space,len,s2,stemdir
3840 if(s.dur&&len<=C.BLEN/4){s2=s
3841 while(s2){if(!s2.beam_st){space*=.9
3843 s2=s2.ts_next
3844 if(!s2||s2.seqst)
3847 for(s2=s.ts_prev;s2&&s2.time==ptime;s2=s2.ts_prev){if(s2.type==C.NOTE&&(s2.nflags<-1||s2.stem>0)){stemdir=false
3849 if(stemdir){for(s2=s.ts_next;s2&&s2.time==s.time;s2=s2.ts_next){if(s2.type==C.NOTE&&(s2.nflags<-1||s2.stem<0)){stemdir=false
3854 function set_sp_tup(s,s_et){var tim=s.time,ttim=s_et.time-tim,sp=time2space(s,ttim),s2=s,wsp=0
3855 while(1){s2=s2.ts_next
3856 if(s2.seqst){wsp+=s2.space
3857 if(s2.bar_type)
3859 if(s2==s_et)
3885 function set_allsymwidth(){var maxx,val,st,s_chs,tim,stup,s=tsfirst,s2=s,xa=0,xl=[],wr=[]
3896 s=s.ts_next}while(s&&!s.seqst);s2.shrink=maxx-xa
3897 s2.space=s2.ts_prev?set_space(s2,tim):0
3898 if(s2.dur&&s2.dur!=s2.notes[0].dur){if(!stup){stup=s2
3902 stup=stup.ts_prev}}else if(stup&&stup.v==s2.v){set_sp_tup(stup,s2)
3904 if(!s2.shrink&&!s2.space&&s2.type==C.CLEF){delete s2.seqst;s2.time=tim}
3905 tim=s2.time
3910 do{st=s2.st;xl[st]=xa
3911 if(s2.wr>wr[st])
3912 wr[st]=s2.wr
3913 s2=s2.ts_next}while(!s2.seqst)}
3928 function set_repeat(s){var s2,s3,i,j,dur,n=s.repeat_n,k=s.repeat_k,st=s.st,v=s.v
3939 for(s2=s;s2;s2=s2.next){if(!s2.dur){if(s2.type==C.BAR){error(1,s2,"Bar in repeat sequence")
3944 if(!s2||!s2.next){error(1,s,errs.not_enough_n)
3946 for(s2=s.prev;s2!=s3;s2=s2.prev){if(s2.type==C.NOTE){s2.beam_end=true
3950 i--;s2=s.ts_next
3951 while(i>0){if(s2.st==st){s2.invis=s2.play=true
3952 if(s2.seqst&&s2.ts_next.seqst)
3953 s2.seqst=false
3954 if(s2.v==v&&s2.dur)
3956 s2=s2.ts_next}
3959 s.head=C.SQUARE;for(s=s2;s;s=s.ts_next){if(s.st==st&&s.v==v&&s.dur)
3963 for(s2=s.prev.prev;s2;s2=s2.prev){if(s2.type==C.BAR||s2.time==tsfirst.time){if(--i<=0)
3965 if(!s2){error(1,s,errs.not_enough_m)
3967 dur=s.time-s2.time
3972 for(s2=s;s2;s2=s2.next){if(s2.type==C.BAR){if(--i<=0)
3974 if(!s2){error(1,s,errs.not_enough_m)
3977 if(n==2&&i>1){s2=s2.next
3978 if(!s2){error(1,s,errs.not_enough_m)
3980 s2.repeat_n=n;s2.repeat_k=--i}
3983 for(s2=s.ts_next;;s2=s2.ts_next){if(s2.st!=st)
3985 if(s2.type==C.BAR){if(s2.v==v)
3988 s2.invis=s2.play=true
3989 if(s2.seqst&&s2.ts_next.seqst)
3990 s2.seqst=false}
3993 s2.bar_mrep=2
3994 s3=s2.next;for(s2=s3.ts_next;;s2=s2.ts_next){if(s2.st!=st)
3996 if(s2.type==C.BAR){if(s2.v==v)
3999 s2.invis=s2.play=true
4000 if(s2.seqst&&s2.ts_next.seqst)
4001 s2.seqst=false}
4006 for(j=k;--j>=0;){for(s2=s3.ts_next;;s2=s2.ts_next){if(s2.st!=st)
4008 if(s2.type==C.BAR){if(s2.v==v)
4011 s2.invis=s2.play=true
4012 if(s2.seqst&&s2.ts_next.seqst)
4013 s2.seqst=false}
4018 s3.rep_nb=k-j+1;s3=s2.next}}
4019 function custos_add(s){var p_voice,new_s,i,s2=s
4020 while(1){if(s2.type==C.NOTE)
4022 s2=s2.next
4023 if(!s2)
4027 new_s.shrink=8+4;new_s.space=s2.space;new_s.wl=0;new_s.wr=4;new_s.nhd=s2.nhd;new_s.notes=[]
4028 for(i=0;i<s.notes.length;i++){new_s.notes[i]={pit:s2.notes[i].pit,shhd:0,dur:C.BLEN/4}}
4031 function bardiv(so){var s,s1,s2,t1,t2,i
4049 s2=clone(s1)
4051 s2.bar_type=t2
4052 lkvsym(s2,s1.next)
4053 while(1){if(s.type!=C.BAR||s.v>s2.v)
4056 lktsym(s2,s)
4058 so=s2
4059 if(s1.text){s2.invis=true
4062 delete s2.a_dd}
4071 function do_warn(s){var s1,s2,s3
4072 for(s2=s;s2;s2=s2.ts_next){switch(s2.type){case C.KEY:if(!cfmt.keywarn||(!s2.k_a_acc&&!s2.k_sf&&!s2.k_old_sf)||s2.k_none||s2.k_play)
4076 case C.METER:if(s2.type==C.METER){if(!cfmt.timewarn)
4079 case C.CLEF:if(!s2.prev)
4081 if(s2.type==C.CLEF){for(s1=s.ts_prev;s1;s1=s1.ts_prev){switch(s1.type){case C.BAR:case C.KEY:case C.METER:continue}
4083 s3=clone(s2)
4089 if(s1.v==s2.v)
4098 if(w_tb[s2.type])
4163 function set_lines(s,next,lwidth,indent){var first,s2,s3,x,xmin,xmid,xmax,wwidth,shrink,space,ws,nlines,last=next?next.ts_prev:null
4175 s2=first=s;xmin=s.x-s.shrink-indent;xmax=xmin+lwidth;xmid=xmin+wwidth/nlines;xmin+=wwidth/nlines*cfmt.breaklimit;for(s=s.ts_next;s!=next;s=s.ts_next){if(!s.x)
4178 s2=s
4197 if(!s3){var beam=0,bar_time=s2.time;xmax-=8;s=s2;for(;s!=next;s=s.ts_next){if(s.beam_st)
4218 if(!s3){s3=s=s2
4244 function cut_tune(lwidth,indent){var s2,i,s=tsfirst
4250 if(cfmt.barsperstaff){i=cfmt.barsperstaff;for(s2=s;s2;s2=s2.ts_next){if(s2.type!=C.BAR||!s2.bar_num||--i>0)
4252 while(s2.ts_next&&s2.ts_next.type==C.BAR)
4253 s2=s2.ts_next
4254 if(s2.ts_next)
4255 s2.ts_next.soln=true
4257 s2=s
4261 s2=set_lines(s2,s,lwidth,indent)
4262 if(!s2)
4264 s=s2
4317 function mrest_expand(){var s,s2
4318 function mexp(s){var s2,s3,s4,next,tim,nbar,nb=s.nmes,dur=s.dur/nb
4324 s2=next=s.next
4325 while(!s2.bar_num)
4326 s2=s2.ts_prev
4327 nbar=s2.bar_num-s.nmes
4328 s3=s2=s
4329 while(--nb>0){if(next){s2=clone(next)
4330 delete s2.soln
4331 delete s2.a_gch
4332 delete s2.a_dd
4333 lkvsym(s2,next)}else{s2=_bar(s)
4334 s.next=s2}
4335 s2.time=tim
4340 if(s3){lktsym(s2,s3)
4345 s3.ts_next=s2
4346 s2.ts_prev=s3
4347 s2.ts_next=null}
4349 if(s2.seqst){s2.bar_num=nbar
4350 s4=s2.ts_next}else{delete s2.bar_num
4351 s4=s2.ts_prev}
4352 s2.bar_type=s4.bar_type||"|"
4358 if(s2.next){s4.next=s2.next
4360 s2.next=s4
4361 s4.prev=s2
4378 if(!s.seqst&&w_tb[s.ts_prev.type]){s2=s}else{s2=s.ts_next
4379 while(!s2.seqst){if(s2.type!=C.MREST||s2.nmes!=s.nmes)
4381 s2=s2.ts_next}}
4382 if(!s2.seqst){while(s.type==C.MREST){mexp(s)
4383 s=s.ts_next}}else{s=s2.ts_prev}}}
4384 function set_auto_clef(st,s_start,clef_type_start){var s,min,max,time,s2,s3;max=12;min=20
4414 s2=s.ts_prev
4415 if(s2&&s2.time==time&&s2.st==st&&s2.type==C.NOTE&&s2.notes[0].pit>=19)
4417 s2=s.ts_next
4418 if(s2&&s2.st==st&&s2.time==time&&s2.type==C.NOTE&&s2.notes[0].pit>=19)
4422 s2=s.ts_prev
4423 if(s2&&s2.time==time&&s2.st==st&&s2.type==C.NOTE&&s2.notes[0].pit<=13)
4425 s2=s.ts_next
4426 if(s2&&s2.st==st&&s2.time==time&&s2.type==C.NOTE&&s2.notes[0].pit<=13)
4431 for(s2=s.ts_prev;s2!=s_last_chg;s2=s2.ts_prev){if(s2.st!=st)
4433 if(s2.type==C.BAR&&s2.v==s.v){s3=s2.bar_type[0]!=':'?s2:s2.next
4435 if(s2.type!=C.NOTE)
4437 if(s2.beam_st&&!s2.p_v.second)
4438 s3=s2}
4441 s_last_chg=s;clef_type=clef_type=='t'?'b':'t';s2=insert_clef(s3,clef_type,clef_type=="t"?2:4);s2.clef_auto=true}
4443 function set_clefs(){var s,s2,st,v,p_voice,g,new_type,new_line,p_staff,pit,staff_clef=new Array(nstaff+1),sy=cur_sy,mid=[]
4482 s2=p_voice.clef
4483 if(!s2.clef_auto)
4489 p_voice=voice_tb[v];st=sy.voices[v].st;s2=p_voice.clef
4490 if(s2.clef_auto){new_type=set_auto_clef(st,s,staff_clef[st].clef?staff_clef[st].clef.clef_type:'a');new_line=new_type=='t'?2:4}else{new_type=s2.clef_type;new_line=s2.clef_line}
4491 if(!staff_clef[st].clef){if(s2.clef_auto){if(s2.type!='a')
4506 if(s2.clef_auto)
4523 s2=voice_tb[v].sym
4524 if(!s2||s2.notes[0].pit!=127)
4533 for(s=s2;s;s=s.next)
4537 Abc.prototype.set_pitch=function(last_s){var s,s2,g,st,delta,pitch,note,dur=C.BLEN,m=nstaff+1,staff_delta=new Int16Array(new Array(m*2)),sy=cur_sy
4648 function set_rest_offset(){var s,s2,v,end_time,not_alone,v_s,y,ymax,ymin,shift,dots,dx,v_s_tb=[],sy=cur_sy
4667 not_alone=true;s2=v_s.s
4668 if(sy.voices[v].range<sy.voices[s.v].range){if(s2.time==s.time){if(s2.ymn<ymax){ymax=s2.ymn
4669 if(s2.dots)
4670 dots=true}}else{if(s2.y<ymax)
4671 ymax=s2.y}}else{if(s2.time==s.time){if(s2.ymx>ymin){ymin=s2.ymx
4672 if(s2.dots)
4673 dots=true}}else{if(s2.y>ymin)
4674 ymin=s2.y}}}
4676 for(s2=s.ts_next;s2;s2=s2.ts_next){if(s2.time>=end_time)
4678 if(s2.st!=s.st||!s2.dur||s2.invis)
4681 if(sy.voices[s2.v].range<sy.voices[s.v].range){if(s2.time==s.time){if(s2.ymn<ymax){ymax=s2.ymn
4682 if(s2.dots)
4683 dots=true}}else{if(s2.y<ymax)
4684 ymax=s2.y}}else{if(s2.time==s.time){if(s2.ymx>ymin){ymin=s2.ymx
4685 if(s2.dots)
4686 dots=true}}else{if(s2.y>ymin)
4687 ymin=s2.y}}}
4714 function init_music_line(){var p_voice,s,s1,s2,s3,last_s,v,st,shr,shrmx,shl,shlp,p_st,top,nv=voice_tb.length
4759 s2=p_voice.ckey
4760 if(s2.k_sf||s2.k_a_acc){s=clone(s2)
4763 s.k_old_sf=s2.k_sf}}
4764 if(insert_meter&1){for(v=0;v<nv;v++){p_voice=voice_tb[v];s2=p_voice.meter
4765 if(!cur_sy.voices[v]||cur_sy.voices[v].second||!cur_sy.st_print[cur_sy.voices[v].st]||!s2.a_meter.length)
4767 s=clone(s2)
4774 for(v=0;v<nv;v++){p_voice=voice_tb[v];s2=p_voice.bar_start;p_voice.bar_start=null
4782 if(!s2)
4787 p_voice.last_sym.rbstart=1}else{new_sym(s2,p_voice,last_s)}}
4791 while(1){s2=s;shl=shrmx=0
4796 s=s.ts_next}while(s!=last_s&&!s.seqst);s2.shrink=shrmx;s2.space=0
4805 function check_end_bar(){var s2,s=tsfirst
4808 if(s.type!=C.BAR){s2=_bar(s)
4809 s2.seqst=true
4810 s2.invis=true
4811 s2.time=s.time+(s.dur||0)
4812 s2.ts_prev=s
4813 s.next=s.ts_next=s2}}
4814 function set_words(p_voice){var s,s2,nflags,lastnote,res,start_flag=true,pitch=127
4827 case C.GRACE:for(s2=s.extra;s2;s2=s2.next)
4828 s2.notes.sort(abc2svg.pitcmp)
4860 for(s2=s.prev;s2;s2=s2.prev){if(s2.type!=C.REST)
4862 s2.notes[0].pit=pitch}}else{if(!s.notes){s.notes=[]
4868 function set_rb(p_voice){var s2,n,s=p_voice.sym
4871 n=0;s2=null
4880 s2=s
4881 if(n==cfmt.rbmax){if(s2)
4882 s=s2;s.rbstop=1
4979 function same_head(s1,s2){var i1,i2,l1,l2,head,i11,i12,i21,i22,sh1,sh2
4984 if((l2=s2.dur)>=C.BLEN)
4986 if(s1.stemless&&s2.stemless)
4988 if(s1.dots!=s2.dots){if((s1.shiftunison&&(s1.shiftunison&1))||s1.dots*s2.dots!=0)
4990 if(s1.stem*s2.stem>0)
4993 if(s1.notes[0].pit>s2.notes[0].pit){if(s1.stem<0)
4995 while(s2.notes[i2].pit!=s1.notes[0].pit){if(++i2>s2.nhd)
4996 return false}}else if(s1.notes[0].pit<s2.notes[0].pit){if(s2.stem<0)
4998 while(s2.notes[0].pit!=s1.notes[i1].pit){if(++i1>s1.nhd)
5000 if(s2.notes[i2].acc!=s1.notes[i1].acc)
5001 return false;i11=i1;i21=i2;sh1=s1.notes[i1].shhd;sh2=s2.notes[i2].shhd
5004 if(i2>s2.nhd){break}
5005 if(s2.notes[i2].acc!=s1.notes[i1].acc)
5009 if(sh2<s2.notes[i2].shhd)
5010 sh2=s2.notes[i2].shhd}while(s2.notes[i2].pit==s1.notes[i1].pit)
5011 if(i1<=s1.nhd){if(i2<=s2.nhd)
5013 if(s2.stem>0)
5014 return false}else if(i2<=s2.nhd){if(s1.stem>0)
5018 if(l1<C.BLEN/2){if(s2.dots)
5023 head=s2.dur>=C.BLEN/2?2:1}else{return false}}
5025 head=s1.p_v.scale<s2.p_v.scale?2:1
5026 if(head==1){for(i2=i21;i2<i22;i2++){s2.notes[i2].invis=true
5027 delete s2.notes[i2].acc}
5028 for(i2=0;i2<=s2.nhd;i2++)
5029 s2.notes[i2].shhd+=sh1}else{for(i1=i11;i1<i12;i1++){s1.notes[i1].invis=true
5034 function unison_acc(s1,s2,i1,i2){var m,d,acc
5035 acc=s2.notes[i2].acc
5036 if(!acc){d=w_note[s2.head]*2+s2.xmx+s1.notes[i1].shac+2
5040 if(s2.dots)
5043 s1.xmx+=d}else{d=w_note[s1.head]*2+s1.xmx+s2.notes[i2].shac+2
5048 for(m=0;m<=s2.nhd;m++){s2.notes[m].shhd+=d;s2.notes[m].shac-=d}
5049 s2.xmx+=d}}
5112 function set_overlap(){var s,s1,s2,s3,i,i1,i2,m,sd,t,dp,d,d2,dr,dr2,dx,left1,right1,left2,right2,right3,pl,pr,sy=cur_sy
5113 function v_invert(){s1=s2;s2=s;d=d2;pl=left1;pr=right1;dr2=dr}
5118 s2=s
5119 while(1){s2=s2.ts_next
5120 if(!s2)
5122 if(s2.time!=s.time){s2=null
5124 if(s2.type==C.NOTE&&!s2.invis&&s2.st==s.st)
5126 if(!s2)
5129 if(sy.voices[s1.v].range<sy.voices[s2.v].range)
5130 s2.dot_low=true
5133 if(s1.ymn>s2.ymx||s1.ymx<s2.ymn)
5135 if(same_head(s1,s2))
5137 if(!s1.dots&&!s2.dots)
5138 if((s1.stem>0&&s2.stem<0&&s1.notes[0].pit==s2.notes[s2.nhd].pit+1)||(s1.stem<0&&s2.stem>0&&s1.notes[s1.nhd].pit+1==s2.notes[0].pit)){if(s1.stem<0){s1=s2;s2=s}
5140 for(m=0;m<=s2.nhd;m++)
5141 s2.notes[m].shhd+=d
5142 s2.xmx+=d
5143 s1.xmx=s2.xmx
5145 right1=set_right(s1);left2=set_left(s2);s3=s1.ts_prev
5152 if(d<-3&&((s2.notes[0].pit&1)||!(s1.dots||s2.dots)||(!(s1.notes[s1.nhd].pit==s2.notes[0].pit+2&&s1.dot_low)&&!(s1.notes[s1.nhd].pit+2==s2.notes[0].pit&&s2.dot_low))))
5154 right2=set_right(s2);left1=set_left(s1)
5165 t=0;i1=s1.nhd;i2=s2.nhd
5166 while(1){dp=s1.notes[i1].pit-s2.notes[i2].pit
5171 s2.dot_low=true
5175 case 0:if(s1.notes[i1].acc!=s2.notes[i2].acc&&!s1.notes[i1].acc&&!s2.notes[i2].acc){t=-1
5177 if(s2.notes[i2].acc){if(!s1.notes[i1].acc)
5178 s1.notes[i1].acc=s2.notes[i2].acc
5179 s2.notes[i2].acc=0}
5180 if(s1.dots&&s2.dots&&(s1.notes[i1].pit&1))
5184 s2.dot_low=false
5189 s2.dot_low=false
5197 if(t<0){unison_acc(s1,s2,i1,i2)
5199 sd=0;if(s1.dots){if(s2.dots){if(!t)
5200 sd=1}else{v_invert()}}else if(s2.dots){if(d2+dr<d+dr2)
5207 d=0;m=s1.stem>=0?0:s1.nhd;d+=s1.notes[m].shhd;m=s2.stem>=0?0:s2.nhd;d-=s2.notes[m].shhd
5227 d=dx+d2+2}else{if(dx<d+dr2+s2.xmx){d2=0
5244 if(d2>4.5&&7.7+s1.xmx+2<d+d2+s2.xmx)
5245 s2.xmx=d2+3-7.7}}}
5246 for(m=s2.nhd;m>=0;m--){s2.notes[m].shhd+=d}
5247 s2.xmx+=d
5249 s1.xmx=s2.xmx}}
5250 Abc.prototype.set_stems=function(){var s,s2,g,slen,scale,ymn,ymx,nflags,ymin,ymax,res
5268 for(s2=s.next;;s2=s2.next){if(s2.type==C.NOTE){if(s.feathered_beam)
5269 s2.nflags++
5270 if(s2.beam_end)
5272 if(s2.nflags>nflags)
5273 nflags=s2.nflags}else if(!s.beam_st&&s.beam_end){for(s2=s.prev;;s2=s2.prev){if(s2.beam_st)
5275 if(s2.nflags>nflags)
5276 nflags=s2.nflags}
6017 function adjust_dur(s){var s2,time,auto_time,i,fac;s2=curvoice.last_sym
6018 if(!s2)
6019 return;if(s2.type==C.MREST||s2.type==C.BAR)
6021 while(s2.type!=C.BAR&&s2.prev)
6022 s2=s2.prev;time=s2.time;auto_time=curvoice.time-time
6024 if(time==0){while(s2&&!s2.dur)
6025 s2=s2.next
6026 if(s2&&s2.type==C.REST&&s2.invis){time+=s2.dur*fac
6027 if(s2.prev)
6028 s2.prev.next=s2.next
6030 curvoice.sym=s2.next
6031 if(s2.next)
6032 s2.next.prev=s2.prev;s2=s2.next}}
6035 for(;s2;s2=s2.next){s2.time=time
6036 if(!s2.dur||s2.grace)
6038 s2.dur*=fac;s2.dur_orig*=fac;time+=s2.dur
6039 if(s2.type!=C.NOTE&&s2.type!=C.REST)
6041 for(i=0;i<=s2.nhd;i++)
6042 s2.notes[i].dur*=fac}
6044 function new_bar(dotted){var s2,c,bar_type,line=parse.line,s={type:C.BAR,fname:parse.fname,istart:parse.bol+line.index,dur:0,multi:0}
6061 if(parse.ottava.length){s2=s
6062 if(curvoice.cst!=curvoice.st){s2={type:C.SPACE,fname:parse.fname,istart:parse.bol+line.index,dur:0,multi:0,invis:true,width:1}
6063 sym_link(s2)}
6064 s2.ottava=parse.ottava
6104 adjust_dur(s);if((bar_type=="["||bar_type=="|:")&&!curvoice.eoln){s2=curvoice.last_sym
6105 if(s2&&s2.time==curvoice.time){if(s2&&s2.type==C.BAR){if(bar_type=="["&&!s2.text&&(curvoice.st==0||(par_sy.staves[curvoice.st-1].flags&STOP_BAR)||s.norepbra)){if(s.text)
6106 s2.text=s.text
6108 s2.a_gch=s.a_gch
6110 s2.norepbra=s.norepbra
6112 s2.rbstart=s.rbstart
6114 s2.rbstop=s.rbstop
6116 if(s2.st==curvoice.st&&bar_type=="|:"){if(s2.bar_type==":|"){s2.bar_type="::";s2.rbstop=2
6118 if(s2.bar_type=="||"){s2.bar_type="||:";s2.rbstop=2
6135 if(s.rbstart&&!curvoice.norepbra&&curvoice.st>0&&!(par_sy.staves[curvoice.st-1].flags&STOP_BAR)){s2={type:C.BAR,fname:s.fname,istart:s.istart,iend:s.iend,bar_type:"[",multi:0,invis:true,text:s.text,rbstart:2}
6136 sym_link(s2);s2.st=curvoice.st
6314 Abc.prototype.new_note=function(grace,sls){var note,s,in_chord,c,dcn,type,tie_s,acc_tie,i,n,s2,nd,res,num,dur,apit,sl1=[],line=parse.line,a_dcn_sav=a_dcn
6323 break}}}else{for(s2=tie_s.extra;s2;s2=s2.next){if(!s2.notes[0].tie_ty)
6325 if(s2.notes[0].midi==mid){s2.tie_s=s
6326 s2.notes[0].tie_n=note
6328 s2.notes[0].s=s2
6448 if(num){curvoice.brk_rhythm=0;s2=curvoice.last_note
6451 s.notes[i].dur=s.notes[i].dur*n/num;s2.dur/=num;s2.dur_orig/=num
6452 for(i=0;i<=s2.nhd;i++)
6453 s2.notes[i].dur/=num}else{num=-num;n=num*2-1;s.dur/=num;s.dur_orig/=num
6455 s.notes[i].dur/=num;s2.dur=s2.dur*n/num;s2.dur_orig=s2.dur_orig*n/num
6456 for(i=0;i<=s2.nhd;i++)
6457 s2.notes[i].dur=s2.notes[i].dur*n/num}
6458 curvoice.time=s2.time+s2.dur;for(s2=s2.next;s2;s2=s2.next)
6459 s2.time=curvoice.time}}else{var div=curvoice.ckey.k_bagpipe?8:4
7604 function sym_add(p_voice,type){var s={type:type,dur:0},s2,p_voice2=curvoice;curvoice=p_voice;sym_link(s);curvoice=p_voice2;s2=s.prev
7605 if(!s2)
7606 s2=s.next
7607 if(s2){s.fname=s2.fname;s.istart=s2.istart;s.iend=s2.iend}
7610 function sort_all(){var s,s2,p_voice,v,time,w,wmin,ir,multi,prev,nb,ir2,v2,fl,new_sy,nv=voice_tb.length,vtb=[],vn=[],sy=cur_sy
7662 function voice_adj(sys_chg){var p_voice,s,s2,v
7663 function set_feathered_beam(s1){var s,s2,t,d,b,i,a,d=s1.dur,n=1
7669 s2=s;b=d/2;a=d/(n-1);t=s1.time
7670 if(s1.feathered_beam>0){for(s=s1,i=n-1;s!=s2;s=s.next,i--){d=((a*i)|0)+b;s.dur=d;s.time=t;t+=d}}else{for(s=s1,i=0;s!=s2;s=s.next,i++){d=((a*i)|0)+b;s.dur=d;s.time=t;t+=d}}
7686 for(s2=s.next;s2;s2=s2.next){if(s2.bar_type&&s2.bar_type[0]==':')
7688 if(s2){if(!s.sls)
7690 s.sls.push({ty:sl.ty,note:{s:s2}})}else{syntax(1,"Lack of ending slur(s)")}}}
7697 for(s2=s.next;s2;s2=s2.next){switch(s2.type){case C.SPACE:continue
7698 case C.NOTE:if(!s2.a_ly)
7700 s.a_ly=s2.a_ly;s2.a_ly=null
7705 s2=clone(s)
7706 s2.type=C.BAR
7707 s2.bar_type='|'
7708 s2.dur=0
7709 s2.time=s.next.time
7710 s2.prev=s
7711 s2.next=s.next
7712 s2.next.prev=s2
7713 s.next=s2}
7727 Abc.prototype.set_bar_num=function(){var s,s2,tim,rep_tim,k,n,bar_num=gene.nbar,bar_tim=0,ptim=0,wmeasure=voice_tb[cur_sy.top_voice].meter.wmeasure
7736 for(s2=s.ts_next;s2;s2=s2.ts_next){if(s2.type==C.BAR&&s2.time){if(s2.time<wmeasure){s=s2
8334 var s2=s.prev
8335 if(s2&&s2.type==C.BAR&&s2.bar_type[0]!=':'){s.next=s2
8336 s.prev=s2.prev
8339 s2.prev=s
8340 s2.next=null
8341 curvoice.last_sym=s2
8594 function draw_lyric_line(p_voice,j,y){var p,lastx,w,s,s2,ly,lyl,hyflag,lflag,x0,font,shift
8618 if(user.anno_start||user.anno_stop){s2={st:s.st,istart:ly.istart,iend:ly.iend,x:x0,y:y,ymn:y,ymx:y+gene.curfont.size,wl:0,wr:w}
8619 anno_start(s2,'lyrics')}
8620 xy_str(x0,y,p,null,null,ly.wh);anno_stop(s2,'lyrics')