Lines Matching defs:s1
561 function draw_repbra(p_voice){var s,s1,x,y,y2,i,p,w,wh,first_repeat;y=staff_tb[p_voice.st].topbar+25
569 s1=s
575 y2=y_get(p_voice.st,true,s1.x,s.x-s1.x)
578 if(s1.text){wh=strwh(s1.text);y2=y_get(p_voice.st,true,s1.x+4,wh[0])+
590 s1=s
596 if(s1==s)
598 x=s1.x
601 if(s.type!=C.BAR){w=s.rbstop?0:s.x-realwidth+4}else if((s.bar_type.length>1&&s.bar_type!="[]")||s.bar_type=="]"){if(s1.st>0&&!(cur_sy.staves[s1.st-1].flags&STOP_BAR))
613 if(s1.text)
614 xy_str(x+4,y2-gene.curfont.size-3,s1.text);xypath(x,y2);if(s1.rbstart==2)
617 output+='v20';output+='"/>\n';y_set(s1.st,true,x,w,y+2)
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
775 if(!s1.beam_st){s=sym_dup(s1);lkvsym(s,s1);lktsym(s,s1);s.x-=12
776 if(s.x>s1.prev.x+12)
777 s.x=s1.prev.x+12;s.beam_st=true
779 delete s.sls;s1=s}
780 notes=nflags=0;two_staves=two_dir=false;st=s1.st;v=s1.v;stem_xoff=s1.grace?GSTEM_XOFF:3.5
781 for(s2=s1;;s2=s2.next){if(s2.type==C.NOTE){if(s2.nflags>nflags)
785 if(s2.stem!=s1.stem)
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
808 s_closest=s1;p_min=100;p_max=0
809 for(s=s1;;s=s.next){if(s.type!=C.NOTE)
820 else if(!two_dir&¬es>=3&&s_closest!=s1&&s_closest!=s2)
822 y=s1.ys+staff_tb[st].y
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
828 max_stem_err=0;s=s1
829 if(two_dir){ys=((s1.grace?3.5:BEAM_SHIFT)*(nflags-1)+
831 if(s1.stem!=s2.stem&&s1.nflags<s2.nflags)
834 b+=ys*s1.stem}else if(!s1.grace){var beam_h=BEAM_DEPTH+BEAM_SHIFT*(nflags-1)
835 while(s.ts_prev&&s.ts_prev.type==C.NOTE&&s.ts_prev.time==s.time&&s.ts_prev.x>s1.xs)
847 stem_err+=BEAM_DEPTH+BEAM_SHIFT*(s.nflags-1)}else{if(s1.stem>0){if(s.stem>0){if(s.ymn>ys+4||s.ymx<ys-beam_h-2)
870 b+=s1.stem*max_stem_err
872 for(s=s1.next;;s=s.next){switch(s.type){case C.REST:g=s.ts_next
878 if(s1.stem>0){y=s.ymx-y
889 if(s1.stem>0){y=g.ymx-y
902 b+=b_pos(s1.grace,s1.stem,nflags,b-staff_tb[st].y)
903 for(s=s1;;s=s.next){switch(s.type){case C.NOTE:s.ys=a*s.xs+b-staff_tb[s.st].y
910 if(s1.stem>0){y-=dy
911 if(s1.multi==0&&y>12)
915 if(s1.multi==0&&y<12)
926 bm.s1=s1;bm.a=a;bm.b=b;bm.nflags=nflags
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
929 function draw_beam(x1,x2,dy,h,bm,n){var y1,dy2,s=bm.s1,nflags=s.nflags
935 anno_start(s1,'beam')
936 if(!s1.grace){bshift=BEAM_SHIFT;bstub=BEAM_STUB;shift=.34;bh=BEAM_DEPTH}else{bshift=3.5;bstub=3.2;shift=.29;bh=1.8}
937 beam_dir=s1.stem
938 if(s1.stem!=s2.stem&&s1.nflags<s2.nflags)
941 bh=-bh;draw_beam(s1.xs-shift,s2.xs+shift,0,bh,bm,1);da=0
942 for(s=s1;;s=s.next){if(s.type==C.NOTE&&s.stem!=beam_dir)
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)
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
988 if(s1.tmp)
989 unlksym(s1)
992 anno_stop(s1,'beam')}
1334 function slur_multi(s1,s2){if(s1.multi)
1335 return s1.multi
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()
1585 if(!s1.tp.length)
1586 delete s1.tp
1587 upstaff=s1.st
1588 set_dscale(s1.st)
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)
1605 if(!s2){error(1,s1,"No end of tuplet in this music line")
1608 if(!dir){s3=s1
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
1613 for(s3=s1;;s3=s3.next){if(s3.type!=C.NOTE&&s3.type!=C.REST){if(s3.type==C.GRACE||s3.type==C.SPACE)
1621 if(nb_only&&!s1.beam_st&&!s1.beam_br1&&!s1.beam_br2){for(s3=s1.prev;s3;s3=s3.prev){if(s3.type==C.NOTE||s3.type==C.REST){if(s3.nflags>=s1.nflags)
1630 xm=(s2.x+s1.x)/2
1636 if(s1.stem*s2.stem>0){if(s1.stem>0)
1644 for(s3=s1;;s3=s3.next){if(s3.x>=xm)
1651 x1=s1.x-4
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}
1662 if(s1.st==upstaff){for(s3=s1;!s3.dur;s3=s3.next);ym=y_get(upstaff,1,s3.x-4,8)
1665 if(s1.stem>0)
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)
1690 for(s3=s1;;s3=s3.next){if(s3.st==upstaff){yy=ym+(s3.x-xm)*a
1695 y_set(upstaff,true,s3.x,s3.next.x-s3.x,yy)}else if(s3==s2){break}}}else{if(s1.stem<0)
1697 if(s1.st==upstaff){for(s3=s1;!s3.dur;s3=s3.next);y1=y_get(upstaff,0,s3.x-4,8)}else{y1=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)
1720 for(s3=s1;;s3=s3.next){if(s3.st==upstaff){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
1733 for(m=0;m<s1.nhd;m++)
1734 if(s1.notes[m]==not1)
1736 if(dir>0){if(m<s1.nhd&&p+1==s1.notes[m+1].pit)
1737 if(s1.notes[m+1].shhd>sh)
1738 sh=s1.notes[m+1].shhd}else{if(m>0&&p==s1.notes[m-1].pit+1)
1739 if(s1.notes[m-1].shhd>sh)
1740 sh=s1.notes[m-1].shhd}
1741 x1=s1.x+sh
1755 case 1:x1=s1.x
1761 default:if(s1!=s2){x2-=s2.wl
1763 x2+=5}else{time=s1.time+s1.dur
1764 for(s=s1.ts_next;s;s=s.ts_next)
1774 if(s1.dots&&!(not1.pit&1)&&((dir>0&&!s1.dot_low)||(dir<0&&s1.dot_low)))
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)}}
1825 while(1){for(s1=s_next;s1;s1=s1.next){if(s1.ti2&&(s1!=s_next||!s_next.prev)){s=s1.ti2
1826 s.x=s1.x
1828 s.next=s1
1829 s.st=s1.st
1830 s.time=s1.time-s.dur
1831 draw_ties(s,s1,1)
1833 if(s1.tie_s)
1835 if(!s1)
1837 s2=s1.tie_s
1838 if(s2.v==s1.v){s_next=s2
1839 s=s1
1845 break}}else{s_next=s1.next
1846 s=s1
1852 if(!s){s2=s1
1855 if(!s){draw_ties_g(s1,s2,2);break}
1856 time=s1.time+s.dur
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]
1872 if(s1.stem>0){while(i<=j){y=k*i+b
3538 function set_float(){var p_voice,st,staff_chg,v,s,s1,up,down
3555 for(s1=s.ts_prev;s1;s1=s1.ts_prev){if(s1.st!=st||s1.v==s.v)
3557 if(s1.type==C.NOTE)
3558 if(s1.notes[0].pit<up)
3559 up=s1.notes[0].pit}
3566 for(s1=s.ts_next;s1;s1=s1.ts_next){if(s1.st!=st+1||s1.v==s.v)
3568 if(s1.type==C.NOTE)
3569 if(s1.notes[s1.nhd].pit>down)
3570 down=s1.notes[s1.nhd].pit}
4031 function bardiv(so){var s,s1,s2,t1,t2,i
4041 s1=s}
4042 if(!s1)
4048 while(s1!=so){if(s1.bar_type&&(s1.bar_type.slice(-1)==':'||s1.text)&&s1.bar_type!=':'){new_type(s1)
4049 s2=clone(s1)
4050 s1.bar_type=t1
4052 lkvsym(s2,s1.next)
4059 if(s1.text){s2.invis=true
4060 delete s1.text
4061 delete s1.rbstart}
4063 s1=s1.ts_next}
4071 function do_warn(s){var s1,s2,s3
4074 for(s1=s.ts_prev;s1;s1=s1.ts_prev){if(s1.type!=C.METER)
4078 s1=s.ts_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}
4084 lktsym(s3,s1.ts_next)
4087 s1=s3
4088 while(1){s1=s1.ts_next
4089 if(s1.v==s2.v)
4091 lkvsym(s3,s1)
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
4979 function same_head(s1,s2){var i1,i2,l1,l2,head,i11,i12,i21,i22,sh1,sh2
4980 if(s1.shiftunison&&s1.shiftunison>=3)
4982 if((l1=s1.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
5003 if(i1>s1.nhd){break}
5005 if(s2.notes[i2].acc!=s1.notes[i1].acc)
5007 if(sh1<s1.notes[i1].shhd)
5008 sh1=s1.notes[i1].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)
5014 return false}else if(i2<=s2.nhd){if(s1.stem>0)
5017 if(l1!=l2){if(l1<l2){l1=l2;l2=s1.dur}
5020 else if(s1.dots)
5021 head=1}else if(l2<C.BLEN/4){if(s1.shiftunison&&(s1.shiftunison&2))
5025 head=s1.p_v.scale<s2.p_v.scale?2:1
5029 s2.notes[i2].shhd+=sh1}else{for(i1=i11;i1<i12;i1++){s1.notes[i1].invis=true
5030 delete s1.notes[i1].acc}
5031 for(i1=0;i1<=s1.nhd;i1++)
5032 s1.notes[i1].shhd+=sh2}
5034 function unison_acc(s1,s2,i1,i2){var m,d,acc
5036 if(!acc){d=w_note[s2.head]*2+s2.xmx+s1.notes[i1].shac+2
5037 acc=s1.notes[i1].acc
5042 for(m=0;m<=s1.nhd;m++){s1.notes[m].shhd+=d;s1.notes[m].shac-=d}
5043 s1.xmx+=d}else{d=w_note[s1.head]*2+s1.xmx+s2.notes[i2].shac+2
5046 if(s1.dots)
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}
5128 s1=s
5129 if(sy.voices[s1.v].range<sy.voices[s2.v].range)
5132 s1.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}
5139 d=s1.notes[0].shhd+7
5143 s1.xmx=s2.xmx
5145 right1=set_right(s1);left2=set_left(s2);s3=s1.ts_prev
5146 if(s3&&s3.time==s1.time&&s3.st==s1.st&&s3.type==C.NOTE&&!s3.invis){right3=set_right(s3)
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
5167 switch(dp){case 2:if(!(s1.notes[i1].pit&1))
5168 s1.dot_low=false
5170 case 1:if(s1.notes[i1].pit&1)
5173 s1.dot_low=false
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
5180 if(s1.dots&&s2.dots&&(s1.notes[i1].pit&1))
5183 case-1:if(s1.notes[i1].pit&1)
5186 s1.dot_low=true
5188 case-2:if(!(s1.notes[i1].pit&1))
5197 if(t<0){unison_acc(s1,s2,i1,i2)
5199 sd=0;if(s1.dots){if(s2.dots){if(!t)
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
5208 if(s1.dots){dx=7.7+s1.xmx+
5209 3.5*s1.dots-3.5+
5210 3;if(!sd){d2=-100;for(i1=0;i1<=s1.nhd;i1++){i=s1.notes[i1].pit
5211 if(!(i&1)){if(!s1.dot_low)
5228 for(i1=0;i1<=s1.nhd;i1++){i=s1.notes[i1].pit
5229 if(!(i&1)){if(!s1.dot_low)
5244 if(d2>4.5&&7.7+s1.xmx+2<d+d2+s2.xmx)
5249 s1.xmx=s2.xmx}}
7663 function set_feathered_beam(s1){var s,s2,t,d,b,i,a,d=s1.dur,n=1
7664 for(s=s1;s;s=s.next){if(s.beam_end||!s.next)
7667 if(n<=1){delete s1.feathered_beam
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}}