623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
|
p_voice.sym = null
}
delete s.ts_prev.ts_next
}
/* -- set the bar numbers and treat %%clip / %%break -- */
function set_bar_num() {
var s, s2, tim,
v = cur_sy.top_voice,
wmeasure = voice_tb[v].meter.wmeasure,
bar_rep = gene.nbar
// insert the EOL of %%break
function do_break() {
var s, i, m, n, d, t
|
|
|
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
|
p_voice.sym = null
}
delete s.ts_prev.ts_next
}
/* -- set the bar numbers and treat %%clip / %%break -- */
function set_bar_num() {
var s, s2, tim, bar_time, bar_num, rep_dtime,
v = cur_sy.top_voice,
wmeasure = voice_tb[v].meter.wmeasure,
bar_rep = gene.nbar
// insert the EOL of %%break
function do_break() {
var s, i, m, n, d, t
|
661
662
663
664
665
666
667
668
669
670
671
672
673
674
|
/* don't count a bar at start of line */
for (s = tsfirst; ; s = s.ts_next) {
if (!s)
return
switch (s.type) {
case METER:
case CLEF:
case KEY:
case STBRK:
continue
case BAR:
if (s.bar_num) {
gene.nbar = s.bar_num /* (%%setbarnb) */
|
>
|
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
/* don't count a bar at start of line */
for (s = tsfirst; ; s = s.ts_next) {
if (!s)
return
switch (s.type) {
case METER:
wmeasure = s.wmeasure
case CLEF:
case KEY:
case STBRK:
continue
case BAR:
if (s.bar_num) {
gene.nbar = s.bar_num /* (%%setbarnb) */
|
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
|
}
break
}
break
}
// set the measure number on the top bars
var bar_time = s.time + wmeasure, // for incomplete measure at start of tune
bar_num = gene.nbar
for ( ; s; s = s.ts_next) {
switch (s.type) {
case METER:
wmeasure = s.wmeasure
if (s.time < bar_time)
bar_time = s.time + wmeasure
break
case MREST:
bar_num += s.nmes - 1
while (s.ts_next
&& s.ts_next.type != BAR)
s = s.ts_next
break
case BAR:
if (s.bar_num) {
bar_num = s.bar_num /* (%%setbarnb) */
if (s.time < bar_time) {
delete s.bar_num
break
}
} else {
if (s.time < bar_time) /* incomplete measure */
break
bar_num++
}
/* check if any repeat bar at this time */
tim = s.time;
s2 = s
do {
if (s2.type == BAR
&& s2.text // if repeat bar
&& !cfmt.contbarnb) {
if (s2.text[0] == '1')
bar_rep = bar_num
else /* restart bar numbering */
bar_num = bar_rep
break
}
s2 = s2.next
} while (s2 && s2.time == tim);
s.bar_num = bar_num;
bar_time = s.time + wmeasure
break
}
}
//fixme
/* do the %%clip stuff */
/* do the %%break stuff */
if (glovar.break)
|
|
|
|
<
|
<
|
>
>
>
>
|
<
|
>
|
>
>
>
|
>
|
>
|
|
>
>
>
|
|
<
<
>
>
|
|
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
|
}
break
}
break
}
// set the measure number on the top bars
bar_time = s.time + wmeasure; // for incomplete measure at start of tune
bar_num = gene.nbar
for ( ; s; s = s.ts_next) {
switch (s.type) {
case METER:
wmeasure = s.wmeasure
if (s.time < bar_time)
bar_time = s.time + wmeasure
break
case MREST:
bar_num += s.nmes - 1
while (s.ts_next
&& s.ts_next.type != BAR)
s = s.ts_next
break
case BAR:
if (s.bar_num) {
bar_num = s.bar_num /* (%%setbarnb) */
if (s.time < bar_time)
delete s.bar_num
}
if (s.time < bar_time) { // incomplete measure
if (s.text && s.text[0] == '1') {
bar_rep = bar_num;
rep_dtime = bar_time - s.time
}
break
}
/* check if any repeat bar at this time */
tim = s.time;
s2 = s
do {
if (s2.dur)
break
if (s2.type == BAR && s2.text) // if repeat bar
break
s2 = s2.next
} while (s2 && s2.time == tim);
bar_num++
if (s2 && s2.type == BAR && s2.text) {
if (s2.text[0] == '1') {
rep_dtime = 0;
bar_rep = bar_num - 1
} else { // restart bar numbering
if (!cfmt.contbarnb)
bar_num = bar_rep
if (rep_dtime) {
bar_time = tim + rep_dtime
break
}
}
}
s.bar_num = bar_num;
bar_time = tim + wmeasure
break
}
}
//fixme
/* do the %%clip stuff */
/* do the %%break stuff */
if (glovar.break)
|