| ︙ | | | ︙ | |
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
curvoice,
staves_found,
vover, // voice overlay
tsfirst
/* apply the %%voice options of the current voice */
function voice_filter() {
var opt, sel, tmp, i
for (opt in parse.voice_opts) {
if (!parse.voice_opts.hasOwnProperty(opt))
continue
sel = new RegExp(opt)
if (sel.test(curvoice.id)
|| sel.test(curvoice.nm)) {
|
|
|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
curvoice,
staves_found,
vover, // voice overlay
tsfirst
/* apply the %%voice options of the current voice */
function voice_filter() {
var opt, sel, i
for (opt in parse.voice_opts) {
if (!parse.voice_opts.hasOwnProperty(opt))
continue
sel = new RegExp(opt)
if (sel.test(curvoice.id)
|| sel.test(curvoice.nm)) {
|
| ︙ | | | ︙ | |
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
}
fl = wmin /* start a new sequence if some width */
}
}
// adjust some voice elements
function voice_adj() {
var p_voice, s, s2, s3, v
// set the duration of the notes under a feathered beam
function set_feathered_beam(s1) {
var s, s2, t, d, b, i, a,
d = s1.dur,
n = 1
|
|
|
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
}
fl = wmin /* start a new sequence if some width */
}
}
// adjust some voice elements
function voice_adj() {
var p_voice, s, s2, v
// set the duration of the notes under a feathered beam
function set_feathered_beam(s1) {
var s, s2, t, d, b, i, a,
d = s1.dur,
n = 1
|
| ︙ | | | ︙ | |
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
p_voice.ignore = false
for (s = p_voice.sym; s; s = s.next) {
if (s.time >= staves_found)
break
}
for ( ; s; s = s.next) {
switch (s.type) {
// case CLEF: // move the clefs before the measure bars
// for (s2 = s.prev; s2; s2 = s2.prev) {
// switch (s2.type) {
// case BAR:
// if (s2.time != s.time)
// break
//
// /* move the clef */
// s.next.prev = s.prev;
// s.prev.next = s.next;
// s.next = s2;
// s.prev = s2.prev;
// s.prev.next = s;
// s2.prev = s
// break
// case MREST:
// case NOTE:
// case REST:
// case SPACE:
// case STBRK:
// break
// default:
// continue
// }
// break
// }
// continue
case GRACE:
// with w_tb[BAR] = 2,
// the grace notes go after the bar;
// if before a bar, change the grace time
if (s.next && s.next.type == BAR)
s.time--
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
p_voice.ignore = false
for (s = p_voice.sym; s; s = s.next) {
if (s.time >= staves_found)
break
}
for ( ; s; s = s.next) {
switch (s.type) {
case GRACE:
// with w_tb[BAR] = 2,
// the grace notes go after the bar;
// if before a bar, change the grace time
if (s.next && s.next.type == BAR)
s.time--
|
| ︙ | | | ︙ | |
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
|
}
/* go to a global (measure + time) */
function go_global_time(s, symsel) {
var s2, bar_time, seq
if (symsel.bar <= 1) { /* special case: there is no measure 0/1 */
// && nbar == -1) { /* see set_bar_num */
if (symsel.bar == 1) {
for (s2 = s; s2; s2 = s2.ts_next) {
if (s2.type == BAR
&& s2.time != 0)
break
}
if (s2.time < voice_tb[cur_sy.top_voice].meter.wmeasure)
s = s2
}
} else {
for ( ; s; s = s.ts_next) {
if (s.type == BAR
&& s.bar_num >= symsel.bar)
break
}
if (!s)
return null
if (symsel.seq != 0) {
seq = symsel.seq
for (s = s.ts_next; s; s = s.ts_next) {
if (s.type == BAR
&& s.bar_num == symsel.bar) {
if (--seq == 0)
break
}
}
if (!s)
return null
}
}
if (symsel.time == 0)
return s;
bar_time = s.time + symsel.time
while (s.time < bar_time) {
|
<
|
|
|
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
}
/* go to a global (measure + time) */
function go_global_time(s, symsel) {
var s2, bar_time, seq
if (symsel.bar <= 1) { /* special case: there is no measure 0/1 */
if (symsel.bar == 1) {
for (s2 = s; s2; s2 = s2.ts_next) {
if (s2.type == BAR
&& s2.time != 0)
break
}
if (s2.time < voice_tb[cur_sy.top_voice].meter.wmeasure)
s = s2
}
} else {
for ( ; s; s = s.ts_next) {
if (s.type == BAR
&& s.bar_num >= symsel.bar)
break
}
if (!s)
return // null
if (symsel.seq != 0) {
seq = symsel.seq
for (s = s.ts_next; s; s = s.ts_next) {
if (s.type == BAR
&& s.bar_num == symsel.bar) {
if (--seq == 0)
break
}
}
if (!s)
return // null
}
}
if (symsel.time == 0)
return s;
bar_time = s.time + symsel.time
while (s.time < bar_time) {
|
| ︙ | | | ︙ | |
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
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, s3, 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
|
|
|
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
|
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
|
| ︙ | | | ︙ | |
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
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
|
}
break
}
break
}
// set the measure number on the top bars
// // and move the clefs before the measure 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 CLEF:
// for (s2 = s.ts_prev; s2; s2 = s2.ts_prev) {
// switch (s2.type) {
// case BAR:
// if (s2.seqst)
// break
// continue
// case MREST:
// case NOTE:
// case REST:
// case SPACE:
// case STAVES:
// case STBRK:
// s2 = undefined
// break
// default:
// continue
// }
// break
// }
// if (!s2)
// break
//
// /* move the clef */
// s.next.prev = s.prev;
// s.prev.next = s.next;
// s.ts_next.ts_prev = s.ts_prev;
// s.ts_prev.ts_next = s.ts_next;
// s.next = s2;
// s.prev = s2.prev;
// if s.prev)
// s.prev.next = s;
// s2.prev = s;
// s.ts_next = s2;
// s.ts_prev = s2.ts_prev;
// s.ts_prev.ts_next = s;
// s2.ts_prev = s
// s = s2
// break
case METER:
wmeasure = s.wmeasure
if (s.time < bar_time)
bar_time = s.time + wmeasure
break
case MREST:
bar_num += s.nmes - 1
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
|
}
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
|
| ︙ | | | ︙ | |
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
|
}
}
// set the transposition in the previous or starting key
function set_transp() {
var s, transp, vtransp
// if (curvoice.clef.clef_type == "p") // percussion
// return
if (curvoice.ckey.k_bagpipe || curvoice.ckey.k_drum)
return
if (cfmt.transp && curvoice.transp) // if %%transpose and score=
syntax(0, "Mix of old and new transposition syntaxes");
transp = (cfmt.transp || 0) + // %%transpose
|
<
<
|
899
900
901
902
903
904
905
906
907
908
909
910
911
912
|
}
}
// set the transposition in the previous or starting key
function set_transp() {
var s, transp, vtransp
if (curvoice.ckey.k_bagpipe || curvoice.ckey.k_drum)
return
if (cfmt.transp && curvoice.transp) // if %%transpose and score=
syntax(0, "Mix of old and new transposition syntaxes");
transp = (cfmt.transp || 0) + // %%transpose
|
| ︙ | | | ︙ | |
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
|
break
if (!s.prev) {
s = curvoice.key
break
}
s = s.prev
}
// s.k_sf = curvoice.okey.k_sf
// if (curvoice.okey.k_none)
// s.k_none = curvoice.okey.k_none
// if (curvoice.okey.k_a_acc)
// s.k_a_acc = curvoice.okey.k_a_acc;
key_transp(s);
curvoice.ckey = clone(s)
if (curvoice.key.k_none)
s.k_sf = 0
}
function set_ottava(dcn) {
|
<
<
<
<
<
|
934
935
936
937
938
939
940
941
942
943
944
945
946
947
|
break
if (!s.prev) {
s = curvoice.key
break
}
s = s.prev
}
key_transp(s);
curvoice.ckey = clone(s)
if (curvoice.key.k_none)
s.k_sf = 0
}
function set_ottava(dcn) {
|
| ︙ | | | ︙ | |
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
|
if (parse.state == 2)
goto_tune();
curvoice.norepbra = !get_bool(param)
}
return
case "repeat":
if (parse.state != 3)
return
if (!curvoice.last_sym) {
syntax(1, "%%repeat cannot start a tune")
return
}
if (!param.length) {
n = 1;
k = 1
|
|
|
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
|
if (parse.state == 2)
goto_tune();
curvoice.norepbra = !get_bool(param)
}
return
case "repeat":
if (parse.state != 3)
return
if (!curvoice.last_sym) {
syntax(1, "%%repeat cannot start a tune")
return
}
if (!param.length) {
n = 1;
k = 1
|
| ︙ | | | ︙ | |
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
|
* for transpose purpose, check if a pitch is already in the measure or
* if it is tied from a previous note, and return the associated accidental
*/
function acc_same_pitch(pitch) {
var i, time,
s = curvoice.last_sym.prev
// the overlaid voices may have no measure bars
// if (curvoice.id[curvoice.id.length - 1] == 'o') {
// for (i = curvoice.v; --i > 0; )
// if (!voice_tb[i].second)
// break
// s = voice_tb[i].last_sym
// }
if (!s)
return //undefined;
time = s.time
for (; s; s = s.prev) {
switch (s.type) {
|
<
<
<
<
<
<
<
<
|
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
|
* for transpose purpose, check if a pitch is already in the measure or
* if it is tied from a previous note, and return the associated accidental
*/
function acc_same_pitch(pitch) {
var i, time,
s = curvoice.last_sym.prev
if (!s)
return //undefined;
time = s.time
for (; s; s = s.prev) {
switch (s.type) {
|
| ︙ | | | ︙ | |
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
|
sym_link(s) // link the staves in this voice
}
par_sy.nstaff = nstaff;
new_syst();
s.sy = par_sy
}
// staves_found = maxtime < 0 ? 0 : maxtime
staves_found = maxtime
/* initialize the (old) voices */
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v]
delete p_voice.second
delete p_voice.ignore
delete p_voice.floating
// p_voice.time = maxtime
}
range = 0
for (i = 0; i < a_vf.length; i++) {
vid = a_vf[i][0];
p_voice = new_voice(vid);
p_voice.time = maxtime;
v = p_voice.v
|
<
<
|
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
|
sym_link(s) // link the staves in this voice
}
par_sy.nstaff = nstaff;
new_syst();
s.sy = par_sy
}
staves_found = maxtime
/* initialize the (old) voices */
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v]
delete p_voice.second
delete p_voice.ignore
delete p_voice.floating
}
range = 0
for (i = 0; i < a_vf.length; i++) {
vid = a_vf[i][0];
p_voice = new_voice(vid);
p_voice.time = maxtime;
v = p_voice.v
|
| ︙ | | | ︙ | |
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
|
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v]
if (par_sy.voices[v].range < 0) {
p_voice.ignore = true
continue
}
par_sy.voices[v].second = p_voice.second;
// par_sy.voices[v].clef = p_voice.clef;
st = p_voice.st
if (st > 0 && !p_voice.norepbra
&& !(par_sy.staves[st - 1].flags & STOP_BAR))
p_voice.norepbra = true
// par_sy.staves[st].clef = p_voice.clef
}
if (parse.state >= 2)
curvoice = voice_tb[par_sy.top_voice]
else
curvoice = null
}
var err_no_strt_ov = "No note in voice overlay"
/* -- get a voice overlay -- */
function get_vover(type) {
var p_voice2, p_voice3, range, s, time, v, v2, v3,
|
<
<
<
|
<
<
|
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
|
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v]
if (par_sy.voices[v].range < 0) {
p_voice.ignore = true
continue
}
par_sy.voices[v].second = p_voice.second;
st = p_voice.st
if (st > 0 && !p_voice.norepbra
&& !(par_sy.staves[st - 1].flags & STOP_BAR))
p_voice.norepbra = true
}
curvoice = parse.state >= 2 ? voice_tb[par_sy.top_voice] : null
}
var err_no_strt_ov = "No note in voice overlay"
/* -- get a voice overlay -- */
function get_vover(type) {
var p_voice2, p_voice3, range, s, time, v, v2, v3,
|
| ︙ | | | ︙ | |
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
|
return p_voice // found
}
p_voice = clone(curvoice);
p_voice.v = voice_tb.length;
p_voice.id = id;
p_voice.sym = p_voice.last_sym = null;
p_voice.nm = null;
p_voice.snm = null;
p_voice.new_name = false;
p_voice.lyric_restart = p_voice.lyric_restart =
p_voice.lyric_cont = p_voice.ly_a_h = null;
voice_tb.push(p_voice)
return p_voice
} // clone_voice()
/* treat the end of overlay */
if (curvoice.ignore)
|
|
|
|
|
|
>
|
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
|
return p_voice // found
}
p_voice = clone(curvoice);
p_voice.v = voice_tb.length;
p_voice.id = id;
p_voice.sym = p_voice.last_sym = null;
delete p_voice.nm
delete p_voice.snm
delete p_voice.new_name
delete p_voice.lyric_restart
delete p_voice.lyric_cont
delete p_voice.ly_a_h;
voice_tb.push(p_voice)
return p_voice
} // clone_voice()
/* treat the end of overlay */
if (curvoice.ignore)
|
| ︙ | | | ︙ | |
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
|
/* (here is treated a new overlay - '&') */
/* create the extra voice if not done yet */
if (!curvoice.last_note) {
syntax(1, err_no_strt_ov)
return
}
//--fixme?
// curvoice.last_sym.beam_end = true
curvoice.last_note.beam_end = true;
p_voice2 = curvoice.voice_down
if (!p_voice2) {
p_voice2 = clone_voice(curvoice.id + 'o');
// p_voice2.voice_up = curvoice;
curvoice.voice_down = p_voice2;
p_voice2.time = 0;
p_voice2.second = true;
v2 = p_voice2.v;
par_sy.voices[v2] = {
st: curvoice.st,
second: true,
scale: curvoice.scale,
key: curvoice.key,
ckey: curvoice.ckey,
okey: curvoice.okey,
pos: p_voice2.pos
}
var f_clone = curvoice.clone != undefined ? 1 : 0;
range = par_sy.voices[curvoice.v].range
for (v = 0; v < par_sy.voices.length; v++) {
if (par_sy.voices[v].range > range)
par_sy.voices[v].range += f_clone + 1
}
par_sy.voices[v2].range = range + 1
if (f_clone) {
p_voice3 = clone_voice(p_voice2.id + 'c');
p_voice3.second = true;
v3 = p_voice3.v;
par_sy.voices[v3] = {
second: true,
scale: curvoice.clone.scale,
range: range + 2
}
p_voice2.clone = p_voice3
}
}
//--fixme: in abcparse.c curvoice ulen and microscale are forced here
p_voice2.ulen = curvoice.ulen
p_voice2.dur_fact = curvoice.dur_fact
if (curvoice.uscale)
p_voice2.uscale = curvoice.uscale
//--fixme:, but not the scale, pos...
// v = curvoice.v
// v2 = p_voice2.v
// p_voice2.cst = p_voice2.st = par_sy.voices[v2].st
// = par_sy.voices[v].st
// p_voice3 = p_voice2.clone
// if (p_voice3) {
// p_voice3.cst = p_voice3.st
// = par_sy.voices[p_voice3.v].st
// = par_sy.voices[curvoice.clone.v].st
// }
if (!vover) { /* first '&' in a measure */
vover = {
bar: true,
mxtime: curvoice.time,
p_voice: curvoice
}
|
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
|
/* (here is treated a new overlay - '&') */
/* create the extra voice if not done yet */
if (!curvoice.last_note) {
syntax(1, err_no_strt_ov)
return
}
curvoice.last_note.beam_end = true;
p_voice2 = curvoice.voice_down
if (!p_voice2) {
p_voice2 = clone_voice(curvoice.id + 'o');
curvoice.voice_down = p_voice2;
p_voice2.time = 0;
p_voice2.second = true;
v2 = p_voice2.v;
par_sy.voices[v2] = {
st: curvoice.st,
second: true
}
var f_clone = curvoice.clone != undefined ? 1 : 0;
range = par_sy.voices[curvoice.v].range
for (v = 0; v < par_sy.voices.length; v++) {
if (par_sy.voices[v].range > range)
par_sy.voices[v].range += f_clone + 1
}
par_sy.voices[v2].range = range + 1
if (f_clone) {
p_voice3 = clone_voice(p_voice2.id + 'c');
p_voice3.second = true;
v3 = p_voice3.v;
par_sy.voices[v3] = {
second: true,
range: range + 2
}
p_voice2.clone = p_voice3
}
}
p_voice2.ulen = curvoice.ulen
p_voice2.dur_fact = curvoice.dur_fact
if (curvoice.uscale)
p_voice2.uscale = curvoice.uscale
if (!vover) { /* first '&' in a measure */
vover = {
bar: true,
mxtime: curvoice.time,
p_voice: curvoice
}
|
| ︙ | | | ︙ | |
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
|
s_key.k_none = true
}
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v];
p_voice.key = s_key;
p_voice.okey = clone(s_key);
p_voice.ckey = clone(s_key)
// if (s_key.k_none)
// p_voice.key.k_sf = 0
}
parse.okey = clone(s_key);
parse.ckey = s_key
if (a.length != 0)
memo_kv_parm('*', a)
if (!glovar.ulen)
glovar.ulen = BASE_LEN / 8;
|
<
<
|
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
s_key.k_none = true
}
for (v = 0; v < voice_tb.length; v++) {
p_voice = voice_tb[v];
p_voice.key = s_key;
p_voice.okey = clone(s_key);
p_voice.ckey = clone(s_key)
}
parse.okey = clone(s_key);
parse.ckey = s_key
if (a.length != 0)
memo_kv_parm('*', a)
if (!glovar.ulen)
glovar.ulen = BASE_LEN / 8;
|
| ︙ | | | ︙ | |
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
|
}
s_key.k_old_sf = curvoice.ckey.k_sf; // memorize the key changes
curvoice.ckey = s_key
if (is_voice_sig()) {
// if (s_key.k_sf != undefined || s_key.k_a_acc) {
// curvoice.ckey = s_key;
curvoice.key = clone(s_key)
if (s_key.k_none)
curvoice.key.k_sf = 0
// }
return
}
/* the key signature must appear before a time signature */
s = curvoice.last_sym
if (s && s.type == METER) {
curvoice.last_sym = s.prev
|
<
<
|
|
|
<
|
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
|
}
s_key.k_old_sf = curvoice.ckey.k_sf; // memorize the key changes
curvoice.ckey = s_key
if (is_voice_sig()) {
curvoice.key = clone(s_key)
if (s_key.k_none)
curvoice.key.k_sf = 0
return
}
/* the key signature must appear before a time signature */
s = curvoice.last_sym
if (s && s.type == METER) {
curvoice.last_sym = s.prev
|
| ︙ | | | ︙ | |
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
|
if (a.length != 0)
memo_kv_parm(vid, a)
if (vid != '*' && parse.state == 1)
new_voice(vid)
return
}
curvoice = new_voice(vid);
set_kv_parm(a)
if (parse.state == 2) // if first voice
goto_tune();
set_transp();
v = curvoice.v
|
>
>
>
>
|
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
|
if (a.length != 0)
memo_kv_parm(vid, a)
if (vid != '*' && parse.state == 1)
new_voice(vid)
return
}
if (vid == '*') {
syntax(1, "Cannot have V:* in tune body")
return
}
curvoice = new_voice(vid);
set_kv_parm(a)
if (parse.state == 2) // if first voice
goto_tune();
set_transp();
v = curvoice.v
|
| ︙ | | | ︙ | |
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
|
voice_filter()
}
}
// change state from 'tune header after K:' to 'in tune body'
// curvoice is defined when called from get_voice()
function goto_tune(is_K) {
var v, p_voice, transp,
s = {
type: STAVES,
dur: 0,
sy: par_sy
}
parse.state = 3; // in tune body
|
|
|
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
|
voice_filter()
}
}
// change state from 'tune header after K:' to 'in tune body'
// curvoice is defined when called from get_voice()
function goto_tune(is_K) {
var v, p_voice,
s = {
type: STAVES,
dur: 0,
sy: par_sy
}
parse.state = 3; // in tune body
|
| ︙ | | | ︙ | |
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
|
p_voice = voice_tb[v];
p_voice.ulen = glovar.ulen
if (p_voice.key.k_bagpipe
&& !p_voice.pos.stm) {
p_voice.pos = clone(p_voice.pos);
p_voice.pos.stm = SL_BELOW
}
// if (p_voice.key.k_none)
// p_voice.key.k_sf = 0
}
// initialize the voices when no %%staves/score
if (staves_found < 0) {
nstaff = voice_tb.length - 1
for (v = 0; v <= nstaff; v++) {
p_voice = voice_tb[v];
p_voice.time = 0; // old voice
p_voice.clef.time = 0
p_voice.st = p_voice.cst =
par_sy.voices[v].st =
par_sy.voices[v].range = v;
par_sy.staves[v] = {
stafflines: '|||||',
staffscale: 1
}
|
<
<
|
|
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
|
p_voice = voice_tb[v];
p_voice.ulen = glovar.ulen
if (p_voice.key.k_bagpipe
&& !p_voice.pos.stm) {
p_voice.pos = clone(p_voice.pos);
p_voice.pos.stm = SL_BELOW
}
}
// initialize the voices when no %%staves/score
if (staves_found < 0) {
nstaff = voice_tb.length - 1
for (v = 0; v <= nstaff; v++) {
p_voice = voice_tb[v];
p_voice.time = 0; // old voice
p_voice.clef.time = 0;
p_voice.st = p_voice.cst =
par_sy.voices[v].st =
par_sy.voices[v].range = v;
par_sy.staves[v] = {
stafflines: '|||||',
staffscale: 1
}
|
| ︙ | | | ︙ | |