Debian Codegraph @

utils/pmx/pmx-src/pmx300.for

raw
1 program pmxab
2 c
3 c This program, PMX, developed by Don Simons
4 c ([email protected]), is a preprocessor for MusiXTeX. In concert with
5 c MusiXTeX and TeX, its purpose is to allow the user to create high-quality
6 c typeset musical scores by including a sequence of PMX commands in an ASCII
7 c input file.
8 c
9 c This program is free software: you can redistribute it and/or modify
10 c it under the terms of the GNU General Public License as published by
11 c the Free Software Foundation, either version 3 of the License, or
12 c (at your option) any later version.
13 c
14 c This program is distributed in the hope that it will be useful,
15 c but WITHOUT ANY WARRANTY; without even the implied warranty of
16 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 c GNU General Public License for more details.
18 c
19 c You should have received a copy of the GNU General Public License
20 c along with this program. If not, see <http://www.gnu.org/licenses/>.
21 c
22 c
23 character*9 date
24 character*5 version,versionc
25 common /comver/ versionc
26 c
27 c To compile with gfortran:
28 c 1. Merge all files using copy *.for epmx[nnnn].for
29 c 2. Search and replace all character*65536 with character*131072
30 c 3. Comment/uncomment getarg lines
31 c 4. gfortran -O pmx[nnnn].for -o pmxab.exe
32 c
33 c To do
34 c Correct Rainer's email address in manual
35 c Linesplit (\\) in h
36 c Tt at start of a movement.
37 c Toggle midi on or off; allow midi only.
38 c Page number printed on 1st page even if 1 system.
39 c Still need inserted space for chordal accidentals
40 c Voicewise transposition.
41 c better segno
42 c coda
43 c duevolte
44 c Fix xtup bracket direction in 2-line staves?? (maybe leave as is)
45 c Sticky ornaments with shifts.
46 c Deal with Werner's vertical spacing thing associated with title.
47 c Multiple ties in midi
48 c Werner's missing c in MIDI due to start/stop ties on same note.
49 c Beams with single 64ths
50 c 128ths and/or dotted 64ths
51 c Close out MIDI with integral # of beats?
52 c Increase ast dimensions or redo logic.
53 c Does slur direction get set for user-defined single-note stem dir'ns?
54 c Transpose by sections.
55 c Optimization loop over sections only
56 c Command-line option to read nbarss in. Write out nbarss when optimizing.
57 c (or just read from .plg?)
58 c Beams over bar lines.
59 c 2-digit figures
60 c A real coule (slanted line between notes in a chord)
61 c Dotted slurs for grace notes.
62 c Undotted chord notes with dotted main note.
63 c Forced line break without line number
64 c Fix dot moving when 2nds in chord get flipped
65 c To do: increase length on notexq in dodyn
66 c
67 c
68 c 3.00
69 c Provides an option to remove the limit of 9 on forced
70 c beams. A side benefit of selecting the option is that all
71 c beams are vectorized and 2-digit figured bass figures are allowed.
72 c 2.98
73 c Fix beaming in 6/2 time by setting mapfb(5) and (6) = 0 in make1bar(...)
74 c 2.97
75 c Fix problem with beaming after new movement command
76 c 2.96 and 2.95
77 c replace and '\','/'. and '"' with chax();
78 c eliminate do loops with shared last line
79 c delete superfluous comments in source
80 c 2.94
81 c Allow moving dots on main and chord note in 2-note termolos
82 c Add definitions of \hbp and \hbpp to pmx.tex
83 c 2.91
84 c Tweak: insert \stdstemfalse before every user-shortened or lengthened stem.
85 c This cancels defaul extensions to middle line and also (with 'L') allows
86 c stems that are longer than 4.66 but still don't reach middle line.
87 c Allow alteration of number height in multibar rest, option n.
88 c Fix bug introduced in 2.89 so that the "o" in "mo800" is now OK.
89 c 2.90
90 c Many tweaks to allow gaps at end or middle of a system using
91 c L[n]S[x] and LC[y]. New pmx.tex.
92 c 2.88
93 c Comment out print*,"Changed pathname to..." since it was going
94 c iteration when optimizing linebreaks with the undocumented option Ao.
95 c Add nv back in as argument for getmidi, so loop transferring data
96 c from midivel to midvelc can be executed. This corrects bug and
97 c allows per-instrument change in midi velocities at the start
98 c of any block
99 c Add subroutine inst2chan to transfer midi data as noted above. Works with
100 c Iv but buggy when used with IT and Ib
101 c 2.87
102 c Allow changes to and from octave treble clef. Instrument with it
103 c must only have one staff.
104 c Some fixes for beam multiplicity changes at staff jumps. Must still
105 c use inline for mult. increase at downward staff jump. See sjb.pmx.
106 c 2.84
107 c Bug fix: dots in chordal seconds
108 c Bug fix: Initialize ihornb for non-beamed, down xtup
109 c Bug fix: When using "AT" with 2-note x3c rD.
110 c 2.83
111 c Fix problems when changing to or from octave treble clef.
112 c Fix beaming (or not) and number location for xtups with
113 c multiple rests. Still some problems with number height but
114 c can be band-aided with number height tweak option.
115 c Tweak error messages for options on "R" command.
116 c Allow forced beam height and slope tweaks with 2-note tremolos
117 c Allow chordal note with 2-note tremolos, adding dots as needed.
118 c Fix call to ncmid in beamstrt when setting start height for beam of
119 c 2-note trem, by changing arg from ivx to iv
120 c 2.82
121 c bugfix: beams with rests, not confused with xtups.
122 c x option after slur index to allow slurs to go from one voice to another.
123 c x option also for ties
124 c 2.81
125 c Allow string of rests to end xtup
126 c in chordal half-note 2-note tremolo, make chord notes open.
127 c 2.80
128 c Add 2-note tremolos
129 c 2.78
130 c Expand bufq to 131072 bytes
131 c Expand maxblks tp 9600
132 c Allow up to 75 pages
133 c Index postscript hairpins from 1 up instead of by voice #.
134 c Add option 'o' to forced beam for open notehead (\hb); set ipl(3)
135 c Add option T[n], n=1,2,3 for single stem tremolo
136 c 2.77
137 c Enable AV+/-x+/-y to add vskip bigh before or after \eject
138 c 2.76
139 c 2.75
140 c Bugfix: unbeamed xtups with dots: in beamn1 and beamid allow dotted 16th, and
141 c 2 or 3 flags on shortened note.
142 c 2.74
143 c Bugfix: allow "0" as argument of @ command on lyrics string.
144 c Check for and allow "\ in centered page headings with P command.
145 c Check for and allow "\ in text dynamics with D command.
146 c For lyrics string starting in xtuplet, insert check for inputting musixlyr.
147 c For staff-crossing beamed xtuplet chords, if 2nd segment of a joined beam
148 c starts with a blank rest, put '\sk' into the TeX.
149 c To enable high-to-both beamed etup staff-crossing chord, for blank
150 c rest at start of forced beam, shift \sk's from before to after \ib..;
151 c so \ib is at start and note in upper voice has a beam to connect to.
152 c Expand range of vertical xtup number shift, now stored in mult(16-22)
153 c Check for and allow \" within lyrics strings, for umlauts.
154 c 2.73 (160121)
155 c Dirk's "..." command, to convert "text" into \pmxlyr{text}\ and insert as
156 c inline TeX. Replace all '~' inside "..." and not preceded with '\', by
157 c '\lk '. Right after 2nd ", replace @[a,b][+,-]n with \at{[a,b][+,-]n}\
158 c Include definitions of \ly and \at in pmx.tex (2 Feb 16). After first ",
159 c add (as type 2 string) '\\input musixlyr \'
160 c After inputting pathname, change any '\' to '/', for Linux compatibility.
161 c 2.72 (160110)
162 c Really finalize \mbrest...go back to 3 args to deal with clef changes.
163 c Fine tune centered whole bar rests to deal with clef changes
164 c Fix bug in wsclef when >1 staff per instrument, since \setclef
165 c needs to know instrument and specify clefs on all staves for that
166 c instrument. Ones that were not changed by user will not be printed,
167 c and will be kept the same as before.
168 c Fix bug with arpegii from one voice to another in same staff.
169 c 2.71 (151226)
170 c Finalize mbrest mods
171 c 2.705
172 c Fix error message
173 c 2.704 (140614)
174 c Octave treble clef
175 c Make horizontal ornament shift (ornhshft) floating
176 c 2.703 (140323)
177 c Option v[-]n at end of any figure will alter figdrop for rest of system
178 c 2.702
179 c Stem slurs. Only for ps, assume no other pos'n adjustments. Option "v"
180 c 2.701
181 c oC = coda (\code{10})
182 c Move iornq(29) (blank barline) to ipl(0) (changes in pmxb, getnote)
183 c oG = new seqno
184 c To do: fix grace note spacing problem (partially done)
185 c 2.622
186 c Redefine midtc(..) and miditran(..); clean up all transpositions/key changes
187 c Kn[+/-...] \ignorenats at signature changes
188 c Fix tie checks in doslur() and dopsslur() to subtract iTransAmt from nolevs
189 c before checking and setting pitch levels levson() and levsoff()
190 c Define midisig separately from isig. Put in common commidisig.
191 c Use for explicit midi signature and for accid corrections to midi piches
192 c in addmidi.
193 c 2.621
194 c Make keyboard rest option work in xtuplets. Created subroutine
195 c chkkbdrests, modified make2bar to include calls to chkkbdrests as rqd.
196 c 2.620
197 c Allow user-defined rest height tweaks at start of beam.
198 c 2.619
199 c At movement break, change \nbinstruments in \newmovement macro; add
200 c 3rd arg to \newmovement in pmx.tex; modify pmxb.for and getnote.for
201 c to remove call to newnoi and change call to \newmovement
202 c 2.618
203 c Add option Ac[l,4] to set vert and horiz size and offsets to properly
204 c center page for letter or a4 paper.
205 c 2.617
206 c In g1etnote, change if-check for note to use index(...) instead
207 c of ichar(charq) since it was messing up gfortran optimizer
208 c After pmxa, search for and remove penultimate line <blank><blank>/
209 c because it was screwing up linux-compiled versions
210 c Bugfix: Increase dimension of kicrd from 7 to 10 in crdaccs(...)
211 c 2.616 (111110)
212 c Allow hairpins to span multiple notes groups (gulps).
213 c 2.615+ (110810)
214 c Fix midi when some instruments are transposed, by subtracting
215 c iTransAmt(instno(iv)) from pitch values sent to via addmidi in
216 c make2bar.for (for main notes) and docrd (for chord notes)
217 c 2.615 (110725)
218 c Fig bug with size-setting (in topfile) when instrument has >1 staves
219 c 2.615 (110724)
220 c Make AS[0|-|s|t]... really set sizes
221 c 2.614
222 c Mod notex.for to fix Terry's bug with raised dotted rests (caused
223 c by double-hboxing).
224 c 2.613
225 c Bugfix: In pmxa, change "do while" limit to keep from overwriting instno.
226 c 2.612
227 c Enhance AS to allow s or t for smallsize or tinysize
228 c 2.611
229 c Error trap for "D" before any notes in a block.
230 c 2.610
231 c Instrument-wise key changes and transposition (incomplete)
232 c 2.603
233 c 101211 In getpmxmod.for, decreased nline by 2 to fix locating errors
234 c following reading in an include file.
235 c 101121 Added some error messages in g1etset.for setup data
236 c 2.602
237 c Correct slur indexing in linebreakslurs.
238 c Account for comment lines in line count for error messages
239 c 2.601
240 c Bug fix: allow 24 slurs with graces
241 c 2.60 Changes made make it really big
242 c increase mv (size of midi) ? Note: MIDI can't have >16 voices w/o
243 c major reprogramming, and 16 may also be a problem (icmm)
244 c nm=24 (voices) done
245 c 24 slurs done
246 c 24 simultaneous beams (Replace index 24 by 0, so get 0-23)
247 c bufq*131072 (gfortran only)
248 c getarg syntax (gfortran only)
249 c 2.523+
250 c Fix voice numbering for normal dynamics and text dynamics
251 c 2.523
252 c Version of bigpmx first posted to Hiroaki's web site.
253 c 2.522
254 c 5/26/10 Replace ipl bits 0-7 with ipl2, add new common for it.
255 c With 2.521+ as starting version, incorporate bigpmx mods to allow 24 voices.
256 c 5/13/10 Fix log2 function
257 c 5/15/10 Fix bitwise storage for dynamics, fix segnoo string length.
258 c 2.521+
259 c 091025 Enable dotting 2nd part of linebreak slur or tie.
260 c To adjust barno height due to linebreak slur, use \bnrs instead of
261 c explicitly redefining \raisebarno (pmxb)
262 c 2.521
263 c Bugfix
264 c 2.520
265 c 090519 Enable ligfonts (special figured bass characters)
266 c 2.519
267 c Fix another bug which kept \sk from being output so misaligned some notes.
268 c 2.518
269 c Fix bugs: referencing fig data, char declaration for member of
270 c common/comfig/
271 c 2.517
272 c Allow figures in voice 1 + any one other.
273 c 2.516
274 c Allow figures in voice #2
275 c 2.515+ to do: Change manual and activate rule against clef change in voice #2.
276 c 2.515
277 c 071222 Changes in getnote to allow auto forced beams to start anywhere.
278 c 071206 In make2bar, shift fermataup7 to left over centered pause.
279 c 070901 In doslur, check for nolev <=2 in case slur ends on rest in 2-line
280 c staff (it was screwing up vertical justification).
281 c n34 for tweaks to midi durations of quarter note septuplets.
282 c To do: In ref250.tex, the tables where 's,t,)' is explained, the line
283 c [+,- i] ... Vertical adjustment of the start of second segment
284 c should it be replaced by
285 c [s +,- i] ... Vertical adjustment of the start of second segment
286 c 2.514
287 c Changes in make2bar to get horizontal spacing right when normal grace
288 c follows after grace
289 c Changes in dograce to get octaves right for any material entered inside
290 c \gaft, which shields transpose register changes from the outside world.
291 c 2.513
292 c In make1bar, near end, for forced beams starting with a rest, copy hgt and
293 c slope tweaks to ALL notes after first, not just the second one, so if
294 c there's more than one rest at start the tweaks are still observed.
295 c In beamid and beamend, add stand-alone triply-flagged notes for xtups.
296 c 2.512
297 c Near end of pmxb, fix error trap to allow redundant 'RD'
298 c Enable multiplicity down-up '][' within xtup.
299 c 2.511
300 c Introduce eskz2 for xtup #'s and bracket lengths, to remove bug caused by
301 c adjusteskz as in bar 7 of barsant.
302 c 2.510a
303 c Test: remove restriction on tempo changes in MIDI macros
304 c Send to CM for beta testing.
305 c 2.509+
306 c To do: Correct manual on AS. "-" is for smaller staves.
307 c 2.510
308 c Forgot to declare litq, voltxtq as character in subroutine getgrace
309 c 2.509
310 c Corrected small bug in arpeggio shifting (ivx <= iv in call putarp)
311 c 2.508
312 c Allow graces in xtups. New subroutine getgrace.
313 c 2.507
314 c To do: Raise/lower figures.
315 c To do: Add 24, 29 to list of musicsizes in manual
316 c New sub adjusteskz to account for ask's when computing lengths of
317 c brackets for unbeamed xtups, slopes and horizontal posn's of number
318 c Bug fix: in beamn1, beamid, and beamend, allow unbeamed xtups w/ 2 flags
319 c Add look-left option for keyboard rests, "L" in rest command, set iornq(30)
320 c 2.506
321 c Fix bug with AK, when simultaneous rests have same duration, use defaults.
322 c 2.505
323 c Keyboard rests AK
324 c 2.504
325 c Space after normal grace: option X[n]
326 c Fixed og when nv .ne. noinst, by using sepsymq instead of '&'
327 c (To do) length of xtup bracket when there is added non-collision space.
328 c Trap musicsize if .ne. 16,20,24,29.
329 c 2.503
330 c Enable arpeggio left shift with ?-x
331 c To do: In manual, arpeggio over 2 staves.
332 c Allow musicsize of 24 and 29. Had to define meter font size explicitly,
333 c also change font size for text dynamics, but not much else so far.
334 c Bugfix in beamstrt, introduced in 2415, ip was changed before putxtn
335 c was called, causing error in printing replacement number.
336 c 2.502
337 c Incorporate Dirk Laurie's patch to use { , } , for ties.
338 c Figure height adjustment: append +[n]
339 c Change ec font stuff in pmx.tex per Olivier Vogel's comment (CM email?)
340 c 2.501
341 c Readjust horizontal offset back to .8 in LineBreakTies
342 c Fix zero-subscript (iudorn) in putorn
343 c 2.50
344 c Increase number of text-dynamics (dimension of txtdynq) per block
345 c from 12 to 41.
346 c Slur option n to override altered default curvature.
347 c Allow default ps slur curvature tweaks with Ap+/-c
348 c 2.416
349 c Increase length of textdynq from 24 to 128
350 c (Todo) Add comment in manual about blank lines at end.
351 c Configuration file: Define subroutine getpmxmod, check path in environment
352 c variable pmxmoddir, check existence, read lines into bufq after setup.
353 c Increase dimension on idynn in dodyn from 4 to 10 for max number
354 c of marks in a bar
355 c Increase allowable # of lines from 2000 to 4000.
356 c (To do) Replace definition of \liftpausc per Olivier.
357 c (To do) Fix extraneous error message if RD is placed at very end.
358 c 2.415
359 c Fix "AT" option: replace putxtn,topfile,beamstrt,beamid to use \xnumt
360 c instead of redefining \xnum. Change font used to \smallfont (as for
361 c normal xtups,
362 c Allow slur to start on rest.
363 c 2.414
364 c Correct bug in crdacc when adding accidental to boundary causes number of
365 c segments to decrease
366 c Special rule for 3-accidental chords: If no 2nds, place them in order
367 c top, bottom, middle.
368 c 2.413
369 c Correct bugs in chordal accidentals, related to left-shifted noteheads
370 c (a) Special problems with downstem when main note needs shifting
371 c (b) Assign 0 rank to boundary segs due to left-shifted noteheads
372 c 2.412
373 c Change default horiz shift of start of seg 2 of linebreak slurs:
374 c -.7 for slurs, -1.2 for ties,
375 c Use height of start of seg 1 slur itself for end of 1 and start of 2.
376 c 2.411
377 c "Apl" activates special treatment of linebreak slur/tie's; breaks all in 2.
378 c "s" option in start of slur/tie as precursor to vert/horiz tweaks for end
379 c of seg 1. of linebreak slur/tie, 2nd "s" for start of seg2.
380 c With "Apl", curvature adjustments on starting slur command apply to seg 1,
381 c those on ending command to seg 2.
382 c 2.410
383 c "AT" to allow Col. S.'s tuplet option. Simply input tuplet.tex and redefine
384 c \xnum, \unbkt, \ovbkt.
385 c "s" option in main xtup input after "x": slope tweak for bracket. mult(4) is
386 c flag, mult(5-9) is tweak value+16
387 c 2.409
388 c Bugfix in docrd for MIDI: Use original pitch in case main/chord were
389 c switched due to 2nds.
390 c Remove "o" from error message for "A" command.
391 c New syntax: optional instrument number separator ":" in movement
392 c break command to precede a 2-digit instrument.
393 c Conditional output formats for \setname at movement break to allow
394 c instrument numbers >9.
395 c Bugfix in coding to raise barno due to slur over line break (pmxb)
396 c Move date/version data statement in pmxab to a better place.
397 c 2.408
398 c Allow pnotes{x} when x>9.995 (mod is only to format stmt in make2bar).
399 c Bug fix in \liftPAusep in notex.for and in pmx.tex
400 c Character variables for version and date
401 c For up-stem single graces slurred to down-stem, shift slur start left by
402 c 0.8 so slur doesn't get too short.
403 c Initialize and slide mult, same as other full-program variables in /all/.
404 c 2.407
405 c Allow AN[n]"[partname]" to be parsed by scor2prt as filename for part n,
406 c 2.406
407 c Alter PMX: put \dnstrut into \znotes in \starteq (for system spacing
408 c equalization).
409 c Put dimensions of double sharps and flats in crdacc (for chords).
410 c Bugfix: Use sepsymq in LineBreakTies(..) instead of '&'
411 c Use only first 4 bits of mult for multiplicity+8, so rest can be used
412 c for other stuff.
413 c Move stemlength stuff in nacc(27-30) to mult(27-30) to remove conflict.
414 c 2.405: Not published but saved for safety.
415 c Option Aph to write \special{header=psslurs.pro} top of each page, so
416 c dviselec will work OK.
417 c 2.404
418 c Allow slur to end on rest, but not start on a rest. Efaults height
419 c of ending is default height of start (before any automatic or user-
420 c defined djustments). User may adjust height as normal from default.
421 c 2.403
422 c Bugfix: turn off repeated beaming patterns.at end of non-last voice.
423 c 2.402
424 c Automatic repeated forced beams. Start with "[:" End with next explicit
425 c forced beam or end of input block.
426 c Increase # of forced beams per line of music per input block from 20 to 40
427 c 2.401
428 c Optional K-Postscript Linebreak Ties, Apl. New subroutine LineBreakTies.
429 c Makes 1st part normal shape, and starts 2nd part a little further left.
430 c Enable arpeggios in xtuplets. Had to make time itar(narp) a real.
431 c 2.40
432 c Set up WrotePsslurDefaults (logical) so only write defaults on 1st Ap.
433 c Fix non-ps-slur input to \midslur (third signed integer). Do not reverse
434 c sign for down-slurs.
435 c 2.359
436 c Add error exit subroutine stop1 to make exit status g77-compatible..
437 c Absolute octave on xtup chord note was 2 octave too high, fixed in getnote
438 c Fermata on vertically shifted rest: special trap in putorn() to set height.
439 c Correct multiple grace note spacing for small staves (in dograce,
440 c define wheadpt1 depending on staff size)
441 c 2.358
442 c Allow curvature corrections at start of postscript slur, in dopsslur()
443 c Local slur options p[+|-][s|t] for [nos|s]luradjust,[not|t]ieadjust
444 c Options for [Nos|S]luradjust,[Not|T]ieadjust,[noh|h]alfties: Ap[+|-][s|t|h]
445 c Make t[ID] act like s[ID]t, most mods in spsslur().
446 c Add spsslur() to read in data for ps slurs, call from getnote.
447 c In beamstrt, save args for SetupB in common comipb to save them for
448 c 2nd call when xtup starts with rest
449 c Add spacing for ornament ")" as if it were accidental, in make2bar().
450 c Horiz shift start and end of ps ties, dep. on stem dir'n, in dopsslur()
451 c Horiz. shift start of ps grace slur, 2 places in dograce().
452 c Horiz shift end of grace slur in endslur()
453 c Make st slurs into postscript ties. Separate subroutine dopsslur(),
454 c Non-beamed xtup: "a" in 1st note or rest, before "x" (sets drawbm=.false.)
455 c Allow two D"x" on same note. Introduced jtxtdyn1 in dodyn.
456 c 2.357a
457 c Fix missing "end" in backfill.com, too-long lines in g1etnote, getnote
458 c 2.357
459 c Increase dimension for # of lit TeX strings from 52 to 83.
460 c Allow blank rest in middle of xtuplet. Only mods in g*etnote().
461 c 2.356
462 c Increased some dimensions from 30 to 40 to allow up to 40 pages.
463 c In unbeamed xtups, "n" did not suppress bracket. Fixed in beamstrt().
464 c Fix parsing of "f,h,H,HH" in sslur.
465 c Fix bug with cdot, note-level for slur termination (in getnote)
466 c 2.355
467 c Midi transposition: IT[+|-][n1][+|-][n2]...[+|-][n(noinst)],
468 c n=# of half-steps. Restrict to mult. of 12 now, to avoid key-sig issues
469 c Make midi recognize ps ties in doslur.
470 c Correct ttieforsl so that it eats 2nd argument properly, using \zcharnote
471 c to get octave right.
472 c 2.354
473 c With postscript slurs, make t-slurs real ties by inserting replacement
474 c macros \tieforisu, etc, defined in pmx.tex
475 c Check for open cresc or decresc at end of input block, using list[de]cresc
476 c Hairpin syntax conditional on postscript slurs. Backup to fill in start
477 c level, using new backfill(...). Separate height tweaks for
478 c start and finish.
479 c 2.353
480 c K-0+n to transpose by half step (rather than just change key)
481 c Allow "rm[n]" when nv>1. Require it in all parts. Just write a stack of
482 c \mbrest's
483 c Enable "Rz"; define \setzalaligne in pmx.tex. Special treatment at end
484 c of input block before movement break, and at start of block after
485 c movement break, using \newmovement rather than \setzalaligne, since
486 c former already redefines \stoppiece. In second case, set rptfg2='z'.
487 c Make clefq(nm) common between pmxb and getnote; change references in
488 c getnote at 'M' to array elements, setting all new clefs as you go.
489 c 2.352
490 c Remove \parskip redefinition from pmx.tex; write it into TeX file when
491 c "Ae" is invoked.
492 c Ap to activate postscript slurs. Add macro \psforts to pmx.tex to redefine
493 c \tslur in case \midslur was used. Allow slur inputs 'f','h','H','HH',
494 c translate them thru mapping to (1,4,5,6) as \midslur params, then let
495 c \psforts translate them back to ps slur macors.
496 c 2.351
497 c Number slurs from 0 up instead of 11 down, anticipating postscript slurs.
498 c Write "\eightrm" instead of "\cmr8" for \figfont with small baseline size.
499 c Increase length of basenameq to 44 characters everywhere.
500 c Increase dimension of mcpitch (midi-chord-pitch) to 20.
501 c Set default systems per page to 1 if nv>7
502 c In pmxb, move place where isystpg is reset to 0, so that \eject gets
503 c written when there is just one system per page.
504 c 2.35
505 c Cautionary accidentals with 'c' anywhere in note symbol.
506 c NEW pmx.tex with \resetsize to set size to normal or small depending on
507 c current \internote. Used with new coding in dograce() to get right
508 c new size in case user has \setsize'ed some lines to \smallvalue. For
509 c \smallvalue-sized staves, redefine \tinynotesize to give 11-pt font.
510 c Affects pmx.tex.
511 c Continuation figure with fractional length. May now mix with other figures.
512 c If another figure follow Cont-fig, separate with colon.
513 c 2.342
514 c Bugfix in getnote to recognize relative octave shift in grace at start of
515 c input block.
516 c In make2bar, initialize islhgt=0 earlier than before (possible solution
517 c to Suse g77 compile problem that I could not reproduce)..
518 c Bugfix in beamstrt & beamn1 for r2x6 c4D d d d
519 c 2.341
520 c Syntax check: Forced page break page number must be > than previous.
521 c Bugfix: Define ivx when "sliding down" breath/caesure data in pmxb.
522 c 2.34
523 c New pmx.tex with redefined liftpausc
524 c Bug fix with dotted, non-beamed xtups.
525 c 2.332
526 c Fix bugs in horizonal shifts, spacing, for accid's, graces, noteheads.
527 c Allow arbitrary pos. input to W in g1etnote and getnote.
528 c 2.331
529 c Bug-fix in dodyn(..): typo on length of arg of txtdyn
530 c 2.33
531 c Caesura (oc), breath (ob). Set iornq(28), store rest of data in ibcdata()
532 c 2.321
533 c Rescale accidental shifts. Still use 7 bits but now map (0,127)
534 c onto (-1.,5.35)
535 c Fix ihornb bug in dodyn, seen with dynamics on lower-voice non-beamed xtups
536 c 2.32 (Noticed after posting)
537 c Prohibit "/" as figure.
538 c 2.32 (Posted)
539 c Tidied up accidentals in chords, do spacing.
540 c Still to do:
541 c check for "(" on chord notes in spacing algo
542 c small accids
543 c double accids
544 c autoshift slurs
545 c 2.310
546 c Extra call to precrd ahead of spacing chk, and single-note crd/acc
547 c shifts seem OK, but not multiple. crd/acc shifts not recorded 1st time.
548 c 2.309
549 c Alternate algo for accid shifts in chords.
550 c 2.308
551 c Auto horiz. notehead shifting added to precrd.
552 c 2.307
553 c Auto shifting of multiple accidentals in chords.
554 c "Ao" in main chord note to keep accidentals in order. Set nacc(28).
555 c If there are any manual main or chord note shifts, then
556 c If any manual shift is preceded by "A" then
557 c 1. Auto-shifting proceeds
558 c 2. "A"-shifts add to autoshifts
559 c 3. non-"A" shifts are ignored!
560 c Else (>0 man shifts, none has "A")
561 c No auto-ordering, No autoshifts,
562 c End if
563 c End if
564 c 2.306
565 c Initialize legacy note level to middle C in case user forgets to set
566 c octave.
567 c Shift xtup note?
568 c Shift in elemskips rather than noteheads?
569 c 2.305
570 c Stop pmxb from multiple endvolta's at start of new page.
571 c 2.304
572 c "Sx" in a note means shorten stemlength by x \internotes. "Sx:" turn on
573 c for multiple notes in the voice, "S:" last shortened note.
574 c 2.303
575 c vshrink stuff all OK? Description is in pmxb.
576 c 2.302
577 c Toggle vshrink with "Av". vshrink normally kicks in when \interstaff
578 c hits 20. This still needs work.
579 c Add " /" to last line if last char is not % or /.
580 c 2.301
581 c Check in beamn1 for single note before multiplicity down-up.
582 c allow '.PMX' as well as '.pmx'
583 c 2.299
584 c Correct typo in pmxb involving PMXbarnotrue.
585 c Replacement printed number for xtup: Unsigned integer after 'n' after 'x'
586 c Minor upgrade parsing xtuplet options 'x...'
587 c Correct dimension of nxtinbm in make2bar.
588 c 2.298
589 c Account for doubled xtup notes in subroutine getx (user-defined spaces),
590 c by adding ndoub as an argument..
591 c 2.297
592 c Created and solved compiler problem. Put drawbm(NM) in its own common.
593 c Add new def'ns [\a|PA]usc, \lift[pa|PA]usc to pmx.tex, use them in make2bar
594 c when \centerbar is used.
595 c Modify \mbrest & \CenterBar in pmx.tex to use \volta@endcor etc. Have PMX
596 c use right 2nd and 3rd args for \mbrest when key, meter, or clef changes.
597 c 2.296
598 c Correct printed numbers for forced beams with multiple xtups. For each beam
599 c make list in setupb by voice of eloff (h-offset) and mtupv (printed #)
600 c Increase lengths of jobname and infileq by 20 characters
601 c Enable whole notes and breves as 1st or last note of xtup in beamn1 and
602 c beamend, and wholes in beamid.
603 c 2.295
604 c Midi balance Ib[n1]:[n2]:...[nn]
605 c Single-slope beam groups [...]-[...]
606 c Trap "i" unless after accidental (main notes, xtups, chord notes)
607 c 2.294
608 c Unequal xtups with "D" to double a note in an xtup.
609 c As above, "F" will (a) increase multiplicity by 1 for marked note and next
610 c one and (b) add a dot to the first one.
611 c Fix bug with e.g. c84 [ .d e.f ] by checking whether forced beam is on
612 c when "." is encountered, then correcting beam start time.(end of getnote)
613 c MIDI velocity (volume) set: Iv[n1]:[n2]:[n3]...
614 c 2.293
615 c Check for single notes spanning bar lines.
616 c Correct various bugs with staff-jumping beams. (1) for 2nd segment, vxtup
617 c must be set in make2bar since beamstrt is not called, fixing problem with
618 c dot at end. (2) add ivjb2 to flag which voice has 2nd segment and fix
619 c problem when >2 staves.
620 c Add nodur to args of dodyn, so can check if stemless and avoid height tweak
621 c Correct bug in getdyn setting flag in idynda2(0) for manual horiz. tweak
622 c 2.292a
623 c Undo syntax check for Type 2 or 3 TeX string starting in column 1.
624 c Meanwhile, Werner's problem with a mid-line Type 3 string has gone away?!
625 c 2.292
626 c Allow comments in xtuplets
627 c Enable multiple octave jumps in grace notes.
628 c Allow dynamics in xtuplets.
629 c Fix bug in getdyn searching for end of text string (correct length of lineq
630 c to 128)
631 c Fix bug in dodyn, must ignore horiz. interaction tweak for
632 c user-text (idno = 0)
633 c Syntax check for Type 2 or 3 TeX string starting in column 1
634 c (NOTE: later undone!)
635 c Syntax check for page number > npages at forced line break.
636 c 2.291
637 c Fix error in AS command (accid spacing for small systems), making only
638 c one spec per staff, nv total.
639 c Stop using MIDI channel 10
640 c 2.29
641 c Fix error in console output format for # of bytes used in MIDI file.
642 c Fix bug in dograce so no space is added between grace and main note when
643 c there is a MIDI-only accidental.
644 c Fix bug so oes?+4 works. It was too ugly to explain.
645 c ...Different ways of storing accidental specs on input and output.
646 c No longer zap \writezbarno in special situations.
647 c Fix bug in dyntxt level on rest
648 c Line spacing equalization. Add macros \starteq, \endeq, \spread, etc.
649 c Activate with Ae. (Maybe later could input alternate values for
650 c \upamt, \dnamt, \parskip). Put \starteq on 1st note in voice 1
651 c in the page, and \endeq on 1st note of next-to-last line in page.
652 c 2.28
653 c Flip direction of forced beam "[f..."
654 c Fix beam numbering for staff jumping beams. Uses irest(23,24,29,30)
655 c Fix bug in sliding ip's for txtdyn's
656 c In dyn's allow vert. offsets +/-64, horiz +/-25.6 (store in idnyda2(1-99)
657 c 2.27
658 c Comment out lines in dodyn checking number of dynamic marks found. Voice
659 c order may not be monotonic if two lines on a staff.
660 c Literal dynamic: D"[text]"
661 c 2.26
662 c Allow hairpin start-stop on same note by disabling auto-tweaks in dodyn,
663 c increasing dimension of idynn to 4 to allow 4 symbols on same note.
664 c Increase voltxtq length from 10 to 20.
665 c AS[-/0][-/0]... to inform PMX that "-" voices are small, and rough
666 c accounting for ast's is done by defining effective headwidth
667 c whead1 in makebar2 to be 0.8*whead.
668 c 2.25
669 c Fix logic bug with sepsym's when # of instruments changes.
670 c Slight increases in default offsets for hairpin starts after "p"
671 c 2.24
672 c Hairpins D< or D> as toggle.
673 c Many automatic position tweaks for letter-group dynamics and hairpins.
674 c 2.23
675 c Continued rhythmic shortcuts: space followed by "." or ","
676 c 2.22
677 c In call to doslur, change tno(...) to tnote(...). This was only
678 c used when checking to slurs per stem directions, and should have been
679 c the note duration all along.
680 c MIDI-only accidental, bit 17 in nacc, or 27 in icrdat.
681 c Use "i" anywhere in note symbol.
682 c 2.21
683 c Increase from 20 to 30 dimensions for movement breaks and midi sections.
684 c Fix out-of-order declarations per mutex comments
685 c Add "Bad error" and "Kluging" messages to log file.
686 c 2.197
687 c add /comips/ to save tie-check midi variables
688 c For spacing of clef changes at start of input block, changed integer time
689 c lastnodur to prevtn, so it works with xtups. Possible incompatibility!
690 c 2.196
691 c Fix Ickbug with time check in ncmid()
692 c Interchange \fermataup7 and \pausec to get proper alignment
693 c Enable French violin clef "f", number 7 in PMX, but 9 in MusiXTeX.
694 c Add defn's of \hsp, \hspp to pmx.tex
695 c Fix pre-slurs on xtup chord notes.
696 c Fixed raised PAuse, define \liftPAuse
697 c Replace \zbreve\sk with \breve.
698 c Made "1" work as mtrdenl by doubling it and mtrnuml. BUT WAIT...what
699 c about "o" and 1 as shorthand for 16???? Search for "Kluge"
700 c Added "vo" (voice) as MIDI instrument 55
701 c Allow 3-digit page numbers (search for "toppageno")
702 c Fix bug caused by prior fix (cancelling accid after bar line was ignored).
703 c Fix double accids in chords
704 c 2.194
705 c Fix bug with accid/tie/barline/chord in addmidi by restructuring accid if
706 c block.
707 c Add meter to MIDI file with every pause
708 c Purify FORTRAN?
709 c 2.193
710 c Increased # of in-line TeX strings from 36 to 52.
711 c Fix entry of # of bytes in header of tempo/meter/key track to allow >255.
712 c 2.191
713 c Event track: Tempos, meters, keys all together. Data in comevent
714 c 2.15
715 c Pretty good midi capability. Still no attention to slurs on chord notes.
716 c 2.11
717 c 11 Dec 99 c rm1
718 c 11 Dec 99 "oes?", "oe?"
719 c 11 Dec 99 Cancel slur horizontal tweaks with non-stemmed notes
720 c 11 Dec 99 Error message for shifted, repeated ornaments.
721 c 2.10 (Version 2.1)
722 c Fix bug with lowdot and xtuplets
723 c 2.09
724 c Fix bug with multiple ornament heights over beams, when one is . or _
725 c Error message from pmxa if rest on last note of xtup.
726 c Enable 12 slurs.
727 c Reinstate multiple rests at start of xtup.
728 c 2.07
729 c Combine consecutive type-1 TeX strings.
730 c \midslur and \curve as 3rd signed digit in slur termination, + 2 opt.int's.
731 c Fixed breve chord notes in docrd
732 c Check irest(28) as well as vxtup when setting nodur for chord notes, since
733 c vxtup isn't set until 1st *main* note in xtup
734 c Vectorize nolev1, slope, ixrest. Klug fix for xtups with variable spacing.
735 c 2.06+
736 c Make deterministic the beam slope calculation when there are an even # of
737 c slopes in list and middle two are equal magnitude but opposite sign.
738 c pmxa Trap for "o:" before 1st note in block
739 c Partial bug fix for 64th notes in xtuplets.
740 c Make ixrest a vector, since with new time scheme may not finish xtup in
741 c same notes block.
742 c Increase max # of pages from 20 to 30 (dimensions of nsystp,..., in pmxb)
743 c 2.06
744 c Account for changes in nv when computing \interstaff. Add a counter
745 c nistaff(iflb) = # of interstaff spaces per system = nv-1. Set whenever
746 c setting isysflb(iflb). Note nv can only change at a forced line break.
747 c Note also, iflb starts at 0!
748 c 2.05
749 c Automatic start of new notes group with part 2 of staff-jump beam
750 c In make1bar, set irest bit 29 of lowest-voice note at same time,
751 c use as flag when making notes groups.
752 c For now, remove dummy blank line at end...it zaps terminal repeats.
753 c 2.02
754 c Fixed slur-counting bug for multiple, slurred, aftergraces.
755 c 2.01
756 c Increase to ask(1400)
757 c Increase max forced page breaks to 18
758 c Define pausc for centered pause
759 c 2.0a
760 c Insert dummy blank line at very end to handle input files w/o terminal CR-LF
761 c pmx03r
762 c Option m[n] in S symbol to change musicsize (for parts)
763 c Double dotted rests now work.
764 c Write file name to log file
765 c Check existence of input file
766 c Allow 24-char jobname, may end with ".pmx"
767 c Comment out time stuff
768 c Replace 3-argument getarg with 2-argument + iargc
769 c Fix bug with negative noinst due to nint<=int replacement
770 c move lovation of iv in isdat1 to allow iv>7.
771 c Set nm=12
772 c pmx03q
773 c replace int(x+.001) with nint(x)
774 c Write TeX file name to screen and to pml.
775 c Replace char(...) with chax(...) to sovle msdev bug.
776 c Bug fix: macro terminations when M is on a line by itself.
777 c Bug fix: don't accumulate space for XS in pmxa.
778 c Streamline Macros: use pointers to bufq instead of scratch files
779 c pmx03p
780 c Store input file in single character array bufq.
781 c lbuf(i)*2 is length of line i
782 c ipbuf is position just before next line to be read.
783 c pmx03
784 c Optimize read/writes
785 c pmx02
786 c Fix line count (for errors) when there are saved macros
787 c pmx01
788 c In optimize mode, open/close macros (Watch out for residual zz files!)
789 c Command line input
790 c Option Ao to optimize, otherwise normal processing
791 c
792 ccccccc
793 parameter (nks=125,nm=24,mv=24576,maxblks=9600)
794 character*128 lnholdq
795 character*131072 bufq
796 integer*2 lbuf(maxblks)
797 common /comevent/ miditime,lasttime
798 logical slmon,dbltie
799 common /comslm/ levson(0:nm),levsoff(0:nm),imidso(0:nm),
800 * naccbl(0:nm),laccbl(0:nm,10),jaccbl(0:nm,10),nusebl,
801 * slmon(0:nm),dbltie
802 integer*2 mmidi
803 logical restpend,relacc,notmain,twoline,ismidi,crdacc
804 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
805 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
806 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
807 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
808 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
809 * debugmidi
810 logical debugmidi
811 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
812 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
813 integer*2 iinsiv
814 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
815 common /commus/ musize,whead20
816 integer*4 nbars0(nks),nbars(nks),ipoe(nks),nbari(nks)
817 real*4 poe0(nks),poe(nks)
818 logical isfirst,optimize
819 logical*4 fexist
820 character*44 jobname
821 character*47 infileq
822 common /a1ll/ iv,ivxo(600),ipo(600),to(600),tno(600),nnl(nm),
823 * nv,ibar,mtrnuml,nodur(nm,200),lenbar,iccount,
824 * idum,itsofar(nm),nib(nm,15),nn(nm),
825 * rest(nm,200),lenbr0,lenbr1,firstline,newmeter
826 logical rest,firstline,newmeter
827 common /comdiag/ n69(0:nm),n34(0:nm)
828 logical mmacrec,gottempo
829 common /commmac/ mmacstrt(0:nm,20),mmacend(0:nm,20),immac,
830 * mmactime(20),nmidsec,msecstrt(0:nm,60),msecend(0:nm,60),
831 * mmacrec,gottempo
832 common /truelinecount/ linewcom(20000)
833 c
834 c Added 130302 only to get nsperi from g1etnote, for use in midi setup
835 c
836 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
837 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
838 logical lastchar,fbon,issegno,isheadr,isvolt
839 character*1 chax
840 c
841 c immac(i) is the index of i-th macro, i=1,nmac. Also make a list containing
842 c nmidsec section starts and stops based on PLAYING macros (not recording).
843 c
844 ccccccccccccccccccccccccc
845 c
846 data date /'7 Feb 23'/
847 data version /'3.00'/
848 c
849 ccccccccccccccccccccccccc
850 data maxit,ncalls /200,0/
851 data isfirst /.true./
852 c itstart = mytime()
853 versionc = version
854 c
855 c Initialize midi parameters
856 c
857 gottempo = .false.
858 ismidi = .false.
859 debugmidi = .false.
860 relacc = .false.
861 mmacrec = .false.
862 nmidsec = 1
863 mgap = 10
864 miditime = 0
865 lasttime = 0
866 nmidcrd = 0
867 nusebl = 0
868 notmain = .false.
869 do 3 ivx = 1 , nm
870 twoline(ivx) = .false.
871 midinst(ivx) = 6
872 midivel(ivx) = 127
873 midibal(ivx) = 64
874 miditran(ivx) = 0
875 3 continue
876 do 12 icm = 0 , nm
877 imidi(icm) = 0
878 restpend(icm) = .false.
879 trest(icm) = 0.
880 levson(icm) = 0
881 levsoff(icm) = 0
882 slmon(icm) = .false.
883 naccbl(icm) = 0
884 n69(icm) = 0
885 n34(icm) = 0
886 msecstrt(icm,1) = 1
887 12 continue
888 c
889 c End of midi parameter initialization
890 c
891 musize = 0
892 optimize = .false.
893 numargs = iargc()
894 if (numargs .eq. 0) then
895 print*,'You could have entered a jobname on the command line,'
896 print*,' but you may enter one now:'
897 read(*,'(a)')jobname
898 numargs = 1
899 else
900 c call getarg(1,jobname,idum) ! May need to replace this w/ next line
901 call getarg(1,jobname)
902 end if
903 10 ljob = lenstr(jobname,44)
904 if (ljob .gt. 44) then
905 print*,'Jobname is too long. Try again.'
906 call stop1()
907 else if (ljob .eq. 0) then
908 print*,'No was jobname entered. Try again.'
909 call stop1()
910 else if (numargs .eq. 2) then
911 if (ljob.eq.2 .and. jobname(1:2).eq.'-o') then
912 optimize = .true.
913 c call getarg(2,jobname,idum) ! May need to replace this w/ next line
914 call getarg(2,jobname)
915 numargs = 1
916 go to 10
917 else
918 print*,'Illegal option on command line'
919 call stop1()
920 end if
921 end if
922 c
923 c Strip ".pmx" if necessary
924 c
925 ndxpmx = max(index(jobname,'.pmx'),index(jobname,'.PMX'))
926 if (ndxpmx .gt. 0) then
927 jobname = jobname(1:ndxpmx-1)
928 ljob = ljob-4
929 end if
930 c
931 c Check for existence of input file
932 c
933 infileq = jobname(1:ljob)//'.pmx'
934 inquire(file=infileq,EXIST=fexist)
935 if (.not.fexist) then
936 inquire(file=jobname(1:ljob)//'.PMX',EXIST=fexist)
937 if (.not.fexist) then
938 print*,'Cannot find file '//infileq
939 call stop1()
940 else
941 infileq = jobname(1:ljob)//'.PMX'
942 end if
943 end if
944 c
945 c Open a log file
946 c
947 open(15,file=jobname(1:ljob)//'.pml')
948 call printl('This is PMX, Version '//version//', '//date)
949 ljob4 = ljob
950 call printl('Opening '//infileq)
951 open(18,file=infileq)
952 c
953 c Copy input file into common buffer
954 c
955 ipbuf = 0
956 linewcom(1) = 1
957 do 8 ilbuf = 1 , maxblks
958 ncomments = 0
959 14 read(18,'(a)',end=9)lnholdq
960 lbuf(ilbuf) = lenstr(lnholdq,128)
961 if (lbuf(ilbuf) .eq. 0) then
962 c
963 c Blank line. Make it a single blank with length 1
964 c
965 lbuf(ilbuf) = 1
966 lnholdq = ' '
967 end if
968 c
969 c Now line has at least one non blank character. Check for comment
970 c As of Version 260, do not copy comments into bufq
971 c But need to count %'s for error messaging
972 c if (lnholdq(1:1).eq.'%') go to 14
973 if (lnholdq(1:1).eq.'%') then
974 ncomments = ncomments+1
975 go to 14
976 end if
977 c
978 c When here, have counted all preceding comments and have a real line
979 c
980 if (ilbuf .gt. 1) then
981 linewcom(ilbuf) = linewcom(ilbuf-1)+1+ncomments
982 else
983 linewcom(1) = 1+ncomments
984 end if
985 if (ipbuf+lbuf(ilbuf).gt.131072) then
986 print*,'Too many characters in file, stopping'
987 call stop1()
988 end if
989 bufq(ipbuf+1:ipbuf+lbuf(ilbuf)) = lnholdq
990 ipbuf = ipbuf+lbuf(ilbuf)
991 8 continue
992 call printl('Too many lines in input file')
993 call stop1()
994 9 continue
995 c
996 c Insert dummy line to handle input files w/o CR-LF at end.
997 c
998 nlbuf = ilbuf-1
999 c nlbuf = ilbuf
1000 c bufq(ipbuf+1:ipbuf+3) = ' / '
1001 c lbuf(nlbuf) = 3
1002 close(18)
1003 do 6 numit = 1 , maxit
1004 if (optimize) call printl('Starting an iteration')
1005 c
1006 c When isfirst=.true., pmxa() generates linebreaks normally, output in nbars0.
1007 c Otherwise, nbars0 is the input
1008 c When islast=.false., pmxb only returns poe's, otherwise does whole job
1009 c
1010 call pmxa(jobname,ljob4,isfirst,nsyst,nbars0,optimize)
1011 if (.not.optimize) then
1012 if (ismidi) then
1013 c
1014 c This was moved here from writemidi 130302 to allow midivel,bal,tran, to be
1015 c set up here as functions of instrument rather than iv (staff).
1016 c Count up staves(iv,nv) vs instruments. Store instr# for iv in iinsiv(iv)
1017 c
1018 nstaves = 0
1019 ivt = 0
1020 do 16 iinst = 1 , nm
1021 nstaves = nstaves+nsperi(iinst)
1022 do 17 ivtt = 1 , nsperi(iinst)
1023 ivt = ivt+1
1024 iinsiv(ivt) = iinst
1025 17 continue
1026 if (nstaves .eq. nv) go to 18
1027 16 continue
1028 print*,'Screwup!'
1029 call stop1()
1030 18 continue
1031 c
1032 c Set up channel numbers for midi.
1033 c
1034 numchan = 0
1035 do 11 iv = nv , 1 , -1
1036 if (twoline(iv)) then
1037 midchan(iv,2) = numchan
1038 numchan = numchan+1
1039 end if
1040 midchan(iv,1) = numchan
1041 numchan = numchan+1
1042 11 continue
1043 c
1044 c numchan will now be the number of channels, but max channel # is numchan-1
1045 c
1046 c Set up velocities, balances, and midi-transpositions
1047 c
1048 do 13 iv = nv , 1 , -1
1049 if (twoline(iv)) then
1050 c 130302 Make these functions of instrument rather than staff (iv)
1051 midvelc(midchan(iv,2)) = midivel(iinsiv(iv))
1052 midbc(midchan(iv,2)) = midibal(iinsiv(iv))
1053 midtc(midchan(iv,2)) = miditran(iinsiv(iv))
1054 end if
1055 midvelc(midchan(iv,1)) = midivel(iinsiv(iv))
1056 midbc(midchan(iv,1)) = midibal(iinsiv(iv))
1057 midtc(midchan(iv,1)) = miditran(iinsiv(iv))
1058 13 continue
1059 end if
1060 c
1061 c TEMPORARY!!!
1062 c
1063 write(15,*)'nlbuf: ',nlbuf
1064 ip1 = 1
1065 do 10000 ilb = 1 , nlbuf
1066 ip1 = ip1+lbuf(ilb)
1067 10000 continue
1068 iplast = ip1-1
1069 c
1070 c Check to see if (1) last line is "<blank><blank>/" and (2) next to last
1071 c line is "/"
1072 c
1073 if (bufq(iplast+1-lbuf(nlbuf):iplast) .eq. ' /') then
1074 if(bufq(iplast-lbuf(nlbuf):iplast-lbuf(nlbuf)).eq.chax(47))then
1075 print*,'Removing last line of "<blank><blank>/"'
1076 write(15,*)'Removing last line of "<blank><blank>/"'
1077 nlbuf = nlbuf-1
1078 end if
1079 end if
1080 c
1081 call pmxb(.true.,poe0,ncalls,optimize)
1082 if (ismidi) then
1083 c
1084 c Write midi file
1085 c
1086 open(51,file=jobname(1:ljob)//'.mid')
1087 if (debugmidi) open(52,file=jobname(1:ljob)//'.dbm')
1088 call printl(' ')
1089 call printl('Writing '//jobname(1:ljob)//'.mid')
1090 call writemidi(jobname,ljob)
1091 end if
1092 close(15)
1093 stop
1094 end if
1095 write(15,*)'nlbuf: ',nlbuf
1096 ip1 = 1
1097 call pmxb(.false.,poe0,ncalls,optimize)
1098 call poestats(nsyst,poe0,poebar0,devnorm0)
1099 c
1100 c Save initial deviation and line breaks for later comparison
1101 c
1102 if (numit .eq. 1) then
1103 devpmx = devnorm0
1104 do 20 isys = 1 , nsyst
1105 nbari(isys) = nbars0(isys)
1106 20 continue
1107 end if
1108 call sortpoe(nsyst,poe0,ipoe)
1109 do 1 iupord = nsyst , 1 , -1
1110 isysu = ipoe(iupord)
1111 print*,'isysu=',isysu
1112 write(15,*)'isysu=',isysu
1113 c
1114 c Skip if system isysu has poe0 < avg or isysd has poe0 > avg
1115 c
1116 if (poe0(isysu).lt.poebar0) go to 1
1117 do 5 idnord = 1 , nsyst
1118 isysd = ipoe(idnord)
1119 if (isysu.eq.isysd .or. nbars0(isysd).eq.1
1120 * .or. poe0(isysd).gt.poebar0) go to 5
1121 do 2 isyst = 1 , nsyst
1122 nbars(isyst) = nbars0(isyst)
1123 if (isyst .eq. isysu) then
1124 nbars(isyst) = nbars(isyst)+1
1125 else if (isyst .eq. isysd) then
1126 nbars(isyst) = nbars(isyst)-1
1127 end if
1128 2 continue
1129 call pmxa(jobname,ljob4,isfirst,nsyst,nbars,optimize)
1130 call pmxb(.false.,poe,ncalls,optimize)
1131 call poestats(nsyst,poe,poebar,devnorm)
1132 if (devnorm .lt. devnorm0) then
1133 devnorm0 = devnorm
1134 poebar0 = poebar
1135 do 4 isys = 1 , nsyst
1136 nbars0(isys) = nbars(isys)
1137 poe0(isys) = poe(isys)
1138 4 continue
1139 print*,'Improved with iup,idown,devnorm:',
1140 * isysu,isysd,devnorm0
1141 write(15,*)'Improved with iup,idown,devnorm:',
1142 * isysu,isysd,devnorm0
1143 write(*,'(5x,20i3)')(nbars0(isys),isys=1,nsyst)
1144 write(15,'(5x,20i3)')(nbars0(isys),isys=1,nsyst)
1145 call sortpoe(nsyst,poe0,ipoe)
1146 go to 6
1147 end if
1148 5 continue
1149 1 continue
1150 c
1151 c If we get here, must have gone thru all switches and found nothing better,
1152 c so done!
1153 c
1154 go to 7
1155 6 continue
1156 7 continue
1157 print*,'Optimum located, numit:',numit,', ncalls:',ncalls
1158 write(15,*)'Optimum located, numit:',numit,', ncalls:',ncalls
1159 print*,'Final error:',devnorm0,', initial error:',devpmx
1160 write(15,*)'Final error:',devnorm0,', initial error:',devpmx
1161 print*,'Percentage improvement:',100.*(1-devnorm0/devpmx)
1162 write(15,*)'Percentage improvement:',100.*(1-devnorm0/devpmx)
1163 call printl('Initial bars/system:')
1164 write(*,'(5x,20i3)')(nbari(isys),isys=1,nsyst)
1165 write(15,'(5x,20i3)')(nbari(isys),isys=1,nsyst)
1166 call printl('Final bars/system:')
1167 write(*,'(5x,20i3)')(nbars0(isys),isys=1,nsyst)
1168 write(15,'(5x,20i3)')(nbars0(isys),isys=1,nsyst)
1169 call pmxa(jobname,ljob4,.false.,nsyst,nbars0,optimize)
1170 call pmxb(.true.,poe0,ncalls,optimize)
1171 close(15)
1172 end
1173 subroutine accsym(nacc,acsymq,lacc)
1174 character*3 acsymq
1175 iacc = iand(nacc,7)
1176 if (iacc .eq. 1) then
1177 acsymq = 'fl'
1178 lacc = 2
1179 else if (iacc .eq. 2) then
1180 acsymq = 'sh'
1181 lacc = 2
1182 else if (iacc .eq. 3) then
1183 acsymq = 'na'
1184 lacc = 2
1185 else if (iacc .eq. 5) then
1186 acsymq = 'dfl'
1187 lacc = 3
1188 else if (iacc .eq. 6) then
1189 acsymq = 'dsh'
1190 lacc = 3
1191 else
1192 print*,'bad accidental: ',iacc
1193 end if
1194 return
1195 end
1196 subroutine addask(taskn,waskn,elaskn,
1197 * fixednew,scaldold,tglp1,scfac,isudsp)
1198 parameter (nm=24)
1199 logical isudsp
1200 common /comas1/ naskb,task(40),wask(40),elask(40)
1201 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
1202 common /comtol/ tol
1203 scoarg = scaldold*scfac
1204 if (isudsp) then
1205 c
1206 c Find which udsp we're dealing with
1207 c
1208 do 1 iudsp = 1 , nudsp
1209 if (abs(taskn+tglp1-tudsp(iudsp)) .lt. tol) go to 2
1210 1 continue
1211 print*,'You should note BEEE here in addask!'
1212 call stop1()
1213 2 continue
1214 c
1215 c Fixednew and scaldold must not be changed, since udsp's are already included
1216 c in fsyst from pmxa, and udsp don't involve scaled space..
1217 c
1218 if (naskb.gt.0 .and. abs(taskn-task(max(1,naskb))).lt.tol) then
1219 c
1220 c Must add user-defined space to what's there already.
1221 c
1222 wask(naskb) = wask(naskb)+udsp(iudsp)
1223 else
1224 c
1225 c This place has no other space.
1226 c
1227 naskb = naskb+1
1228 task(naskb) = taskn
1229 wask(naskb) = udsp(iudsp)
1230 elask(naskb) = 0.
1231 end if
1232 else
1233 c 130330 start
1234 oldwask = 0.
1235 oldelask = 0.
1236 c 130330 end
1237 c
1238 c This is a normal space, no effect if smaller than existing space
1239 c
1240 if (naskb.gt.0 .and. abs(taskn-task(max(1,naskb))).lt.tol) then
1241 c
1242 c We already put in some space at this time
1243 c Check if new one needs more space than old one at same time
1244 c
1245 if (waskn .gt. wask(naskb)) then
1246 c
1247 c 130330 We were double counting the larger space when it came 2nd
1248 c Need to fix but don't see how yet. Assume times came in order and
1249 c that last naskb defined spaces that need updating
1250 c
1251 oldwask = wask(naskb)
1252 oldelask = elask(naskb)
1253 c End of 130330 insertions
1254 naskb = naskb-1
1255 else
1256 return
1257 end if
1258 end if
1259 naskb = naskb+1
1260 task(naskb) = taskn
1261 wask(naskb) = waskn
1262 elask(naskb) = elaskn
1263 c 130330 start
1264 c fixednew = fixednew+waskn
1265 c scaldold = scaldold+elaskn
1266 fixednew = fixednew+waskn-oldwask
1267 scaldold = scoarg+elaskn-oldelask
1268 c 130330 end
1269 end if
1270 return
1271 end
1272 subroutine addblank(noteq,lnoten)
1273 character*8 noteq
1274 character*1 tchar
1275 tchar = noteq(1:1)
1276 noteq = ' '//tchar
1277 lnoten = 2
1278 return
1279 end
1280 subroutine addfb(nfb,iv,tnew,t1fb,t2fb,ulfbq,ifbadd)
1281 parameter (nm=24)
1282 integer nfb(nm)
1283 common /comtol/ tol
1284 real*4 t1fb(nm,20),t2fb(nm,20)
1285 character*1 ulfbq(nm,20)
1286 ifbadd = 1
1287 nfb(iv) = nfb(iv)+1
1288 do 1 ifb = nfb(iv)-1 , 1 , -1
1289 if (tnew .lt. t1fb(iv,ifb)-tol) then
1290 t1fb(iv,ifb+1) = t1fb(iv,ifb)
1291 t2fb(iv,ifb+1) = t2fb(iv,ifb)
1292 ulfbq(iv,ifb+1) = ulfbq(iv,ifb)
1293 else
1294 ifbadd = ifb+1
1295 go to 2
1296 end if
1297 1 continue
1298 2 continue
1299 t1fb(iv,ifbadd) = tnew
1300 ulfbq(iv,ifbadd) = 'x'
1301 return
1302 end
1303 subroutine addmidi(icm,nolev,iacc,midisig,time,rest,endrest)
1304 c subroutine addmidi(icm,nolev,iacc,isig,time,rest,endrest)
1305 parameter(nm=24,mv=24576)
1306 integer*2 mmidi,itk(25)
1307 integer*4 itiesav(5,100)
1308 character*1 notenumq
1309 logical endrest,eximacc,it1found
1310 logical rest
1311 logical restpend,relacc,notmain,twoline,ismidi,crdacc
1312 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
1313 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
1314 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
1315 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
1316 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
1317 * debugmidi
1318 logical debugmidi
1319 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
1320 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
1321 integer*2 iinsiv
1322 logical slmon,dbltie
1323 common /comslm/ levson(0:nm),levsoff(0:nm),imidso(0:nm),
1324 * naccbl(0:nm),laccbl(0:nm,10),jaccbl(0:nm,10),nusebl,
1325 * slmon(0:nm),dbltie
1326 common /comevent/ miditime,lasttime
1327 common /comdiag/ n69(0:nm),n34(0:nm)
1328 c common /commidisig/ midisig(nm)
1329 c
1330 c Following variables are local but must be saved. I hope they are.
1331 c (3/18/00) With g77 they are not, so add a common block here.
1332 c
1333 c integer*2 ipslon(0:nm),lusebl(10),jusebl(10),icmm(0:12)
1334 integer*2 ipslon(0:nm),lusebl(10),jusebl(10),icmm(0:15)
1335 common /comips/ ipslon,lusebl,jusebl
1336 c data icmm /0,1,2,3,4,5,6,7,8,10,11,12,13/
1337 data icmm /0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16/
1338 c
1339 c Cancel out barline accidentals if there's a rest.
1340 c
1341 if (rest) naccbl(icm) = 0
1342 c
1343 c Special path to insert dummy rest at end of a section
1344 c
1345 if (endrest) go to 20
1346 c
1347 do 7 ion = 0 , nmidcrd
1348 c
1349 c check if this is only to get pitch of a chord note
1350 c
1351 if (notmain) go to 6
1352 c
1353 c check for rest
1354 c
1355 if (rest) then
1356 c
1357 c Will not put in a note, but must update timing
1358 c
1359 if (.not.restpend(icm)) then
1360 c
1361 c First rest in sequence, save the time
1362 c
1363 restpend(icm) = .true.
1364 trest(icm) = time
1365 else
1366 trest(icm) = trest(icm)+time
1367 end if
1368 c
1369 c Note: code checkers don't like the above due to calling addmidi(trest(icm))
1370 c but this only happens if rest at end of section (endrest=.true.) (called
1371 c from getmidi(), in which case these above lines are bypassed.
1372 c
1373 call chkimidi(icm)
1374 return
1375 end if
1376 c
1377 c time tics
1378 c
1379 if (imidi(icm).gt.0 .and. ion.eq.0) then
1380 idur = mgap
1381 else
1382 idur = 0
1383 end if
1384 if (restpend(icm)) then
1385 restpend(icm) = .false.
1386 idur = idur+nint(15*trest(icm))
1387 end if
1388 c
1389 c time to start of note
1390 c
1391 idurvar = isetvarlen(idur,nby2on)
1392 if (nby2on .gt. 4) then
1393 print*,'You got >4 bytes, something is bogus.'
1394 call stop1()
1395 end if
1396 imidi(icm) = imidi(icm)+1
1397 do 2 i = 1 , nby2on
1398 c
1399 c imidi points to cell before highest (leftmost) byte. Start with lowest byte
1400 c at far right, fill in backwards
1401 c
1402 mmidi(icm,imidi(icm)+nby2on-i) = mod(idurvar,256)
1403 if (nby2on .gt. 1) idurvar = idurvar/256
1404 2 continue
1405 imidi(icm) = imidi(icm)+nby2on-1
1406 c
1407 c Note-on signal
1408 c
1409 imidi(icm) = imidi(icm)+1
1410 mmidi(icm,imidi(icm)) = 9*16+icmm(icm)
1411 c
1412 c Entry point for chord note pitch determination
1413 c
1414 6 continue
1415 c
1416 c Get midi pitch. On chord iteration, only do this first time (main note),
1417 c since pitch was already computed for nonmain chord notes.
1418 c
1419 if (ion .eq. 0) then
1420 ipsav = nolev*12./7+11
1421 ipsav0 = ipsav
1422 if (midisig .ne. 0) then
1423 c
1424 c Adjust for signature
1425 c
1426 notenumq = char(48+mod(nolev,7))
1427 if (midisig.ge.index('4152630',notenumq)) then
1428 ipsav = ipsav+1
1429 else if (-midisig.ge.index('0362514',notenumq)) then
1430 ipsav = ipsav-1
1431 end if
1432 end if
1433 c
1434 c Deal with accidentals.
1435 c
1436 c iacc 0 1 2 3 4 5 6 7
1437 c effect X fl sh na X dfl dsh X
1438 c iashft X -1 1 0 X -2 2 X
1439 c
1440 jacc = 0
1441 eximacc = .false.
1442 if (iacc .gt. 0) then
1443 c
1444 c Adjust key-sig-adjusted pitch for explicit accidental (and exit)
1445 c
1446 jacc = iashft(iacc)
1447 eximacc = .true.
1448 if (.not.relacc) jacc = jacc+ipsav0-ipsav
1449 c
1450 c (Above) Shift applies to diatonic pitch but will be added to adjusted one
1451 c
1452 else if (naccim(icm) .gt. 0) then
1453 c
1454 c Possible implicit accidental from earlier in the bar
1455 c Check for prior accid in this bar at this note level
1456 c
1457 do 3 kacc = 1 , naccim(icm)
1458 if (laccim(icm,kacc) .eq. nolev) then
1459 jacc = jaccim(icm,kacc)
1460 eximacc = .true.
1461 if (.not.relacc) jacc = jacc+ipsav0-ipsav
1462 go to 4
1463 end if
1464 3 continue
1465 4 continue
1466 end if
1467 c
1468 c Must split off the following if block from those above because chord
1469 c notes can cause naccim>0, forcing us to miss other chord note's
1470 c accross-bar-line accidental
1471 c
1472 if (naccbl(icm).gt.0 .and. .not.eximacc) then
1473 c
1474 c Possible carryover accid from prior bar (or prior same-pitch note).
1475 c
1476 do 21 kacc = 1 , naccbl(icm)
1477 if (laccbl(icm,kacc) .eq. nolev) then
1478 jacc = jaccbl(icm,kacc)
1479 c
1480 c Since we are *using* the bar-line accid, must flag it to be saved for next.
1481 c
1482 nusebl = nusebl+1
1483 jusebl(nusebl) = jacc
1484 lusebl(nusebl) = nolev
1485 if (.not.relacc) jacc = jacc+ipsav0-ipsav
1486 go to 22
1487 end if
1488 21 continue
1489 22 continue
1490 end if
1491 ipsav = ipsav+jacc
1492 end if
1493 if (notmain) then
1494 mcpitch(nmidcrd) = ipsav
1495 c
1496 c Save pitch for tie checks
1497 c
1498 if (levson(icm).eq.nolev.and..not.slmon(icm))
1499 * ipslon(icm) = ipsav
1500 else
1501 imidi(icm) = imidi(icm)+1
1502 if (ion.eq.0) then
1503 mmidi(icm,imidi(icm)) = ipsav
1504 if (levson(icm).eq.nolev.and..not.slmon(icm))
1505 * ipslon(icm) = ipsav
1506 else
1507 mmidi(icm,imidi(icm)) = mcpitch(ion)
1508 end if
1509 end if
1510 if (ion .eq. 0) then
1511 c
1512 c Only record accids for non-chords, main chord note during chord iteration
1513 c and chordnotes on first call but not during iteration
1514 c
1515 if (iacc.gt.0) then
1516 c
1517 c Set marker for accidental for possible continuations later this bar
1518 c but first check and clear earlier ones on same note.
1519 c
1520 do 23 kacc = 1 , naccim(icm)
1521 if (laccim(icm,kacc) .eq. nolev) then
1522 do 24 macc = kacc , naccim(icm)-1
1523 laccim(icm,macc) = laccim(icm,macc+1)
1524 jaccim(icm,macc) = jaccim(icm,macc+1)
1525 24 continue
1526 go to 25
1527 end if
1528 23 continue
1529 go to 26
1530 25 continue
1531 naccim(icm) = naccim(icm)-1
1532 26 continue
1533 c
1534 c Flag new accidental
1535 c
1536 naccim(icm) = naccim(icm)+1
1537 laccim(icm,naccim(icm)) = nolev
1538 jaccim(icm,naccim(icm)) = iashft(iacc)
1539 end if
1540 c
1541 c Bail if this is a chord note on the first call (from docrd)
1542 c
1543 if (notmain) then
1544 call chkimidi(icm)
1545 return
1546 end if
1547 end if
1548 c
1549 c Vel
1550 c
1551 imidi(icm) = imidi(icm)+1
1552 mmidi(icm,imidi(icm)) = midvelc(icm)
1553 call chkimidi(icm)
1554 7 continue
1555 c
1556 c For tie checks
1557 c
1558 if (levson(icm).gt.0.and..not.slmon(icm)) imidso(icm) = imidi(icm)
1559 c
1560 c Entry point for special rests at section ends (endrest=T)
1561 c
1562 20 continue
1563 c
1564 c Now insert all the ends
1565 c
1566 do 8 ioff = 0 , nmidcrd
1567 if (ioff .eq. 0) then
1568 c
1569 c time to end
1570 c
1571 idur1 = nint(15*time)
1572 if (.not.endrest .or. miditime.eq.nint(15*trest(icm))) then
1573 idur = idur1-mgap
1574 else
1575 idur = idur1
1576 end if
1577 c
1578 c Deal with roundoff problems with 7-tuplets on half or quarters
1579 c
1580 if (idur1 .eq. 69) then
1581 n69(icm) = n69(icm)+1
1582 c if (mod(n69(icm)+6,7) .gt. 3) idur = 58
1583 if (mod(n69(icm)+6,7) .gt. 3) idur = idur1-mgap-1
1584 else if (idur1 .eq. 34) then
1585 n34(icm) = n34(icm)+1
1586 if (mod(n34(icm)+6,7) .gt. 4) idur = idur1-mgap+1
1587 end if
1588 idurvar = isetvarlen(idur,nby2off)
1589 if (nby2off .gt. 4) then
1590 print*,'You got >4 bytes, something is bogus.'
1591 call stop1()
1592 end if
1593 imidi(icm) = imidi(icm)+1
1594 call chkimidi(icm)
1595 do 1 i = 1 , nby2off
1596 mmidi(icm,imidi(icm)+nby2off-i) = mod(idurvar,256)
1597 if (nby2off .gt. 1) idurvar = idurvar/256
1598 1 continue
1599 imidi(icm) = imidi(icm)+nby2off-1
1600 else
1601 c
1602 c Inserting end of chord note, delta time is 0
1603 c
1604 imidi(icm) = imidi(icm)+1
1605 mmidi(icm,imidi(icm)) = 0
1606 end if
1607 c
1608 c Note off
1609 c
1610 imidi(icm) = imidi(icm)+1
1611 mmidi(icm,imidi(icm)) = 8*16+icmm(icm)
1612 c
1613 c Pitch
1614 c
1615 imidi(icm) = imidi(icm)+1
1616 if (ioff .eq. 0) then
1617 mmidi(icm,imidi(icm)) = ipsav
1618 else
1619 mmidi(icm,imidi(icm)) = mcpitch(ioff)
1620 end if
1621 c
1622 c Vel
1623 c
1624 imidi(icm) = imidi(icm)+1
1625 mmidi(icm,imidi(icm)) = 0
1626 call chkimidi(icm)
1627 if (endrest) then
1628 return
1629 end if
1630 8 continue
1631 naccbl(icm) = nusebl
1632 if (nusebl .gt. 0) then
1633 c
1634 c Fix tables of "bar-line" accids that are saved due to consecutive notes.
1635 c
1636 do 30 kacc = 1 , nusebl
1637 laccbl(icm,kacc) = lusebl(kacc)
1638 jaccbl(icm,kacc) = jusebl(kacc)
1639 30 continue
1640 nusebl = 0
1641 end if
1642 c
1643 c Begin tie checks
1644 c
1645 if (slmon(icm)) then
1646 c
1647 c Prior note had a slur start
1648 c
1649 if (levson(icm).eq.levsoff(icm) .and. iacc.eq.0) then
1650 c
1651 c We have a tie! (Assumed there would be no accidental on tie-ending note)
1652 c Make a list of times of all events back to the one starting at imidso+1,
1653 c which is at or before where the tie started. Ident tie start and stop by
1654 c comparing pitches. Save the 4 pieces of data in itiesav(1...4,nsav4tie)
1655 c Store actual time in itiesav(5,nsav4tie), using itiesav(1,1) as initial
1656 c time.
1657 nsav4tie = 0
1658 imidt = imidso(icm)
1659 10 nsav4tie = nsav4tie+1
1660 itiesav(1,nsav4tie) = igetvarlen(mmidi,icm,imidt,nbytes)
1661 imidt = imidt+nbytes
1662 do 11 j = 1 , 3
1663 itiesav(j+1,nsav4tie) = mmidi(icm,imidt+j)
1664 11 continue
1665 imidt = imidt+3
1666 if (nsav4tie .eq. 1) then
1667 itiesav(5,1) = itiesav(1,1)
1668 else
1669 itiesav(5,nsav4tie) = itiesav(1,nsav4tie)+
1670 * itiesav(5,nsav4tie-1)
1671 end if
1672 if (imidt .ne. imidi(icm)) go to 10
1673 c
1674 c Find which two pitches agree with saved slur pitch.
1675 c
1676 it1found = .false.
1677 do 12 it2 = 1 , nsav4tie
1678 if (itiesav(3,it2) .eq. ipslon(icm)) then
1679 if (it1found) go to 13
1680 it1 = it2
1681 it1found = .true.
1682 end if
1683 12 continue
1684 call printl(
1685 * 'Program error, tied notes, send source to Dr. Don')
1686 it1 = nsav4tie+1
1687 it2 = nsav4tie+1
1688 13 continue
1689 c
1690 c List the positions we want to keep
1691 c
1692 jsav = 0
1693 do 14 isav = 1 , nsav4tie
1694 if (isav.eq.it1 .or. isav.eq.it2) go to 14
1695 jsav = jsav+1
1696 itk(jsav) = isav
1697 14 continue
1698 nsav4tie = nsav4tie-2
1699 c
1700 c Now dump events it1 & it2, recompute times, restack mmidi.
1701 c
1702 imidi(icm) = imidso(icm)
1703 do 15 isav = 1 ,nsav4tie
1704 if (isav .eq. 1) then
1705 idurvar = isetvarlen(itiesav(5,itk(isav)),nbytes)
1706 else
1707 idurvar = isetvarlen(itiesav(5,itk(isav))-
1708 * itiesav(5,itk(isav-1)),nbytes)
1709 end if
1710 imidi(icm) = imidi(icm)+1
1711 do 16 i = 1 , nbytes
1712 mmidi(icm,imidi(icm)+nbytes-i) = mod(idurvar,256)
1713 if (nbytes .gt. 1) idurvar = idurvar/256
1714 16 continue
1715 imidi(icm) = imidi(icm)+nbytes-1
1716 do 17 i = 2 , 4
1717 imidi(icm) = imidi(icm)+1
1718 mmidi(icm,imidi(icm)) = itiesav(i,itk(isav))
1719 17 continue
1720 15 continue
1721 end if
1722 slmon(icm) = .false.
1723 levsoff(icm) = 0
1724 if (.not.dbltie) levson(icm) = 0
1725 end if
1726 if (levson(icm).gt.0) slmon(icm) = .true.
1727 if (nmidcrd .gt. 0) nmidcrd = 0
1728 call chkimidi(icm)
1729 return
1730 end
1731 subroutine addstr(notexq,lnote,soutq,lsout)
1732 common /comlast/ islast,usevshrink
1733 logical islast,usevshrink
1734 character*(*) notexq
1735 character*80 soutq
1736 if (lsout+lnote .gt. 72) then
1737 if (islast) write(11,'(a)')soutq(1:lsout)//'%'
1738 lsout = 0
1739 end if
1740 if (lsout .gt. 0) then
1741 soutq = soutq(1:lsout)//notexq(1:lnote)
1742 else
1743 soutq = notexq(1:lnote)
1744 end if
1745 lsout = lsout+lnote
1746 return
1747 end
1748 subroutine adjusteskz(ib,istart,poenom)
1749 c
1750 c For block ib, this adds accidental spaces to eskz, for use in getting
1751 c length of xtup bracket and slopes of brackets and beams.
1752 c
1753 parameter (nm=24)
1754 common /comas1/ naskb,task(40),wask(40),elask(40)
1755 integer*4 istart(80)
1756 common /comnsp/ space(80),nb,prevtn(nm),
1757 * flgndv(nm),flgndb,eskgnd,ptsgnd,ivmxsav(nm,2),nvmxsav(nm)
1758 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
1759 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
1760 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
1761 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
1762 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
1763 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
1764 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
1765 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
1766 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
1767 character*1 ulq,sepsymq,sq
1768 logical beamon,firstgulp,figbass,figchk,isfig
1769 common /comeskz2/ eskz2(nm,200)
1770 common /comtol/ tol
1771 common /comntot/ ntot
1772 inmin = istart(ib)+1
1773 do 10 iaskb = 1 , naskb
1774 if (task(iaskb) .lt. to(istart(ib))-tol) go to 10
1775 eskadd = wask(iaskb)/poenom-elask(iaskb)
1776 do 11 in = inmin , ntot
1777 if (to(in) .gt. task(iaskb)-tol) then
1778 eskz2(ivxo(in),ipo(in)) = eskz2(ivxo(in),ipo(in))+eskadd
1779 if (abs(to(in)-task(iaskb)).lt. tol) inmin=inmin-1
1780 else
1781 inmin = inmin+1
1782 end if
1783 11 continue
1784 10 continue
1785 return
1786 end
1787 subroutine askfig(pathnameq,lpath,basenameq,lbase,figbass,istype0)
1788 logical figbass,ispoi,topmods,istype0,done,isbbm
1789 common /comhsp/ hpttot(176)
1790 common /compoi/ ispoi
1791 common /combbm/ isbbm
1792 common /comas3/ ask(2500),iask,topmods
1793 character*40 pathnameq
1794 character*44 basenameq
1795 character*1 sq,chax
1796 character*129 outq
1797 sq = chax(92)
1798 open(12,file=pathnameq(1:lpath)//basenameq(1:lbase)//'.tex')
1799 c
1800 c Transfer first 5 lines of main internal TeX file
1801 c
1802 do 11 il = 1 , 5
1803 call moveln(11,12,done)
1804 11 continue
1805 if (istype0) then
1806 c
1807 c Transfer literal TeX stuff from special scratch file
1808 c
1809 rewind(17)
1810 10 call moveln(17,12,done)
1811 if (.not.done) go to 10
1812 close(17)
1813 end if
1814 c
1815 c Transfer next 2 lines from main scratch file
1816 c
1817 do 3 il = 1 , 2
1818 call moveln(11,12,done)
1819 3 continue
1820 if (ispoi) write(12,'(a)')sq//'input musixpoi'
1821 if (isbbm) write(12,'(a)')sq//'input musixbbm'
1822 if (figbass) then
1823 c
1824 c Transfer .fig data from scratch (unit 14) into external .tex (unit 12)
1825 c
1826 4 call moveln(14,12,done)
1827 if (.not.done) go to 4
1828 close(14)
1829 end if
1830 iask = 0
1831 ihs = 0
1832 1 read(11,'(a129)',end=999)outq
1833 c
1834 c Hardspaces.
1835 c
1836 if (outq(1:5) .eq. sq//'xard') then
1837 ihs = ihs+1
1838 outq(2:2) = 'h'
1839 write(outq(12:15),'(f4.1)')hpttot(ihs)
1840 lenout = 19
1841 go to 9
1842 end if
1843 c
1844 c This part hard-wires ask's into new .tex file as ast's
1845 c
1846 2 indxask = index(outq,sq//'ask')
1847 if (indxask .ne. 0) then
1848 iask = iask+1
1849 call putast(ask(iask),indxask,outq)
1850 go to 2
1851 end if
1852 lenout = llen(outq,129)
1853 9 continue
1854 write(12,'(a)')outq(1:lenout)
1855 c
1856 c If this is the line with "readmod", check for topmods.
1857 c
1858 if (topmods .and. outq(2:8).eq.'readmod') then
1859 topmods = .false.
1860 rewind(16)
1861 do 7 il = 1 , 1000
1862 read(16,'(a129)',end=8)outq
1863 lenout = llen(outq,129)
1864 c
1865 c We inserted the '%' in subroutine littex, to guarantee including blank.
1866 c
1867 write(12,'(a)')outq(1:lenout)
1868 7 continue
1869 8 continue
1870 close(16)
1871 end if
1872 go to 1
1873 999 close(11)
1874 close(12)
1875 return
1876 end
1877 subroutine backfill(iunit,oldq,lenold,newq,lennew)
1878 c
1879 c In iunit, looks backward for oldq, overwrites newq
1880 c Safest if both are same length!
1881 c
1882 character*128 lineq(200),nowq
1883 character*(*) oldq,newq
1884 linesback = 0
1885 1 continue
1886 backspace(iunit)
1887 read(iunit,'(a)')nowq
1888 ndx = index(nowq,oldq(1:lenold))
1889 c
1890 c Save the line just read
1891 c
1892 linesback = linesback+1
1893 lineq(linesback) = nowq
1894 if (ndx .eq. 0) then
1895 backspace(iunit)
1896 go to 1
1897 end if
1898 c
1899 c If here, it's replacement time.
1900 c
1901 lineq(linesback) = nowq(1:ndx-1)//newq(1:lennew)
1902 * //nowq(ndx+lenold:128)
1903 backspace(iunit)
1904 do 2 line = linesback , 1 , -1
1905 write(iunit,'(a128)')lineq(line)
1906 2 continue
1907 return
1908 end
1909 subroutine beamend(notexq,lnote)
1910 parameter (nm=24)
1911 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
1912 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
1913 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
1914 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
1915 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
1916 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
1917 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
1918 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
1919 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
1920 character*1 ulq,sepsymq,sq,ulqq,chax
1921 logical beamon,firstgulp,figbass,figchk,flipend,btest,
1922 * isfig,vxtup,isdotm,isbjmp,isbj2,drawbm
1923 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
1924 common /comoct/ noctup
1925 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
1926 * mtupv(nm,9),nxtinbm(nm),
1927 * islope(nm),xelsk(24),eloff(nm,9),
1928 * nssb(nm),issb(nm),lev1ssb(nm,20)
1929 common /comdraw/ drawbm(nm)
1930 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
1931 common /strtmid/ ihnum3,flipend(nm),ixrest(nm)
1932 character*4 tempq
1933 character*8 noteq
1934 character*79 notexq
1935 ip = ipo(jn)
1936 multip = iand(mult(ivx,ip),15)-8
1937 lnote = 0
1938 if (ixrest(ivx) .eq. 4) then
1939 c
1940 c This is the LAST note in the xtup (i.e., all rests before). Make single.
1941 c
1942 nodur(ivx,ip) = 2**(4-multip)
1943 call notex(notexq,lnote)
1944 ixrest(ivx) = 0
1945 return
1946 end if
1947 nole = nolev(ivx,ip)
1948 c
1949 c Check for special situations with 2nds (see precrd)
1950 c
1951 if (btest(nacc(ivx,ip),30)) then
1952 nole = nole - 1
1953 else if (btest(nacc(ivx,ip),31)) then
1954 nole = nole + 1
1955 end if
1956 c
1957 c Terminate indented beams for 2-note tremolo if needed
1958 c
1959 if (btest(irest(ivx,ip-1),2) .and.
1960 * igetbits(irest(ivx,ip-1),2,5) .gt. 0) then
1961 nindent = igetbits(irest(ivx,ip-1),2,5)
1962 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
1963 addoff = -1-.5*nindent
1964 else
1965 addoff = 1+.5*nindent
1966 endif
1967 c addoff = addoff+(.595-.065*abs(islope(ivx)))*islope(ivx)
1968 addoff = addoff+.0822*islope(ivx)
1969 if (addoff .lt. -.05) then
1970 write(tempq,'(f4.1)')addoff
1971 else
1972 write(tempq,'(f4.2)')addoff
1973 end if
1974 notexq = sq//'raise'//tempq(1:4)//sq//'internote'//sq//'hbox{'
1975 * //sq//'loffset{.7}{'//sq//'tb'//ulq(ivx,ibmcnt(ivx))//
1976 * '0}}'
1977 lnote = 46
1978 end if
1979 if (.not.drawbm(ivx)) then
1980 c
1981 c Xtuplet with no beam, just put in the right kind of note
1982 c
1983 if (btest(irest(ivx,ip),0)) then
1984 c
1985 c Rest at end of unbeamed xtup
1986 c
1987 lnote = 3
1988 if (btest(islur(ivx,ip),29)) then
1989 notexq = sq//'sk'
1990 c
1991 c 180106 There was a problem with nolev(ivx,ip) not being set to 0 for
1992 c a blank rest ending xtup, but hopefully returning from here will handle it.
1993 c
1994 return
1995 else if (multip .eq. 0) then
1996 notexq = sq//'qp'
1997 else if (multip .eq. -1) then
1998 notexq = sq//'hp'
1999 else if (multip .eq. 1) then
2000 notexq = sq//'ds'
2001 else if (multip .eq. 2) then
2002 notexq = sq//'qs'
2003 else
2004 notexq = sq//'hs'
2005 end if
2006 c
2007 c 180106 Deal with possible level tweak
2008 c
2009 nole = mod(nolev(ivx,ip)+50,100)-50
2010 if (nole .ne. 0) then
2011 if (abs(nole) .lt. 10) then
2012 noteq = chax(48+abs(nole))
2013 lnoten = 1
2014 else
2015 write(noteq(1:2),'(i2)')abs(nole)
2016 lnoten = 2
2017 end if
2018 if (nole .gt. 0) then
2019 notexq = sq//'raise'//noteq(1:lnoten)//sq//'internote'
2020 * //notexq(1:lnote)
2021 else
2022 notexq = sq//'lower'//noteq(1:lnoten)//sq//'internote'
2023 * //notexq(1:lnote)
2024 end if
2025 lnote = 16+lnoten+lnote
2026 end if
2027 return
2028 end if
2029 if (btest(islur(ivx,ip),30)) then
2030 c
2031 c Forced stem direction
2032 c
2033 ndsav = nodur(ivx,ip)
2034 nodur(ivx,ip) = 2**(4-multip)
2035 if (btest(nacc(ivx,ip-1),27))
2036 * nodur(ivx,ip)=nodur(ivx,ip)/2
2037 call notex(notexq,lnote)
2038 nodur(ivx,ip) = ndsav
2039 else
2040 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2041 if (lnoten .eq. 1) call addblank(noteq,lnoten)
2042 c
2043 c To reduce confusion due to this early update of lnote, do it
2044 c below, separately in each case/
2045 c lnote = lnoten+3
2046 if (.not.btest(nacc(ivx,ip-1),27)) then
2047 c
2048 c Prior note is not regular-dotted
2049 c
2050 if (btest(irest(ivx,ip-1),2) .and.
2051 * igetbits(irest(ivx,ip-1),2,5) .gt. 0) then
2052 c
2053 c Unbeamed tremolo with indented beams. Put termination in right here
2054 c
2055 nindent = igetbits(irest(ivx,ip-1),2,5)
2056 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
2057 addoff = -1-.5*nindent
2058 else
2059 addoff = 1+.5*nindent
2060 endif
2061 c
2062 c Is there an islope here, for unbeamed?
2063 c
2064 if (addoff .lt. -.05) then
2065 write(tempq,'(f4.1)')addoff
2066 else
2067 write(tempq,'(f4.2)')addoff
2068 end if
2069 notexq = sq//'raise'//tempq(1:4)//sq//'internote'//sq//
2070 * 'hbox{'
2071 * //sq//'loffset{.7}{'//sq//'tb'//ulq(ivx,ibmcnt(ivx))//
2072 * '0}}'
2073 lnote = 46
2074 end if
2075 if (multip .eq. 0) then
2076 if (btest(irest(ivx,ip-1),2) .and.
2077 * nodur(ivx,ip).gt.24) then
2078 c
2079 c 2nd note of unbeamed half-note trem; make open
2080 c But it's not clear if unbeamed half-note tremolo is Kosher,
2081 c so don't worry about stem lengths here now.
2082 c
2083 if (lnote .eq. 0) then
2084 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))//noteq
2085 else
2086 notexq = notexq(1:46)//
2087 * sq//'h'//ulq(ivx,ibmcnt(ivx))//noteq
2088 lnote = 46
2089 end if
2090 else
2091 if (btest(irest(ivx,ip-1),2) .and.
2092 * nodur(ivx,ip).eq.24 .or. nodur(ivx,ip).eq.12) then
2093 c
2094 c Need a dot.
2095 c
2096 lnote = 46
2097 if (lnoten .eq. 1) then
2098 noteq = ' '//noteq(1:1)
2099 lnoten = 2
2100 end if
2101 c
2102 c Insert stemlength stuff here for unbeamed dotted tremolo.
2103 c May later combine with below to avoid repeat. But need to
2104 c return to normal stem length after note is set.
2105 c
2106 nindent = igetbits(irest(ivx,ip-1),2,5)
2107 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
2108 slen = (4.5+nindent+nolev1(ivx)-nole
2109 * +1.3*(eskz(ivx,ip)-eskz(ivx,ip-1)-.7)
2110 * *islope(ivx)/slfac)*.6667
2111 else
2112 slen = (4.5+nindent-nolev1(ivx)+nole
2113 * -1.3*(eskz(ivx,ip)-eskz(ivx,ip-1)-.7)
2114 * *islope(ivx)/slfac)*.6667
2115 end if
2116 write(tempq,'(f4.1)')slen
2117 notexq = sq//'slx{'//tempq//'}'//notexq(1:lnote)
2118 lnote = lnote+10
2119 end if
2120 c
2121 c Next steps are a historical kluge to distinguish dotted unbeamed 2-note trem
2122 c (needs \qup) from normal xtup on dotted note (eg e44dx2 f, wants no dot)
2123 c
2124 if (btest(irest(ivx,ip-1),2)) then
2125 if (lnote .eq. 0) then
2126 c notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))
2127 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))//'p'
2128 * //noteq(1:lnoten)
2129 else
2130 notexq = notexq(1:lnote)//sq//'q'
2131 c * //ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2132 * //ulq(ivx,ibmcnt(ivx))//'p'//noteq(1:lnoten)
2133 end if
2134 c lnote = lnote+3+lnoten
2135 lnote = lnote+4+lnoten
2136 else
2137 if (lnote .eq. 0) then
2138 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))
2139 * //noteq(1:lnoten)
2140 else
2141 notexq = notexq(1:lnote)//sq//'q'
2142 * //ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2143 end if
2144 lnote = lnote+3+lnoten
2145 end if
2146 if (btest(irest(ivx,ip-1),2) .and.
2147 * nodur(ivx,ip).eq.24 .or. nodur(ivx,ip).eq.12) then
2148 notexq = notexq(1:lnote)//sq//'slz'
2149 lnote=lnote+4
2150 end if
2151 end if
2152 else if (btest(irest(ivx,ip-1),2)) then
2153 c
2154 c 2nd note of unbeamed quarter or 8th trem; make quarter note
2155 c Get stemlength change
2156 c
2157 lnote = 46
2158 nindent = igetbits(irest(ivx,ip-1),2,5)
2159 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
2160 slen = (4.5+nindent+nolev1(ivx)-nole
2161 * +1.3*(eskz(ivx,ip)-eskz(ivx,ip-1)-.7)
2162 * *islope(ivx)/slfac)*.6667
2163 else
2164 slen = (4.5+nindent-nolev1(ivx)+nole
2165 * -1.3*(eskz(ivx,ip)-eskz(ivx,ip-1)-.7)
2166 * *islope(ivx)/slfac)*.6667
2167 end if
2168 write(tempq,'(f4.1)')slen
2169 notexq = notexq(1:46)//sq//'slx{'//tempq//'}'
2170 lnote = lnote+10
2171 c
2172 c Check for dotted unbeamed tremolo
2173 c
2174 if (abs(nodur(ivx,ip)/12.-nodur(ivx,ip)/12).lt..001) then
2175 c
2176 c Need a dot
2177 c
2178 if (lnoten .eq. 1) then
2179 noteq = ' '//noteq(1:1)
2180 lnoten = 2
2181 end if
2182 if (lnote .eq. 0) then
2183 notexq = sq//'pt'//noteq(1:lnoten)
2184 else
2185 notexq = notexq(1:lnote)//sq//'pt'//noteq(1:lnoten)
2186 end if
2187 lnote = lnote+3+lnoten
2188 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2189 if (lnoten .eq. 1) then
2190 noteq = ' '//noteq(1:1)
2191 lnoten = 2
2192 end if
2193 end if
2194 notexq = notexq(1:lnote)//
2195 * sq//'q'//ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2196 c * //sq//'stemcut'
2197 * //sq//'slz'
2198 c lnote=lnote+3+lnoten+8
2199 lnote=lnote+3+lnoten+4
2200 else if (multip .eq. -1) then
2201 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2202 lnote = lnoten+3
2203 else if (multip .eq. 1) then
2204 notexq = sq//'c'//ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2205 lnote = lnoten+3
2206 else if (multip .eq. 2) then
2207 notexq = sq//'cc'//ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2208 lnote = lnoten+4
2209 else if (multip .eq. 3) then
2210 notexq = sq//'ccc'//ulq(ivx,ibmcnt(ivx))//noteq(1:lnoten)
2211 lnote = lnoten+5
2212 else if (multip .eq. -2) then
2213 notexq = sq//'wh'//noteq(1:lnoten)
2214 lnote = lnoten+3
2215 else if (multip .eq. -3) then
2216 notexq = sq//'breve'//noteq(1:lnoten)
2217 lnote = lnoten+6
2218 else
2219 print*
2220 print*,'(Error in beamend, send source to Dr. Don)'
2221 call stop1()
2222 end if
2223 else
2224 c
2225 c Prior note is regular-dotted so this one is halved
2226 c
2227 lnote = lnoten+3
2228 if (multip .eq. 0) then
2229 notexq = sq//'c'//ulq(ivx,ibmcnt(ivx))//noteq
2230 else if (multip .eq. -1) then
2231 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))//noteq
2232 else if (multip .eq. -2) then
2233 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))//noteq
2234 else if (multip .eq. 1) then
2235 notexq = sq//'cc'//ulq(ivx,ibmcnt(ivx))//noteq
2236 lnote = lnoten+4
2237 else if (multip .eq. 2) then
2238 notexq = sq//'ccc'//ulq(ivx,ibmcnt(ivx))//noteq
2239 lnote = lnoten+5
2240 end if
2241 end if
2242 end if
2243 return
2244 end if
2245 c
2246 c End of block for unbeamed. Problem if beamed but ends w/ rest. Try just
2247 c skipping the call in that case.
2248 c
2249 if (.not.btest(irest(ivx,ip),0)) then
2250 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2251 end if
2252 c call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2253 c lnote = 0
2254 c
2255 c New way, with flipend, which was computed in beamstrt.
2256 c
2257 if (flipend(ivx) .and. btest(ipl(ivx,ip),30)) then
2258 ulq(ivx,ibmcnt(ivx)) = chax(225-ichar(ulq(ivx,ibmcnt(ivx))))
2259 flipend(ivx) = .false.
2260 end if
2261 if (ip .gt. ibm1(ivx,ibmcnt(ivx))) then
2262 c
2263 c This is not a one-noter from beam-jump. Check if multiplicity has increased
2264 c
2265 if (btest(irest(ivx,ip-1),0)) then
2266 c
2267 c Prior note is a rest, check one before that
2268 c
2269 mp = iand(mult(ivx,ip-2),15)-8
2270 else
2271 mp = iand(mult(ivx,ip-1),15)-8
2272 end if
2273 if (multip .gt. mp) then
2274 c
2275 c Assume 1-3, 2-3, or 1-2
2276 c
2277 do 2 imp = multip , mp+1 , -1
2278 call ntrbbb(imp,'t',ulq(ivx,ibmcnt(ivx)),ivx,notexq,lnote)
2279 2 continue
2280 else if (btest(nacc(ivx,ip-1),27)) then
2281 c
2282 c 2nd member of dotted xtup
2283 c
2284 call ntrbbb(multip+1,'t',
2285 * ulq(ivx,ibmcnt(ivx)),ivx,notexq,lnote)
2286 end if
2287 end if
2288 c
2289 c Beam termination and direction analysis
2290 c
2291 if (btest(irest(ivx,ip),23) .and. .not.isbjmp) then
2292 c
2293 c This is the end of the first segment in a jump-beam. ivbj1=ivx will be number
2294 c of the jump-beam. ivbj2 will be tested along with isbjmp to see if in the
2295 c voice of the 2nd part of jumped beam. (May need special treatment for
2296 c multi-segment jump-beams
2297 c
2298 isbjmp = .true.
2299 ivbj1 = ivx
2300 multbj1 = iand(15,mult(ivx,ip)-8)
2301 ivbj2 = 0
2302 end if
2303 if (.not.btest(irest(ivx,ip),23)) then
2304 c
2305 c This is either a normal beamend or end of a sequence of jump-beam segments,
2306 c (170409) or rest at end of xtup
2307 c so some sort of termination is required
2308 c
2309 ulqq = ulq(ivx,ibmcnt(ivx))
2310 if (.not.isbjmp .or. ivx.ne.ivbj2) then
2311 if (btest(irest(ivx,ip),0)) then
2312 c
2313 c Xtup ends with rest
2314 c
2315 if (multip .eq. 1) then
2316 notexq = sq//'ds'
2317 lnote = 3
2318 else if (multip .eq. 2) then
2319 notexq = sq//'qs'
2320 lnote = 3
2321 else if (multip .eq. 3) then
2322 notexq = sq//'hs'
2323 lnote = 3
2324 end if
2325 c
2326 c 170801 Borrowed from main rest entry way down below to get level adjustment:
2327 c BUT nole is like 102, not 2, so subtracted 100 for nole. Why different???
2328 c "... Now raise if necc."
2329 c
2330 if (btest(islur(ivx,ip),29)) then
2331 c
2332 c Blank rest
2333 c
2334 notexq = sq//'sk'
2335 lnote = 3
2336 else if (nole .ne. 0) then
2337 c
2338 c Bandaid. Odd case with rests in xtups + 2 voices where came thru here with
2339 c nolev=-4 but expected 100+/-. Try to fix.
2340 c
2341 if (abs(nole).lt.30) nole = 100+nole
2342 c
2343 if (abs(nole-100) .lt. 10) then
2344 noteq = chax(48+abs(nole-100))
2345 lnoten = 1
2346 else
2347 write(noteq(1:2),'(i2)')abs(nole-100)
2348 lnoten = 2
2349 end if
2350 c ??? if (nole .gt. 0) then
2351 if (nole .gt. 100) then
2352 notexq = sq//'raise'//noteq(1:lnoten)//sq//'internote'
2353 * //notexq(1:lnote)
2354 else
2355 notexq = sq//'lower'//noteq(1:lnoten)//sq//'internote'
2356 * //notexq(1:lnote)
2357 end if
2358 lnote = 16+lnoten+lnote
2359 end if
2360 return
2361 else
2362 c
2363 c Normal termination
2364 c
2365 call ntrbbb(1,'t',ulqq,mod(ivx,24),notexq,lnote)
2366 end if
2367 else
2368 c
2369 c Terminate a sequence of jump-beam segments.
2370 c
2371 ulqq = chax(225-ichar(ulqq))
2372 call ntrbbb(1,'t',ulqq,mod(ivbj1,24),notexq,lnote)
2373 end if
2374 end if
2375 c
2376 c Check for end of 2nd seg of staff-jump xtup chord blank rest
2377 c
2378 c if (isbjmp.and.ivx.eq.ivbj2
2379 if (isbjmp
2380 * .and.btest(islur(ivx,ip),29)) then
2381 notexq = notexq(1:lnote)//sq//'sk'
2382 return
2383 end if
2384 c
2385 c And now the note, checking for open-head beamed tremolo
2386 c
2387 if (btest(irest(ivx,ip-1),2)) then
2388 c
2389 c Check for dotted tremolo
2390 c
2391 if (abs(nodur(ivx,ip)/12.-nodur(ivx,ip)/12).lt..001) then
2392 c
2393 c Need a dot
2394 c
2395 if (nodur(ivx,ip).eq.24 .or. nodur(ivx,ip).eq.12) then
2396 c
2397 c Solid notehead
2398 c
2399 notexq = notexq(1:lnote)//sq//'qbp'
2400 else
2401 c
2402 c Assuming open notehead and nodur = 48
2403 c
2404 notexq = notexq(1:lnote)//sq//'hbp'
2405 end if
2406 lnote = lnote+4
2407 else
2408 if (nodur(ivx,ip).eq.32 .or. nodur(ivx,ip).eq.48) then
2409 if (lnote .gt. 0) then
2410 notexq = notexq(1:lnote)//sq//'hb'
2411 else
2412 notexq = sq//'hb'
2413 end if
2414 else
2415 if (lnote .gt. 0) then
2416 notexq = notexq(1:lnote)//sq//'qb'
2417 else
2418 notexq = sq//'qb'
2419 end if
2420 end if
2421 lnote = lnote+3
2422 end if
2423 else
2424 c
2425 c No tremolo
2426 c
2427 if (lnote .gt. 0) then
2428 notexq = notexq(1:lnote)//sq//'qb'
2429 else
2430 notexq = sq//'qb'
2431 end if
2432 lnote = lnote+3
2433 end if
2434 isdotm = .false.
2435 if (.not.vxtup(ivx)) then
2436 if (2**log2(nodur(ivx,ip)) .ne. nodur(ivx,ip)) then
2437 if (.not.btest(iornq(ivx,ip),13)) then
2438 notexq = notexq(1:lnote)//'p'
2439 else
2440 notexq = notexq(1:lnote)//'m'
2441 isdotm = .true.
2442 end if
2443 lnote = lnote+1
2444 end if
2445 end if
2446 c
2447 c 5/25/08 Allow >12
2448 c 5/9/10 Up to 24; replace 24 with 0
2449 c
2450 if (.not.(isbjmp.and.ivx.eq.ivbj2)) then
2451 call istring(mod(ivx,24),tempq,len)
2452 else
2453 call istring(mod(ivbj1,24),tempq,len)
2454 end if
2455 if (isbjmp .and. ivx.eq.ivbj2
2456 * .and..not.btest(irest(ivx,ip),23)) isbjmp=.false.
2457 notexq = notexq(1:lnote)//tempq(1:len)
2458 lnote = lnote+len
2459 notexq = notexq(1:lnote)//noteq(1:lnoten)
2460 lnote = lnote+lnoten
2461 if (isdotm) then
2462 if (lnoten .eq. 1) then
2463 notexq = notexq(1:lnote)//'{'//noteq(1:1)//'}'
2464 lnote = lnote+3
2465 else
2466 notexq = notexq(1:lnote)//noteq(lnoten-1:lnoten-1)
2467 lnote = lnote+1
2468 end if
2469 end if
2470 return
2471 end
2472 subroutine beamid(notexq,lnote)
2473 parameter (nm=24)
2474 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
2475 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
2476 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
2477 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
2478 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
2479 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
2480 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
2481 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
2482 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
2483 character*1 ulq,sepsymq,sq,ulqq,chax
2484 logical beamon,firstgulp,figbass,figchk,flipend,btest,
2485 * isfig,vxtup,isdotm,isbjmp,bar1syst,isdotted,isbj2,drawbm
2486 character*79 notexq
2487 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
2488 common /comoct/ noctup
2489 common /strtmid/ ihnum3,flipend(nm),ixrest(nm)
2490 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
2491 * mtupv(nm,9),nxtinbm(nm),
2492 * islope(nm),xelsk(24),eloff(nm,9),
2493 * nssb(nm),issb(nm),lev1ssb(nm,20)
2494 common /comdraw/ drawbm(nm)
2495 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
2496 common /comask/ bar1syst,fixednew,scaldold,
2497 * wheadpt,fbar,poenom
2498 character*8 noteq
2499 character*4 tempq
2500 lnote = 0
2501 ip = ipo(jn)
2502 nole = nolev(ivx,ip)
2503 c
2504 c Check for special situations with 2nds (see precrd)
2505 c
2506 if (btest(nacc(ivx,ip),30)) then
2507 nole = nole - 1
2508 else if (btest(nacc(ivx,ip),31)) then
2509 nole = nole + 1
2510 end if
2511 if (.not.btest(irest(ivx,ip),0)) then
2512 multip = iand(mult(ivx,ip),15)-8
2513 c if (btest(islur(ivx,ip-1),3)) multip = multip+1
2514 c
2515 c (Above test OK since must have ip>1). Double dotted note preceding
2516 c
2517 c Move the following, because can't ask for note until after checking for
2518 c embedded xtup with number, due to ordering/octave feature.
2519 c
2520 c call notefq(noteq,lnoten,nolev(ivx,ip),ncmid(iv,ip))
2521 end if
2522 if (btest(irest(ivx,ip),28)) vxtup(ivx) = .true.
2523 if (vxtup(ivx)) then
2524 c
2525 c In an xtup
2526 c
2527 if (btest(irest(ivx,ip),0)) then
2528 c
2529 c Intermediate rest in xtup, put in the rest. Reset nodur so notex works OK
2530 c
2531 nodur(ivx,ip) = 2**(4-(iand(mult(ivx,ip),15)-8))
2532 call notex(notexq,lnote)
2533 c
2534 c Re-zero so next note does not get confused
2535 c
2536 nodur(ivx,ip) = 0
2537 return
2538 end if
2539 if (.not.drawbm(ivx)) then
2540 c
2541 c Xtuplet with no beam, just put in the right kind of note
2542 c
2543 if (btest(islur(ivx,ip),30)) then
2544 c
2545 c Forced stem direction
2546 c
2547 ndsav = nodur(ivx,ip)
2548 nodur(ivx,ip) = 2**(4-multip)
2549 if (btest(nacc(ivx,ip),19) .or.
2550 * btest(nacc(ivx,ip),27)) then
2551 nodur(ivx,ip)=3*nodur(ivx,ip)/2
2552 else if (btest(nacc(ivx,ip-1),27)) then
2553 nodur(ivx,ip)=nodur(ivx,ip)/2
2554 end if
2555 call notex(notexq,lnote)
2556 nodur(ivx,ip) = ndsav
2557 else
2558 c
2559 c Use ulq for stem direction
2560 c
2561 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2562 if (lnoten .eq. 1) call addblank(noteq,lnoten)
2563 lnote = 3
2564 if (.not.btest(nacc(ivx,ip-1),27)) then
2565 c
2566 c Prior note of xtup is not regular-dotted
2567 c
2568 if (multip .eq. 0) then
2569 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))
2570 else if (multip .eq. -1) then
2571 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))
2572 else if (multip .eq. 1) then
2573 notexq = sq//'c'//ulq(ivx,ibmcnt(ivx))
2574 else if (multip .eq. 2) then
2575 notexq = sq//'cc'//ulq(ivx,ibmcnt(ivx))
2576 lnote = 4
2577 else if (multip .eq. 3) then
2578 notexq = sq//'ccc'//ulq(ivx,ibmcnt(ivx))
2579 lnote = 5
2580 else if (multip .eq. -2) then
2581 notexq = sq//'wh'
2582 end if
2583 if (btest(nacc(ivx,ip),27)) then
2584 c
2585 c This xtup note is regular dotted non-beamed xtup
2586 c
2587 c notexq = notexq(1:3)//'p'
2588 c lnote = 4
2589 notexq = notexq(1:lnote)//'p'
2590 lnote = lnote+1
2591 end if
2592 else
2593 c
2594 c Prior note of xtup is regular-dotted so this one is halved
2595 c
2596 if (multip .eq. 2) then
2597 notexq = sq//'ccc'//ulq(ivx,ibmcnt(ivx))
2598 lnote = 5
2599 else if (multip .eq. 1) then
2600 notexq = sq//'cc'//ulq(ivx,ibmcnt(ivx))
2601 lnote = 4
2602 else if (multip .eq. 0) then
2603 notexq = sq//'c'//ulq(ivx,ibmcnt(ivx))
2604 else if (multip .eq. -1) then
2605 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))
2606 else if (multip .eq. -2) then
2607 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))
2608 end if
2609 end if
2610 notexq = notexq(1:lnote)//noteq
2611 lnote = lnote+lnoten
2612 end if
2613 return
2614 else if (nodur(ivx,ip).eq.0) then
2615 c
2616 c In the beamed xtup but not the last note
2617 c
2618 if (nodur(ivx,ip-1).gt.0) then
2619 c
2620 c Embedded Xtup, mult>0, starts here. Put in number if needed
2621 c
2622 nxtinbm(ivx) = nxtinbm(ivx)+1
2623 iud = 1
2624 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') iud = -1
2625 c
2626 c Get ip#, notelevel of middle note (or gap) in xtup
2627 c
2628 ipmid = ip+ntupv(ivx,nxtinbm(ivx))/2
2629 xnlmid = levrn(nolev(ivx,ipmid),irest(ivx,ipmid),iud,
2630 * ncmid(iv,ipmid),iand(15,mult(ivx,ipmid))-8)
2631 if (mod(ntupv(ivx,nxtinbm(ivx)),2).eq.0) xnlmid = (xnlmid+
2632 * levrn(nolev(ivx,ipmid-1),irest(ivx,ipmid-1),iud,
2633 * ncmid(iv,ipmid-1),iand(15,mult(ivx,ipmid-1))-8))/2
2634 iflop = 0
2635 if (abs(xnlmid-ncmid(iv,ip)).lt.3.) iflop = -iud
2636 iup = iud+2*iflop
2637 if (btest(irest(ivx,ip),14)) then
2638 iup = -iup
2639 iflop = 0
2640 if (iud*iup .lt. 0) iflop = iup
2641 end if
2642 c
2643 c Place number if needed
2644 c
2645 if (.not.btest(islur(ivx,ip),31)) then
2646 mprint = igetbits(nacc(ivx,ip),5,22)
2647 if (mprint.eq.0) mprint=mtupv(ivx,nxtinbm(ivx))
2648 call putxtn(mprint,iflop,multip,iud,wheadpt,poenom,
2649 * nolev1(ivx),islope(ivx),slfac,
2650 * xnlmid,islur(ivx,ip),lnote,notexq,ncmid(iv,ip),nlnum,
2651 * eloff(ivx,nxtinbm(ivx)),iup,irest(ivx,ip),
2652 * mult(ivx,ip),.false.)
2653 end if
2654 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2655 else
2656 c
2657 c Intermediate note of xtup
2658 c
2659 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2660 end if
2661 else
2662 c
2663 c Last note of xtup (but not last note of beam!)
2664 c
2665 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2666 end if
2667 else if (btest(irest(ivx,ip),0)) then
2668 call notex(notexq,lnote)
2669 return
2670 else
2671 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
2672 end if
2673 c
2674 c Check for string of rests up to and including last note in xtup.
2675 c
2676 c Replace next 2 lines to keep from doing this block
2677 c when in second part of staff-jumping chordal xtup. This fix could
2678 c break some unaccounted non-chordal staff-jum xtup situations.
2679 c if (vxtup(ivx) .and. btest(irest(ivx,ip+1),0) .and.
2680 c * .not.btest(irest(ivx,ip),0)) then
2681 if (vxtup(ivx) .and. btest(irest(ivx,ip+1),0) .and.
2682 * .not.btest(irest(ivx,ip),0) .and.
2683 * .not.(isbjmp.and.ivx.eq.ivbj2)) then
2684 c
2685 c This note is not a rest but next is a rest. Do rests continue to
2686 c end of xtup, where nodur>0
2687 c
2688 do 3 ipnow = ip+1 , ip+24
2689 if (nodur(ivx,ipnow).gt.0) go to 4 ! This is last of xtup
2690 if (.not.btest(irest(ivx,ipnow+1),0)) go to 5 ! Next is not rest
2691 c
2692 c If I don't go to 5, know next note IS a rest!
2693 c
2694 3 continue
2695 4 continue
2696 call ntrbbb(1,'t',ulq(ivx,ibmcnt(ivx)),ivx,notexq,lnote)
2697 notexq = notexq(1:lnote)//sq//'qb'
2698 lnote = lnote+3
2699 call istring(ivx,tempq,len)
2700 notexq = notexq(1:lnote)//tempq(1:len)
2701 lnote = lnote+len
2702 notexq = notexq(1:lnote)//noteq(1:lnoten)
2703 lnote = lnote+lnoten
2704 return
2705 5 continue
2706 c
2707 c Check if multiplicity changes in a way requiring action,
2708 c unless (160211) it's blank rest on start of 2nd seg of joined beam
2709 c
2710 else if(.not.btest(irest(ivx,ip-1),24)
2711 * .or..not.btest(islur(ivx,ip-1),29)) then
2712 ipleft = ip-1
2713 if (btest(irest(ivx,ipleft),0)) ipleft = ipleft-1
2714 if (.not.btest(islur(ivx,ipleft),20)) then
2715 multl = iand(15,mult(ivx,ipleft))-8
2716 else
2717 multl = 1
2718 end if
2719 mub = multip - multl
2720 ipright = ip+1
2721 if (btest(irest(ivx,ipright),0)) ipright = ipright+1
2722 if (.not.btest(islur(ivx,ip),20)) then
2723 multr = iand(15,mult(ivx,ipright))-8
2724 else
2725 multr = 1
2726 end if
2727 mua = multr-multip
2728 if (mub.gt.0 .or. mua .lt. 0) then
2729 c
2730 c Multiplicity has increased from left or will decrease to right. Need action.
2731 c
2732 if (isbjmp .and. ivx.eq.ivbj2) then
2733 ivb = ivbj1
2734 ulqq = chax(225-ichar(ulq(ivx,ibmcnt(ivx))))
2735 else
2736 ivb = ivx
2737 ulqq = ulq(ivx,ibmcnt(ivx))
2738 end if
2739 if (mua .ge. 0) then
2740 call ntrbbb(multip,'n',ulqq,ivb,notexq,lnote)
2741 c
2742 c Test for next note being blank rest, assuming staff-crossing
2743 c xtup chord
2744 c
2745 else if (multl .ge. multr .and.
2746 * .not.btest(islur(ivx,ip+1),29)) then
2747 do 1 im = multip , 1+multr, -1
2748 call ntrbbb(im,'t',ulqq,ivb,notexq,lnote)
2749 1 continue
2750 c else
2751 c Test for next note being blank rest, assuming staff-crossing
2752 c xtup chord
2753 c
2754 else if (.not.btest(islur(ivx,ip+1),29)) then
2755 do 2 im = 1+multr, multip
2756 call ntrbbb(im,'r',ulqq,ivb,notexq,lnote)
2757 2 continue
2758 call ntrbbb(multr,'n',ulqq,ivb,notexq,lnote)
2759 end if
2760 else if (ip .gt. 1) then
2761 c
2762 c Check for 2nd member of dotted xtup
2763 c
2764 if (btest(nacc(ivx,ip-1),27)) call ntrbbb(multip+1,'t',
2765 * ulq(ivx,ibmcnt(ivx)),ivx,notexq,lnote)
2766 end if
2767 end if
2768 c
2769 c Now put in the note
2770 c
2771 if (lnote .gt. 0) then
2772 notexq = notexq(1:lnote)//sq//'qb'
2773 else
2774 notexq = sq//'qb'
2775 end if
2776 lnote = lnote+3
2777 isdotm = .false.
2778 if (isdotted(nodur,ivx,ip)) then
2779 c
2780 c rule out ')'
2781 c
2782 if (.not.btest(iornq(ivx,ip),13)) then
2783 if (.not.btest(islur(ivx,ip),3)) then
2784 notexq = notexq(1:lnote)//'p'
2785 else
2786 c
2787 c Double dot
2788 c
2789 notexq = notexq(1:lnote)//'pp'
2790 lnote = lnote+1
2791 end if
2792 else
2793 notexq = notexq(1:lnote)//'m'
2794 isdotm = .true.
2795 end if
2796 lnote = lnote+1
2797 else if (btest(nacc(ivx,ip),19)
2798 * .or. btest(nacc(ivx,ip),27)) then
2799 c
2800 c Special dotted notation for 2:1 xtup, or normal dot in xtup
2801 c
2802 notexq = notexq(1:lnote)//'p'
2803 lnote = lnote+1
2804 end if
2805 c
2806 c 5/25/08 Allow >12
2807 c
2808 if (.not.(isbjmp.and.ivx.eq.ivbj2)) then
2809 c call istring(mod(ivx,12),tempq,len)
2810 call istring(mod(ivx,24),tempq,len)
2811 else
2812 c call istring(mod(ivbj1,12),tempq,len)
2813 call istring(mod(ivbj1,24),tempq,len)
2814 end if
2815 notexq = notexq(1:lnote)//tempq(1:len)
2816 lnote = lnote+len
2817 notexq = notexq(1:lnote)//noteq(1:lnoten)
2818 lnote = lnote+lnoten
2819 if (isdotm) then
2820 if (lnoten .eq. 2) then
2821 notexq = notexq(1:lnote)//'{'//noteq(2:2)//'}'
2822 lnote = lnote+3
2823 else
2824 notexq = notexq(1:lnote)//noteq(lnoten-1:lnoten-1)
2825 lnote = lnote+1
2826 end if
2827 end if
2828 return
2829 end
2830 subroutine beamn1(notexq,lnote)
2831 parameter (nm=24)
2832 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
2833 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
2834 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
2835 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
2836 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
2837 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
2838 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
2839 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
2840 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
2841 character*1 ulq,sepsymq,sq
2842 logical beamon,firstgulp,figbass,figchk,btest,
2843 * isfig,vxtup,isdotm,isbjmp,isbj2,drawbm
2844 logical gotnote
2845 common /comoct/ noctup
2846 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
2847 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
2848 * mtupv(nm,9),nxtinbm(nm),
2849 * islope(nm),xelsk(24),eloff(nm,9),
2850 * nssb(nm),issb(nm),lev1ssb(nm,20)
2851 common /comdraw/ drawbm(nm)
2852 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
2853 character*8 noteq,tempq,numq
2854 character*79 notexq
2855 gotnote = .false.
2856 lnoten = 0
2857 ip1 = ipo(jn)
2858 multip = iand(15,mult(ivx,ip1))-8
2859 if (.not.drawbm(ivx) .and. btest(irest(ivx,ip1),0)) then
2860 lnote = 0
2861 c
2862 c The rest was already written in beamstrt, so just get out of here
2863 c
2864 return
2865 end if
2866 nole = nolev(ivx,ipo(jn))
2867 c
2868 c Check for special situations with 2nds (see precrd)
2869 c
2870 if (btest(nacc(ivx,ipo(jn)),30)) then
2871 nole = nole - 1
2872 else if (btest(nacc(ivx,ipo(jn)),31)) then
2873 nole = nole + 1
2874 end if
2875 if (vxtup(ivx) .and. .not.drawbm(ivx)) then
2876 c
2877 c Xtuplet with no beam, just put in the right kind of note
2878 c
2879 if (btest(islur(ivx,ip1),30)) then
2880 c
2881 c Forced stem direction
2882 c
2883 ndsav = nodur(ivx,ip1)
2884 nodur(ivx,ip1) = 2**(4-multip)
2885 if (btest(nacc(ivx,ip1),19) .or.
2886 * btest(nacc(ivx,ip1),27)) nodur(ivx,ip1)=3*nodur(ivx,ip1)/2
2887 call notex(notexq,lnote)
2888 nodur(ivx,ip1) = ndsav
2889 else
2890 call notefq(noteq,lnoten,nole,ncmid(iv,ip1))
2891 gotnote = .true.
2892 if (lnoten .eq. 1) call addblank(noteq,lnoten)
2893 lnote = 3
2894 if (multip .le. 0) then
2895 if ((btest(irest(ivx,ip1),2) .and.
2896 * nodur(ivx,ip1+1).ge.32)
2897 * .or. multip .eq. -1) then
2898 c
2899 c 1st note of unbeamed half-note trem; make open
2900 c
2901 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))
2902 else if (multip .eq. -2) then
2903 notexq = sq//'wh'
2904 else
2905 notexq = sq//'q'//ulq(ivx,ibmcnt(ivx))
2906 end if
2907 c
2908 c Check for dot
2909 c
2910 if (btest(irest(ivx,ip1),2) .and.
2911 * abs(nodur(ivx,ip1+1)/12.-nodur(ivx,ip1+1)/12).lt..001) then
2912 c
2913 c Need a dot. already called addblank for noteq
2914 c
2915 if (lnote .eq. 0) then
2916 notexq = sq//'pt'//noteq(1:lnoten)
2917 lnote = 3+lnoten
2918 else
2919 notexq = notexq(1:lnote)//'p'
2920 lnote = lnote+1
2921 end if
2922 end if
2923 c
2924 c Insert the stemlength calcs here for dotted, unbeamed.
2925 c Later may combine with below to avoid repeat.
2926 c
2927 if (btest(irest(ivx,ip1),2)) then
2928 nindent = igetbits(irest(ivx,ip1),2,5)
2929 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
2930 slen = (4.5+nindent+nolev1(ivx)-nole
2931 * -.4*islope(ivx)/slfac)*.6667
2932 else
2933 slen = (4.5+nindent-nolev1(ivx)+nole
2934 * +.4*islope(ivx)/slfac)*.6667
2935 end if
2936 write(tempq,'(f4.1)')slen
2937 notexq = sq//'slx{'//tempq(1:4)//'}'//
2938 * notexq(1:lnote)
2939 lnote = lnote+10
2940 end if
2941 else if (btest(irest(ivx,ip1),2)) then
2942 c
2943 c 1st note of unbeamed quarter or 8th trem, make a quarter note
2944 c
2945 c Stem length calcs here. The .2 factor is empirical, but
2946 c slfac accounts for musicsize.
2947 c
2948 nindent = igetbits(irest(ivx,ip1),2,5)
2949 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
2950 slen = (4.5+nindent+nolev1(ivx)-nole
2951 * -.4*islope(ivx)/slfac)*.6667
2952 else
2953 slen = (4.5+nindent-nolev1(ivx)+nole
2954 * +.4*islope(ivx)/slfac)*.6667
2955 end if
2956 write(tempq,'(f4.1)')slen
2957 notexq = sq//'slx{'//tempq(1:4)//'}'//
2958 * sq//'q'//ulq(ivx,ibmcnt(ivx))
2959 lnote = 13
2960 c
2961 c Check for dotted 2-note trem; prepend dot to notexq if needed
2962 c
2963 if (nodur(ivx,ip1+1).eq.12 .or.
2964 * nodur(ivx,ip1+1).eq.24) then
2965 if (lnoten .eq. 1) then
2966 noteq = ' '//noteq(1:1)
2967 lnoten = 2
2968 end if
2969 notexq = sq//'pt'//noteq(1:lnoten)//notexq(1:lnote)
2970 lnote = lnote+3+lnoten
2971 call notefq(noteq,lnoten,nole,ncmid(iv,ip1))
2972 gotnote = .true.
2973 if (lnoten .eq. 1) then
2974 noteq = ' '//noteq(1:1)
2975 lnoten = 2
2976 end if
2977 end if
2978 else if (multip .eq. -1) then
2979 notexq = sq//'h'//ulq(ivx,ibmcnt(ivx))
2980 else if (multip .eq. 1) then
2981 notexq = sq//'c'//ulq(ivx,ibmcnt(ivx))
2982 else if (multip .eq. 2) then
2983 notexq = sq//'cc'//ulq(ivx,ibmcnt(ivx))
2984 lnote = 4
2985 else if (multip .eq. 3) then
2986 notexq = sq//'ccc'//ulq(ivx,ibmcnt(ivx))
2987 lnote = 5
2988 else if (multip .eq. -2) then
2989 notexq = sq//'wh'
2990 else if (multip .eq. -3) then
2991 notexq = sq//'breve'
2992 lnote = 6
2993 else
2994 print*
2995 print*,'(Error in beamn1, send source to Dr. Don)'
2996 call stop1()
2997 end if
2998 if (btest(nacc(ivx,ip1),19) .or. btest(nacc(ivx,ip1),27)) then
2999 c notexq = notexq(1:3)//'p'
3000 c lnote = 4
3001 notexq = notexq(1:lnote)//'p'
3002 lnote = lnote+1
3003 end if
3004 notexq = notexq(1:lnote)//noteq
3005 lnote = lnote+lnoten
3006 end if
3007 return
3008 end if
3009 c
3010 c Check if mult. decreases from 1st note to 2nd
3011 c
3012 if (ibm2(ivx,ibmcnt(ivx)).gt.ip1
3013 * .or. btest(islur(ivx,ip1),20)) then
3014 c
3015 c More than one note or single-note before a multiplicity-down-up "]["
3016 c
3017 if (btest(islur(ivx,ip1),20)) then
3018 multr = 1
3019 else if (.not.btest(irest(ivx,ip1+1),0)) then
3020 multr = iand(15,mult(ivx,ip1+1))-8
3021 else
3022 multr = iand(15,mult(ivx,ip1+2))-8
3023 end if
3024 lnote = 0
3025 c
3026 c Check if staff-jumper
3027 c
3028 if (isbjmp .and. ivbj2.gt.0) then
3029 ivxp = ivbj1
3030 else
3031 ivxp = ivx
3032 end if
3033 if (multr .lt. multip) then
3034 do 1 im = multip , multr+1 , -1
3035 c
3036 c Right-shifted 'termination'
3037 c
3038 if (isbjmp .and. ivbj2.gt.0) then
3039 c
3040 c Jump beam
3041 c
3042 call ntrbbb(im,'t',ulq(ivxp,ibmcnt(ivx)),
3043 * ivxp,notexq,lnote)
3044 else
3045 c
3046 c Same staff
3047 c
3048 call ntrbbb(im,'r',ulq(ivx,ibmcnt(ivx)),ivxp,notexq,lnote)
3049 end if
3050 1 continue
3051 end if
3052 end if
3053 c
3054 c Check for beamed, dotted 2-note tremolo
3055 c
3056 if (btest(irest(ivx,ip1),2) .and.
3057 * abs(nodur(ivx,ip1+1)/12.-nodur(ivx,ip1+1)/12).lt..001) then
3058 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
3059 gotnote = .true.
3060 if (lnoten .eq. 1) then
3061 noteq = ' '//noteq(1:1)
3062 lnoten = 2
3063 end if
3064 end if
3065 c
3066 c Put in the note, but check first for open-head beamed tremolo.
3067 c
3068 if (btest(irest(ivx,ip1),2) .and. nodur(ivx,ip1+1).ge.32) then
3069 c
3070 c 2-note open head tremolo
3071 c
3072 if (lnote .gt. 0) then
3073 notexq = notexq(1:lnote)//sq//'hb'
3074 else
3075 notexq = sq//'hb'
3076 end if
3077 else
3078 if (lnote .gt. 0) then
3079 notexq = notexq(1:lnote)//sq//'qb'
3080 else
3081 notexq = sq//'qb'
3082 end if
3083 end if
3084 lnote = lnote+3
3085 if (btest(irest(ivx,ip1),2) .and.
3086 * (nodur(ivx,ip1+1).eq.24.or.nodur(ivx,ip1+1).eq.12
3087 * .or.nodur(ivx,ip1+1).eq.48)) then
3088 c
3089 c 2-note trem on dotted note
3090 c
3091 notexq = notexq(1:lnote)//'p'
3092 lnote = lnote+1
3093 end if
3094 c
3095 c Check for dot
3096 c
3097 isdotm = .false.
3098 if (.not.vxtup(ivx)) then
3099 nd = nodur(ivx,ipo(jn))
3100 if (nd.ne.0) then
3101 if (2**log2(nd).ne.nd) then
3102 if (.not.btest(iornq(ivx,ip1),13)) then
3103 if (.not.btest(islur(ivx,ip1),3)) then
3104 notexq = notexq(1:lnote)//'p'
3105 else
3106 c
3107 c Double dot
3108 c
3109 notexq = notexq(1:lnote)//'pp'
3110 lnote = lnote+1
3111 end if
3112 else
3113 notexq = notexq(1:lnote)//'m'
3114 isdotm = .true.
3115 end if
3116 lnote = lnote+1
3117 end if
3118 end if
3119 else if (btest(nacc(ivx,ip1),19) .or.
3120 * btest(nacc(ivx,ip1),27)) then
3121 c
3122 c In an xtup with special 2:1 notation with a dot on 1st note, or normal dot
3123 c
3124 notexq = notexq(1:lnote)//'p'
3125 lnote = lnote+1
3126 end if
3127 c
3128 c Do the number; 0 if 12
3129 c 5/25/08 allow >12
3130 c
3131 if (.not.btest(irest(ivx,ip1),24)) then
3132 call istring(mod(ivx,24),numq,len)
3133 else
3134 c
3135 c 1st note of staff-jumping beam
3136 c
3137 call istring(mod(ivbj1,24),numq,len)
3138 end if
3139 notexq = notexq(1:lnote)//numq(1:len)
3140 lnote = lnote+len
3141 if (.not.gotnote) then
3142 call notefq(noteq,lnoten,nole,ncmid(iv,ip1))
3143 end if
3144 notexq = notexq(1:lnote)//noteq(1:lnoten)
3145 lnote = lnote+lnoten
3146 if (isdotm) then
3147 if (lnoten .eq. 1) then
3148 notexq = notexq(1:lnote)//'{'//noteq(1:1)//'}'
3149 lnote = lnote+3
3150 else
3151 notexq = notexq(1:lnote)//noteq(lnoten-1:lnoten-1)
3152 lnote = lnote+1
3153 end if
3154 end if
3155 return
3156 end
3157 subroutine beamstrt(notexq,lnote,nornb,ihornb,space,squez,ib)
3158 parameter (nm=24)
3159 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
3160 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
3161 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
3162 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
3163 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
3164 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
3165 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
3166 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
3167 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
3168 character*1 ulq,sepsymq,sq
3169 character*40 restq
3170 character*79 inameq
3171 logical beamon,firstgulp,figbass,figchk,btest,
3172 * isfig,vxtup,bar1syst,addbrack,flipend,xto,drawbm
3173 common /comeskz2/ eskz2(nm,200)
3174 common /comoct/ noctup
3175 common /strtmid/ ihnum3,flipend(nm),ixrest(nm)
3176 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
3177 * mtupv(nm,9),nxtinbm(nm),
3178 * islope(nm),xelsk(24),eloff(nm,9),
3179 * nssb(nm),issb(nm),lev1ssb(nm,20)
3180 common /comdraw/ drawbm(nm)
3181 common /comas1/ naskb,task(40),wask(40),elask(40)
3182 common /comask/ bar1syst,fixednew,scaldold,
3183 * wheadpt,fbar,poenom
3184 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
3185 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
3186 * lnam(nm),inameq(nm)
3187 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
3188 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
3189 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
3190 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
3191 c
3192 c The following is just to save the outputs from SetupB for the case of
3193 c xtups starting with a rest, where beamstrt is called twice.
3194 c
3195 common /comipb/ nnb,sumx,sumy,ipb(24),smed
3196 character*1 chax
3197 character*8 noteq
3198 character*79 notexq,tempq
3199 integer nornb(nm),ihornb(nm,24)
3200 real*4 space(80),squez(80)
3201 logical novshrinktop,cstuplet,usexnumt,writebrests
3202 common /comnvst/ novshrinktop,cstuplet
3203 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
3204 * fullsize(nm),ivxfig2,ivvfig(2,74)
3205 character*10 figq
3206 common /xjbeambrests/ nbrests
3207 common /comslope/ bigslope,novbm
3208 logical bigslope,novbm
3209 writebrests = .true.
3210 ibc = ibmcnt(ivx)
3211 ipb1 = ibm1(ivx,ibc)
3212 multb = iand(15,mult(ivx,ipb1))-8
3213 ip = ipo(jn)
3214 lnote = 0
3215 nvtrem = 0 ! Vertical adjustment beams for tremolo
3216 c
3217 c Compute slopes and note offsets from start of beam. Inside SetupB, for each
3218 c xtup in the beam, set eloff,mtupv (in comxtup) for printed number. Also
3219 c gets islope(ivx), transferred in common.
3220 c
3221 if (ixrest(ivx).eq.0 .and. .not.btest(nacc(ivx,ip),21))
3222 * call SetupB(xelsk,nnb,sumx,sumy,ipb,smed,ixrest(ivx))
3223 c
3224 c Will always come past here after entering beamstrt for 2-note tremolo, and
3225 c slope will have been computed, even for unbeamed. So start the indented
3226 c beams here. The indented tremolo bars will be added to the notexq output
3227 c string, under the tacet assumption that there is no horizontal shift
3228 c enacted by the action just before and after the call to beamstrt.
3229 c
3230 if (btest(irest(ivx,ipb1),2) .and.
3231 * igetbits(irest(ivx,ipb1),2,5) .gt. 0) then
3232 nindent = igetbits(irest(ivx,ipb1),2,5)
3233 tempq = sq//'roffset{.7}{'//sq//'ib'
3234 ltemp = 16
3235 if (nindent .eq. 2) then
3236 tempq = tempq(1:16)//'b'
3237 ltemp = 17
3238 else if (nindent .eq. 3) then
3239 tempq = tempq(1:16)//'bb'
3240 ltemp = 18
3241 end if
3242 c
3243 c Use beam # 0 for indented beams
3244 c
3245 tempq = tempq(1:ltemp)//ulq(ivx,ibc)//'0'
3246 ltemp = ltemp+2
3247 c
3248 c Get adjustment to nolev1 for main beam based on nindent
3249 c
3250 if (ulq(ivx,ibc) .eq. 'u') then
3251 nvtrem = nindent-1
3252 else
3253 nvtrem = 1-nindent
3254 end if
3255 c
3256 c Get numerical position of initiation for main beam. Will adjust height at
3257 c closing to account for nindent
3258 c
3259 numinit = nolev1(ivx)-ncmid(iv,ipb1)+4
3260 c
3261 c Get forced beam height tweak, apply here for indented beams
3262 c
3263 iadj = igetbits(ipl(ivx,ipb1),6,11)-30
3264 if (iadj .ne. -30) numinit = numinit+iadj
3265 if (numinit.ge.0 .and. numinit.le.9) then
3266 write(noteq,'(i1)') numinit
3267 lnoten = 1
3268 else
3269 write(noteq,'(a1,i2,a1)')'{',numinit,'}'
3270 lnoten = 4
3271 end if
3272 tempq = tempq(1:ltemp)//noteq(1:lnoten)
3273 ltemp = ltemp+lnoten
3274 c
3275 c Now do the slope.
3276 c 170408 Baseline is in islope(ivx). Apply slope tweak if present.
3277 c
3278 numinit = islope(ivx)
3279 iadj = igetbits(ipl(ivx,ipb1),6,17)-30
3280 if (iadj .ne. -30) numinit = numinit+iadj
3281 if (numinit.ge.0 .and. numinit.le.9) then
3282 write(noteq,'(i1,a1)') numinit,'}'
3283 lnoten = 2
3284 else
3285 write(noteq,'(a1,i2,a2)')'{',numinit,'}}'
3286 lnoten = 5
3287 end if
3288 tempq = tempq(1:ltemp)//noteq(1:lnoten)
3289 ltemp = ltemp+lnoten
3290 notexq = tempq
3291 lnote = ltemp
3292 end if
3293 if (btest(nacc(ivx,ip),21)) then
3294 c
3295 c This is start of later segment of single-slope beam group so use slope and
3296 c height from prior beam. Slope is already OK.
3297 c
3298 issb(ivx) = issb(ivx)+1
3299 nolev1(ivx) = lev1ssb(ivx,issb(ivx))
3300 end if
3301 c
3302 c Move this up to before indented beams for tremolo
3303 c lnote = 0
3304 drawbm(ivx) = .true.
3305 if (btest(irest(ivx,ipb1),28) .and. ixrest(ivx).ne.2) then
3306 vxtup(ivx) = .true.
3307 nxtinbm(ivx) = nxtinbm(ivx)+1
3308 c
3309 c irest(28)=>Xtup starts on this note. Set up for xtuplet.
3310 c Number goes on notehead side at middle note (or gap) of xtup, unless that
3311 c puts it in staff, then it flops to stem (or beam) side.
3312 c __ __
3313 c | | | O | |
3314 c O | | O
3315 c |___| O |__| |
3316 c
3317 c iud -1 -1 1 1 ...stem direction
3318 c iflop 0 1 -1 0 ...direction of flop
3319 c iup -1 1 -1 1 ...direction of number and bracket
3320 c
3321 iud = 1
3322 if (ulq(ivx,ibc) .eq. 'u') iud = -1
3323 c
3324 c Get ip#, note level of middle note (or gap) in xtup
3325 c
3326 ipmid = ipb1+ntupv(ivx,nxtinbm(ivx))/2
3327 c
3328 c 130129 If middle note is a rest, go to next note. Note last note cannot
3329 c be a rest
3330 c
3331 14 continue
3332 if (btest(irest(ivx,ipmid),0)) then
3333 ipmid = ipmid+1
3334 go to 14
3335 end if
3336 xnlmid = levrn(nolev(ivx,ipmid),irest(ivx,ipmid),iud,
3337 * ncmid(iv,ipmid),iand(15,mult(ivx,ipmid))-8)
3338 if (mod(ntupv(ivx,nxtinbm(ivx)),2) .eq. 0) xnlmid = (xnlmid+
3339 * levrn(nolev(ivx,ipmid-1),irest(ivx,ipmid-1),iud,
3340 * ncmid(iv,ipmid-1),iand(15,mult(ivx,ipmid-1))-8))/2
3341 iflop = 0
3342 if (abs(xnlmid-ncmid(iv,ipb1)).lt.3.) iflop = -iud
3343 iup = iud+2*iflop
3344 if (btest(irest(ivx,ipb1),14)) then
3345 c
3346 c Alter iud, iflop, iup to flip number/bracket. (Stare at above pic)
3347 c
3348 iup = -iup
3349 iflop = 0
3350 if (iud*iup .lt. 0) iflop = iup
3351 end if
3352 c
3353 c Determine if a beam is to be drawn.
3354 c Had problem w/ half-note 2-note xtups always F, so add a test
3355 c
3356 if (igetbits(irest(ivx,ipb1),2,3) .ne. 0) then
3357 drawbm(ivx) = .true.
3358 go to 6
3359 end if
3360 do 5 ipp = ibm1(ivx,ibc),ibm2(ivx,ibc)
3361 if (iand(15,mult(ivx,ipp))-8 .le. 0) then
3362 drawbm(ivx) = .false.
3363 go to 6
3364 end if
3365 5 continue
3366 drawbm(ivx) = .not.btest(islur(ivx,ibm1(ivx,ibc)),18)
3367 6 continue
3368 c
3369 c Are we using tuplet.tex?
3370 c
3371 usexnumt = cstuplet .and. .not.drawbm(ivx)
3372 c
3373 c Check for single note xtup 171217
3374 c
3375 if (btest(irest(ivx,ipb1),28) .and. nnb.eq.1) then
3376 drawbm(ivx) = .false.
3377 end if
3378 c
3379 c Place xtup number if needed
3380 c
3381 if (.not.btest(islur(ivx,ipb1),31) .or. multb.le.0) then
3382 mprint = igetbits(nacc(ivx,ip),5,22)
3383 if (mprint.eq.0) mprint=mtupv(ivx,nxtinbm(ivx))
3384 c Stab in the dark! Note: tried setting unbeam flag islur18 but no go.
3385 if (nnb .eq. 1) then
3386 xnlmid = nolev1(ivx)
3387 islope(ivx) = 0
3388 c
3389 c Move up, outside number check block, so all 1-note xtups ar unbeamed
3390 c drawbm(ivx) = .false.
3391 c
3392 end if
3393 call putxtn(mprint,iflop,multb,iud,wheadpt,
3394 * poenom,nolev1(ivx),islope(ivx),slfac,xnlmid,islur(ivx,ipb1),
3395 * lnote,notexq,ncmid(iv,ipb1),nlnum,eloff(ivx,nxtinbm(ivx)),
3396 * iup,irest(ivx,ipb1),mult(ivx,ipb1),usexnumt)
3397 end if
3398 if (.not.drawbm(ivx)) then
3399 c
3400 c Xtuplet with no beam
3401 c
3402 if (.not.btest(islur(ivx,ipb1),31)) then
3403 c
3404 c Number printing has not been suppressed, so put in the bracket.
3405 c scale = stretch factor for bracket if there are asx's
3406 c xnsk = length of the bracket in \noteskips = (\elemskips)/(eon)
3407 c
3408 xnsk = (eskz2(ivx,ipb1+ntupv(ivx,nxtinbm(ivx))-1)
3409 * -eskz2(ivx,ipb1))/squez(ib)/feon(space(ib)/squez(ib))
3410 if (iup .eq. 1) then
3411 if (lnote .gt. 0) then
3412 notexq = notexq(1:lnote)//sq//'ovbkt'
3413 else
3414 notexq = sq//'ovbkt'
3415 end if
3416 else
3417 if (lnote .gt. 0) then
3418 notexq = notexq(1:lnote)//sq//'unbkt'
3419 else
3420 c
3421 c Introduced 12/5/98, req'd due to possible presence of in-line TeX
3422 c
3423 notexq = sq//'unbkt'
3424 end if
3425 end if
3426 lnote = lnote+6
3427 if (iline.eq.1) then
3428 smed = smed/(1.-fracindent)
3429 end if
3430 xslope = 1.8*smed*slfac
3431 islope(ivx) = nint(xslope)
3432 nolev1(ivx) = nlnum - nint(smed*eloff(ivx,1))
3433 if (islope(ivx) .eq. 0) nolev1(ivx) = nolev1(ivx)-1
3434 if (iup .eq. 1) nolev1(ivx) = nolev1(ivx)+4
3435 levbracket = nolev1(ivx)
3436 if (iup.eq.1 .and. cstuplet) levbracket = levbracket-1
3437 call notefq(noteq,lnoten,levbracket,ncmid(iv,ipb1))
3438 if (lnoten .eq. 1) call addblank(noteq,lnoten)
3439 notexq = notexq(1:lnote)//noteq(1:lnoten)//'{'
3440 lnote = lnote+lnoten+1
3441 if (xnsk .lt. 0.995) then
3442 write(notexq(lnote+1:lnote+4),'(i1,f3.2)')0,xnsk
3443 lnote = lnote+4
3444 else if (xnsk .lt. 9.995) then
3445 write(notexq(lnote+1:lnote+4),'(f4.2)')xnsk
3446 lnote = lnote+4
3447 else
3448 write(notexq(lnote+1:lnote+5),'(f5.2)')xnsk
3449 lnote = lnote+5
3450 end if
3451 notexq = notexq(1:lnote)//'}'
3452 lnote = lnote+1
3453 if (btest(mult(ivx,ipb1),4)) then
3454 c
3455 c Tweak slope of bracket
3456 c
3457 islope(ivx) = islope(ivx)+igetbits(mult(ivx,ipb1),5,5)-16
3458 end if
3459 if (islope(ivx).lt.0 .or. islope(ivx).ge.10) then
3460 notexq = notexq(1:lnote)//'{'
3461 lnote = lnote+1
3462 if (islope(ivx) .lt. -9) then
3463 write(notexq(lnote+1:lnote+3),'(i3)')islope(ivx)
3464 lnote = lnote+3
3465 else
3466 write(notexq(lnote+1:lnote+2),'(i2)')islope(ivx)
3467 lnote = lnote+2
3468 end if
3469 notexq = notexq(1:lnote)//'}'
3470 lnote = lnote+1
3471 else
3472 write(notexq(lnote+1:lnote+1),'(i1)')islope(ivx)
3473 lnote = lnote+1
3474 end if
3475 c
3476 c Done with bracket
3477 c
3478 end if
3479 if (ixrest(ivx) .eq. 1) then
3480 c
3481 c Put in the rest. Possible problem: Rest is a spacing char, but between
3482 c beamstrt and beamn1 some non-spacing chars. are inserted.
3483 c
3484 c 130126 Deal with vertical shifts of rest starting xtuplet
3485 c
3486 lrest = 3
3487 if (btest(islur(ivx,ip),29)) then
3488 restq = sq//'sk'
3489 c if (multb .eq. 0) then
3490 else if (multb .eq. 0) then
3491 restq = sq//'qp'
3492 else if (.not.drawbm(ivx).and.multb.eq.1) then
3493 restq = sq//'ds'
3494 else if (.not.drawbm(ivx).and.multb.eq.2) then
3495 restq = sq//'qs'
3496 else if (.not.drawbm(ivx).and.multb.eq.3) then
3497 restq = sq//'hs'
3498 else
3499 restq = sq//'hpause'
3500 lrest = 7
3501 end if
3502 if (btest(nacc(ivx,ipb1),18) .and.
3503 * btest(nacc(ivx,ipb1),19)) then
3504 c
3505 c VERY special case of rest at start of F-tuplet, needs dot
3506 c
3507 restq = sq//'pt4'//restq(1:lrest)
3508 lrest = lrest+4
3509 end if
3510
3511 nole = mod(nolev(ivx,ip)+20,100)-20
3512 c if (nole .eq. 0) then
3513 if (nole.eq.0 .or. btest(islur(ivx,ip),29)) then
3514 c
3515 c Rest blank or is not raised
3516 c
3517 notexq = notexq(1:lnote)//restq
3518 lnote = lnote+lrest
3519 else
3520 if (abs(nole) .lt. 10) then
3521 tempq = chax(48+abs(nole))
3522 ltemp = 1
3523 else
3524 write(tempq(1:2),'(i2)')abs(nole)
3525 ltemp = 2
3526 end if
3527 if (nole .gt. 0) then
3528 tempq = sq//'raise'//tempq(1:ltemp)//sq//'internote'
3529 else
3530 tempq = sq//'lower'//tempq(1:ltemp)//sq//'internote'
3531 end if
3532 ltemp = 16+ltemp
3533 notexq = notexq(1:lnote)//tempq(1:ltemp)//restq(1:lrest)
3534 lnote = lnote+ltemp+lrest
3535 end if
3536 c
3537 c No need to come back through this subroutine (as would if rest starts bar
3538 c & multb>0), so do not advance ibm1. But must check in beamn1 and do nothing.
3539 c
3540 ixrest(ivx) = 0
3541 end if
3542 return
3543 end if
3544 c
3545 c End if block for non-beamed xtup start...note we returned
3546 c
3547 if (ixrest(ivx) .eq. 1) then
3548 c
3549 c Insert rest at start of beamed xtup. See above note for possible problem.
3550 c But first check if blank rest and if in forced beam (assuming xtuplet),
3551 c and if so, count rest from beginning, add \sk's AFTER starting beam '\ib*'
3552 c
3553 if (btest(islur(ivx,ip),29) .and. btest(ipl(ivx,ip),30)) then
3554 nbrests = nbrests+1
3555 writebrests = .false.
3556 else
3557 nodur(ivx,ipb1) = 2**(4-multb)
3558 call notex(tempq,ltemp)
3559 if (lnote .gt. 0) then
3560 notexq = notexq(1:lnote)//tempq(1:ltemp)
3561 else
3562 notexq = tempq(1:ltemp)
3563 end if
3564 lnote = lnote+ltemp
3565 end if
3566 c
3567 c Re-zero just in case!
3568 c
3569 nodur(ivx,ipb1) = 0
3570 ibm1(ivx,ibc) = ibm1(ivx,ibc)+1
3571 c
3572 c See if next note is a non-rest
3573 c
3574 if (.not.btest(irest(ivx,ipb1+1),0)) then
3575 ixrest(ivx) = 2
3576 else
3577 c
3578 c Suppress reprinting xtup number next time through beamstrt
3579 c
3580 islur(ivx,ipb1+1) = ibset(islur(ivx,ipb1+1),31)
3581 c
3582 c Set new xtup start flag
3583 c
3584 irest(ivx,ipb1+1) = ibset(irest(ivx,ipb1+1),28)
3585 end if
3586 return
3587 end if
3588 end if
3589 c
3590 c Just ended if block for xtups
3591 c
3592 if (vxtup(ivx) .and. ipb1.eq.ibm2(ivx,ibc)) then
3593 c
3594 c Move actual note writing to beamend
3595 c
3596 ixrest(ivx) = 4
3597 return
3598 end if
3599 if (issb(ivx) .eq. 0) then
3600 c
3601 c 1st bmstrt in single-slope bm grp, Adjust start level(s) and slope if needed
3602 c
3603 iadj = igetbits(ipl(ivx,ipb1),6,11)-30
3604 if (iadj .ne. -30) then
3605 nolev1(ivx) = nolev1(ivx)+iadj
3606 do 2 isssb = 1 , nssb(ivx)
3607 lev1ssb(ivx,isssb) = lev1ssb(ivx,isssb)+iadj
3608 2 continue
3609 end if
3610 iadj = igetbits(ipl(ivx,ipb1),6,17)-30
3611 if (iadj .ne. -30) then
3612 islope(ivx) = islope(ivx)+iadj
3613 c if (abs(islope(ivx)) .gt. 9) islope(ivx) = sign(9,islope(ivx))
3614 if (abs(islope(ivx)).gt.9.and..not.bigslope)
3615 * islope(ivx) = sign(9,islope(ivx))
3616 if (nssb(ivx) .gt. 0) then
3617 c
3618 c Cycle thru non-rest notes in SSBG, looking for bmstrts.
3619 c
3620 isssb = 0
3621 do 4 inb = 2, nnb
3622 if (btest(nacc(ivx,ipb(inb)),21)) then
3623 c
3624 c Beam segment start. New start level
3625 isssb = isssb+1
3626 lev1ssb(ivx,isssb) =
3627 * lev1ssb(ivx,isssb)+islope(ivx)*xelsk(inb)/slfac
3628 end if
3629 4 continue
3630 end if
3631 end if
3632 end if
3633 iadj = igetbits(islur(ivx,ipb1),2,27)
3634 addbrack = .false.
3635 if (btest(ipl(ivx,ipb1),30)) then
3636 c
3637 c Check for altered starting polarity. Only in forced beams. Nominal start
3638 c level is nolev1. So beam level is nolev1 +/- 6, to be compared w/ nolev(.,.).
3639 c
3640 if (ulq(ivx,ibc).eq.'u' .and.
3641 * nolev1(ivx)+6.lt.nolev(ivx,ipb1)) then
3642 if (lnote .eq. 0) then
3643 notexq = sq//'loff{'
3644 else
3645 notexq = notexq(1:lnote)//sq//'loff{'
3646 end if
3647 lnote = lnote+6
3648 addbrack = .true.
3649 else if (ulq(ivx,ibc).eq.'l' .and.
3650 * nolev1(ivx)-6.gt.nolev(ivx,ipb1)) then
3651 if (lnote .eq. 0) then
3652 notexq = sq//'roff{'
3653 else
3654 notexq = notexq(1:lnote)//sq//'roff{'
3655 end if
3656 lnote = lnote+6
3657 addbrack = .true.
3658 end if
3659 c
3660 c Check end level for possible flipping in forced beam. Have to do it
3661 c here since with multiple voices, xelsk will not be preserved.
3662 c
3663 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') then
3664 bmlev = nolev1(ivx)+6+islope(ivx)*xelsk(nnb)/slfac
3665 flipend(ivx) = bmlev.lt.nolev(ivx,ibm2(ivx,ibc))
3666 else if (ulq(ivx,ibmcnt(ivx)) .eq. 'l') then
3667 bmlev = nolev1(ivx)-6+islope(ivx)*xelsk(nnb)/slfac
3668 flipend(ivx) = bmlev.gt.nolev(ivx,ibm2(ivx,ibc))
3669 end if
3670 end if
3671 multbb = multb+iadj
3672 c
3673 c Tremolo starting?
3674 c
3675 if (btest(irest(ivx,ipb1),2)) multbb =
3676 * igetbits(irest(ivx,ipb1),2,3)
3677 call ntrbbb(multbb,'i',ulq(ivx,ibc),ivx,notexq,lnote)
3678 c
3679 c Put in name of start level and slope, after correcting nolev1 if xtup
3680 c started with a rest.
3681 c
3682 if (ixrest(ivx).eq.2) nolev1(ivx) =
3683 * nint(nolev1(ivx)+xelsk(1)*islope(ivx)/slfac)
3684 c
3685 c Add adjustment nvtrem to main beam to account for tremolo indented beams
3686 c
3687 call notefq(noteq,lnoten,nolev1(ivx)+nvtrem,ncmid(iv,ipb1))
3688 if (islope(ivx) .lt. -9) then
3689 notexq = notexq(1:lnote)//noteq(1:lnoten)//'{'
3690 lnote = lnote+5+lnoten
3691 write(notexq(lnote-3:lnote),'(i3,a1)')islope(ivx),'}'
3692 else if (islope(ivx) .lt. 0) then
3693 notexq = notexq(1:lnote)//noteq(1:lnoten)//'{'
3694 lnote = lnote+4+lnoten
3695 write(notexq(lnote-2:lnote),'(i2,a1)')islope(ivx),'}'
3696 else if (islope(ivx) .le. 9) then
3697 notexq = notexq(1:lnote)//noteq(1:lnoten)
3698 lnote = lnote+1+lnoten
3699 write(notexq(lnote:lnote),'(i1)')islope(ivx)
3700 else
3701 notexq = notexq(1:lnote)//noteq(1:lnoten)//'{'
3702 lnote = lnote+4+lnoten
3703 write(notexq(lnote-2:lnote),'(i2,a1)')islope(ivx),'}'
3704 end if
3705 c
3706 c Check for beam-thk fine-tuning
3707 c
3708 if (iadj .gt. 0) then
3709 do 1 imp = multb+iadj , multb+1 , -1
3710 call ntrbbb(imp,'t',ulq(ivx,ibc),ivx,notexq,lnote)
3711 1 continue
3712 end if
3713 c
3714 c If we shifted, must close with right bracket
3715 c
3716 if (addbrack) then
3717 notexq = notexq(1:lnote)//'}'
3718 lnote = lnote+1
3719 end if
3720 c
3721 c Add in \sk's for very special case of staff-crossing xtup chords
3722 c Assumes we are in lower (first) voice of up-to-both beamed xtup
3723 c that starts with blank rests (notes in upper voice here).
3724 c
3725 if (nbrests.gt.0 .and. writebrests) then
3726 do 7 isk = 1 , nbrests
3727 notexq = notexq(1:lnote)//chax(92)//'sk'
3728 lnote = lnote+3
3729 7 continue
3730 nbrests = 0
3731 end if
3732 c
3733 c Get 'floor' zmin for figures
3734 c Note: Will not come thru here on 1st note of unbeamed xtup, so figure height
3735 c won't be adjusted. If anyone ever needs that, need to duplicate this
3736 c functionality up above, before exiting.
3737 c
3738 if (figbass .and. (ivx.eq.1 .or. ivx.eq.ivxfig2)) then
3739 if (ivx .eq. 1) then
3740 ivf = 1
3741 else
3742 ivf = ivxfig2
3743 end if
3744 zmult = 1.2*(multb-1)
3745 ymin = 100.
3746 do 3 inb = 1, nnb
3747 if (isfig(ivf,ipb(inb))) then
3748 if (ulq(iv,ibc) .eq. 'u') then
3749 ybot = nolev(iv,ipb(inb))
3750 else
3751 ybot = islope(ivx)/slfac*xelsk(inb)+nolev1(ivx)
3752 * -stemlen-zmult
3753 end if
3754 ymin = min(ymin,ybot)
3755 end if
3756 3 continue
3757 maxdrop = ncmid(iv,ipb1)-4-ymin+5.01
3758 ifigdr(ivf,iline) = max(ifigdr(ivf,iline),maxdrop)
3759 end if
3760 c
3761 c Compute ornament levels if needed
3762 c
3763 NomOrnLev = ncmid(iv,ipb1)+5
3764 iorn = 0
3765 do 8 inb = 1 , nnb
3766 ip = ipb(inb)
3767 if (.not.btest(iornq(ivx,ip),23)) go to 8
3768 if (btest(irest(ivx,ip),26) .and. ulq(ivx,ibc).eq.'l') then
3769 c
3770 c letter-dynamic or hairpin ending under down-beamed
3771 c
3772 iorn = iorn+1
3773 ybeam = nolev1(ivx)-stemlen+islope(ivx)*xelsk(inb)/slfac+1
3774 * -1.2*(multb-1)
3775 ihornb(ivx,iorn) = min(nint(ybeam-3.),NomOrnLev-10)
3776 else if (.not.btest(ipl(ivx,ip),10)) then
3777 c
3778 c Bits 0-13: (stmgx+Tupf._) , 14: Down fermata, was F
3779 c 15: Trill w/o "tr", was U , 16-18 Editorial s,f,n , 19-21 TBD
3780 c
3781 c Non-chord. There IS an ornament. Need ihornb only if upbeam, and if
3782 c ornament is 1,2,3,5,6,7,8,9,10,15-21 (up- but not domn ferm.)
3783 c
3784 if (ulq(ivx,ibc).eq.'u' .and.
3785 * iand(iornq(ivx,ipb(inb)),4163566).gt.0) then
3786 iorn = iorn+1
3787 iornq(ivx,ip) = ibset(iornq(ivx,ip),22)
3788 ybeam = nolev1(ivx)+stemlen+islope(ivx)*xelsk(inb)/slfac-1
3789 * +1.2*(multb-1)
3790 ihornb(ivx,iorn) = max(nint(ybeam+3.),NomOrnLev)
3791 end if
3792 else
3793 c
3794 c In a chord. Orn may be on main note or non-main or both. Set ihornb if
3795 c upbeam and highest note has orn, or down beam and lowest. Find 1st chord note
3796 c
3797 do 10 icrd1 = 1 , ncrd
3798 if (iand(255,icrdat(icrd1)) .eq. ip .and.
3799 * iand(15,ishft(icrdat(icrd1),-8)) .eq. ivx) go to 11
3800 10 continue
3801 11 continue
3802 c
3803 c Find outermost note, min or max depending on beam direction ulq. xto is true
3804 c if there's an ornament on that note. Expand orn list to include ._, since if
3805 c on extreme chord note in beam, will move.
3806 c So ornaments are all except 0,4,13 (,g,)
3807 c
3808 levx = nolev(ivx,ip)
3809 xto = iand(iornq(ivx,ipb(inb)),4186094).gt.0
3810 icrdx = 0
3811 do 12 icrd = icrd1 , ncrd
3812 if (iand(255,icrdat(icrd)) .ne. ip .or.
3813 * iand(15,ishft(icrdat(icrd),-8)) .ne. ivx) go to 13
3814 levc = iand(127,ishft(icrdat(icrd),-12))
3815 if ((ulq(ivx,ibc).eq.'u'.and.levc.gt.levx) .or.
3816 * (ulq(ivx,ibc).eq.'l'.and.levc.lt.levx)) then
3817 levx = levc
3818 icrdx = icrd
3819 xto = iand(icrdorn(icrd),4186094).gt.0
3820 end if
3821 12 continue
3822 13 continue
3823 c
3824 c If there's orn on extreme note, do stuff
3825 c
3826 if (xto) then
3827 iorn = iorn+1
3828 if (ulq(ivx,ibc) .eq. 'u') then
3829 ybeam = nolev1(ivx)+stemlen+islope(ivx)*xelsk(inb)/slfac-1
3830 * +1.2*(multb-1)
3831 ihornb(ivx,iorn) = max(nint(ybeam+3.),NomOrnLev)
3832 else
3833 ybeam = nolev1(ivx)-stemlen+islope(ivx)*xelsk(inb)/slfac+1
3834 * -1.2*(multb-1)
3835 ihornb(ivx,iorn) = min(nint(ybeam-3.),NomOrnLev-10)
3836 end if
3837 if (icrdx .eq. 0) then
3838 c
3839 c Affected ornament is on main note
3840 c
3841 iornq(ivx,ip) = ibset(iornq(ivx,ip),22)
3842 else
3843 icrdorn(icrdx) = ibset(icrdorn(icrdx),22)
3844 end if
3845 end if
3846 end if
3847 8 continue
3848 c
3849 c Henceforth nornb will be a counter.
3850 c
3851 if (iorn .gt. 0) nornb(ivx)=1
3852 if (ixrest(ivx) .eq. 2) ixrest(ivx) = 0
3853 return
3854 end
3855 block data
3856 parameter (nm=24)
3857 common /comtol/ tol
3858 common /comtrans/ cheadq
3859 common /compage/ widthpt,ptheight,hoffpt,voffpt,
3860 * nsyst,nflb,ibarflb(0:40),
3861 * isysflb(0:40),npages,nfpb,ipagfpb(0:18),isysfpb(0:18),
3862 * usefig,fintstf,gintstf,fracsys(30),nmovbrk,isysmb(0:30),
3863 * nistaff(0:40)
3864 common /cblock/
3865 * etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
3866 * xilbn,xilbtc,xilhdr,xilfig,a,b,inhnoh
3867 common /cominbot/ inbothd
3868 logical usefig
3869 common /comstart/ facmtr
3870 character*60 cheadq
3871 character*120 instrq,titleq,compoq
3872 logical headlog
3873 common /comtitl/ instrq,titleq,compoq,headlog,inskip,ncskip,
3874 * inhead
3875 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
3876 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
3877 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
3878 * rtshfac
3879 common /combmh/ bmhgt,clefend
3880 common /comdyn/ ndyn,idyndat(99),levdsav(nm),ivowg(12),hoh1(12),
3881 * hoh2(12),hoh2h1(2),ntxtdyn,ivxiptxt(41),txtdynq(41),
3882 * idynda2(99),levhssav(nm),listcresc,listdecresc
3883 character*128 txtdynq
3884 logical kbdrests
3885 common /comkbdrests/ levbotr(8),levtopr(8),kbdrests
3886 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
3887 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
3888 logical EarlyTransOn,LaterInstTrans
3889 common /comsize/ isize(nm)
3890 c
3891 data tol /.001/
3892 data cheadq
3893 * /' '/
3894 data gslfac /9./
3895 data instrq,titleq,compoq,headlog /3*' ',.false./
3896 c
3897 c meter space (pts) = xb4mbr = musicsize*facmtr
3898 c
3899 data facmtr /0.55/
3900 data grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
3901 * flagfac,dotfac,bacfac,agc1fac,clefend,bmhgt
3902 * / 1.3333,.4 , .7 , .3 , 0.2 , 2.0 , 1.0 ,
3903 * .7,.7 ,.9 ,.5 ,2.3 ,1.1 /
3904 data rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,arpfac
3905 * / 1.32 , 2.25 , 0.47 , 0.83 , 0.17 , 0.5 , 1.7 /
3906 data rtshfac / 1.0 /
3907 data isize /nm*0/
3908 c
3909 c From other
3910 c
3911 data ptheight,widthpt,hoffpt,voffpt,
3912 * etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
3913 * xilbn,xilbtc,xilhdr,xilfig,a,b,inbothd,inhnoh
3914 * / 740. , 524. , 0., 0.,
3915 * .50 , .25 , 0.4 , 0.4 , 0.2 , 12. ,21. , 12.,
3916 * 4 , 1.6 ,5.,5.7,1.071,2.714,16 ,16 /
3917 data fracsys /30*0./
3918 data ivowg,hoh1,hoh2,hoh2h1 /0,0,0,0,0,1,1,1,1,1,1,1,
3919 c * 2.0,1.5,1.0,0.5,1.3,1.3,0.4,0.8,1.2,0.8,1.2,1.6,
3920 * 2.2,1.7,1.2,0.7,1.3,1.3,0.4,0.8,1.2,0.8,1.2,1.6,
3921 * -2.7,-2.2,-1.7,-1.2,-2.3,-2.1,-1.0,-1.7,-2.1,-1.6,-1.9,-2.3,
3922 * -0.3,0.3 /
3923 data kbdrests /.false./,
3924 * levtopr /9,7,5,5,7,5,6,6/, levbotr /0,0,0,2,1,4,5,4/
3925 data EarlyTransOn, LaterInstTrans /2*.false./
3926 data iInstTrans /nm*0/
3927 data iTransAmt /nm*0/
3928 end
3929 subroutine catspace(space,squez,nnsk)
3930 parameter (nkb=3999,maxblks=9600)
3931 common /c1omnotes/ nnodur,wminnh(nkb),nnpd(maxblks),durb(maxblks),
3932 * iddot,nptr(nkb),ibarcnt,mbrest,ibarmbr,
3933 * ibaroff,udsp(nkb),wheadpt,sqzb(maxblks)
3934 common /comtol/ tol
3935 do 16 iptr = nptr(ibarcnt) , nptr(ibarcnt+1)-1
3936 if (abs(space-durb(iptr)) .lt. tol) then
3937 if (abs(squez-sqzb(iptr)) .lt. tol) then
3938 c
3939 c Increment pre-existing entry
3940 c
3941 nnpd(iptr) = nnpd(iptr)+nnsk
3942 return
3943 end if
3944 end if
3945 16 continue
3946 c
3947 c Didn't find current duration & squez, so add a new entry.
3948 c No particular reason to keep in order, so add at the end.
3949 c
3950 nnpd(nptr(ibarcnt+1)) = nnsk
3951 durb(nptr(ibarcnt+1)) = space
3952 sqzb(nptr(ibarcnt+1)) = squez
3953 nptr(ibarcnt+1) = nptr(ibarcnt+1)+1
3954 return
3955 end
3956 character*1 function chax(n)
3957 c
3958 c The only reason for this seemingly do-nothing function is to get around an
3959 c apparent bug in the Visual Fortran Standard Edition 5.0.A compiler!
3960 c
3961 chax = char(n)
3962 return
3963 end
3964 subroutine checkdyn(lineq,iccount,ibar)
3965 character*128 lineq
3966 character*1 durq,chax
3967 character*4 dynsymq
3968 logical txtdyn
3969 txtdyn = .false.
3970 c
3971 c On entry, iccount is on "D"
3972 c
3973 if (lineq(iccount+1:iccount+1) .eq. chax(34)) then
3974 c
3975 c Dynamic text
3976 c
3977
3978 istart = iccount+2 ! 1 past 1st quote
3979 3 continue
3980 iend = index(lineq(istart:128),chax(34))
3981 if (lineq(istart+iend-2:istart+iend-2) .eq. chax(92)) then
3982 istart = iccount+iend+2
3983 go to 3
3984 end if
3985 if (iend .eq. 0) then
3986 call errmsg(lineq,iccount+1,ibar,
3987 * 'Dynamic text must be terminated with double quote!')
3988 call stop1()
3989 end if
3990 c
3991 c Set iccount to character after 2nd ", and set ipm
3992 c
3993 c iccount = iccount+iend+2
3994 iccount = istart+iend
3995 ipm = index('- +',lineq(iccount:iccount))
3996 if (ipm .eq. 0) then
3997 call errmsg(lineq,iccount,ibar,
3998 * 'Expected "-", "+", or blank here!')
3999 call stop1()
4000 end if
4001 else
4002 c
4003 c Expect ordinary dynamic
4004 c
4005 do 1 iend = iccount+2 , 128
4006 ipm = index('- +',lineq(iend:iend))
4007 if (ipm .gt. 0) go to 2
4008 1 continue
4009 2 continue
4010 if (iend-iccount.gt.5 .or. iend-iccount.lt.2) then
4011 call errmsg(lineq,iend-1,ibar,
4012 * 'Wrong length for dynamic mark!')
4013 call stop1()
4014 end if
4015 read(lineq(iccount+1:iend-1),'(a'//chax(47+iend-iccount)//')')
4016 * dynsymq
4017 idno = (index(
4018 * 'ppppppp pp p mp mf f fp sfz ff fff ffff< > ',
4019 * dynsymq)+3)/4
4020 if (idno .eq. 0) then
4021 call errmsg(lineq,iccount+1,ibar,'Illegal dynamic mark!')
4022 call stop1()
4023 end if
4024 iccount = iend
4025 end if
4026 if (ipm .ne. 2) then
4027 c
4028 c There is a vertical shift, have "+" or "-"
4029 c
4030 iccount = iccount+1
4031 if (index('0123456789',lineq(iccount:iccount)) .eq. 0) then
4032 call errmsg(lineq,iccount,ibar,
4033 * 'Expected integer here for vertical offset!')
4034 call stop1()
4035 end if
4036 call readnum(lineq,iccount,durq,fnum)
4037 idno = nint(fnum)
4038 if (idno .gt. 63) then
4039 call errmsg(lineq,iccount-1,ibar,
4040 * 'Vertical offset for dynamic mark must be (-63,63)!')
4041 call stop1()
4042 end if
4043 ipm = index('- +',durq)
4044 if (ipm .eq. 0) then
4045 call errmsg(lineq,iccount,ibar,
4046 * 'Expected "+", "-", or blank here!')
4047 call stop1()
4048 end if
4049 if (ipm .ne. 2) then
4050 c
4051 c There is a horizontal shift
4052 c
4053 iccount = iccount+1
4054 if (index('.0123456789',lineq(iccount:iccount)) .eq. 0) then
4055 call errmsg(lineq,iccount,ibar,
4056 * 'Expected number here for horizontal offset!')
4057 call stop1()
4058 end if
4059 call readnum(lineq,iccount,durq,fnum)
4060 idno = nint(10*fnum)
4061 if (idno .gt. 255) then
4062 call errmsg(lineq,iccount-1,ibar,
4063 * 'Horizontal offset for dynamic mark must be (-25.5,25.5)!')
4064 call stop1()
4065 else if (durq .ne. ' ') then
4066 call errmsg(lineq,iccount,ibar,
4067 * 'There should be a blank here!')
4068 call stop1()
4069 end if
4070 end if
4071 c
4072 c iccount should be on the blank at the end of the entire symbol
4073 c
4074 end if
4075 return
4076 end
4077 subroutine chkarp(ncrd,icrdat,ivx,ip,iscacc,isarp)
4078 c subroutine chkarp(found1,ncrd,icrdat,icrdot,ivx,ip,isacc,isarp,
4079 c * icashft)
4080 logical found1,iscacc,isarp,btest
4081 integer icrdat(193)
4082 found1 = .false.
4083 c
4084 c icashft will be max left shift of accid's in chord notes.
4085 c Used only for spacing checks.
4086 c Will include left shift of chord note itself.
4087 c Rezero after use.
4088 c
4089 do 18 icrd = 1 , ncrd
4090 c
4091 c This if block cycles thru all chord notes on ivx,ip; then returns.
4092 c
4093 if (iand(255,icrdat(icrd)) .eq. ip .and.
4094 * iand(15,ishft(icrdat(icrd),-8)) .eq. ivx) then
4095 found1 = .true.
4096 iscacc = iscacc .or.
4097 * (btest(icrdat(icrd),19).and..not.btest(icrdat(icrd),27))
4098 c
4099 c Accid on this chord note, and it's not midi-only.
4100 c
4101 c irshft = igetbits(icrdot(icrd),7,20)
4102 cc
4103 cc Include increment for notehead shift
4104 cc
4105 c if (btest(icrdat(icrd),23)) then
4106 c if (irshft .eq. 0) then
4107 c irshft = 44
4108 c else
4109 c irshft=irshft-20
4110 c end if
4111 c end if
4112 c if (irshft .ne. 0) then
4113 cc
4114 cc Accid on chord note is shifted. Include only left shift, in 20ths.
4115 cc
4116 c if (irshft .lt. 64) icashft = max(icashft,64-irshft)
4117 c end if
4118 c end if
4119 isarp = isarp .or. btest(icrdat(icrd),25)
4120 else if (found1) then
4121 return
4122 end if
4123 18 continue
4124 return
4125 end
4126 subroutine chkimidi(icm)
4127 parameter (nm=24,mv=24576)
4128 integer*2 mmidi
4129 logical restpend,relacc,notmain,twoline,ismidi,crdacc
4130 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
4131 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
4132 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
4133 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
4134 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
4135 * debugmidi
4136 logical debugmidi
4137 if (imidi(icm) .ge. mv) then
4138 print*
4139 print*,'Midi file is too long! It will be corrupted or worse'
4140 write(*,'(a6,2x,4i8)')
4141 * 'imidi:',imidi(0),imidi(1),imidi(2),imidi(3)
4142 end if
4143 return
4144 end
4145 subroutine chkkbdrests(ip,iv,ivx,nn,islur,irest,nolev,ivmx,
4146 c * nib,nv,ibar,tnow,tol,nodur,mode,levtopr,levbotr,mult)
4147 * nib,nv,ibar,tnow,tol,nodur,mode,levtopr,levbotr,mult,ipl)
4148 parameter (nm=24)
4149 integer*4 nn(nm),islur(nm,200),irest(nm,200),
4150 * nolev(nm,200),nib(nm,15),nodur(nm,200),levbotr(8),levtopr(8),
4151 * ivmx(nm,2),mult(nm,200),ipl(nm,200)
4152 c
4153 c On 130127 put this code, formerly in make2bar right before calling notex for
4154 c a single note/rest, into this subroutine, so the same logic could also be
4155 c with the calls to beamstrt/mid/end to adjust height of rests in xtups if the
4156 c keyboard rest option is selected
4157 c
4158 c mode=1 if called as before, 2 if for an xtup. Only affects check for
4159 c quarter rests, which will fix later.
4160 c
4161 c Get reference level: next following note if no intervening blank rests,
4162 c otherwise next prior note. Relative to bottom line.
4163 c
4164 c if (ip.ne.nn(ivx).and..not.btest(iornq(ivx,ip),30)) then
4165 if (ip.ne.nn(ivx).and..not.btest(ipl(ivx,ip),1)) then
4166 c
4167 c Not the last note and not "look-left" for level
4168 c
4169 do 8 kkp = ip+1 , nn(ivx)
4170 if (btest(islur(ivx,kkp),29)) go to 4
4171 if (.not.btest(irest(ivx,kkp),0)) then
4172 levnext = nolev(ivx,kkp)-ncmid(iv,kkp)+4 ! Relative to bottom line
4173 go to 9
4174 end if
4175 8 continue
4176 end if
4177 4 continue
4178 c
4179 c If here, there were no following notes or came to a blank rest, or
4180 c "look-left" option set. So look before
4181 c
4182 if (ip .eq. 1) return ! Get out if this is the first note.
4183 do 3 kkp = ip-1, 1, -1
4184 if (.not.btest(irest(ivx,kkp),0)) then
4185 levnext = nolev(ivx,kkp)-ncmid(iv,kkp)+4 ! Relative to bottom line
4186 go to 9
4187 end if
4188 3 continue
4189 return ! Pretty odd, should never be here, but get out if so.
4190 9 continue
4191 c
4192 c Find note in other voice at same time
4193 c
4194 iupdown = sign(1,ivx-nv-1)
4195 ivother = ivmx(iv,(3-iupdown)/2)
4196 tother = 0.
4197 do 5 kkp = 1 , nib(ivother,ibar)
4198 if (abs(tother-tnow) .lt. tol) go to 6
4199 tother = tother+nodur(ivother,kkp)
4200 5 continue
4201 c
4202 c If here, then no note starts in other voice at same time, so set default
4203 c
4204 levother = -iupdown*50
4205 go to 7
4206 6 continue
4207 c
4208 c If here, have just identified a simultaneous note or rest in other voice
4209 c
4210 if (.not.btest(irest(ivother,kkp),0)) then ! Not a rest, use it
4211 levother = nolev(ivother,kkp)-ncmid(iv,ip)+4
4212 else
4213 if (nodur(ivother,kkp) .eq. nodur(ivx,ip)) then
4214 c
4215 c Rest in other voice has same duration, get out (so defualt spacing is used)
4216 c
4217 return
4218 end if
4219 levother = -iupdown*50
4220 end if
4221 7 continue
4222 if (mode.eq.1) then
4223 indxr = log2(nodur(ivx,ip))+1
4224 else
4225 c nodu = 2**(4-(iand(mult(ivx,ip),15)-8))
4226 indxr = 4-(iand(mult(ivx,ip),15)-8)+1
4227 end if
4228 if (iupdown .lt. 0) then
4229 levtop = levtopr(indxr)
4230 iraise1 = levother-levtop-3 ! Based on other note
4231 iraise2 = levnext-levtop ! Based on following note
4232 if (indxr.eq.5 .and. levnext.lt.1) iraise2=iraise2+2
4233 iraise = min(iraise1,iraise2)
4234 if (mod(iraise+50,2).eq.1 .and.
4235 * iraise+levtop.gt.-1) iraise = iraise-1
4236 else
4237 levbot = levbotr(indxr)
4238 iraise1 = levother-levbot+3
4239 iraise2 = levnext-levbot
4240 if (indxr.eq.5 .and. levnext.gt.8) iraise2=iraise2-1
4241 iraise = max(iraise1,iraise2)
4242 if (mod(iraise+50,2).eq.1 .and.
4243 * iraise+levbot.le.9) iraise = iraise-1
4244 end if
4245 nolev(ivx,ip) = 100+iraise
4246 return
4247 end
4248 subroutine chklit(lineq,iccount,literr)
4249 character*128 lineq
4250 character*1 charq,chax
4251 literr = 0
4252 itype = 1
4253 17 call g1etchar(lineq,iccount,charq)
4254 if (charq .eq. chax(92)) then
4255 itype = itype+1
4256 if (itype .gt. 3) then
4257 literr = 1
4258 return
4259 end if
4260 go to 17
4261 end if
4262 lenlit = itype
4263 18 call g1etchar(lineq,iccount,charq)
4264 if (charq.eq.chax(92)) then
4265 call g1etchar(lineq,iccount,charq)
4266 if (charq .ne. ' ') then
4267 c
4268 c Starting a new tex command withing the string
4269 c
4270 lenlit = lenlit+2
4271 if (lenlit .gt. 128) then
4272 literr = 2
4273 return
4274 end if
4275 go to 18
4276 end if
4277 else
4278 lenlit = lenlit+1
4279 if (lenlit .gt. 128) then
4280 literr = 2
4281 return
4282 end if
4283 go to 18
4284 end if
4285 return
4286 end
4287 subroutine chkpm4ac(lineq,iccount,nacc,moved)
4288 c
4289 c Called after getting +/-/</> in a note (not rest). iccount is on the +-<>.
4290 c Sets moved=.true. and sets move parameters in nacc if necc: horiz only (bits
4291 c 10-16) if < or >, horiz and vert (bits 4-9) if two consecutive signed
4292 c numbers. If moved=.true., iccount on exit is on end of last number.
4293 c If moved=.false., iccount still on +/-
4294 c
4295 logical moved,ishorz
4296 character*128 lineq
4297 character*1 durq
4298 if (index('sfnA',lineq(iccount-1:iccount-1)).gt.0 .and.
4299 * index('0123456789.',lineq(iccount+1:iccount+1)).gt.0) then
4300 c
4301 c Prior char was accid & next is #; this may be start of accidental shift.
4302 c Must test for "." above in case we get "<" or ">"
4303 c
4304 ipm = index('- +< >',lineq(iccount:iccount))-2
4305 if (lineq(iccount+1:iccount+1).eq.'.' .and.
4306 * index('0123456789',lineq(iccount+2:iccount+2)).eq.0) then
4307 c
4308 c Rare case of [accid][+/-].[letter]. Bail out
4309 c
4310 moved = .false.
4311 return
4312 end if
4313 ishorz = ipm .gt. 1
4314 c
4315 c Save iccount in case it's not accid shift and we have to reset.
4316 c
4317 icsav = iccount
4318 iccount = iccount+1
4319 call readnum(lineq,iccount,durq,fnum)
4320 if (ishorz .or. index('+-',durq).gt.0) then
4321 c
4322 c This has to be accidental shift. Set vert. shift.
4323 c
4324 if (.not.ishorz) then
4325 c
4326 c +/- syntax, both shifts set, vertical first
4327 c
4328 call setbits(nacc,6,4,int(ipm*fnum+32.5))
4329 ipm = index('- +',durq)-2
4330 iccount = iccount+1
4331 call readnum(lineq,iccount,durq,fnum)
4332 else
4333 c
4334 c </> syntax, only horiz set
4335 c
4336 ipm = ipm-3
4337 end if
4338 c
4339 c Set horiz. shift
4340 c
4341 call setbits(nacc,7,10,nint(20*(ipm*fnum+5.35)))
4342 iccount = iccount-1
4343 moved = .true.
4344 else
4345 c
4346 c False alarm. Reset everything and flow onward
4347 c
4348 moved = .false.
4349 iccount = icsav
4350 end if
4351 else
4352 c
4353 c Either prior char was not 'sfn' or next was not digit, so take no action
4354 c
4355 moved = .false.
4356 end if
4357 return
4358 end
4359 subroutine clefsym(isl,notexq,lnote,nclef)
4360 c
4361 c Returns string calling Don's TeX macro \pmxclef, for drawing small clefs.
4362 c
4363 character*(*) notexq
4364 character*1 chax
4365 nclef = iand(ishft(isl,-12),7)
4366 if (nclef .eq. 0) then
4367 c
4368 c treble
4369 c
4370 nlev = 2
4371 else if (nclef .gt. 6) then
4372 c
4373 c French violin
4374 c
4375 nlev = 0
4376 else if (nclef .lt. 5) then
4377 c
4378 c C-clef
4379 c
4380 nlev = 2*nclef-2
4381 else
4382 c
4383 c F-clef
4384 c
4385 nlev = 2*nclef-6
4386 end if
4387 notexq = chax(92)//'pmxclef'//chax(48+min(nclef,7))
4388 * //chax(48+nlev)
4389 lnote = 10
4390 return
4391 end
4392 subroutine crdacc(nacc,naccid,micrd,nolevm,rmsshift,lasttime,
4393 * levmaxacc,icrdot0,segrb0,ksegrb0,nsegrb0,twooftwo,icashft)
4394 c
4395 c nacc = accidental bitmap for main note
4396 c naccid = # of accid's in chord
4397 c micrd = array with icrd #'s for notes w/ acc's, 0=>main note
4398 c nolevm = level of main note
4399 c segrb(1|2,.) x|y-coord of right-bdry segment
4400 c ksegrb(.) internal use; tells what defined this segment
4401 c -2: Left-shifted notehead
4402 c -1: Original right boundary
4403 c 0: Main note accidental
4404 c icrd: Chord-note accidental
4405 c isetshft(i),i=1,naccid: what set shift for this accid, same codes
4406 c icrdot0 = top-down level-rank of main note among accid-notes
4407 c icrdot(icrd)(27-29) = level rank of chord-note among accid-notes
4408 c twooftwo will be true 2nd time thru; signal to store shifts w/ notes
4409 c
4410 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
4411 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
4412 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
4413 real*4 segar(5,2,6),segal(5,2,6),segrb(2,50),segrb0(2,50)
4414 integer*4 nsegar(5),nsegal(5),micrd(10),iacctbl(6),ksegrb(50),
4415 * isetshft(10),ksegrb0(50)
4416 logical lasttime,mainnote,twooftwo
4417 data nsegar / 3,4,3,3,2 /, nsegal / 2,4,3,3,2 /
4418 data segar /
4419 c
4420 c Fancy sharp boundary. fl,sh,na,dfl,dsh
4421 c
4422 * -0.05,-0.38,-0.34,-.05, -.15,-1.4,-2.9,-3.0, -1.4, -1.2,
4423 c * -0.75,-0.20,-0.80, 0. , 0. , .96,-1.04,1.6, 0. , 0. ,
4424 c meas value for y, natural is 1.6
4425 * -0.75,-0.20,-0.80,-.75, 0. , .96,-1.04,1.48, .96, 1.2,
4426 * 0.00,-0.38, 0.00, 0. , 0. ,3.15, 1.64,3.0, 3.15, 0. ,
4427 * 0. , 0.00, 0. , 0. , 0. , 0. , 2.90, 0. , 0. , 0. ,
4428 * 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
4429 * 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. /
4430 data segal /
4431 c * 0.00, 0.00,-1.04, 0. , 0. ,3.15, 2.9,-1.6, 0. , 0. ,
4432 cc (meas. value is 3.08) ^^^^
4433 cc Raise top of flat so it interferes with bottom of sharp
4434 * -1.00,-1.02,-0.60,-1.65, -1.2,-1.4,-2.9, -3.0, -1.4, -1.2,
4435 * 0.00,-1.20,-1.04, 0. , 0. ,3.15,-1.64,-1.48,3.15, 1.2,
4436 * 0. ,-1.02, 0.00, 0. , 0. , 0. , 1.04, 3.0, 0. , 0. ,
4437 * 0. , 0.00, 0. , 0. , 0. , 0. , 2.9 , 0. , 0. , 0. ,
4438 * 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,
4439 * 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. /
4440 c
4441 c iacctbl(i) = internal accid # (1-5) when i=extern accid # (1,2,3,5,6)
4442 c
4443 data iacctbl / 1 , 2 , 3 , 0 , 4 , 5 /
4444 c
4445 c Set up barrier segrb(iseg,ipoint) to define coords of corner points
4446 c on stem+notes
4447 c
4448 do 11 iseg = 1 , nsegrb0
4449 segrb(1,iseg) = segrb0(1,iseg)
4450 segrb(2,iseg) = segrb0(2,iseg)
4451 ksegrb(iseg) = ksegrb0(iseg)
4452 11 continue
4453 nsegrb = nsegrb0
4454 rmsshift = 0.
4455 shiftmin = 1000.
4456 do 1 iwa = 1 , naccid
4457 c
4458 c Initialize shift for this note
4459 c
4460 shift = 0.
4461 mainnote = micrd(iwa).eq.0
4462 isetshft(iwa) = -1
4463 c
4464 c Get note level and accidental type
4465 c
4466 if (mainnote) then
4467 nolev = nolevm
4468 iacctype = iacctbl(igetbits(nacc,3,0))
4469 else
4470 nolev = igetbits(icrdat(micrd(iwa)),7,12)
4471 iacctype = iacctbl(igetbits(icrdat(micrd(iwa)),3,20))
4472 end if
4473 c
4474 c Cycle thru segments on right edge of this accidental
4475 c
4476 do 2 isega = 1 , nsegar(iacctype)-1
4477 ybotaseg = nolev+segar(iacctype,2,isega)
4478 ytopaseg = nolev+segar(iacctype,2,isega+1)
4479 c
4480 c Cycle thru segments of right-hand barrier
4481 c
4482 do 3 isegrb = 1 , nsegrb-1
4483 c
4484 c Must find all barrier segments that start below ytopseg & end above ybotseg
4485 c
4486 if (segrb(2,isegrb) .lt. ytopaseg) then
4487 c
4488 c Barrier seg starts below top of accid
4489 c Check if barrier seg ends above bottom of accid
4490 c
4491 if (segrb(2,isegrb+1) .gt. ybotaseg) then
4492 if (shift .gt.
4493 * segrb(1,isegrb)-segar(iacctype,1,isega)) then
4494 shift = segrb(1,isegrb)-segar(iacctype,1,isega)
4495 c
4496 c Record the cause of the shift
4497 c
4498 isetshft(iwa) = ksegrb(isegrb)
4499 end if
4500 end if
4501 c
4502 c Does barrier segment end above top of accid seg?
4503 c
4504 if (segrb(2,isegrb+1) .gt. ytopaseg) go to 4
4505 end if
4506 3 continue
4507 4 continue
4508 2 continue
4509 if (.not.btest(nacc,28) .and. abs(shift).gt.0.0001
4510 * .and. .not.lasttime) then
4511 c if (nolev .eq. levmaxacc) then
4512 if (nolev.eq.levmaxacc .and. isetshft(iwa).eq.-1) then
4513 rmsshift = 1000.
4514 return
4515 end if
4516 c
4517 c Does the following properly account for left-shifted noteheads?
4518 c
4519 c Top-down rank of this note we just shifted
4520 c
4521 if (mainnote) then
4522 irank = icrdot0
4523 else
4524 irank = igetbits(icrdot(micrd(iwa)),3,27)
4525 end if
4526 c
4527 c Compare level-rank of this note vs. that of note that caused the shift.
4528 c This has effect of checking for basic interferences from top down.
4529 c
4530 c ksegrb(.) internal use; tells what defined this segment
4531 c -2: Left-shifted notehead
4532 c -1: Original right boundary
4533 c 0: Main note accidental
4534 c icrd: Chord-note accidental
4535 c isetshft(i),i=1,naccid: what set shift for this accid, same codes
4536 c
4537 if (isetshft(iwa) .lt. 0) then
4538 iranksetter = 0
4539 else if (isetshft(iwa) .eq. 0) then
4540 iranksetter = icrdot0
4541 else
4542 iranksetter = igetbits(icrdot(isetshft(iwa)),3,27)
4543 end if
4544 if (iranksetter.ne.0 .and. irank.ne.iranksetter+1) then
4545 rmsshift = 1000.
4546 return
4547 end if
4548 end if
4549 rmsshift = rmsshift+shift**2
4550 if (lasttime .and. abs(shift).gt..0001) then
4551 if (mainnote) then
4552 if (.not.btest(nacc,29)) go to 10
4553 else
4554 if (.not.btest(icrdat(micrd(iwa)),29)) go to 10
4555 end if
4556 c
4557 c If here, "A" was set on a manual shift, so must cumulate the shift. Note that if there
4558 c was a manual shift but auto-shift was zero, will not come thru here, but shift value
4559 c will be left intact.
4560 c
4561 if (mainnote) then
4562 shift = shift+.05*(igetbits(nacc,7,10)-107)
4563 else
4564 shift = shift+.05*(igetbits(icrdot(micrd(iwa)),7,20)-107)
4565 end if
4566 10 continue
4567 if (twooftwo) then
4568 c
4569 c Record the shift for this accidental
4570 c
4571 if (shift .lt. -5.35) then
4572 call printl(' ')
4573 call printl('WARNING: auto-generated accidental '//
4574 * 'shift too big for PMX, ignoring')
4575 else
4576 ishift = nint(20*(shift+5.35))
4577 if (mainnote) then
4578 call setbits(nacc,7,10,ishift)
4579 else
4580 call setbits(icrdot(micrd(iwa)),7,20,ishift)
4581 end if
4582 end if
4583 else
4584 c
4585 c This is the earlier call to precrd, so need minimum shift
4586 c
4587 shiftmin = min(shiftmin,shift)
4588 end if
4589 end if
4590 c
4591 c Bail out if this is the last accidental to check
4592 c
4593 if (iwa .eq. naccid) go to 1
4594 c
4595 c Add this accidental to the right barrier! Count down from highest barrier segment,
4596 c find 1st one starting below top of accid, and first one starting below bot.
4597 c
4598 do 5 ibelowtop = nsegrb , 1 , -1
4599 if (segrb(2,ibelowtop) .lt.
4600 * nolev+segal(iacctype,2,nsegal(iacctype))) then
4601 do 9 ibelowbot = ibelowtop , 1 , -1
4602 if (segrb(2,ibelowbot) .lt.
4603 * nolev+segal(iacctype,2,1)) go to 6
4604 9 continue
4605 print*,'Oops2!'
4606 call stop1()
4607 end if
4608 5 continue
4609 print*,'Ugh0! in crdaccs'
4610 call stop1()
4611 6 continue
4612 netgain = nsegal(iacctype)-ibelowtop+ibelowbot
4613 c
4614 c Shift high segments up
4615 c
4616 if (netgain .ge. 0) then
4617 do 7 isegrb = nsegrb , ibelowtop+1 , -1
4618 segrb(1,isegrb+netgain) = segrb(1,isegrb)
4619 segrb(2,isegrb+netgain) = segrb(2,isegrb)
4620 ksegrb(isegrb+netgain) = ksegrb(isegrb)
4621 7 continue
4622 c
4623 c Set up 1st segment above accid
4624 c
4625 segrb(1,ibelowtop+netgain) = segrb(1,ibelowtop)
4626 segrb(2,ibelowtop+netgain) =
4627 * nolev+segal(iacctype,2,nsegal(iacctype))
4628 ksegrb(ibelowtop+netgain) = ksegrb(ibelowtop)
4629 else
4630 c
4631 c netgain<0, must remove segments. Use same coding but reverse order,
4632 c work from bottom up
4633 c
4634 segrb(1,ibelowtop+netgain) = segrb(1,ibelowtop)
4635 segrb(2,ibelowtop+netgain) =
4636 * nolev+segal(iacctype,2,nsegal(iacctype))
4637 ksegrb(ibelowtop+netgain) = ksegrb(ibelowtop)
4638 do 12 isegrb = ibelowtop+1 , nsegrb
4639 segrb(1,isegrb+netgain) = segrb(1,isegrb)
4640 segrb(2,isegrb+netgain) = segrb(2,isegrb)
4641 ksegrb(isegrb+netgain) = ksegrb(isegrb)
4642 12 continue
4643 end if
4644 c
4645 c Insert new segments
4646 c
4647 do 8 isega = 1 , nsegal(iacctype)-1
4648 segrb(1,ibelowbot+isega) = shift+segal(iacctype,1,isega)
4649 segrb(2,ibelowbot+isega) = nolev+segal(iacctype,2,isega)
4650 if (mainnote) then
4651 ksegrb(ibelowbot+isega) = 0
4652 else
4653 ksegrb(ibelowbot+isega) = micrd(iwa)
4654 end if
4655 8 continue
4656 c
4657 c Update number of barrier segments
4658 c
4659 nsegrb = nsegrb+netgain
4660 1 continue ! next accidental
4661 if (lasttime .and. .not.twooftwo) then
4662 c
4663 c This is the final call on the pre-ask pass, so compute left-shift rqmt.
4664 c
4665 icashft = nint(-20*shiftmin)
4666 end if
4667 return
4668 end
4669 subroutine crdaccs(nacc,ipl,irest,naccid,kicrd,nolevm,
4670 * levmaxacc,levminacc,icrdot0,twooftwo,icashft)
4671 c
4672 c nacc = accidental bitmap for main note
4673 c naccid = # of accid's in chord
4674 c kicrd = array with icrd #'s for notes w/ acc's, 0=>main note
4675 c nolevm = level of main note
4676 c
4677 c This is called once per multi-accidental chord. In here, loop over all
4678 c permutations of the order of accidental as stored in kicrd. Each time thru
4679 c loop, call crdacc once, get rms shift. Only save permutation and rms value
4680 c if it is less than old value.
4681 c
4682 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
4683 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
4684 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
4685 c
4686 c Make consistent? 120106
4687 c integer*4 kicrd(7),iperm(7),micrd(10),ipermsav(7),ksegrb0(50)
4688 integer*4 kicrd(10),iperm(7),micrd(10),ipermsav(7),ksegrb0(50)
4689 real*4 segrb0(2,50)
4690 logical btest,tagged,manual,lshift,twooftwo
4691 c
4692 c Initialize right-barrier
4693 c
4694 segrb0(1,1) = 0.
4695 segrb0(2,1) = -1000.
4696 segrb0(1,2) = 0.
4697 segrb0(2,2) = 1000.
4698 nsegrb0 = 2
4699 ksegrb0(1) = -1
4700 ksegrb0(2) = -1
4701 c
4702 c Search for left-shifted notes, Make up the initial right-barrier, which
4703 c will be good for all permutations.
4704 c irest()(27) is set if any notes are left-shifted
4705 c Must use ALL chord notes, not just ones w/ accid's.
4706 c
4707 if (btest(irest,27)) then
4708 do 15 icrd = icrd1-1, icrd2
4709 if (icrd .eq. icrd1-1) then
4710 c
4711 c Main note
4712 c
4713 c lshift = btest(ipl,8)
4714 lshift = btest(ipl,8) .or. btest(nacc,31)
4715 if (lshift) nolev = nolevm
4716 else
4717 c
4718 c Chord note
4719 c
4720 lshift = btest(icrdat(icrd),23)
4721 c if (lshift) nolev = igetbits(icrdat(icrd),7,12)
4722 if (lshift) then
4723 nolev = igetbits(icrdat(icrd),7,12)
4724 if (btest(nacc,31) .and. nolev.eq.nolevm+1) then
4725 c
4726 c This note is not really shifted, It is the upper of a 2nd with the main
4727 c note on an upstem, and Main note must be shifted.
4728 c nacc(31) signals the real truth.
4729 c
4730 lshift = .false.
4731 end if
4732 end if
4733 end if
4734 if (lshift) then
4735 do 16 isegrb = 1 , nsegrb0-1
4736 if (segrb0(2,isegrb+1) .gt. nolev-1) then
4737 c
4738 c Add this notehead to the right boundary here. Move all higher segs up 2.
4739 c
4740 do 17 iiseg = nsegrb0 , isegrb+1 , -1
4741 segrb0(1,iiseg+2) = segrb0(1,iiseg)
4742 segrb0(2,iiseg+2) = segrb0(2,iiseg)
4743 ksegrb0(iiseg+2) = ksegrb0(iiseg)
4744 17 continue
4745 go to 18
4746 end if
4747 16 continue
4748 18 continue
4749 c
4750 c Insert notehead into list. Set kseg=-2 to signal notehead shift.
4751 c
4752 iiseg = isegrb+1
4753 segrb0(1,iiseg) = -1.2
4754 segrb0(2,iiseg) = nolev-1.
4755 ksegrb0(iiseg) = -2
4756 segrb0(1,iiseg+1) = 0.
4757 segrb0(2,iiseg+1) = nolev+1.
4758 ksegrb0(iiseg+1) = -1
4759 nsegrb0 = nsegrb0+2
4760 end if
4761 15 continue
4762 end if
4763 c
4764 c Done setting right barrier for left-shifted noteheads
4765 c
4766 tagged = .false.
4767 manual = .false.
4768 c
4769 c Preprocess to check for manual shifts.
4770 c If are manual main [nacc(10-16)] or chord note [icrdot(20-26)]shifts, then
4771 c If any manual shift is preceded by "A" [nacc(29), icrdat(29)] then
4772 c 1. Auto-shifting proceeds
4773 c 2. "A"-shifts add to autoshifts
4774 c 3. non-"A" shifts are ignored!
4775 c Else (>0 man shifts, none has "A")
4776 c No auto-ordering, No autoshifts, Observe all manual shifts.
4777 c End if
4778 c End if
4779 c
4780 maxmanshft = 0
4781 do 13 i = 1 , naccid
4782 if (kicrd(i) .eq. 0) then
4783 c
4784 c Main note
4785 c
4786 manshft = igetbits(nacc,7,10)
4787 if (manshft .ne. 0) then
4788 manual = .true.
4789 if (btest(nacc,29)) then
4790 tagged = .true.
4791 else
4792 c maxmanshft = max(maxmanshft,64-manshft)
4793 maxmanshft = max(maxmanshft,107-manshft)
4794 end if
4795 end if
4796 else
4797 c
4798 c Chord note
4799 c
4800 manshft = igetbits(icrdot(kicrd(i)),7,20)
4801 if (manshft .ne. 0) then
4802 manual = .true.
4803 if (btest(icrdat(kicrd(i)),29)) then
4804 tagged = .true.
4805 else
4806 c maxmanshft = max(maxmanshft,64-manshft)
4807 maxmanshft = max(maxmanshft,107-manshft)
4808 end if
4809 end if
4810 end if
4811 13 continue
4812 if (manual) then
4813 if (tagged) then
4814 c
4815 c zero out all untagged shifts
4816 c
4817 do 14 i = 1 , naccid
4818 if (kicrd(i) .eq. 0) then
4819 if (.not.btest(nacc,29)) call setbits (nacc,7,10,0)
4820 else
4821 if (.not.btest(icrdat(kicrd(i)),29))
4822 * call setbits (icrdot(kicrd(i)),7,20,0)
4823 end if
4824 14 continue
4825 else
4826 c
4827 c There are manual shifts but none tagged. Only proceed if "Ao" was entered
4828 c
4829 if (.not.btest(nacc,28)) then
4830 icashft = maxmanshft
4831 return
4832 end if
4833 end if
4834 end if
4835 if (btest(nacc,28)) then
4836 c
4837 c Take the accidentals in order as originally input, then exit.
4838 c
4839 call crdacc(nacc,naccid,kicrd,nolevm,rmsshift,.true.,
4840 * idummy,idummy,segrb0,ksegrb0,nsegrb0,twooftwo,icashft)
4841 return
4842 c end if
4843 else if (naccid .eq. 3) then
4844 c
4845 c Special treatment if 3 accidentals in chord. If there aren't accids on a 2nd
4846 c then place in order top, bottom, middle.
4847 c
4848 do 20 i = 1 , 3
4849 if (kicrd(i) .eq. 0) then
4850 irank = icrdot0
4851 nolev = nolevm
4852 else
4853 irank = igetbits(icrdot(kicrd(i)),3,27)
4854 nolev = igetbits(icrdat(kicrd(i)),7,12)
4855 end if
4856 if (irank .eq. 1 ) then
4857 micrd(1) = kicrd(i)
4858 else
4859 micrd(5-irank) = kicrd(i)
4860 end if
4861 if (irank .eq. 2) then
4862 levmidacc = nolev
4863 end if
4864 20 continue
4865 if (levmaxacc.ne.levmidacc+1 .and.
4866 * levmidacc.ne.levminacc+1) then
4867 call crdacc(nacc,naccid,micrd,nolevm,rmsshift,.true.,
4868 * idummy,idummy,segrb0,ksegrb0,nsegrb0,twooftwo,icashft)
4869 return
4870 end if
4871 end if
4872 rmsmin = 100000.
4873 c
4874 c Initialize permutation array
4875 c
4876 do 7 i = 1 , naccid
4877 iperm(i) = i
4878 7 continue
4879 c
4880 c Start looping over permutations
4881 c
4882 do 8 ip = 1 , 5041
4883 if (ip .ne. 1) then
4884 c
4885 c Work the magic algorithm to get the next permutation
4886 c
4887 do 1 k = naccid-1 , 1 , -1
4888 if (iperm(k) .le. iperm(k+1)) go to 2
4889 1 continue
4890 c
4891 c If here, we just got the last permutation, so exit the loop over permutations
4892 c
4893 go to 10
4894 2 continue
4895 do 3 j = naccid , 1 , -1
4896 if (iperm(k) .le. iperm(j)) go to 4
4897 3 continue
4898 4 continue
4899 it = iperm(j)
4900 iperm(j) = iperm(k)
4901 iperm(k) = it
4902 is = k+1
4903 do 5 ir = naccid , 1 , -1
4904 if (ir .le. is) go to 6
4905 it = iperm(ir)
4906 iperm(ir) = iperm(is)
4907 iperm(is) = it
4908 is = is+1
4909 5 continue
4910 6 continue
4911 end if
4912 c
4913 c New we have a permutation. Take icrd values out of kicrd and put them into
4914 c micrd in the order of the permutation
4915 c
4916 do 9 i = 1 , naccid
4917 micrd(i) = kicrd(iperm(i))
4918 9 continue
4919 call crdacc(nacc,naccid,micrd,nolevm,rmsshift,.false.,
4920 * levmaxacc,icrdot0,segrb0,ksegrb0,nsegrb0,twooftwo,icashft)
4921 if (rmsshift .lt. rmsmin) then
4922 c
4923 c Save this permutation, reset minrms
4924 c
4925 do 11 i = 1 , naccid
4926 ipermsav(i) = iperm(i)
4927 rmsmin = rmsshift
4928 11 continue
4929 end if
4930 8 continue
4931 print*,'Should not BEEEEEE here!'
4932 call stop1()
4933 10 continue
4934 c
4935 c Done looping, get info for the final choice
4936 c
4937 do 12 i = 1 , naccid
4938 micrd(i) = kicrd(ipermsav(i))
4939 12 continue
4940 call crdacc(nacc,naccid,micrd,nolevm,rmsshift,.true.,
4941 * idummy,idummy,segrb0,ksegrb0,nsegrb0,twooftwo,icashft)
4942 return
4943 end
4944 subroutine doacc(ihshft,ivshft,notexq,lnote,nacc,nolev,ncm,caut)
4945 character*1 sq,chax
4946 character*3 acsymq
4947 character*8 noteq
4948 character*79 notexq
4949 logical btest,caut
4950 sq = chax(92)
4951 if (ihshft .eq. -107) ihshft=0
4952 c
4953 c If main note shifted left, so shift accid. Terminate below, when acc. is done.
4954 c
4955 if (ihshft .ne. 0) then
4956 c
4957 c Accid must be shifted horizontally
4958 c
4959 if (ihshft .lt. 0) then
4960 notexq = sq//'loffset{'
4961 ihshft = -ihshft
4962 else
4963 notexq = sq//'roffset{'
4964 end if
4965 hshft = .05*ihshft
4966 if (hshft .lt. 1.) then
4967 write(notexq(10:12),'(f3.2)')hshft
4968 lnote = 12
4969 else
4970 write(notexq(10:13),'(f4.2)')hshft
4971 lnote = 13
4972 end if
4973 notexq = notexq(1:lnote)//'}{'//sq
4974 lnote = lnote+3
4975 else
4976 notexq = sq
4977 lnote = 1
4978 end if
4979 if (btest(nacc,3)) then
4980 notexq = notexq(1:lnote)//'big'
4981 lnote = lnote+3
4982 end if
4983 if (caut) then
4984 c
4985 c Cautionary accidental. Need to define bigcna,... in pmx.tex
4986 c
4987 notexq = notexq(1:lnote)//'c'
4988 lnote = lnote+1
4989 end if
4990 call accsym(nacc,acsymq,lacc)
4991 notexq = notexq(1:lnote)//acsymq(1:lacc)
4992 lnote = lnote+lacc
4993 noleva = nolev
4994 if (ivshft .ne. 0) noleva = noleva+ivshft-32
4995 call notefq(noteq,lnoten,noleva,ncm)
4996 if (lnoten .eq. 1) call addblank(noteq,lnoten)
4997 notexq = notexq(1:lnote)//noteq(1:lnoten)
4998 lnote = lnote+lnoten
4999 if (ihshft .ne. 0) then
5000 c
5001 c Terminate horizontal shift
5002 c
5003 notexq = notexq(1:lnote)//'}'
5004 lnote = lnote+1
5005 end if
5006 return
5007 end
5008 subroutine docrd(ivx,ip,nodu,ncm,iv,tnow,soutq,lsout,ulq,ibmcnt,
5009 * islur,nvmx,nv,beamon,nolevm,ihornb,nornb,stemlen,
5010 * dotxtup,nacc,irest)
5011 parameter (nm=24,mv=24576)
5012 integer*4 irest(nm,24)
5013 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
5014 * xinsnow,lowdot
5015 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
5016 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
5017 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
5018 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
5019 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
5020 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
5021 * rtshfac
5022 integer*2 mmidi,iinsiv
5023 logical restpend,relacc,notmain,twoline,ismidi,crdacc
5024 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
5025 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
5026 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
5027 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
5028 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
5029 * debugmidi
5030 logical debugmidi
5031 logical lowdot,dotxtup
5032 integer*4 ihornb(nm,24),nornb(nm)
5033 character*1 ulq(nm,9),chax
5034 character*7 nosymq
5035 character*8 noteq
5036 character*79 notexq,outq
5037 character*80 soutq
5038 logical btest,isleft,isright,beamon
5039 character*79 inameq
5040 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
5041 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
5042 * lnam(nm),inameq(nm)
5043 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
5044 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
5045 logical EarlyTransOn,LaterInstTrans
5046 common /commidisig/ midisig
5047 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
5048 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
5049 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
5050 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
5051 c
5052 c This subr. once produced notexq for entire chord. 10/18/97 altered to write
5053 c chord notes as we go. 10/22/97 find range of icrd first.
5054 c 2/25/98 moved rangefinding to precrd so done before slurs, so now
5055 c on entry, icrd1, icrd2 define range of icrd for this chord.
5056 c
5057 c Set counter (for this note) for chord notes present. Set notmain=T.
5058 c Will test for notmain=.true. in addmidi to tell whether to save pitch.
5059 c
5060 nmidcrd = 0
5061 notmain = .true.
5062 crdacc = .false.
5063 do 5 icrd = icrd1 , icrd2
5064 lnote = 0
5065 nolev = igetbits(icrdat(icrd),7,12)
5066 c
5067 c 3/8/03 save original pitch to use in midi, in case 2nds alter things.
5068 c
5069 nolevo = nolev
5070 c
5071 c Check for special situations with 2nds (see precrd).
5072 c
5073 if (btest(nacc,30) .and. nolev.eq.nolevm-1) then
5074 c
5075 c Upstem, 2nd with upper as main, interchange pitches,
5076 c rt-shift upper (now chord note). Lower (orig chord, now main)
5077 c if dotted, probably had shifted dot, dot parameters must be moved
5078 c from chord to main
5079 c
5080 nolev = nolevm
5081 if (btest(icrdat(icrd),26)) then
5082 c
5083 c Orig. chord note dot shift, must transfer to main.
5084 c
5085 icrdotsav = icrdot(icrd)
5086 icrdatsav = icrdat(icrd)
5087 if (btest(irest(ivx,ip),19)) then
5088 c
5089 c Main note (upper) had a dot shift, must move it to chord
5090 c
5091 call setbits(icrdat(icrd),1,26,1)
5092 call setbits(icrdot(icrd),7,0,
5093 * nint(updot(ivx,ndotmv(ivx)+1)*10)+64)
5094 call setbits(icrdot(icrd),7,7,
5095 * nint(rtdot(ivx,ndotmv(ivx)+1)*10)+64)
5096 c
5097 c May need to worry about other chord params (accid shefts etc) later
5098 c
5099 else
5100 icrdat(icrd) = ibclr(icrdat(icrd),26)
5101 end if
5102 c
5103 c We are adding a main note dot shift, so push any later ones back
5104 c
5105
5106 if (.not.btest(irest(ivx,ip),19)) then
5107 maxdotmv(ivx) = maxdotmv(ivx)+1
5108 do 1 indm = maxdotmv(ivx) , ndotmv(ivx)+2 , -1
5109 updot(ivx,indm) = updot(ivx,indm-1)
5110 rtdot(ivx,indm) = rtdot(ivx,indm-1)
5111 1 continue
5112 end if
5113 irest(ivx,ip) = ibset(irest(ivx,ip),19)
5114 updot(ivx,ndotmv(ivx)+1) = 0.1*(iand(127,icrdotsav)-64)
5115 rtdot(ivx,ndotmv(ivx)+1) =
5116 * 0.1*(iand(127,ishft(icrdotsav,-7))-64)
5117 end if
5118 else if (btest(nacc,31) .and. nolev.eq.nolevm+1) then
5119 c
5120 c Downstem, 2nd with lower as main, interchange pitches,
5121 c left-shift lower (now chord note). Lower (orig main, now chord)
5122 c probably had shifted dot, dot parameters must be moved from
5123 c main to chord
5124 c
5125 nolev = nolevm
5126 if (btest(irest(ivx,ip),19)) then
5127 icrdotsav = icrdot(icrd)
5128 icrdatsav = icrdat(icrd)
5129 icrdat(icrd) = ibset(icrdat(icrd),26)
5130 c bits in icrdot
5131 c 0-6 10*abs(vertical dot shift in \internote) + 64
5132 c 7-13 10*abs(horizontal dot shift in \internote) + 64
5133 c Assuming >0 for now!
5134 call setbits(icrdot(icrd),7,0,
5135 * nint(updot(ivx,ndotmv(ivx)+1)*10)+64)
5136 call setbits(icrdot(icrd),7,7,
5137 * nint(rtdot(ivx,ndotmv(ivx)+1)*10)+64)
5138 c
5139 c Must also set dot shift for (now) main note (orig. chord note).
5140 c
5141 if (btest(icrdatsav,26)) then
5142 updot(ivx,ndotmv(ivx)+1) = 0.1*(iand(127,icrdotsav)-64)
5143 rtdot(ivx,ndotmv(ivx)+1) =
5144 * 0.1*(iand(127,ishft(icrdotsav,-7))-64)
5145 else
5146 c
5147 c No dot move on original chord (now main) note,
5148 c
5149 updot(ivx,ndotmv(ivx)+1) = 0.
5150 rtdot(ivx,ndotmv(ivx)+1) = 0.
5151 end if
5152 end if
5153 end if
5154 c
5155 c Lower dot for lower-voice notes?. Conditions are:
5156 c 1. Dotted time value
5157 c 2. Lower voice of two
5158 c 3. Note is on a line
5159 c 4. Not a rest (cannot be a rest in a chord!)
5160 c. 5. Flag (lowdot) is set to true
5161 c
5162 if (lowdot .and. nvmx.eq.2 .and. ivx.le.nv) then
5163 if (2**log2(nodu).ne.nodu .and. mod(nolev-ncm,2).eq.0) then
5164 if (btest(icrdat(icrd),26)) then
5165 c
5166 c Note already in movdot list. Drop by 2.
5167 c
5168 call setbits(icrdot(icrd),7,0,
5169 * igetbits(icrdot(icrd),7,0)-20)
5170 else
5171 c
5172 c Not in list so just move it right now
5173 c
5174 call dotmov(-2.,0.,soutq,lsout,igetbits(islur,1,3))
5175 end if
5176 end if
5177 end if
5178 if (btest(icrdat(icrd),26)) then
5179 c
5180 c Move the dot. Basic call for chord notes, not main note.
5181 c
5182 updotc = 0.1*(iand(127,icrdot(icrd))-64)
5183 rtdotc = 0.1*(iand(127,ishft(icrdot(icrd),-7))-64)
5184 call dotmov(updotc,rtdotc,soutq,lsout,igetbits(islur,1,3))
5185 end if
5186 isleft = btest(icrdat(icrd),23)
5187 isright = btest(icrdat(icrd),24)
5188 c
5189 c Check for ornament in chord.
5190 c
5191 if (icrdorn(icrd) .gt. 0) then
5192 call putorn(icrdorn(icrd),nolev,nolevm,nodu,nornb,ulq,
5193 * ibmcnt,ivx,ncm,islur,nvmx,nv,ihornb,stemlen,outq,lout,
5194 * ip,0,beamon,.true.)
5195 call addstr(outq,lout,soutq,lsout)
5196 end if
5197 c
5198 c Chord-note symbol. First check for breve
5199 c
5200 if (nodu .eq. 128) then
5201 nosymq = chax(92)//'zbreve'
5202 lsym = 7
5203 else
5204 c
5205 c Not a breve chord. Get first letters in chord-note symbol
5206 c
5207 if (isleft) then
5208 nosymq = chax(92)//'l'
5209 else if (isright) then
5210 nosymq = chax(92)//'r'
5211 else
5212 nosymq = chax(92)//'z'
5213 end if
5214 if (nodu .ge. 64) then
5215 nosymq = nosymq(1:2)//'w'
5216 else if (nodu .ge. 32) then
5217 nosymq = nosymq(1:2)//'h'
5218 else
5219 nosymq = nosymq(1:2)//'q'
5220 end if
5221 if (2**log2(nodu).eq.nodu .and. .not.dotxtup) then
5222 lsym = 3
5223 else if (.not.btest(islur,3) .or. dotxtup) then
5224 c
5225 c Single dot
5226 c
5227 nosymq = nosymq(1:3)//'p'
5228 lsym = 4
5229 else
5230 c
5231 c Double dot
5232 c
5233 nosymq = nosymq(1:3)//'pp'
5234 lsym = 5
5235 end if
5236 end if
5237 if (btest(icrdat(icrd),19).and..not.btest(icrdat(icrd),27)) then
5238 c
5239 c Accidental and not MIDI-only. Build up bits 0-3 of nacc
5240 c
5241 nactmp = igetbits(icrdat(icrd),3,20)
5242 c
5243 c Kluge for bigness. Only means 'As' has not been issued
5244 c
5245 if (bacfac .ne. 1.e6) nactmp = nactmp+8
5246 call doacc(igetbits(icrdot(icrd),7,20)-107,
5247 * igetbits(icrdot(icrd),6,14),
5248 c * notexq,lnote,nactmp,nolev,ncmid(iv,ip))
5249 c Get original nolev, not altered to deal with 2nds
5250 * notexq,lnote,nactmp,igetbits(icrdat(icrd),7,12),
5251 * ncmid(iv,ip),btest(icrdat(icrd),31))
5252 notexq = notexq(1:lnote)//nosymq
5253 crdacc = .true.
5254 else
5255 notexq = nosymq
5256 end if
5257 lnote = lnote+lsym
5258 c
5259 c Get note name (again if accid, due to possible octave jump)
5260 c
5261 call notefq(noteq,lnoten,nolev,ncm)
5262 if (lnoten.eq.1) call addblank(noteq,lnoten)
5263 c
5264 c Put in note name
5265 c
5266 notexq = notexq(1:lnote)//noteq
5267 lnote = lnote+lnoten
5268 if (btest(icrdat(icrd),25)) then
5269 c
5270 c Arpeggio signal
5271 c
5272 call putarp(tnow,ivx,ip,nolev,ncm,soutq,lsout)
5273 end if
5274 call addstr(notexq,lnote,soutq,lsout)
5275 if (ismidi) then
5276 c
5277 c Here is where we collect MIDI pitch info for the chord note. By checking
5278 c notmain, addmidi(...) knows to just compute the
5279 c pitch number and store it in mcpitch(nmidcrd). Then on call to addmidi()
5280 c for MAIN note, will put in note codes for all chord notes + main note.
5281 c
5282 kv = 1
5283 if (ivx .gt. iv) kv=2
5284 nmidcrd = nmidcrd+1
5285 if (nmidcrd .gt. 20) then
5286 print*
5287 print*,'21 chord notes is too many for midi processor'
5288 call stop1()
5289 end if
5290 c
5291 c Use original saved pitch level, unaltered by 2nds logic.
5292 c
5293 call addmidi(midchan(iv,kv),nolevo+miditran(instno(iv)),
5294 * igetbits(icrdat(icrd),3,20),midisig,1.,
5295 * .false.,.false.)
5296 end if
5297 5 continue
5298 notmain = .false.
5299 return
5300 end
5301 subroutine dodyn(ivx,ip,nolev,ncm,ipl,islur,irest,nvmx,nv,
5302 * beamon,ihornb,nornb,ulq,ibmcnt,nostem,soutq,lsout)
5303 parameter (nm=24)
5304 c
5305 c Inputs are array *elements* except ihornb,nornb,ulq
5306 c
5307 common /commus/ musize,whead20
5308 common /comdyn/ ndyn,idyndat(99),levdsav(nm),ivowg(12),hoh1(12),
5309 * hoh2(12),hoh2h1(2),ntxtdyn,ivxiptxt(41),txtdynq(41),
5310 * idynda2(99),levhssav(nm),listcresc,listdecresc
5311 character*128 txtdynq
5312 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
5313 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
5314 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
5315 logical btest,beamon,upstem,nostem
5316 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
5317 * ,WrotePsslurDefaults,SlurCurve
5318 logical fontslur,upslur,WrotePsslurDefaults
5319 character*1 udqq,chax,ulq(nm,9)
5320 character*4 dynstrq
5321 character*5 numpq
5322 character*48 dyntablq,tempq
5323 character*79 notexq
5324 character*80 soutq
5325 integer*4 ihornb(nm,24),nornb(nm),idynn(10)
5326 common /comhair/ ihairuse,idhair(nm)
5327 data dyntablq /'ppppppp pp p mp mf f fp sfz ff fff ffff'/
5328 numdyn = 0
5329 c
5330 c Find dynamics for (ivx,ip) in list. May be as many as 4. Store idyn values
5331 c in idynn(1...4)
5332 c
5333 do 1 idyn = 1 , ndyn
5334 ivxtent = iand(idyndat(idyn),15)
5335 * +16*igetbits(idynda2(idyn),1,10)
5336 if (ivxtent .eq. ivx) then
5337 iptent = igetbits(idyndat(idyn),8,4)
5338 if (iptent .eq. ip) then
5339 numdyn = numdyn+1
5340 idynn(numdyn) = idyn
5341 else if (iptent .gt. ip) then
5342 c
5343 c I don't think there are any more possible for this ivx,ip, so exit loop
5344 c
5345 go to 2
5346 end if
5347 end if
5348 1 continue
5349 2 continue
5350 c
5351 c At this point there is a list of idyn's in idynn(1...numdyn)
5352 c Compute level, and stem-dir'n-based horizontal tweaks
5353 c
5354 hoffsd = 0.
5355 c
5356 c Set upstem to false as default
5357 c
5358 upstem = .false.
5359 if (btest(irest,0)) then
5360 c
5361 c It's a rest. Assume it doesn't go below the staff
5362 c
5363 lbot = ncm-4
5364 else if (.not.beamon) then
5365 if (udqq(nolev,ncm,islur,nvmx,ivx,nv).eq.'u' .or. nostem) then
5366 upstem = .true.
5367 if (.not.btest(ipl,10)) then
5368 lbot = min(nolev-1,ncm-4)
5369 else
5370 lbot = min(minlev-1,ncm-4)
5371 end if
5372 else
5373 hoffsd = -.5
5374 if (.not.btest(ipl,10)) then
5375 lbot = min(nolev-7,ncm-4)
5376 else
5377 lbot = min(minlev-7,ncm-4)
5378 end if
5379 end if
5380 else
5381 if (ulq(ivx,ibmcnt) .eq. 'u') then
5382 upstem = .true.
5383 if (.not.btest(ipl,10)) then
5384 lbot = min(nolev-1,ncm-4)
5385 else
5386 lbot = min(minlev-1,ncm-4)
5387 end if
5388 else
5389 hoffsd = -.5
5390 if (nornb(ivx).eq.0) then
5391 lbot = 1
5392 else
5393 lbot = ihornb(ivx,nornb(ivx))+1
5394 end if
5395 if (lbot .eq. 1) then
5396 c
5397 c Kluge for non-beamed, down xtup, for which ihorb was never set.
5398 c Assumes stem is shortened.
5399 c
5400 lbot = nolev-5
5401 end if
5402 nornb(ivx) = nornb(ivx)+1
5403 end if
5404 end if
5405 lbot = lbot-5
5406 jtxtdyn1 = 1
5407 c
5408 c Now ready to loop over current dyn's
5409 c
5410 do 3 icntdyn = 1 , numdyn
5411 idynd = idyndat(idynn(icntdyn))
5412 idynd2 = idynda2(idynn(icntdyn))
5413 idno = igetbits(idynd,4,12)
5414 c ivx = iand(15,idynd)
5415 ivx = iand(15,idynd)+16*igetbits(idynd2,1,10)
5416 c
5417 c Build the command into notex in stages. Insert name & rq'd args in order:
5418 c
5419 c Command name
5420 c hpstrt, hpcend, hpdend, pmxdyn
5421 c ivx
5422 c X X X
5423 c level
5424 c X X X
5425 c hoff
5426 c X X X X
5427 c d-mark
5428 c X
5429 c
5430 if (idno .eq. 0) then
5431 c
5432 c Text-dynamic
5433 c
5434 notexq = chax(92)//'txtdyn'
5435 lnote = 7
5436 else if (idno .le. 12) then
5437 c
5438 c Letter-group
5439 c
5440 notexq = chax(92)//'pmxdyn'
5441 lnote = 7
5442 else if (fontslur) then
5443 lnote = 7
5444 if (idno .eq. 13) then
5445 c
5446 c Start a font-based hairpin
5447 c
5448 notexq = chax(92)//'hpstrt'
5449 else if (idno .eq. 14) then
5450 c
5451 c End crescendo
5452 c
5453 notexq = chax(92)//'hpcend'
5454 else
5455 c
5456 c End decrescendo
5457 c
5458 notexq = chax(92)//'hpdend'
5459 end if
5460 c
5461 c Put in voice number as ID for font-based hairpin
5462 c
5463 if (ivx .le. 9) then
5464 notexq = notexq(1:lnote)//char(48+ivx)
5465 lnote = lnote+1
5466 else if (ivx .le. 19) then
5467 notexq = notexq(1:lnote)//'{1'//char(38+ivx)//'}'
5468 lnote = lnote+4
5469 else
5470 notexq = notexq(1:lnote)//'{2'//char(28+ivx)//'}'
5471 lnote = lnote+4
5472 end if
5473 else
5474 c
5475 c Postscript hairpins
5476 c
5477 lnote = 7
5478 if (idno .eq. 13) then
5479 notexq = chax(92)//'Icresc'
5480 else if (idno .eq.14) then
5481 notexq = chax(92)//'Idecresc'
5482 lnote = 9
5483 else
5484 notexq = chax(92)//'Tcresc'
5485 end if
5486 if (idno .le. 14) then
5487 c
5488 c Get and record ID no for start of ps hairpin
5489 c Find first unused ID
5490 c
5491 do 8 idh = 1 , 24
5492 if (.not.btest(ihairuse,idh)) go to 9
5493 8 continue
5494 call printl('Bad place in putdyn, call Dr. Don')
5495 call stop1()
5496 9 continue
5497 ihairuse = ibset(ihairuse,idh)
5498 idhair(ivx) = idh
5499 else
5500 c
5501 c Unrecord ID no for end of ps hairpin
5502 c
5503 call setbits(ihairuse,1,idhair(ivx),0)
5504 end if
5505 c
5506 c Write ID # for start or end of ps hairpin
5507 c
5508 idh = idhair(ivx)
5509 if (idh .le. 9) then
5510 notexq = notexq(1:lnote)//char(48+idh)
5511 lnote = lnote+1
5512 else if (idh .le. 19) then
5513 notexq = notexq(1:lnote)//'{1'//char(38+idh)//'}'
5514 lnote = lnote+4
5515 else
5516 notexq = notexq(1:lnote)//'{2'//char(28+idh)//'}'
5517 lnote = lnote+4
5518 end if
5519 end if
5520 c
5521 c Begin setting level
5522 c
5523 lbot1 = lbot
5524 if (idno.gt.0 .and. idno.le.5) then
5525 c
5526 c All letters are short so raise a bit.
5527 c
5528 lbot1 = lbot1+1
5529 else if (idno .ge. 13) then
5530 lbot1 = lbot1+2
5531 end if
5532 c
5533 c Convert so reference is bottom line
5534 c
5535 lbot1 = lbot1-ncm+4
5536 if ((fontslur.and.idno.eq.13) .or.
5537 * ((.not.fontslur).and.(idno.eq.13.or.idno.eq.14))) then
5538 c
5539 c Hairpin start. Save level and user-tweak before applying user tweak.
5540 c
5541 levdsav(ivx) = lbot1
5542 levhssav(ivx) = 0
5543 if (btest(idynd,16)) levhssav(ivx) = -64+igetbits(idynd,7,17)
5544 else if ((fontslur.and.idno.ge.14) .or. idno.eq.15) then
5545 c
5546 c Hairpin end; Compare level with saved start level before user-tweaks
5547 c
5548 lbot1 = min(lbot1,levdsav(ivx))
5549 c
5550 c Save pre-tweak level
5551 c
5552 lpretweak = lbot1
5553 end if
5554 c
5555 c Check for user-defined vertical tweak
5556 c
5557 if (btest(idynd,16)) lbot1 = lbot1-64+igetbits(idynd,7,17)
5558 c
5559 c Now horizontal stuff
5560 c
5561 hoff = hoffsd
5562 c
5563 c Some special horizontal tweaks
5564 c
5565 if (upstem .and. idno.gt.0 .and.
5566 * (idno.le.4 .or. idno.eq.8 .or. idno.eq.9)) hoff = hoff+.4
5567 c
5568 c User-defined tweaks
5569 c
5570 if (btest(idynd2,0))
5571 * hoff = hoff+(igetbits(idynd2,9,1)-256)*.1
5572 if (numdyn .gt. 1) then
5573 c
5574 c Horizontal-interaction-based tweaks.
5575 c
5576 c Cases:
5577 c numdyn type1 type2 type3 data used
5578 c 2 wrd-grp hrpnstrt - ivowg(1...12),hoh1(1...12)
5579 c 2 hrpnend wrd-grp - ivowg,hoh2
5580 c 2 hrpnend hrpnstrt - hoh2h1(1...2)
5581 c 3 hrpnend wrd-grp hrpnstrt ivowg,hoh2,hoh1
5582 c
5583 if (idno.gt.0 .and. idno.le.12) then
5584 c
5585 c Word-group, may need vertical tweak to line up.
5586 c
5587 lbot1 = lbot1+ivowg(idno)
5588 c
5589 c Protecting against hp start-stop on same note
5590 c
5591 else if (((fontslur.and.idno.ge.14).or.idno.eq.15)
5592 * .and. icntdyn.lt.numdyn) then
5593 c
5594 c Hairpin ending, check next type
5595 c
5596 if ((fontslur .and.
5597 * igetbits(idyndat(idynn(icntdyn+1)),4,12).eq.13)
5598 * .or. (.not.fontslur .and.
5599 * ((igetbits(idyndat(idynn(icntdyn+1)),4,12).eq.13)
5600 * .or.
5601 * (igetbits(idyndat(idynn(icntdyn+1)),4,12).eq.14))))
5602 * then
5603 c
5604 c Hairpin end then hairpin start, no words, (remember dealing with end now)
5605 c
5606 hoff = hoff+hoh2h1(1)
5607 else
5608 c
5609 c Hairpin end then word-group, need idno for w-g to set hp offset
5610 c
5611 hoff = hoff +
5612 * hoh2(igetbits(idyndat(idynn(icntdyn+1)),4,12))
5613 end if
5614 c
5615 c Protecting against hp start-stop on same note
5616 c
5617 else if (icntdyn.gt.1 .and. idno.gt.0 .and.
5618 * ((fontslur.and.idno.lt.14).or.
5619 * (.not.fontslur.and.idno.lt.15))) then
5620 c
5621 c Hairpin start, check prior type
5622 c
5623 if ((fontslur.and.
5624 * igetbits(idyndat(idynn(icntdyn-1)),4,12).ge.14)
5625 * .or.
5626 * (.not.fontslur.and.
5627 * igetbits(idyndat(idynn(icntdyn-1)),4,12).eq.15))
5628 * then
5629 c
5630 c Hairpin end then hairpin start, (remember dealing with start now)
5631 c
5632 hoff = hoff+hoh2h1(2)
5633 else
5634 c
5635 c Hairpin start after word-group, need idno for w-g to set hp offset
5636 c
5637 hoff = hoff+
5638 * hoh1(igetbits(idyndat(idynn(icntdyn-1)),4,12))
5639 end if
5640 end if
5641 end if
5642 c
5643 c End of if-block for 2- or 3-way interactions.
5644 c
5645 if ((.not.fontslur) .and. idno.ge.13)
5646 c
5647 c Slur font and hairpin. Add hoff, and change from \interneote to \qn@width
5648 c
5649 * hoff = (hoff+.5)*6./2.5
5650 c
5651 c Position corrections all done now. Put in the level.
5652 c
5653 if ((fontslur.and.idno.eq.13) .or.
5654 * ((.not.fontslur).and.(idno.eq.13.or.idno.eq.14))) then
5655 c
5656 c Hairpin start.
5657 c
5658 if (.not.fontslur) then
5659 c
5660 c Postscript hairpin start...inset placeholder for start level.
5661
5662 notexq = notexq(1:lnote)//'{ }'
5663 lnote = lnote+5
5664 end if
5665 else
5666 c
5667 c Insert actual level in all cases except hairpin start
5668 c Create string with level in it
5669 c
5670 if (lbot1 .gt. 9) then
5671 numpq = '{'
5672 write(numpq(2:3),'(i2)')lbot1
5673 numpq = numpq(1:3)//'}'
5674 lnumpq = 4
5675 else if (lbot1 .gt. -1) then
5676 numpq = char(48+lbot1)
5677 lnumpq = 1
5678 else if (lbot1 .gt. -10) then
5679 numpq = '{'
5680 write(numpq(2:3),'(i2)')lbot1
5681 numpq = numpq(1:3)//'}'
5682 lnumpq = 4
5683 else
5684 numpq = '{'
5685 write(numpq(2:4),'(i3)')lbot1
5686 numpq = numpq(1:4)//'}'
5687 lnumpq = 5
5688 end if
5689 c
5690 c Level has now been computed and stored in numpq
5691 c Append the level
5692 c
5693 notexq = notexq(1:lnote)//numpq(1:lnumpq)
5694 lnote = lnote+lnumpq
5695 end if
5696 if (abs(hoff) .lt. .001) then
5697 c
5698 c No horiz offset
5699 c
5700 notexq = notexq(1:lnote)//'0'
5701 lnote = lnote+1
5702 else
5703 c
5704 c Horizontal tweak
5705 c
5706 lform = lfmt1(hoff)
5707 notexq = notexq(1:lnote)//'{'
5708 lnote = lnote+1
5709 write(notexq(lnote+1:lnote+lform),
5710 * '(f'//chax(48+lform)//'.1)')hoff
5711 lnote = lnote+lform
5712 notexq = notexq(1:lnote)//'}'
5713 lnote = lnote+1
5714 end if
5715 if (idno .eq. 0) then
5716 c
5717 c text-dynamic. Find the string and append it
5718 c
5719 do 4 jtxtdyn = jtxtdyn1 , ntxtdyn
5720 c ivxip = ivx+16*ip
5721 ivxip = ivx+32*ip
5722 if (ivxip .eq. ivxiptxt(jtxtdyn)) go to 5
5723 4 continue
5724 call printl('Abnormal stop in putdyn')
5725 call stop1()
5726 5 continue
5727 ltxtdyn = lenstr(txtdynq(jtxtdyn),128)
5728 c
5729 c Do this to insert 1st 2 args of \txtdyn, allow 3rd to be longer (on next line)
5730 c
5731 call addstr(notexq(1:lnote),lnote,soutq,lsout)
5732 if (musize .eq. 20) then
5733 notexq = '{'//char(92)//'medtype'//char(92)//'it '
5734 lnote = 13
5735 else if (musize .eq. 16) then
5736 notexq = '{'//char(92)//'normtype'//char(92)//'it '
5737 lnote = 14
5738 else if (musize .eq. 24) then
5739 notexq = '{'//char(92)//'bigtype'//char(92)//'it '
5740 lnote = 13
5741 else if (musize .eq. 29) then
5742 notexq = '{'//char(92)//'Bigtype'//char(92)//'it '
5743 lnote = 13
5744 end if
5745 c
5746 notexq = notexq(1:lnote)//txtdynq(jtxtdyn)(1:ltxtdyn)//'}'
5747 lnote = lnote+ltxtdyn+1
5748 c
5749 c Reset jtxtdyn1 just in case >1 txtdyn on same note.
5750 c
5751 jtxtdyn1 = jtxtdyn+1
5752 else if (idno .le. 12) then
5753 c
5754 c Letter-group dynamic. Append the letter-group command
5755 c
5756 id = 4*idno
5757 dynstrq = dyntablq(id-3:id)
5758 id = lenstr(dynstrq,4)
5759 notexq = notexq(1:lnote)//chax(92)//dynstrq(1:id)
5760 lnote = lnote+1+id
5761 end if
5762 call addstr(notexq(1:lnote),lnote,soutq,lsout)
5763 if ((.not.fontslur).and.idno.eq.15) then
5764 c
5765 c PS slurs on, hairpin is ending. Go back and set height at beginning.
5766 c Add user-defined tweak to default level
5767 c
5768 lbot1 = lpretweak+levhssav(ivx)
5769 if (lbot1 .gt. 9) then
5770 numpq = '{'
5771 write(numpq(2:3),'(i2)')lbot1
5772 numpq = numpq(1:3)//'}'
5773 lnumpq = 4
5774 else if (lbot1 .gt. -1) then
5775 numpq = char(48+lbot1)
5776 lnumpq = 1
5777 else if (lbot1 .gt. -10) then
5778 numpq = '{'
5779 write(numpq(2:3),'(i2)')lbot1
5780 numpq = numpq(1:3)//'}'
5781 lnumpq = 4
5782 else
5783 numpq = '{'
5784 write(numpq(2:4),'(i3)')lbot1
5785 numpq = numpq(1:4)//'}'
5786 lnumpq = 5
5787 end if
5788 c
5789 c Construct string to search backwards for placeholder
5790 c
5791 if (idh .le. 9) then
5792 tempq = 'cresc'//char(48+idh)//'{ }'
5793 ltemp = 11
5794 else if (idh .le. 19) then
5795 tempq = 'cresc'//'{1'//char(38+idh)//'}{ }'
5796 ltemp = 14
5797 else
5798 tempq = 'cresc'//'{2'//char(28+idh)//'}{ }'
5799 ltemp = 14
5800 end if
5801 write(11,'(a)')soutq(1:lsout)//'%'
5802 lsout = 0
5803 call backfill(11,tempq,ltemp,
5804 * tempq(1:ltemp-5)//numpq(1:lnumpq),ltemp-5+lnumpq)
5805 end if
5806 3 continue
5807 c
5808 c Shrink arrays, decrease ndyn 111109
5809 c
5810 do 6 icntdyn = numdyn, 1 , -1
5811 do 7 jdyn = idynn(icntdyn) , ndyn-1
5812 idyndat(jdyn) = idyndat(jdyn+1)
5813 idynda2(jdyn) = idynda2(jdyn+1)
5814 7 continue
5815 ndyn = ndyn-1
5816 6 continue
5817 end
5818 subroutine dograce(ivx,ip,ptgr,soutq,lsout,ncm,nacc,ig,ipl,
5819 * farend,
5820 * beamon,nolev,ncmidx,islur,nvmx,nv,ibmcnt,tnote,ulq,instno)
5821 c
5822 c ip will be one LESS than current note, for way-after's before bar-end,
5823 c It is only used to find ig.
5824 c ig is returned to makeabar in case there's a slur that needs to be ended
5825 c
5826 parameter (nm=24)
5827 logical beamon,stemup
5828 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
5829 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
5830 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
5831 * graspace(37),
5832 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
5833 * naccg(74),voltxtq(6),litq(83)
5834 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
5835 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
5836 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
5837 * rtshfac
5838 common /comask/ bar1syst,fixednew,scaldold,
5839 * wheadpt,fbar,poenom
5840 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
5841 * ,WrotePsslurDefaults,SlurCurve
5842 common /comoct/ noctup
5843 logical upg,slurg,slashg,bar1syst,upslur,btest,isgaft,iswaft,
5844 * normsp,farend,fontslur,WrotePsslurDefaults
5845 real*4 ptgr(37)
5846 character*80 soutq
5847 character*128 litq
5848 character*79 notexq
5849 character*20 voltxtq
5850 character*10 figq
5851 character*8 noteq,noteqGA
5852 character*3 acsymq
5853 character*1 sq,chax,udqq,ulq(nm,9)
5854 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
5855 * fullsize(nm),ivxfig2,ivvfig(2,74)
5856 sq = chax(92)
5857 isgaft = btest(ipl,29)
5858 iswaft = btest(ipl,31)
5859 normsp = .not. isgaft
5860 c
5861 c Find ig.
5862 c
5863 do 120 ig = 1 , ngrace
5864 if (ipg(ig).eq.ip .and. ivg(ig).eq.ivx) go to 121
5865 120 continue
5866 print*,'Problem finding grace index in dograce'
5867 stop
5868 121 continue
5869 ngs = ngstrt(ig)
5870 mg = multg(ig)
5871 c wheadpt1 = wheadpt*fullsize(ivx)
5872 wheadpt1 = wheadpt*fullsize(instno)
5873 c
5874 c For way-after-graces at end of bar, must set the octave.
5875 c
5876 if (farend) then
5877 noctup = 0
5878 if (ncm .eq.23) noctup = -2
5879 end if
5880 if (slurg(ig) .and. .not.iswaft .and..not.isgaft) then
5881 if (listslur .eq. 16777215) then
5882 print*
5883 print*,'You defined the twentyfifth slur, one too many!'
5884 write(15,'(/,a)')
5885 * 'You defined the twentyfifth slur, one too many!'
5886 call stop1()
5887 end if
5888 c
5889 c Slur on fore-grace. Get index of next slur not in use, from 23 down.
5890 c
5891 ndxslur = log2(16777215-listslur)
5892
5893 end if
5894 if (nng(ig) .eq. 1) then
5895 c
5896 c Single grace.
5897 c
5898 if (normsp) then
5899 c
5900 c Anything but GA
5901 c
5902 call addstr(sq//'shlft',6,soutq,lsout)
5903 niptgr = nint(ptgr(ig))
5904 c
5905 c Empirical tweak for postscript.
5906 c
5907 C if (.not.fontslur) niptgr = niptgr+nint(wheadpt*.3)
5908 c++
5909 if (niptgr .lt. 10) then
5910 call addstr(chax(48+niptgr)//'{',2,soutq,lsout)
5911 else if (niptgr .lt. 100) then
5912 write(notexq(1:2),'(i2)')niptgr
5913 call addstr('{'//notexq(1:2)//'}{',5,soutq,lsout)
5914 else
5915 print*,
5916 * 'Call Dr. Don if you really want grace note group > 99 pt'
5917 stop
5918 end if
5919 else
5920 call addstr(sq//'gaft{1.5}{',11,soutq,lsout)
5921 c
5922 c GA. Compute aftshft, for later use.
5923 c
5924 aftshft = grafac
5925 if (naccg(ngstrt(ig)).gt.0) aftshft = aftshft+agc1fac
5926 aftshft = aftshft*wheadpt
5927 end if
5928 if (slurg(ig) .and. .not.isgaft .and..not.iswaft) then
5929 c
5930 c Start slur on pre-grace. No accounting needed since will be ended very soon.
5931 c
5932 call notefq(noteq,lnoten,nolevg(ngs),ncm)
5933 if (fontslur) then
5934 if (upg(ig)) then
5935 call addstr(sq//'islurd',7,soutq,lsout)
5936 else
5937 call addstr(sq//'isluru',7,soutq,lsout)
5938 end if
5939 else
5940 c
5941 c Start Postscript slur.
5942 c
5943 if (upg(ig)) then
5944 call addstr(sq//'isd',4,soutq,lsout)
5945 else
5946 call addstr(sq//'isu',4,soutq,lsout)
5947 end if
5948 end if
5949 c
5950 c Print slur number, 23-ndxslur
5951 c
5952 lnote = 0
5953 if (23-ndxslur .lt. 10) then
5954 c notexq = notexq(1:lnote)//chax(59-ndxslur)
5955 notexq = chax(71-ndxslur)
5956 lnote = 1
5957 else if (23-ndxslur .lt. 20) then
5958 c notexq = notexq(1:lnote)//'{1'//chax(49-ndxslur)//'}'
5959 notexq = '{1'//chax(61-ndxslur)//'}'
5960 lnote = 4
5961 else
5962 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
5963 lnote = 4
5964 end if
5965 call addstr(notexq(1:lnote)//noteq(1:lnoten),
5966 * lnote+lnoten,soutq,lsout)
5967 if (.not.fontslur) then
5968 c
5969 c Horizontal tweaks for postscript slur on single grace
5970 c
5971 stemup = .true.
5972 if (upg(ig)) then
5973 c
5974 c Check for up-grace + down stem. Get stem direction
5975 c
5976 if (.not.beamon) then
5977 c
5978 c Separate note. Get stem direction.
5979 c
5980 stemup = udqq(nolev,ncmidx,
5981 * islur,nvmx,ivx,nv) .eq. 'u'
5982 else
5983 c
5984 c In a beam
5985 c
5986 stemup = ulq(ivx,ibmcnt) .eq. 'u'
5987 end if
5988 c
5989 c Stop the shift if whole note
5990 c
5991 stemup = stemup .or. tnote.gt.63
5992 end if
5993 if (stemup) then
5994 call addstr('{-.3}',5,soutq,lsout)
5995 else
5996 call addstr('{-.8}',5,soutq,lsout)
5997 end if
5998 end if
5999 end if
6000 if (naccg(ngs) .gt. 0) then
6001 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6002 c
6003 c Save for checking octave shifts in GA
6004 c
6005 if (isgaft) then
6006 lnotenGA = lnoten
6007 noteqGA = noteq
6008 end if
6009 c
6010 if (lnoten .eq. 1) call addblank(noteq,lnoten)
6011 call accsym(naccg(ngs),acsymq,lacc)
6012 call addstr(sq//'big'//acsymq(1:lacc)//
6013 * noteq(1:lnoten),4+lacc+lnoten,soutq,lsout)
6014 end if
6015 if (slashg(ig)) then
6016 notexq = sq//'grc'
6017 lnote = 4
6018 else if (mg .eq. 0) then
6019 notexq = sq//'zq'
6020 lnote = 3
6021 else
6022 notexq = sq//'zc'
6023 do 61 i = 2 , mg
6024 notexq = notexq(1:i+1)//'c'
6025 61 continue
6026 lnote = mg+2
6027 end if
6028 if (upg(ig)) then
6029 notexq = notexq(1:lnote)//'u'
6030 else
6031 notexq = notexq(1:lnote)//'l'
6032 end if
6033 call addstr(notexq,lnote+1,soutq,lsout)
6034 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6035 c
6036 if (isgaft .and. naccg(ngs).eq.0) then
6037 lnotenGA = lnoten
6038 noteqGA = noteq
6039 end if
6040 c
6041 if (lnoten .eq. 1) call addblank(noteq,lnoten)
6042 call addstr(noteq,lnoten,soutq,lsout)
6043 if (slashg(ig)) call addstr(sq//'off{-'//sq//
6044 * 'noteskip}',16,soutq,lsout)
6045 c
6046 c Above code needed since slashg causes spacing
6047 c
6048 if (slurg(ig) .and. (iswaft.or.isgaft)) then
6049 c
6050 c Terminate slur on single after-grace
6051 c
6052 ndxslur = igetbits(ipl,5,23)
6053 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6054 call addstr(sq//'tslur',6,soutq,lsout)
6055 c
6056 c Print 24-ndxslur
6057 c
6058 if (23-ndxslur .lt. 10) then
6059 call addstr(chax(71-ndxslur)//noteq(1:lnoten),
6060 * 1+lnoten,soutq,lsout)
6061 else if (23-ndxslur .lt. 20) then
6062 call addstr('{2'//chax(61-ndxslur)//'}'//noteq(1:lnoten),
6063 * 4+lnoten,soutq,lsout)
6064 else
6065 c call addstr('{1'//chax(49-ndxslur)//'}'//noteq(1:lnoten),
6066 call addstr('{1'//chax(51-ndxslur)//'}'//noteq(1:lnoten),
6067 * 4+lnoten,soutq,lsout)
6068 end if
6069 slurg(ig) = .false.
6070 listslur = ibclr(listslur,ndxslur)
6071 end if
6072 call addstr('}',1,soutq,lsout)
6073 c
6074 c+++ Try to fix loss of octave with single gaft
6075 c
6076 if (isgaft) then
6077 itrans = 0
6078 do 1 i = 1 , lnotenGA
6079 if (noteqGA(i:i) .eq. chax(39)) then
6080 itrans = itrans+7
6081 else if (noteqGA(i:i) .eq. chax(96)) then
6082 itrans = itrans-7
6083 end if
6084 1 continue
6085 if (itrans. eq. -14) then
6086 call addstr(sq//'advance'//sq//'transpose-14',21,
6087 * soutq,lsout)
6088 else if (itrans .eq. -7) then
6089 call addstr(sq//'advance'//sq//'transpose-7',20,
6090 * soutq,lsout)
6091 else if (itrans .eq. 7) then
6092 call addstr(sq//'advance'//sq//'transpose7',19,
6093 * soutq,lsout)
6094 else if (itrans .eq. 14) then
6095 call addstr(sq//'advance'//sq//'transpose14',20,
6096 * soutq,lsout)
6097 end if
6098 end if
6099 else
6100 c
6101 c Multiple grace. Put in literally. Compute beam stuff
6102 c
6103 sumx = 0.
6104 sumy = 0.
6105 sumxy = 0.
6106 sumxx = 0.
6107 sumyy = 0.
6108 x = 0.
6109 do 118 ing = ngs , ngs+nng(ig)-1
6110 if (ing.gt.ngs .and. naccg(ing).gt.0) x = x+acgfac
6111 y = nolevg(ing)
6112 sumx = sumx + x
6113 sumy = sumy + y
6114 sumxy = sumxy + x*y
6115 sumxx = sumxx + x*x
6116 sumyy = sumyy + y*y
6117 x = x+emgfac
6118 118 continue
6119 delta = nng(ig)*sumxx-sumx*sumx
6120 em = (nng(ig)*sumxy-sumx*sumy)/delta
6121 islope = nint(0.5*em*gslfac)
6122 if (iabs(islope) .gt. 9) islope = isign(9,islope)
6123 beta = (sumy-islope/gslfac*sumx)/nng(ig)
6124 nolev1 = nint(beta)
6125 c
6126 c Back up
6127 c
6128 notexq = sq//'settiny'//sq//'off{'
6129 if (normsp) then
6130 write(notexq(14:18),'(a1,f4.1)')'-',ptgr(ig)
6131 call addstr(notexq(1:18)//'pt}',21,soutq,lsout)
6132 finalshift = ptgr(ig)
6133 else
6134 aftshft = wheadpt*1.33
6135 if (naccg(ngstrt(ig)).gt.0) aftshft = aftshft+wheadpt*0.5
6136 write(notexq(14:17),'(f4.1)')aftshft
6137 call addstr(notexq(1:17)//'pt}'//sq//'bsk',24,soutq,lsout)
6138 end if
6139 c
6140 c Start the beam
6141 c
6142 notexq = sq//'ib'
6143 do 119 ing = 2 , mg
6144 notexq = notexq(1:ing+1)//'b'
6145 119 continue
6146 if (upg(ig)) then
6147 notexq = notexq(1:mg+2)//'u'
6148 else
6149 notexq = notexq(1:mg+2)//'l'
6150 end if
6151 notexq = notexq(1:mg+3)//'0'
6152 c
6153 c Get starting note for beam
6154 c
6155 call notefq(noteq,lnoten,nolev1,ncm)
6156 call addstr(notexq(1:mg+4)//noteq(1:lnoten),
6157 * mg+4+lnoten,soutq,lsout)
6158 c
6159 c Put in the slope
6160 c
6161 if (islope .ge. 0) then
6162 call addstr(chax(48+islope),1,soutq,lsout)
6163 else
6164 call addstr('{-'//chax(48-islope)//'}',4,soutq,lsout)
6165 end if
6166 c
6167 c Start a slur on multiple fore-grace
6168 c
6169 if (slurg(ig) .and. .not.isgaft .and. .not.iswaft) then
6170 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6171 if (fontslur) then
6172 if (upg(ig)) then
6173 call addstr(sq//'islurd',7,soutq,lsout)
6174 else
6175 call addstr(sq//'isluru',7,soutq,lsout)
6176 end if
6177 else
6178 c
6179 c Need a tweak for postscript slur
6180 c
6181 if (upg(ig)) then
6182 call addstr(sq//'isd',4,soutq,lsout)
6183 else
6184 call addstr(sq//'isu',4,soutq,lsout)
6185 end if
6186 end if
6187 c
6188 c Print 23-ndxslur
6189 c
6190 if (23-ndxslur .lt. 10) then
6191 call addstr(chax(71-ndxslur)//noteq(1:lnoten),1+lnoten,
6192 * soutq,lsout)
6193 else if (23-ndxslur .lt. 2) then
6194 call addstr('{1'//chax(61-ndxslur)//'}'//noteq(1:lnoten),
6195 * 4+lnoten,soutq,lsout)
6196 else
6197 call addstr('{1'//chax(51-ndxslur)//'}'//noteq(1:lnoten),
6198 * 4+lnoten,soutq,lsout)
6199 end if
6200 c
6201 c Put in tweak for postscript slur
6202 c
6203 if (.not.fontslur) call addstr('{-.3}',5,soutq,lsout)
6204 end if
6205 c
6206 c Put in first note. Call notefq again in case octave changed
6207 c
6208 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6209 if (naccg(ngs) .eq. 0) then
6210 notexq = sq//'zqb0'//noteq(1:lnoten)
6211 lnote = 5+lnoten
6212 else
6213 if (lnoten .eq. 1) call addblank(noteq,lnoten)
6214 call accsym(naccg(ngs),acsymq,lacc)
6215 notexq = sq//'big'//acsymq(1:lacc)//noteq(1:lnoten)
6216 lnote = 4+lacc+lnoten
6217 call notefq(noteq,lnoten,nolevg(ngs),ncm)
6218 notexq =notexq(1:lnote)//sq//'zqb0'//noteq(1:lnoten)
6219 lnote = lnote+5+lnoten
6220 end if
6221 call addstr(notexq,lnote,soutq,lsout)
6222 do 127 ing = ngs+1 , ngs+nng(ig)-1
6223 c
6224 c Skip
6225 c
6226 ptoff = wheadpt1*emgfac
6227 if (naccg(ing).gt.0) ptoff = ptoff+wheadpt1*acgfac
6228 if (isgaft .and. .not.iswaft) aftshft = aftshft+ptoff
6229 notexq = sq//'off{'
6230 write(notexq(6:8),'(f3.1)')ptoff
6231 if (normsp) finalshift = finalshift-ptoff
6232 call addstr(notexq(1:8)//'pt}',11,soutq,lsout)
6233 if (ing .eq. ngs+nng(ig)-1) then
6234 c
6235 c Terminate beam if needed
6236 c
6237 if (upg(ig)) then
6238 call addstr(sq//'tbu0',5,soutq,lsout)
6239 else
6240 call addstr(sq//'tbl0',5,soutq,lsout)
6241 end if
6242 c
6243 c Terminate after slur if needed
6244 c
6245 if ((isgaft.or.iswaft) .and. slurg(ig)) then
6246 if (iswaft) ndxslur = igetbits(ipl,5,23)
6247 call notefq(noteq,lnoten,nolevg(ing),ncm)
6248 call addstr(sq//'tslur',6,soutq,lsout)
6249 c
6250 c Print 11-ndxslur
6251 cc Print 23-ndxslur
6252 c
6253 if (23-ndxslur .lt. 10) then
6254 call addstr(chax(71-ndxslur)//noteq(1:lnoten),
6255 * 1+lnoten,soutq,lsout)
6256 else if (23-ndxslur .lt. 20) then
6257 call addstr('{2'//chax(61-ndxslur)//'}'
6258 * //noteq(1:lnoten),4+lnoten,soutq,lsout)
6259 else
6260 call addstr('{1'//chax(51-ndxslur)//'}'
6261 * //noteq(1:lnoten),4+lnoten,soutq,lsout)
6262 end if
6263 c
6264 c Stop slur terminator after exit from this subroutine
6265 c
6266 listslur = ibclr(listslur,ndxslur)
6267 slurg(ig) = .false.
6268 end if
6269 end if
6270 c
6271 c Accidental if needed
6272 c
6273 if (naccg(ing).gt.0) then
6274 call notefq(noteq,lnoten,nolevg(ing),ncm)
6275 if (lnoten .eq. 1) call addblank(noteq,lnoten)
6276 call accsym(naccg(ing),acsymq,lacc)
6277 call addstr(sq//'big'//acsymq(1:lacc)
6278 * //noteq(1:lnoten),4+lacc+lnoten,soutq,lsout)
6279 end if
6280 c
6281 c Put in the (beamed) grace note
6282 c
6283 call notefq(noteq,lnoten,nolevg(ing),ncm)
6284 call addstr(sq//'zqb0'//noteq(1:lnoten),5+lnoten,
6285 * soutq,lsout)
6286 127 continue
6287 c
6288 c Terminate the grace
6289 c
6290 notexq = sq//'off{'
6291 lnote = 5
6292 ptoff = wheadpt*emgfac
6293 if (iand(nacc,3).gt.0 .and. .not.btest(nacc,17))
6294 * ptoff = ptoff+wheadpt*accfac
6295 if (isgaft .and. .not.iswaft) then
6296 notexq = notexq(1:5)//'-'
6297 lnote = 6
6298 ptoff = aftshft
6299 end if
6300 if (normsp) ptoff = finalshift
6301 if (ptoff .lt. 9.95) then
6302 write(notexq(lnote+1:lnote+3),'(f3.1)')ptoff
6303 lnote = lnote+3
6304 else if (ptoff .lt. 99.95) then
6305 write(notexq(lnote+1:lnote+4),'(f4.1)')ptoff
6306 lnote = lnote+4
6307 else
6308 write(notexq(lnote+1:lnote+5),'(f5.1)')ptoff
6309 lnote = lnote+5
6310 end if
6311 call addstr(notexq(1:lnote)//'pt}',lnote+3,soutq,lsout)
6312 if (isgaft.and..not.iswaft) call addstr(sq//'sk',3,soutq,lsout)
6313 call addstr(sq//'resetsize',10,soutq,lsout)
6314 end if
6315 return
6316 end
6317 subroutine dopsslur(nolev,isdat1,isdat2,isdat3,isdat4,nsdat,ip,
6318 * iv,kv,nv,beamon,ncm,soutq,lsout,ulq,islur,
6319 * ipl,iornq,islhgt,tno,nacc)
6320 c
6321 c Called once per main note.
6322 c 12 May 2002 Create this subroutine to isolate postscript slurs/ties.
6323 c Always set \Nosluradjust\Notieadjust
6324 c
6325 parameter (nm=24,mv=24576)
6326 integer*4 isdat1(202),isdat2(202),isdat3(202),isdat4(202)
6327 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
6328 * ,WrotePsslurDefaults,SlurCurve
6329 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
6330 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
6331 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
6332 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
6333 common /comsln/ is1n1,is2n1,irzbnd,isnx
6334 character*1 ulq,slurudq,udfq,udqq,chax
6335 character*79 notexq
6336 character*8 noteq
6337 character*80 soutq
6338 logical upslur,beamon,btest,stemup,iscrd,
6339 * settie,fontslur,pstie,WrotePsslurDefaults
6340 logical slmon,dbltie
6341 common /comslm/ levson(0:nm),levsoff(0:nm),imidso(0:nm),
6342 * naccbl(0:nm),laccbl(0:nm,10),jaccbl(0:nm,10),nusebl,
6343 * slmon(0:nm),dbltie
6344 integer*2 mmidi,iinsiv
6345 logical restpend,relacc,notmain,twoline,ismidi,crdacc
6346 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
6347 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
6348 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
6349 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
6350 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
6351 * debugmidi
6352 logical debugmidi
6353 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
6354 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
6355 logical EarlyTransOn,LaterInstTrans
6356 c 130316
6357 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
6358 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
6359 c
6360 c Bits in isdat1:
6361 c 13-17 iv
6362 c 3-10 ip
6363 c 11 start/stop switch
6364 c 12 kv-1
6365 c 19-25 ichar(code$)
6366 c 26 force direction?
6367
6368 c 27 forced dir'n = up if on, set in sslur; also
6369 c final direction, set in doslur when beam is started, used on term.
6370 c 28-31 mod(ndxslur,16), set in doslur when slur is started, used on term.
6371 c 18 int(ndxslur/16), ditto. So this allows ndxslur>15.
6372 c 2 stem slur flag
6373 c 1 flag for "x" slur (voice-independent)
6374 c
6375 c Bits in isdat2
6376 c 0 Chord switch. Not set on main note.
6377 c 1-2 left/right notehead shift. Set only for chord note.
6378 c 3 tie positioning
6379 c 4 dotted flag
6380 c 6-11 voff1 1-63 => -31...+31
6381 c 12-18 hoff1 1-127 => -6.3...+6.3
6382 c 19-25 nolev
6383 c 26 \sluradjust (p+s)
6384 c 27 \nosluradjust (p-s)
6385 c 28 \tieadjust (p+t)
6386 c 29 \notieadjust (p-t)
6387 c
6388 c Bits in isdat3: Only used for slur endings
6389 c 0 set if midslur (at least one argument)
6390 c 1 set if curve (2 more args)
6391 c 2-7 32+first arg (height correction) (1st arg may be negative)
6392 c 8-10 second arg (initial slope)
6393 c 11-13 third arg (closing slope)
6394 c 14-21 tie level for use in LineBreakTies
6395 c 22-29 ncm for use in LineBreakTies
6396 c
6397 c Bits in isdat4 Only used for linebreak slurs
6398 c 0-5 Linebreak seg 1 voff 1-63 => -31...+31
6399 c 6-12 Linebreak seg 1 hoff 1-127 => -6.3...+6.3
6400 c 16-21 Linebreak seg 2 voff 1-63 => -31...+31
6401 c 22-28 Linebreak seg 2 hoff 1-127 => -6.3...+6.3
6402 c
6403 c In listslur bit ib is on if slur index ib is in use, ib=0-13.
6404 c ndxslur = slur index
6405 c Height of slur is nole+ivoff+iupdn. iupdn is +/-1 if t&s slurs on same note,
6406 c s-slur is blank (idcode=32), t-slur is idcode=1.
6407 c ivoff is user-defined shift or shift due to . or _ , or chord adjustment.
6408 c Ivoff will be set for ./_ only if no user-defined shift is specified.
6409 c If highest note has upslur, save slur height in islhgt in case
6410 c ornament must be moved.
6411 c
6412 islhgt = 0
6413 if (beamon) then
6414 stemup = ulq .eq. 'u'
6415 else if (nvmx(iv) .eq. 2) then
6416 if (.not.btest(islur,30)) then
6417 c
6418 c Single note, 2 lines of music, stem direction not forced
6419 c
6420 stemup = ivx .gt. nv
6421 else
6422 stemup = btest(islur,17)
6423 end if
6424 else
6425 stemup = udqq(nolev,ncm,islur,nvmx(iv),ivx,nv) .eq. 'u'
6426 end if
6427 iscrd = btest(ipl,10)
6428 if (ismidi) then
6429 settie = .false.
6430 dbltie = .false.
6431 end if
6432 do 1 isdat = 1 , nsdat
6433 isdata = isdat1(isdat)
6434 if (iv .eq. igetbits(isdata,5,13) .and.
6435 * ip .eq. igetbits(isdata,8,3) .and.
6436 c * kv .eq. igetbits(isdata,1,12)+1) then
6437 * (kv .eq. igetbits(isdata,1,12)+1 .or.
6438 * btest(isdata,1))) then
6439 c
6440 c Since iv and kv match, ivx will be correct
6441 c
6442 idcode = igetbits(isdata,7,19)
6443 ivoff = igetbits(isdat2(isdat),6,6)-32
6444 ihoff = igetbits(isdat2(isdat),7,12)-64
6445 iupdn = 0
6446 slurudq = 'd'
6447 nolevs = igetbits(isdat2(isdat),7,19)
6448 pstie = btest(isdat2(isdat),3) .or. idcode.eq.1
6449 if (btest(isdata,11)) then
6450 c
6451 c Turnon
6452 c Get slur direction
6453 c
6454 if (btest(isdata,26)) then
6455 c
6456 c Force slur direction
6457 c
6458 if (btest(isdata,27)) slurudq = 'u'
6459 else if (nvmx(iv) .eq. 1) then
6460 c
6461 c Only one voice per line
6462 c
6463 if (.not.beamon) then
6464 c
6465 c Separate note.
6466 c
6467 slurudq = udfq(nolev,ncm)
6468 else
6469 c
6470 c In a beam
6471 c
6472 if (ulq .ne. 'u') slurudq = 'u'
6473 end if
6474 if (iscrd) then
6475 if (nolevs .gt. ncm) then
6476 slurudq = 'u'
6477 else
6478 slurudq = 'd'
6479 end if
6480 end if
6481 else
6482 c
6483 c Two voices per line. Get default
6484 c
6485 if (ivx .gt. nv) slurudq = 'u'
6486 c
6487 c Upper voice of the two, so up slur
6488 c
6489 end if
6490 if (btest(isdata,2)) then
6491 c
6492 c ADjust for stem slur. ASSUME this is the ONLY pos'n adjustment.
6493 c
6494 if (stemup) then
6495 slurudq = 'u'
6496 ivoff = ivoff+4
6497 else
6498 slurudq = 'd'
6499 ivoff = ivoff-4
6500 end if
6501 end if
6502 c
6503 c Set level for slur starting on rest
6504 c
6505 if (nolevs.eq.0 .or. nolevs.gt.60) then
6506 if (slurudq .eq. 'u') then
6507 nolevs = ncm+2
6508 else
6509 nolevs = ncm-2
6510 end if
6511 end if
6512 c
6513 c Save up/down-ness for use at termination
6514 c
6515 if (slurudq .eq. 'u') isdata = ibset(isdata,27)
6516 c
6517 c End of section for setting slur direction, still in "Turnon" if-block.
6518 c
6519 if (btest(iornq,11).or.btest(iornq,12)) then
6520 c
6521 c Raise or lower slur by one unit provided . or _ is on same side as slur
6522 c
6523 ivoffinc = 0
6524 if ((stemup .and. slurudq.eq.'d') .or.
6525 * (.not.stemup .and. slurudq.eq.'u')) then
6526 c
6527 c Must move the slur for _ or .
6528 c
6529 if (stemup) then
6530 ivoffinc = -1
6531 else
6532 ivoffinc = 1
6533 end if
6534 if (((stemup .and. nolev.ge.ncm-2) .or.
6535 * (.not.stemup .and. nolev.le.ncm+2)) .and.
6536 * mod(abs(ncm-nolev),2).eq.0) ivoffinc = 2*ivoffinc
6537 ivoff = ivoff+ivoffinc
6538 end if
6539 end if
6540 if (listslur .eq. 16777215) then
6541 print*
6542 print*,'You1 defined the twentyfifth slur, one too many!'
6543 write(15,'(/,a)')
6544 * 'You defined the twentyfifth slur, one too many!'
6545 call stop1()
6546 end if
6547 c
6548 c Get index of next slur not in use, starting from 12 down
6549 c
6550 ndxslur = log2(16777215-listslur)
6551 c
6552 c Record slur index
6553 c
6554 listslur = ibset(listslur,ndxslur)
6555 c
6556 c Save for use on termination
6557 c 080531 Allow >16 slurs
6558 call setbits(isdata,4,28,mod(ndxslur,16))
6559 call setbits(isdata,1,18,ndxslur/16)
6560 c
6561 c Shift for stem?
6562 c
6563 if (stemup .and. slurudq.eq.'u' .and. tno.lt.63.) then
6564 if (.not.pstie) then
6565 ihoff = ihoff+8
6566 else
6567 ihoff = ihoff+2
6568 end if
6569 end if
6570 if (iscrd) then
6571 c
6572 c Additional horiz shifts for h-shifted noteheads?
6573 c
6574 if (btest(isdat2(isdat),1)) then
6575 c
6576 c Slur start on left-shifted chord notehead. ASSUME downstem.
6577 c
6578 if (nolevs.eq.minlev .and. slurudq.eq.'d') then
6579 ihoff = ihoff-2
6580 else
6581 ihoff = ihoff-10
6582 end if
6583 else if (btest(isdat2(isdat),2)) then
6584 c
6585 c Right shifted chord notehead. ASSUME upstem.
6586 c
6587 if (nolevs.eq.maxlev .and. slurudq.eq.'u') then
6588 ihoff = ihoff+2
6589 else
6590 ihoff = ihoff+10
6591 end if
6592 end if
6593 end if
6594 notexq = chax(92)
6595 lnote = 1
6596 c
6597 c Check for local adjustment default changes
6598 c
6599 if (btest(isdat2(isdat),26)) then
6600 notexq = chax(92)//'sluradjust'//chax(92)
6601 lnote = 12
6602 else if (btest(isdat2(isdat),27)) then
6603 notexq = chax(92)//'nosluradjust'//chax(92)
6604 lnote = 14
6605 else if (btest(isdat2(isdat),28)) then
6606 notexq = chax(92)//'tieadjust'//chax(92)
6607 lnote = 11
6608 else if (btest(isdat2(isdat),29)) then
6609 notexq = chax(92)//'notieadjust'//chax(92)
6610 lnote = 13
6611 end if
6612 if (ihoff .eq. 0) then
6613 c
6614 c Write stuff for non-shifted start
6615 c
6616 notexq = notexq(1:lnote)//'islur'//slurudq
6617 lnote = lnote+6
6618 else
6619 notexq = notexq(1:lnote)//'is'//slurudq
6620 lnote = lnote+3
6621 end if
6622 c
6623 c Prepend postscript tie switch
6624 c
6625 if (pstie) then
6626 notexq = chax(92)//'tieforis'//slurudq//notexq(1:lnote)
6627 lnote = lnote+10
6628 end if
6629 if (btest(isdat2(isdat),4)) then
6630 c
6631 c Dotted slur
6632 c
6633 notexq = chax(92)//'dotted'//notexq(1:lnote)
6634 lnote = lnote+7
6635 end if
6636 c
6637 c Add slur index to string
6638 c Print 23-ndxslur
6639 c
6640 if (23-ndxslur .lt. 10) then
6641 c
6642 c 5/25/08 Allow 24 slurs
6643 c
6644 notexq = notexq(1:lnote)//chax(71-ndxslur)
6645 lnote = lnote+1
6646 else if (23-ndxslur .lt. 20) then
6647 notexq = notexq(1:lnote)//'{1'//chax(61-ndxslur)//'}'
6648 lnote = lnote+4
6649 else
6650 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
6651 lnote = lnote+4
6652 end if
6653 c
6654 c Add note name to string
6655 c
6656 islhgt = nolevs+iupdn+ivoff
6657 call notefq(noteq,lnoten,islhgt,ncm)
6658 notexq = notexq(1:lnote)//noteq(1:lnoten)
6659 lnote = lnote+lnoten
6660 c
6661 c Store height and staff mid level for use with LineBreakTies
6662 c
6663 call setbits(isdat3(isdat),8,14,islhgt)
6664 call setbits(isdat3(isdat),8,22,ncm)
6665 c
6666 c Save height (for ornament and barnobox interference) if topmost slur is up
6667 c
6668 if (slurudq.eq.'u' .and.
6669 * (.not.btest(isdat2(isdat),0).or.nolevs.eq.maxlev)) then
6670 islhgt = nolevs+iupdn+ivoff
6671 c
6672 c Save height & idcode if top voice and slur start
6673 c
6674 if (ivx.eq.ivmx(nv,nvmx(nv)) .and. islhgt.gt.is1n1) then
6675 is1n1 = islhgt
6676 is2n1 = idcode
6677 end if
6678 end if
6679 if (ihoff .ne. 0.) then
6680 shift = ihoff*0.1
6681 notexq = notexq(1:lnote)//'{'
6682 lnote = lnote+1
6683 lform = lfmt1(shift)
6684 write(notexq(lnote+1:lnote+lform),'(f'//
6685 * chax(48+lform)//'.1)') shift
6686 lnote = lnote+lform
6687 notexq = notexq(1:lnote)//'}'
6688 lnote = lnote+1
6689 end if
6690 call addstr(notexq,lnote,soutq,lsout)
6691 c
6692 c Zero out ip1 to avoid problems if slur goes to next input blk.
6693 c
6694 call setbits(isdata,8,3,0)
6695 c
6696 c Set slur-on data for midi. Only treat null-index slurs and ps ties for now.
6697 c
6698 if (ismidi .and. (idcode.eq.32 .or. idcode.eq.1)) then
6699 c levson(midchan(iv,kv)) = nolevs
6700 c 130316
6701 levson(midchan(iv,kv)) = nolevs+miditran(instno(iv))
6702 if (settie) dbltie = .true.
6703 c
6704 c Only way settie=T is if we just set a tie ending. So there's also a slur
6705 c start here, so set a flag telling addmidi not to zero out levson
6706 c
6707 end if
6708 else
6709 c
6710 c Slur is ending. Back thru list to find starting slur
6711 c
6712 do 3 j = isdat-1 , 1 , -1
6713 if (iv.eq.igetbits(isdat1(j),5,13) .and.
6714 c * kv.eq.igetbits(isdat1(j),1,12)+1) then
6715 * (kv.eq.igetbits(isdat1(j),1,12)+1
6716 * .or. btest(isdat1(j),1))) then
6717 if (idcode .eq. igetbits(isdat1(j),7,19)) then
6718 ndxslur = igetbits(isdat1(j),4,28)
6719 c
6720 c 080531 Allow >16 slurs
6721 c
6722 * +16*igetbits(isdat1(j),1,18)
6723 if (btest(isdat1(j),27)) slurudq = 'u'
6724 go to 4
6725 end if
6726 end if
6727 3 continue
6728 print*,'Bad place in doslur'
6729 call stop1()
6730 4 continue
6731 c
6732 c Bugfix 070901 for slur ending on rest in 2-voice staff
6733 c
6734 if (nolevs.le.2 .or. nolevs.gt.60) then
6735 c
6736 c Ending is on a rest, reset nolevs to default starting height
6737 c
6738 nolevs = igetbits(isdat2(j),7,19)
6739 end if
6740 if (btest(isdat3(isdat),0) .or. btest(isdat3(j),0)) then
6741 c
6742 c Deal with \curve or \midslur. isdat is ending, j is start.
6743 c
6744 if (btest(isdat3(isdat),0)) then
6745 imid = igetbits(isdat3(isdat),6,2)-32
6746 else
6747 imid = igetbits(isdat3(j),6,2)-32
6748 end if
6749 c
6750 c Postscript slurs, and \midslur adjustment is needed. Invoke macro
6751 c (from pmx.tex) that redefines \tslur as r'qd. Tentative mapping:
6752 c Abs(imid) Postscript slur type
6753 c 1 f
6754 c 2-3 default
6755 c 4 h
6756 c 5 H
6757 c 6+ HH
6758 c
6759 call addstr(chax(92)//'psforts'//
6760 * chax(48+min(abs(imid),6)),9,soutq,lsout)
6761 end if
6762 if (btest(isdata,2)) then
6763 c
6764 c ADjust for stem slur.
6765 c
6766 if (stemup) then
6767 slurudq = 'u'
6768 ivoff = ivoff+4
6769 else
6770 slurudq = 'd'
6771 ivoff = ivoff-4
6772 end if
6773 end if
6774 c
6775 c Shift slur ending for stem on any note?
6776 c
6777 if (.not.stemup .and. slurudq.eq.'d' .and. tno.lt.63.) then
6778 if (.not.pstie) then
6779 ihoff = ihoff-8
6780 else
6781 ihoff = ihoff-3
6782 end if
6783 end if
6784 if (iscrd) then
6785 c
6786 c Shift termination for shifted notehead?
6787 c
6788 if (btest(isdat2(isdat),1)) then
6789 c
6790 c Left-shifted chord notehead. ASSUME downstem.
6791 c
6792 if (nolevs.eq.minlev .and. slurudq.eq.'d') then
6793 ihoff = ihoff-2
6794 else
6795 ihoff = ihoff-10
6796 end if
6797 else if (btest(isdat2(isdat),2)) then
6798 c
6799 c Right shifted chord notehead. ASSUME upstem.
6800 c
6801 if (nolevs.eq.maxlev .and. slurudq.eq.'u') then
6802 ihoff = ihoff+2
6803 else
6804 ihoff = ihoff+10
6805 end if
6806 end if
6807 end if
6808 if (ihoff .eq. 0) then
6809 notexq = chax(92)//'tslur'
6810 lnote = 6
6811 else
6812 c
6813 c Shift needed
6814 c
6815 notexq = chax(92)//'ts'
6816 lnote = 3
6817 end if
6818 c
6819 c Switch to postscript tie
6820 c
6821 if (pstie) then
6822 notexq = chax(92)//'tieforts'//notexq(1:lnote)
6823 lnote = lnote+9
6824 end if
6825 c
6826 c Print 13-ndxslur
6827 c 5/25/08 Allow 14 slurs
6828 c
6829 if (23-ndxslur .lt. 10) then
6830 notexq = notexq(1:lnote)//chax(71-ndxslur)
6831 lnote = lnote+1
6832 else if (23-ndxslur .lt. 20) then
6833 notexq = notexq(1:lnote)//'{1'//chax(61-ndxslur)//'}'
6834 lnote = lnote+4
6835 else
6836 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
6837 lnote = lnote+4
6838 end if
6839 if (btest(iornq,11).or.btest(iornq,12)) then
6840 c
6841 c Raise or lower slur by one unit provided . or _ is on same side as slur
6842 c
6843 ivoffinc = 0
6844 if ((stemup .and. slurudq.eq.'d') .or.
6845 * (.not.stemup .and. slurudq.eq.'u')) then
6846 if (stemup) then
6847 ivoffinc = -1
6848 else
6849 ivoffinc = 1
6850 end if
6851 if (((stemup .and. nolev.ge.ncm-2) .or.
6852 * (.not.stemup .and. nolev.le.ncm+2)) .and.
6853 * mod(abs(ncm-nolev),2).eq.0) ivoffinc = 2*ivoffinc
6854 end if
6855 ivoff = ivoff+ivoffinc
6856 end if
6857 call notefq(noteq,lnoten,nolevs+iupdn+ivoff,ncm)
6858 if (slurudq.eq.'u' .and.
6859 * (.not.btest(isdat2(isdat),0).or.nolevs.eq.maxlev)) then
6860 islhgt = nolevs+iupdn+ivoff
6861 c
6862 c If topvoice, upslur, and idcode checks, no more need to keep hgt for barno.
6863 c
6864 if (ivx.eq.ivmx(nv,nvmx(nv)) .and. is1n1.gt.0) then
6865 if (idcode .eq. is2n1) is1n1=0
6866 end if
6867 end if
6868 notexq = notexq(1:lnote)//noteq(1:lnoten)
6869 lnote = lnote+lnoten
6870 if (ihoff .ne. 0) then
6871 shift = ihoff*0.1
6872 notexq = notexq(1:lnote)//'{'
6873 lnote = lnote+1
6874 lform = lfmt1(shift)
6875 write(notexq(lnote+1:lnote+lform),
6876 * '(f'//chax(48+lform)//'.1)')shift
6877 lnote = lnote+lform
6878 notexq = notexq(1:lnote)//'}'
6879 lnote = lnote+1
6880 end if
6881 call addstr(notexq,lnote,soutq,lsout)
6882 c
6883 c Clear the bit from list of slurs in use
6884 c
6885 listslur = ibclr(listslur,ndxslur)
6886 c
6887 c Zero out the entire strings for start and stop
6888 c
6889 isdata = 0
6890 isdat2(isdat) = 0
6891 isdat3(isdat) = 0
6892 isdat4(isdat) = 0
6893 isdat1(j) = 0
6894 isdat2(j) = 0
6895 isdat3(j) = 0
6896 isdat4(j) = 0
6897 c
6898 c Set midi info for slur ending
6899 c
6900 if (ismidi .and. (idcode.eq.32 .or. idcode.eq.1)) then
6901 icm = midchan(iv,kv)
6902 if (slmon(icm)) then
6903 if (nolevs+miditran(instno(iv)).eq.levson(icm) .and.
6904 * iand(7,nacc).eq.0) then
6905 c
6906 c There is a tie here. NB!!! assumed no accidental on 2nd member of tie.
6907 c
6908 levsoff(icm) = nolevs+miditran(instno(iv))
6909 settie = .true.
6910 else
6911 levsoff(icm) = 0
6912 levson(icm) = 0
6913 slmon(icm) = .false.
6914 end if
6915 end if
6916 end if
6917 end if
6918 isdat1(isdat) = isdata
6919 end if
6920 1 continue
6921 c
6922 c Clear and collapse the slur data list
6923 c
6924 numdrop = 0
6925 do 2 isdat = 1 , nsdat
6926 if (isdat1(isdat) .eq. 0) then
6927 numdrop = numdrop+1
6928 else if (numdrop .gt. 0) then
6929 isdat1(isdat-numdrop) = isdat1(isdat)
6930 isdat2(isdat-numdrop) = isdat2(isdat)
6931 isdat3(isdat-numdrop) = isdat3(isdat)
6932 isdat4(isdat-numdrop) = isdat4(isdat)
6933 isdat1(isdat) = 0
6934 isdat2(isdat) = 0
6935 isdat3(isdat) = 0
6936 isdat4(isdat) = 0
6937 end if
6938 2 continue
6939 nsdat = nsdat-numdrop
6940 return
6941 end
6942 subroutine doslur(nolev,isdat1,isdat2,isdat3,nsdat,ip,iv,kv,nv,
6943 * beamon,ncm,soutq,lsout,ulq,islur,ipl,iornq,islhgt,tno,nacc)
6944 c
6945 c Called once per main note. (5/26/02) for non-ps slurs only
6946 c
6947 parameter (nm=24,mv=24576)
6948 integer*4 isdat1(202),isdat2(202),isdat3(202)
6949 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
6950 * ,WrotePsslurDefaults,SlurCurve
6951 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
6952 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
6953 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
6954 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
6955 common /comsln/ is1n1,is2n1,irzbnd,isnx
6956 character*1 ulq,slurudq,udfq,udqq,chax
6957 character*79 notexq
6958 character*8 noteq
6959 character*80 soutq
6960 logical upslur,beamon,btest,stemup,iscrd,sfound,tfound,tmove,
6961 * settie,fontslur,WrotePsslurDefaults
6962 logical slmon,dbltie
6963 common /comslm/ levson(0:nm),levsoff(0:nm),imidso(0:nm),
6964 * naccbl(0:nm),laccbl(0:nm,10),jaccbl(0:nm,10),nusebl,
6965 * slmon(0:nm),dbltie
6966 integer*2 mmidi,iinsiv
6967 logical restpend,relacc,notmain,twoline,ismidi,crdacc
6968 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
6969 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
6970 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
6971 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
6972 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
6973 * debugmidi
6974 logical debugmidi
6975 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
6976 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
6977 logical EarlyTransOn,LaterInstTrans
6978 c 130316
6979 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
6980 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
6981 c
6982 c Bits in isdat1:
6983 c 13-17 iv
6984 c 3-10 ip
6985 c 11 start/stop switch
6986 c 12 kv-1
6987 c 19-25 ichar(code$)
6988 c 26 force direction?
6989 c 27 forced dir'n = up if on, set in sslur; also
6990 c final direction, set in doslur when beam is started, used on term.
6991 c 28-31 ndxslur, set in doslur when beam is started, used on term.
6992 c
6993 c Bits in isdat2
6994 c 0 Chord switch. Not set on main note.
6995 c 1-2 left/right notehead shift. Set only for chord note.
6996 c 3 tie positioning
6997 c 4 dotted flag
6998 c 6-11 voff1 1-63 => -31...+31
6999 c 12-18 hoff1 1-127 => -6.3...+6.3
7000 c 19-25 nolev
7001 c
7002 c Bits in isdat3: Only used for slur endings
7003 c 0 set if midslur (at least one argument)
7004 c 1 set if curve (2 more args)
7005 c 2-7 32+first arg (height correction) (1st arg may be negative)
7006 c 8-10 second arg (initial slope)
7007 c 11-13 third arg (closing slope)
7008 c
7009 c In listslur bit ib is on if slur index ib is in use, ib=0-23.
7010 c ndxslur = slur index
7011 c Height of slur is nole+ivoff+iupdn. iupdn is +/-1 if t&s slurs on same note,
7012 c s-slur is blank (idcode=32), t-slur is idcode=1.
7013 c ivoff is user-defined shift or shift due to . or _ , or chord adjustment.
7014 c Ivoff will be set for ./_ only if no user-defined shift is specified.
7015 c If highest note has upslur, save slur height in islhgt in case
7016 c ornament must be moved.
7017 c
7018 islhgt = 0
7019 if (beamon) then
7020 stemup = ulq .eq. 'u'
7021 else if (nvmx(iv) .eq. 2) then
7022 if (.not.btest(islur,30)) then
7023 c
7024 c Single note, 2 lines of music, stem direction not forced
7025 c
7026 stemup = ivx .gt. nv
7027 else
7028 stemup = btest(islur,17)
7029 end if
7030 else
7031 stemup = udqq(nolev,ncm,islur,nvmx(iv),ivx,nv) .eq. 'u'
7032 end if
7033 iscrd = btest(ipl,10)
7034 if (btest(islur,1)) then
7035 c
7036 c 't'-slur (idcode=1) somewhere on this note. Find it, check height against
7037 c 's'-slur (idcode=32)
7038 c
7039 sfound = .false.
7040 tfound = .false.
7041 tmove = .false.
7042 do 5 isdat = 1 , nsdat
7043 if (iv .eq. igetbits(isdat1(isdat),5,13) .and.
7044 * ip .eq. igetbits(isdat1(isdat),8,3) .and.
7045 * kv .eq. igetbits(isdat1(isdat),1,12)+1) then
7046 if (.not.tfound) then
7047 tfound = igetbits(isdat1(isdat),7,19).eq.1
7048 if (tfound) then
7049 nolevt = igetbits(isdat2(isdat),7,19)
7050 isdatt = isdat
7051 if (sfound) go to 6
7052 end if
7053 end if
7054 if (.not.sfound) then
7055 sfound = igetbits(isdat1(isdat),7,19).eq.32
7056 if (sfound) then
7057 nolevs = igetbits(isdat2(isdat),7,19)
7058 isdats = isdat
7059 if (tfound) go to 6
7060 end if
7061 end if
7062 end if
7063 5 continue
7064 c
7065 c Will come thru here if there is a t with no s, so comment out the following
7066 c print*,'Did not find s+t-slurs in doslur'
7067 c
7068 6 continue
7069 if (sfound .and. tfound)
7070 * tmove = nolevs.eq.nolevt .and.
7071 c
7072 c Check if 2 starts or two stops
7073 c
7074 * ((btest(isdat1(isdats),11).and.btest(isdat1(isdatt),11)) .or.
7075 * (.not.btest(isdat1(isdats),11).and.
7076 * .not.btest(isdat1(isdatt),11)) )
7077 c
7078 c This is a flag for later changing slur level, after we know slur dir'n.
7079 c
7080 end if
7081 if (ismidi) then
7082 settie = .false.
7083 dbltie = .false.
7084 end if
7085 do 1 isdat = 1 , nsdat
7086 isdata = isdat1(isdat)
7087 if (iv .eq. igetbits(isdata,5,13) .and.
7088 * ip .eq. igetbits(isdata,8,3) .and.
7089 * kv .eq. igetbits(isdata,1,12)+1) then
7090 c
7091 c Since iv and kv match, ivx will be correct
7092 c
7093 idcode = igetbits(isdata,7,19)
7094 ivoff = igetbits(isdat2(isdat),6,6)-32
7095 ihoff = igetbits(isdat2(isdat),7,12)-64
7096 iupdn = 0
7097 slurudq = 'd'
7098 nolevs = igetbits(isdat2(isdat),7,19)
7099 if (btest(isdata,11)) then
7100 c
7101 c Turnon,
7102 c
7103 if (nolevs.eq.0 .or. nolevs.gt.60) then
7104 c
7105 c Note was a rest, cannot start slur on rest.
7106 c
7107 print*
7108 call printl('Cannot start slur on a rest')
7109 call stop1()
7110 end if
7111 c
7112 c Get slur direction
7113 c
7114 if (btest(isdata,26)) then
7115 c
7116 c Force slur direction
7117 c
7118 if (btest(isdata,27)) slurudq = 'u'
7119 else if (nvmx(iv) .eq. 1) then
7120 c
7121 c Only one voice per line
7122 c
7123 if (.not.beamon) then
7124 c
7125 c Separate note.
7126 c
7127 slurudq = udfq(nolev,ncm)
7128 else
7129 c
7130 c In a beam
7131 c
7132 if (ulq .ne. 'u') slurudq = 'u'
7133 end if
7134 if (iscrd) then
7135 if (nolevs .gt. ncm) then
7136 slurudq = 'u'
7137 else
7138 slurudq = 'd'
7139 end if
7140 end if
7141 else
7142 c
7143 c Two voices per line. Get default
7144 c
7145 if (ivx .gt. nv) slurudq = 'u'
7146 c
7147 c Upper voice of the two, so up slur
7148 c
7149 end if
7150 c
7151 c Save up/down-ness for use at termination
7152 c
7153 if (slurudq .eq. 'u') isdata = ibset(isdata,27)
7154 c
7155 c End of section for setting slur direction, still in "Turnon" if-block.
7156 c
7157 if (idcode.eq.1 .and. tmove) then
7158 iupdn = 1
7159 if (slurudq .eq. 'd') iupdn = -1
7160 end if
7161 if (btest(iornq,11).or.btest(iornq,12)) then
7162 c
7163 c Raise or lower slur by one unit provided . or _ is on same side as slur
7164 c
7165 ivoffinc = 0
7166 if ((stemup .and. slurudq.eq.'d') .or.
7167 * (.not.stemup .and. slurudq.eq.'u')) then
7168 c
7169 c Must move the slur for _ or .
7170 c
7171 if (stemup) then
7172 ivoffinc = -1
7173 else
7174 ivoffinc = 1
7175 end if
7176 if (((stemup .and. nolev.ge.ncm-2) .or.
7177 * (.not.stemup .and. nolev.le.ncm+2)) .and.
7178 * mod(abs(ncm-nolev),2).eq.0) ivoffinc = 2*ivoffinc
7179 ivoff = ivoff+ivoffinc
7180 end if
7181 end if
7182 if (listslur .eq. 16777215) then
7183 print*
7184 print*,'You1 defined the twenty-fifth slur, one too many!'
7185 write(15,'(/,a)')
7186 * 'You2 defined the twenty-fifth slur, one too many!'
7187 call stop1()
7188 end if
7189 c
7190 c Get index of next slur not in use, starting from ? down
7191 c
7192 ndxslur = log2(16777215-listslur)
7193 c
7194 c Record slur index
7195 c
7196 listslur = ibset(listslur,ndxslur)
7197 c
7198 c Save for use on termination
7199 c 080531 Allow >16 slurs
7200 call setbits(isdata,4,28,mod(ndxslur,16))
7201 call setbits(isdata,1,18,ndxslur/16)
7202 c
7203 c Shift for stem?
7204 c
7205 if (stemup .and. slurudq.eq.'u' .and. tno.lt.63.)
7206 * ihoff = ihoff+8
7207 if (btest(isdat2(isdat),3)) then
7208 c
7209 c Tie spacing, (slur start)
7210 c
7211 if (slurudq.eq.'d') then
7212 ivoff = ivoff+1
7213 ihoff = ihoff+8
7214 else if (slurudq.eq.'u') then
7215 ivoff = ivoff-1
7216 if (.not.(stemup.and.tno.lt.63.)) ihoff = ihoff+8
7217 c
7218 c (already shifted if (stemup.and.tno.gt.63.) and slurudq='u')
7219 c
7220 end if
7221 end if
7222 if (iscrd) then
7223 c
7224 c Additional horiz shifts for h-shifted noteheads?
7225 c
7226 if (btest(isdat2(isdat),1)) then
7227 c
7228 c Slur start on left-shifted chord notehead. ASSUME downstem.
7229 c
7230 if (nolevs.eq.minlev .and. slurudq.eq.'d') then
7231 ihoff = ihoff-2
7232 else
7233 ihoff = ihoff-10
7234 end if
7235 else if (btest(isdat2(isdat),2)) then
7236 c
7237 c Right shifted chord notehead. ASSUME upstem.
7238 c
7239 if (nolevs.eq.maxlev .and. slurudq.eq.'u') then
7240 ihoff = ihoff+2
7241 else
7242 ihoff = ihoff+10
7243 end if
7244 end if
7245 end if
7246 if (ihoff .eq. 0) then
7247 c
7248 c Write stuff for non-shifted start
7249 c
7250 notexq = chax(92)//'islur'//slurudq
7251 lnote = 7
7252 else
7253 notexq = chax(92)//'is'//slurudq
7254 lnote = 4
7255 end if
7256 if (btest(isdat2(isdat),4)) then
7257 c
7258 c Dotted slur
7259 c
7260 noteq(1:8) = notexq
7261 notexq = chax(92)//'dotted'//noteq
7262 lnote = lnote+7
7263 end if
7264 c
7265 c Add slur index to string
7266 c Print 23-ndxslur
7267 c
7268 if (23-ndxslur .lt. 10) then
7269 c
7270 c 5/25/08 Allow 24 slurs
7271 c
7272 notexq = notexq(1:lnote)//chax(71-ndxslur)
7273 lnote = lnote+1
7274 else if (23-ndxslur .lt. 20) then
7275 notexq = notexq(1:lnote)//'{1'//chax(61-ndxslur)//'}'
7276 lnote = lnote+4
7277 else
7278 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
7279 lnote = lnote+4
7280 end if
7281 c
7282 c Add note name to string
7283 c
7284 call notefq(noteq,lnoten,nolevs+iupdn+ivoff,ncm)
7285 notexq = notexq(1:lnote)//noteq(1:lnoten)
7286 lnote = lnote+lnoten
7287 c
7288 c Save height (for ornament and barnobox interference) if topmost slur is up
7289 c
7290 if (slurudq.eq.'u' .and.
7291 * (.not.btest(isdat2(isdat),0).or.nolevs.eq.maxlev)) then
7292 islhgt = nolevs+iupdn+ivoff
7293 c
7294 c Save height & idcode if top voice and slur start
7295 c
7296 if (ivx.eq.ivmx(nv,nvmx(nv)) .and. islhgt.gt.is1n1) then
7297 is1n1 = islhgt
7298 is2n1 = idcode
7299 end if
7300 end if
7301 if (ihoff .ne. 0.) then
7302 shift = ihoff*0.1
7303 notexq = notexq(1:lnote)//'{'
7304 lnote = lnote+1
7305 lform = lfmt1(shift)
7306 write(notexq(lnote+1:lnote+lform),'(f'//
7307 * chax(48+lform)//'.1)') shift
7308 lnote = lnote+lform
7309 notexq = notexq(1:lnote)//'}'
7310 lnote = lnote+1
7311 end if
7312 call addstr(notexq,lnote,soutq,lsout)
7313 c
7314 c Zero out ip1 to avoid problems if slur goes to next input blk.
7315 c
7316 call setbits(isdata,8,3,0)
7317 c
7318 c Set slur-on data for midi. Only treat null-index slurs and ps ties for now.
7319 c
7320 if (ismidi .and. idcode.eq.32) then
7321 levson(midchan(iv,kv)) = nolevs+miditran(instno(iv))
7322 if (settie) dbltie = .true.
7323 c
7324 c Only way settie=T is if we just set a tie ending. So there's also a slur
7325 c start here, so set a flag telling addmidi not to zero out levson
7326 c
7327 end if
7328 else
7329 c
7330 c Slur is ending. Back thru list to find starting slur
7331 c
7332 do 3 j = isdat-1 , 1 , -1
7333 if (iv.eq.igetbits(isdat1(j),5,13) .and.
7334 * kv.eq.igetbits(isdat1(j),1,12)+1) then
7335 if (idcode .eq. igetbits(isdat1(j),7,19)) then
7336 ndxslur = igetbits(isdat1(j),4,28)
7337 c
7338 c 080531 Allow >16 slurs
7339 c
7340 * +16*igetbits(isdat1(j),1,18)
7341 if (btest(isdat1(j),27)) slurudq = 'u'
7342 go to 4
7343 end if
7344 end if
7345 3 continue
7346 print*,'Bad place in doslur'
7347 call stop1()
7348 4 continue
7349 if (nolevs.eq.0 .or. nolevs.gt.60) then
7350 c
7351 c Ending is on a rest, reset nolevs to default starting height
7352 c
7353 nolevs = igetbits(isdat2(j),7,19)
7354 end if
7355 if (btest(isdat3(isdat),0)) then
7356 c
7357 c Deal with \curve or \midslur
7358 c
7359 imid = igetbits(isdat3(isdat),6,2)-32
7360 c
7361 c Remember, only dealing with non-ps slurs
7362 c
7363 c Who knows where the following line came from. Removed it 6/30/02 to
7364 c restore behavior of non-ps slurs to old way
7365 c if (slurudq .eq. 'd') imid = -imid
7366 c 3/8/03 added the following
7367 c
7368 if (slurudq .eq. 'd') imid = -abs(imid)
7369 c
7370 if (btest(isdat3(isdat),1)) then
7371 notexq = chax(92)//'curve'
7372 lnote = 6
7373 else
7374 notexq = chax(92)//'midslur'
7375 lnote = 8
7376 end if
7377 if (imid.lt.0 .or. imid.gt.9) then
7378 c
7379 c Need brackets
7380 c
7381 notexq = notexq(1:lnote)//'{'
7382 lnote = lnote+1
7383 if (imid .lt. -9) then
7384 write(notexq(lnote+1:lnote+3),'(i3)')imid
7385 lnote = lnote+3
7386 else if (imid.lt.0 .or. imid.gt.9) then
7387 write(notexq(lnote+1:lnote+2),'(i2)')imid
7388 lnote = lnote+2
7389 else
7390 write(notexq(lnote+1:lnote+1),'(i1)')imid
7391 lnote = lnote+1
7392 end if
7393 notexq = notexq(1:lnote)//'}'
7394 lnote = lnote+1
7395 else
7396 c
7397 c 1=<imid=<9, no brackets
7398 c
7399 notexq = notexq(1:lnote)//char(48+imid)
7400 lnote = lnote+1
7401 end if
7402 if (btest(isdat3(isdat),1)) then
7403 c
7404 c \curve; 3 args
7405 c
7406 notexq = notexq(1:lnote)
7407 * //char(48+igetbits(isdat3(isdat),3,8))
7408 notexq = notexq(1:lnote+1)
7409 * //char(48+igetbits(isdat3(isdat),3,11))
7410 lnote = lnote+2
7411 end if
7412 call addstr(notexq,lnote,soutq,lsout)
7413 end if
7414 c
7415 c Shift slur ending for stem on any note?
7416 c
7417 if (.not.stemup .and. slurudq.eq.'d' .and. tno.lt.63.)
7418 * ihoff = ihoff-8
7419 if (btest(isdat2(isdat),3)) then
7420 c
7421 c Shift ending for tie spacing
7422 c
7423 if (slurudq .eq. 'u') then
7424 ihoff = ihoff-8
7425 ivoff = ivoff-1
7426 else if (slurudq .eq. 'd') then
7427 ivoff = ivoff+1
7428 if (stemup.or. tno.gt.63.) ihoff = ihoff-8
7429 end if
7430 end if
7431 if (iscrd) then
7432 c
7433 c Shift termination for shifted notehead?
7434 c
7435 if (btest(isdat2(isdat),1)) then
7436 c
7437 c Left-shifted chord notehead. ASSUME downstem.
7438 c
7439 if (nolevs.eq.minlev .and. slurudq.eq.'d') then
7440 ihoff = ihoff-2
7441 else
7442 ihoff = ihoff-10
7443 end if
7444 else if (btest(isdat2(isdat),2)) then
7445 c
7446 c Right shifted chord notehead. ASSUME upstem.
7447 c
7448 if (nolevs.eq.maxlev .and. slurudq.eq.'u') then
7449 ihoff = ihoff+2
7450 else
7451 ihoff = ihoff+10
7452 end if
7453 end if
7454 end if
7455 if (ihoff .eq. 0) then
7456 notexq = chax(92)//'tslur'
7457 lnote = 6
7458 else
7459 c
7460 c Shift needed
7461 c
7462 notexq = chax(92)//'ts'
7463 lnote = 3
7464 end if
7465 c
7466 c Print 23-ndxslur
7467 c 5/25/08 Allow 14 slurs (???????????)
7468 c
7469 if (23-ndxslur .lt. 10) then
7470 notexq = notexq(1:lnote)//chax(71-ndxslur)
7471 lnote = lnote+1
7472 else if (23-ndxslur .lt. 20) then
7473 notexq = notexq(1:lnote)//'{1'//chax(61-ndxslur)//'}'
7474 lnote = lnote+4
7475 else
7476 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
7477 lnote = lnote+4
7478 end if
7479 if (btest(iornq,11).or.btest(iornq,12)) then
7480 c
7481 c Raise or lower slur by one unit provided . or _ is on same side as slur
7482 c
7483 ivoffinc = 0
7484 if ((stemup .and. slurudq.eq.'d') .or.
7485 * (.not.stemup .and. slurudq.eq.'u')) then
7486 if (stemup) then
7487 ivoffinc = -1
7488 else
7489 ivoffinc = 1
7490 end if
7491 if (((stemup .and. nolev.ge.ncm-2) .or.
7492 * (.not.stemup .and. nolev.le.ncm+2)) .and.
7493 * mod(abs(ncm-nolev),2).eq.0) ivoffinc = 2*ivoffinc
7494 end if
7495 ivoff = ivoff+ivoffinc
7496 end if
7497 if (idcode.eq.1 .and. tmove) then
7498 c
7499 c t-slur height adjustment
7500 c
7501 iupdn = 1
7502 if (slurudq .eq. 'd') iupdn = -1
7503 end if
7504 call notefq(noteq,lnoten,nolevs+iupdn+ivoff,ncm)
7505 if (slurudq.eq.'u' .and.
7506 * (.not.btest(isdat2(isdat),0).or.nolevs.eq.maxlev)) then
7507 islhgt = nolevs+iupdn+ivoff
7508 c
7509 c If topvoice, upslur, and idcode checks, no more need to keep hgt for barno.
7510 c
7511 if (ivx.eq.ivmx(nv,nvmx(nv)) .and. is1n1.gt.0) then
7512 if (idcode .eq. is2n1) is1n1=0
7513 end if
7514 end if
7515 notexq = notexq(1:lnote)//noteq(1:lnoten)
7516 lnote = lnote+lnoten
7517 if (ihoff .ne. 0) then
7518 shift = ihoff*0.1
7519 notexq = notexq(1:lnote)//'{'
7520 lnote = lnote+1
7521 lform = lfmt1(shift)
7522 write(notexq(lnote+1:lnote+lform),
7523 * '(f'//chax(48+lform)//'.1)')shift
7524 lnote = lnote+lform
7525 notexq = notexq(1:lnote)//'}'
7526 lnote = lnote+1
7527 end if
7528 call addstr(notexq,lnote,soutq,lsout)
7529 c
7530 c Clear the bit from list of slurs in use
7531 c
7532 listslur = ibclr(listslur,ndxslur)
7533 c
7534 c Zero out the entire strings for start and stop
7535 c
7536 isdata = 0
7537 isdat2(isdat) = 0
7538 isdat1(j) = 0
7539 isdat2(j) = 0
7540 isdat3(isdat) = 0
7541 c
7542 c Set midi info for slur ending
7543 c
7544 if (ismidi .and. idcode.eq.32) then
7545 icm = midchan(iv,kv)
7546 if (slmon(icm)) then
7547 if (nolevs+miditran(instno(iv)).eq.levson(icm) .and.
7548 * iand(7,nacc).eq.0) then
7549 c
7550 c There is a tie here. NB!!! assumed no accidental on 2nd member of tie.
7551 c
7552 levsoff(icm) = nolevs+miditran(instno(iv))
7553 settie = .true.
7554 else
7555 levsoff(icm) = 0
7556 levson(icm) = 0
7557 slmon(icm) = .false.
7558 end if
7559 end if
7560 end if
7561 end if
7562 isdat1(isdat) = isdata
7563 end if
7564 1 continue
7565 c
7566 c Clear and collapse the slur data list
7567 c
7568 numdrop = 0
7569 do 2 isdat = 1 , nsdat
7570 if (isdat1(isdat) .eq. 0) then
7571 numdrop = numdrop+1
7572 else if (numdrop .gt. 0) then
7573 isdat1(isdat-numdrop) = isdat1(isdat)
7574 isdat2(isdat-numdrop) = isdat2(isdat)
7575 isdat3(isdat-numdrop) = isdat3(isdat)
7576 isdat1(isdat) = 0
7577 isdat2(isdat) = 0
7578 isdat3(isdat) = 0
7579 end if
7580 2 continue
7581 nsdat = nsdat-numdrop
7582 return
7583 end
7584 subroutine dotmov(updot,rtdot,soutq,lsout,iddot)
7585 c
7586 c iddot = 0 for single dot, 1 for double
7587 c
7588 character*80 soutq,notexq
7589 character*1 sq,chax
7590 sq = chax(92)
7591 lfmtup = lfmt1(updot)
7592 lfmtrt = lfmt1(rtdot)
7593 write(notexq,'(a37,f'//chax(48+lfmtup)//'.1,a2,f'//chax(48+lfmtrt)
7594 * //'.1,a15)')
7595 * sq//'makeatletter'//sq//'def'//sq//'C@Point#1#2{'//sq//
7596 * 'PMXpt{',updot,'}{',rtdot,'}'//chax(48+iddot)//'}'//sq
7597 * //'makeatother'
7598 c
7599 c Example of string just created:
7600 c \makeatletter\def\C@Point#1#2{\PMXpt{.5}{.5}}\makeatother\
7601 c
7602 lnote = 54+lfmtup+lfmtrt
7603 call addstr(notexq(1:lnote),lnote,soutq,lsout)
7604 return
7605 end
7606 subroutine dotrill(iv,ip,iornq,noteq,lnoten,notexq,lnote)
7607 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
7608 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
7609 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
7610 character*1 chax
7611 character*8 noteq
7612 character*79 notexq
7613 logical tronly,btest
7614 do 1 itr = 1 , ntrill
7615 if (iv.eq.ivtrill(itr) .and. ip.eq.iptrill(itr)) go to 2
7616 1 continue
7617 print*,'Problem in dotrill. Call Dr. Don'
7618 stop
7619 2 continue
7620 tronly = xnsktr(itr) .lt. 0.01
7621 if (tronly) then
7622 notexq = chax(92)//'zcharnote'
7623 lnote = 10
7624 else if (btest(iornq,7)) then
7625 notexq = chax(92)//'Trille'
7626 lnote = 7
7627 else
7628 notexq = chax(92)//'trille'
7629 lnote = 7
7630 end if
7631 notexq = notexq(1:lnote)//noteq(1:lnoten)//'{'
7632 lnote = lnote+lnoten+1
7633 c
7634 c Write trill duration to nearest tenth of a noteskip
7635 c
7636 if (tronly) then
7637 notexq = notexq(1:lnote)//chax(92)//'it tr}'
7638 lnote = lnote+7
7639 return
7640 end if
7641 if (xnsktr(itr) .lt. .95) then
7642 nfmt = 2
7643 else if (xnsktr(itr) .lt. 9.95) then
7644 nfmt = 3
7645 else
7646 nfmt = 4
7647 end if
7648 write(notexq(lnote+1:lnote+nfmt),'(f'//chax(48+nfmt)//'.1)')
7649 * xnsktr(itr)
7650 lnote = lnote+nfmt
7651 notexq = notexq(1:lnote)//'}'
7652 lnote = lnote+1
7653 return
7654 end
7655 subroutine endslur(stemup,upslur,nolev,iupdn,ndxslur,ivoff,ncm,
7656 * soutq,lsout,fontslur)
7657 c
7658 c Only called to end slur started in dograce.
7659 c
7660 logical shift,stemup,upslur,fontslur
7661 character*80 soutq
7662 character*79 notexq
7663 character*8 noteq
7664 character*1 chax
7665 shift = .not.stemup .and. .not.upslur
7666 if (.not.shift) then
7667 c
7668 c No shift needed
7669 c
7670 notexq = chax(92)//'tslur'
7671 lnote = 6
7672 else
7673 c
7674 c Shift needed
7675 c
7676 notexq = chax(92)//'ts'
7677 lnote = 3
7678 end if
7679 c
7680 c Print 23-ndxslur
7681 c
7682 if (23-ndxslur .lt. 10) then
7683 notexq = notexq(1:lnote)//chax(71-ndxslur)
7684 lnote = lnote+1
7685 else if (23-ndxslur .lt. 20) then
7686 notexq = notexq(1:lnote)//'{1'//chax(61-ndxslur)//'}'
7687 lnote = lnote+4
7688 else
7689 notexq = notexq(1:lnote)//'{2'//chax(51-ndxslur)//'}'
7690 lnote = lnote+4
7691 end if
7692 call notefq(noteq,lnoten,nolev+iupdn+ivoff,ncm)
7693 notexq = notexq(1:lnote)//noteq(1:lnoten)
7694 lnote = lnote+lnoten
7695 if (shift) then
7696 if (fontslur) then
7697 notexq = notexq(1:lnote)//'{-.6}'
7698 else
7699 notexq = notexq(1:lnote)//'{-.8}'
7700 end if
7701 lnote = lnote+5
7702 end if
7703 call addstr(notexq,lnote,soutq,lsout)
7704 return
7705 end
7706 subroutine errmsg(lineq,iccount,ibarno,msgq)
7707 parameter(nm=24)
7708 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
7709 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
7710 logical lastchar,fbon,issegno,isheadr,isvolt
7711 character*128 lineq
7712 character*78 outq
7713 character*(*) msgq
7714 character*1 chax
7715 common /truelinecount/ linewcom(20000)
7716 if (iccount .le. 78) then
7717 outq = lineq(1:78)
7718 iposn = iccount
7719 else
7720 outq = '... '//lineq(55:128)
7721 iposn = iccount-50
7722 end if
7723 print*
7724 ibarnop = ibarno
7725 if (linesinpmxmod.eq.0 .or.
7726 * nline .gt. line1pmxmod+linesinpmxmod) then
7727 c
7728 c Error is in main .pmx file
7729 c
7730 c nlinep = nline-linesinpmxmod
7731 c Correct for comments not copied into buffer
7732 nlinep = linewcom(nline)-linesinpmxmod
7733 else
7734 c
7735 c Error is in include file
7736 c
7737 ibarnop = 0
7738 nlinep = nline-line1pmxmod+1
7739 call printl(
7740 * 'ERROR in include file named above, description given below')
7741 end if
7742 open(19,file='pmxaerr.dat')
7743 write(19,'(i6)') nlinep
7744 close(19)
7745 ndigbn = max(1,int(log10(ibarnop+.1)+1))
7746 ndignl = int(log10(nlinep+.1)+1)
7747 lenmsg = index(msgq,'!')-1
7748 c
7749 c Split off msgq(..) since UNIX compilers don't allow concat substring!!!
7750 c
7751 write(*,'(/,a15,i'//chax(48+ndignl)//',a6,i'//chax(48+ndigbn)//
7752 *',$)')' ERROR in line ',nlinep,', bar ',ibarnop
7753 write(*,'(1x,a)')msgq(1:lenmsg)
7754 write(15,'(/,a15,i'//chax(48+ndignl)//',a6,i'//chax(48+ndigbn)//
7755 *',$)')' ERROR in line ',nlinep,', bar ',ibarnop
7756 write(15,'(a)')msgq(1:lenmsg)
7757 i10 = iposn/10
7758 i1 = iposn-10*i10
7759 write(*,'('//chax(48+i10)//chax(48+i1)//'x,a)')'v'
7760 write(15,'('//chax(48+i10)//chax(48+i1)//'x,a)')'v'
7761 print*,outq(1:78)
7762 write(15,'(a)')' '//outq(1:78)
7763 write(*,'('//chax(48+i10)//chax(48+i1)//'x,a)')'^'
7764 write(15,'('//chax(48+i10)//chax(48+i1)//'x,a)')'^'
7765 return
7766 end
7767 subroutine eskb4(ip,ivx,in,ib,space,tstart,fbar,itrpt,esk)
7768 c
7769 c Get elemskips to previous note. Called only for graces, no xtups involved.
7770 c
7771 parameter (nm=24)
7772 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
7773 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
7774 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
7775 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
7776 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
7777 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
7778 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
7779 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
7780 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
7781 character*1 ulq,sepsymq,sq
7782 logical beamon,firstgulp,figbass,figchk,isfig
7783 real*4 tstart(80),space(80)
7784 common /comtol/ tol
7785 itnd = nint(to(in))
7786 if (ip.eq.1 .or. itnd.eq.itrpt) then
7787 c
7788 c Start of bar or after rpt.
7789 c
7790 esk = fbar
7791 return
7792 else
7793 esk = 0.
7794 itprev = itnd-nodur(ivx,ip-1)
7795 do 1 iib = ib , 1 , -1
7796 if (tstart(iib) .lt. itprev+tol) then
7797 c
7798 c This is the block
7799 c
7800 nnsk = nint(float((itnd-itprev))/space(iib))
7801 esk = esk+nnsk*feon(space(iib))
7802 return
7803 else
7804 nnsk = nint((itnd-tstart(iib))/space(iib))
7805 esk = esk+nnsk*feon(space(iib))
7806 itnd = nint(tstart(iib))
7807 end if
7808 1 continue
7809 end if
7810 print*,'Problem in eskb4. Send files to Dr. Don'
7811 stop
7812 end
7813 function f1eon(time)
7814 f1eon = sqrt(time/2)
7815 return
7816 end
7817 function feon(time)
7818 common /comeon/ eonk,ewmxk
7819 feon = sqrt(time/2)**(1.-eonk)*ewmxk
7820 return
7821 end
7822 subroutine findbeam(ibmrep,numbms,mapfb)
7823 c
7824 c Called once per voice per bar, after setting forced beams.
7825 c
7826 parameter (nm=24)
7827 dimension mask(49,3),nummask(3),eqonly(49,3)
7828 c integer numbms(nm),ipr(48),nip1(0:47),nip2(0:47),mapfb(24),
7829 c * itr(48),nodue(48)
7830 c logical short(48),eqonly
7831 integer numbms(nm),ipr(248),nip1(0:247),nip2(0:247),mapfb(24),
7832 * itr(248),nodue(248)
7833 logical short(248),eqonly
7834 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
7835 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
7836 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
7837 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
7838 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
7839 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
7840 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
7841 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
7842 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
7843 common /comipl2/ ipl2(nm,200)
7844 common /combeam/ ibmtyp
7845 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
7846 common /comtol/ tol
7847 character*1 ulq,sepsymq,sq
7848 logical beamon,firstgulp,figbass,figchk,
7849 * isfig,btest
7850 data nip1,nip2 /496*0/
7851 data nummask / 29 , 49 , 12 /
7852 data mask
7853 * / 65535, 4095, 65520, 255, 65280, 63,
7854 * 252, 16128, 64512, 15, 240, 3840,
7855 * 61440, 7, 14, 112, 224, 1792,
7856 * 3584, 28672, 57344, 3, 12, 48,
7857 * 192, 768, 3072, 12288, 49152, 20*0 ,
7858 * 16777215, 65535, 16776960, 4095, 65520, 1048320,
7859 * 16773120, 255, 65280, 16711680, 63, 252,
7860 * 16128, 64512, 4128768, 16515072, 15, 60,
7861 * 240, 3840, 15360, 61440, 983040, 3932160,
7862 * 15728640, 7, 14, 112, 224, 1792,
7863 * 3584, 28672, 57344, 458752, 917504, 7340032,
7864 * 14680064, 3, 12, 48, 192, 768,
7865 * 3072, 12288, 49152, 196608, 786432, 3145728,
7866 * 12582912,
7867 * 4095, 255, 4080, 15, 240, 3840,
7868 * 3, 12, 48, 192, 768, 3072,
7869 * 37*0 /
7870 data eqonly /3*.true.,46*.false.,7*.true.,91*.false./
7871 ip = 0
7872 nreal = 0
7873 itnow = 0
7874 1 continue
7875 ip = ip+1
7876 if (ip .gt. nn(ivx)) go to 9
7877 11 if (nodur(ivx,ip).eq.0) then
7878 c
7879 c Ignore all xtup notes except the last, the one with nodur > 0 .
7880 c Xtups are irrelevant here since they are already all in forced beams.
7881 c Will update itnow by nodur at the END of this loop
7882 c
7883 ip = ip+1
7884 go to 11
7885 end if
7886 nreal = nreal+1
7887 nodue(nreal) = nodur(ivx,ip)
7888 short(nreal) = nodue(nreal).lt.16 .and.
7889 * .not.btest(irest(ivx,ip),0)
7890 c
7891 c Rule out notes that have 'alone'-flag set
7892 c
7893 * .and..not.btest(islur(ivx,ip),18)
7894 ipr(nreal) = ip
7895 itr(nreal) = itnow
7896 if (nodue(nreal) .eq. 1) then
7897 c
7898 c 64th gap
7899 c
7900 if (mod(itnow,2) .eq. 0) then
7901 c
7902 c Start of 32nd gap, lump with following note
7903 c
7904 ip = ip+1
7905 nodue(nreal) = 1+nodur(ivx,ip)
7906 itnow = itnow+nodue(nreal)
7907 else
7908 c
7909 c End of 32nd gap, lump with preceeding note
7910 c
7911 nreal = nreal-1
7912 nodue(nreal) = 1+nodue(nreal)
7913 itnow = itnow+1
7914 end if
7915 else
7916 itnow = itnow+nodur(ivx,ip)
7917 end if
7918 go to 1
7919 9 continue
7920 ir1 = 1
7921 itseg = lenbar/ibmrep
7922 do 13 irep = 1 , ibmrep
7923 c
7924 c Set bitmaps for all shorts neighbored by a short. Each bit represents a
7925 c span of 32nd note. maps, mapm, mape record start, full duration, and end
7926 c of consecutive span of beamable (<1/4) notes.
7927 c
7928 maps = 0
7929 mapm = 0
7930 mape = 0
7931 itend = itseg*irep
7932 itoff = itend-itseg
7933 do 2 ir = ir1 , nreal
7934 it2 = itr(ir)+nodue(ir)-2
7935 if (it2 .ge. itend) then
7936 ir1 = ir
7937 go to 14
7938 end if
7939 c if (short(ir).and.((ir.gt.1.and.short(ir-1)).or.(ir.lt.nreal
7940 if (short(ir).and.((ir.gt.1.and.short(max(ir-1,1))).or.
7941 * (ir.lt.nreal.and.short(ir+1)))) then
7942 ib1 = (itr(ir)-itoff)/2
7943 ib2 = (it2-itoff)/2
7944 if (max(ib1,ib2).gt.47 .or. ir.gt.48 .or.
7945 * min(ib1,ib2).lt.0) return
7946 c
7947 c Must have an odd number obe beats in a long bar. Auto-beam won't work
7948 c
7949 nip1(ib1) = ipr(ir)
7950 nip2(ib2) = ipr(ir)
7951 c
7952 c nip1,2(ib) = 0 unless a real note starts,ends on bit ib; then = ip
7953 c
7954 maps = ibset(maps,ib1)
7955 mape = ibset(mape,ib2)
7956 do 3 ib = ib1 , ib2
7957 mapm = ibset(mapm,ib)
7958 3 continue
7959 end if
7960 2 continue
7961 14 continue
7962 if (mapm .eq. 0) go to 13
7963 c
7964 c Zero out bits from forced beams
7965 c
7966 maps = iand(maps,not(mapfb(irep)))
7967 mapm = iand(mapm,not(mapfb(irep)))
7968 mape = iand(mape,not(mapfb(irep)))
7969 c
7970 c Compare map with template.
7971 c
7972 do 4 it = 1 , nummask(ibmtyp)
7973 masknow = mask(it,ibmtyp)
7974 if (iand(masknow,mapm) .eq. masknow) then
7975 c
7976 c Find least significant bit in the mask to check start time
7977 c
7978 mtemp = masknow
7979 maskm = masknow
7980 do 5 is1 = 0 , 47
7981 c do 5 is1 = 0 , 247
7982 if (iand(1,mtemp) .eq. 1) go to 6
7983 mtemp = ishft(mtemp,-1)
7984 5 continue
7985 6 continue
7986 if (iand(ishft(1,is1),maps) .eq. 0) go to 4
7987 c
7988 c is1 is the bit where the beam starts. Continue shifting to
7989 c find most significant bit in the mask to check ending time
7990 c
7991 do 7 is2 = is1 , 47
7992 c do 7 is2 = is1 , 247
7993 mtemp = ishft(mtemp,-1)
7994 if (iand(1,not(mtemp)) .eq. 1) go to 8
7995 7 continue
7996 8 continue
7997 c
7998 c is2 is now the bit on which the beam ends.
7999 c
8000 if (iand(ishft(1,is2),mape) .eq. 0) go to 4
8001 c
8002 c Did we pick out a single note from the middle of a longer sequence?
8003 c
8004 if (nip1(is1) .eq. nip2(is2)) go to 4
8005 c
8006 c We almost have a beam. Check equality of notes if needed.
8007 c
8008 if (eqonly(it,ibmtyp)) then
8009 do 10 ip = nip1(is1) , nip2(is2)
8010 if (nodur(ivx,ip) .ne. 8) then
8011 c
8012 c There is a non-1/8th note in this beam. Exit if not 2 quarters
8013 c
8014 if (is2-is1 .ne. 15) go to 4
8015 c
8016 c Beam is 2 quarters long. Check if can split in half.
8017 c
8018 ithalf = 0
8019 do 20 iip = nip1(is1) , nip2(is2)
8020 ithalf = ithalf+nodur(ivx,iip)
8021 if (ithalf .gt. 16) go to 4
8022 if (ithalf .eq. 16) go to 21
8023 20 continue
8024 print*,'Problem in findbeam, please call Dr. Don'
8025 go to 4
8026 21 continue
8027 c
8028 c Otherwise, split in half by keeping only the first half. Other half will
8029 c be picked up later, assuming masks are listed longest first.
8030 c
8031 is2 = is1+7
8032 c
8033 c Reset maskm (since only used part of mask), used later to zero out
8034 c bits that contain beams
8035 c
8036 maskm = 0
8037 do 15 is = is1 , is2
8038 maskm = ibset(maskm,is)
8039 15 continue
8040 go to 16
8041 end if
8042 10 continue
8043 end if
8044 16 continue
8045 c
8046 c This is a beam. If last "effective" ends on odd 64th, add 1 more
8047 c
8048 c if (abs(mod(to(iand(255,ipl(ivx,nip2(is2))))
8049 c * +nodur(ivx,nip2(is2)),2.)) .gt. tol) then
8050 if (abs(amod(to(ipl2(ivx,nip2(is2)))
8051 * +nodur(ivx,nip2(is2))+.5*tol,2.)) .gt. tol) then
8052 nip2(is2) = nip2(is2)+1
8053 end if
8054 numbms(ivx) = numbms(ivx)+1
8055 numnew = numbms(ivx)
8056 call logbeam(numnew,nip1(is1),nip2(is2))
8057 c
8058 c Zero out the appropriate bits so these notes don't get used again
8059 c
8060 mapm = iand(mapm,not(maskm))
8061 if (mapm.eq.0) go to 13
8062 maps = iand(maps,not(maskm))
8063 mape = iand(mape,not(maskm))
8064 end if
8065 4 continue
8066 13 continue
8067 return
8068 end
8069 subroutine findeonk(nptr1,nptr2,wovera,xelsk,dtmin,dtmax,eonk0)
8070 parameter (nkb=3999,maxblks=9600)
8071 c
8072 c Compute an exponent eonk for use in the "flattened" formula for elemskips
8073 c vs time. We must solve the eqution f = 0. Initial quess is eonk0.
8074 c
8075 common /c1omnotes/ nnodur,wminnh(nkb),nnpd(maxblks),durb(maxblks),
8076 * iddot,nptr(nkb),ibarcnt,mbrest,ibarmbr,
8077 * ibaroff,udsp(nkb),wheadpt,sqzb(maxblks)
8078 common /comtol/ tol
8079 common /comeon/ eonk,ewmxk
8080 eonk = eonk0
8081 niter = 0
8082 1 continue
8083 ewmxk = f1eon(dtmax)**eonk
8084 niter = niter+1
8085 esum = 0.
8086 desum = 0.
8087 do 2 iptr = nptr1 , nptr2
8088 targ = durb(iptr)/sqzb(iptr)
8089 esum = esum+nnpd(iptr)*sqzb(iptr)*feon(targ)
8090 detarg = sqrt(targ/2*(dtmax/targ)**eonk)*alog(dtmax/targ)
8091 desum = desum+nnpd(iptr)*sqzb(iptr)*detarg
8092 2 continue
8093 f = wovera*feon(dtmin)-xelsk-esum
8094 fp = wovera*sqrt(dtmin/2*(dtmax/dtmin)**eonk)*alog(dtmax/dtmin)
8095 * -desum
8096 if (abs(fp).lt.tol .or. abs(eonk-.5).gt..5 .or. niter.gt.100) then
8097 call printl(
8098 * 'Error in findeonk. Please send source to Dr. Don')
8099 eonk = 0.
8100 ewmxk = 1.
8101 return
8102 end if
8103 dsoln = -f/fp
8104 if (abs(dsoln) .lt. .1*tol) return
8105 c
8106 c Not converged yet, try again
8107 c
8108 eonk = eonk+dsoln
8109 go to 1
8110 end
8111 function fnote(nodur,ivx,ip,nacc)
8112 c
8113 c This return the real duration of a note
8114 c
8115 parameter (nm=24)
8116 integer*4 nodur(nm,200),nacc(nm,200)
8117 logical btest
8118 ipback = ip
8119 if (nodur(ivx,ip) .gt. 0) then
8120 if (ip .gt. 1) then
8121 c
8122 c Check if this is last note of xtup
8123 c
8124 if (nodur(ivx,ip-1).eq.0) then
8125 ipback = ip-1
8126 go to 2
8127 end if
8128 end if
8129 fnote = nodur(ivx,ip)
8130 return
8131 end if
8132 2 continue
8133 c
8134 c Count back to prior non zero note. Start at ip to avoid neg index if ip=1.
8135 c Count how many doubled xtups notes there are from ip-1 to first note.
8136 c
8137 ndoub = 0
8138 do 1 ip1m1 = ipback , 1 , -1
8139 if (nodur(ivx,ip1m1) .gt. 0) go to 4
8140 if (ip1m1.lt.ip .and. btest(nacc(ivx,ip1m1),18)) ndoub=ndoub+1
8141 1 continue
8142 4 continue
8143 c
8144 c count forward to next non-0 nodur. Start at ip in case last note of xtup.
8145 c
8146 do 3 iip = ip , 200
8147 c
8148 c Count doubled xtup notes from ip to end.
8149 c
8150 if (btest(nacc(ivx,iip),18)) ndoub = ndoub+1
8151 if (nodur(ivx,iip) .gt. 0) then
8152 c fnote = nodur(ivx,iip)/float(iip-ip1m1)
8153 fnote = nodur(ivx,iip)/float(iip-ip1m1+ndoub)
8154 if (btest(nacc(ivx,ip),18)) then
8155 fnote = 2*fnote
8156 else if (btest(nacc(ivx,ip),27)) then
8157 fnote = 1.5*fnote
8158 else if (ip .gt. 1) then
8159 if (btest(nacc(ivx,ip-1),27)) fnote = .5*fnote
8160 end if
8161 return
8162 end if
8163 3 continue
8164 print*,' '
8165 call printl
8166 * ('Probable misplaced barline or incorrect meter, stopping')
8167 print*,'ivx,ip:',ivx,ip
8168 call stop1()
8169 end
8170 subroutine g1etchar(lineq,iccount,charq)
8171 parameter(nm=24)
8172 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
8173 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
8174 logical lastchar,issegno,isheadr,isvolt,fbon
8175 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
8176 logical mrecord,mplay,endmac
8177 character*1 charq
8178 character*128 lineq,lnholdq
8179 c
8180 c Gets the next character out of lineq*128. If pointer iccount=128 on entry,
8181 c then reads in a new line. Resets iccount. Ends program if no more input.
8182 c
8183 if (iccount .eq. 128) then
8184 call read10(lineq,lastchar)
8185 if (lastchar) return
8186 if (.not.endmac) then
8187 iccount = 0
8188 if (.not.mplay) nline = nline+1
8189 else
8190 endmac = .false.
8191 iccount = icchold
8192 lineq = lnholdq
8193 end if
8194 if (mrecord) then
8195 call m1rec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
8196 end if
8197 end if
8198 iccount = iccount+1
8199 charq = lineq(iccount:iccount)
8200 return
8201 end
8202 subroutine g1etnote(loop,ifig,optimize,fulltrans)
8203 parameter (nm=24,nkb=3999,mv=24576,maxblks=9600)
8204 character*1 chax
8205 logical twotrem
8206 common /a1ll/ iv,ivxo(600),ipo(600),to(600),tno(600),nnl(nm),
8207 * nv,ibar,mtrnuml,nodur(nm,200),lenbar,iccount,
8208 * nbars,itsofar(nm),nib(nm,15),nn(nm),
8209 * rest(nm,200),lenbr0,lenbr1,firstline,newmeter
8210 common /c1omnotes/ nnodur,wminnh(nkb),nnpd(maxblks),durb(maxblks),
8211 * iddot,nptr(nkb),ibarcnt,mbrest,ibarmbr,
8212 * ibaroff,udsp(nkb),wheadpt,sqzb(maxblks)
8213 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
8214 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
8215 common /compage/ widthpt,ptheight,hoffpt,voffpt,
8216 * nsyst,nflb,ibarflb(0:40),
8217 * isysflb(0:40),npages,nfpb,ipagfpb(0:18),isysfpb(0:18),
8218 * usefig,fintstf,gintstf,fracsys(30),nmovbrk,isysmb(0:30),
8219 * nistaff(0:40)
8220 common /c1ommvl/ nvmx(nm),ivmx(nm,2),ivx,fbar,nacc(nm,200)
8221 common /comkeys/ nkeys,ibrkch(18),newkey(18),iskchb,idsig,isig1,
8222 * mbrestsav,kchmid(18),ornrpt,shifton,barend,noinst,stickyS
8223 logical lastchar,firstline,rest,loop,newmeter,fbon,issegno,barend,
8224 * isheadr,fulbrp,usefig,isvolt,iskchb,kchmid,plusmin,ornrpt,
8225 * stickyS
8226 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
8227 common /commus/ musize,whead20
8228 logical mrecord,mplay,endmac,shifton,optimize
8229 character*128 lineq,lnholdq
8230 character*1 charq,dotq,dumq,durq,charlq
8231 integer*2 mmidi
8232 logical restpend,relacc,notmain,twoline,ismidi,crdacc,cdot
8233 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
8234 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
8235 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
8236 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
8237 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
8238 * debugmidi
8239 logical debugmidi
8240 character*131072 bufq
8241 integer*2 lbuf(maxblks)
8242 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
8243 logical novshrinktop,upslur,fontslur,ztrans,
8244 * WrotePsslurDefaults,cstuplet
8245 common /comnvst/ novshrinktop,cstuplet
8246 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
8247 * ,WrotePsslurDefaults,SlurCurve
8248 character*51 literq(3),lyrerq(5)
8249 common /comligfont/ isligfont
8250 logical isligfont
8251 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
8252 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
8253 logical EarlyTransOn,LaterInstTrans
8254 logical fulltrans
8255 common /comsize/ isize(nm)
8256 common /commidisig/ midisig
8257 common /comis4bignv/ is4bignv,AIset
8258 logical is4bignv,AIset
8259 common /comshort/ shortfrac,codafrac,ishort,mbrsum,nmbr,nocodabn,
8260 * poefa
8261 real*4 poefa(125)
8262 logical nocodabn
8263 data literq
8264 * /'Literal TeX string cannot start with 4 backslashes!',
8265 * 'TeX string must have <129 char, end with backslash!',
8266 * 'Type 2 or 3 TeX string can only start in column 1!'/
8267 data lyrerq
8268 * /'pmxlyr string must end with " followed by blank!',
8269 * 'pmxlyr string cannot extend past position 120!',
8270 * 'There must be "a" or "b" here!',
8271 * 'There must be "+" or "-" here!',
8272 * 'There must be an integer here!'/
8273 cdot = .false.
8274 twotrem = .false.
8275 1 call g1etchar(lineq,iccount,charq)
8276 if (charq .ne. ' ') charlq = charq
8277 if (lastchar) then
8278 if (index('/%',charlq) .eq. 0) then
8279 print*
8280 print*,'WARNING:'
8281 print*,'Last non-blank character is "',charlq,'", not "/,%"'
8282 print*,'ASCII code:',ichar(charlq)
8283 write(15,'(/a)')'Last non-blank character is "'//charlq//
8284 * '", not "/,%"'
8285 write(15,'(a11,2x,i3)')'ASCII code:',ichar(charlq)
8286 c
8287 c Append " /" to last line. NB lastchar=.true. => ilbuf=nlbuf+1.
8288 c
8289 ilbuf = ilbuf-1
8290 lbuf(ilbuf) = lbuf(ilbuf)+2
8291 bufq = bufq(1:ipbuf)//' /'
8292 write(15,*)'appending <blank>/'
8293 print*,'appending <blank>/'
8294 lineq = lineq(1:iccount)//' /'
8295 lastchar = .false.
8296 go to 1
8297 end if
8298 return
8299 end if
8300 if (charq .eq. ' ') then
8301 go to 1
8302 else if (charq.eq.'%' .and. iccount.eq.1) then
8303 iccount = 128
8304 go to 1
8305 c
8306 c Replacement 1/22/12 since gfortran 4.7 with -O was choking here!
8307 c
8308 else if (index('abcdefg',charq).gt.0 .or.
8309 * charq.eq.'r') then
8310 c
8311 c This is a note/rest.
8312 c
8313 if (cdot) go to 28
8314 idotform = 0
8315 numnum = 0
8316 plusmin = .false.
8317 28 nnl(ivx) = nnl(ivx)+1
8318 if (nnl(ivx) .gt. 200) then
8319 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8320 * '>200 notes in line of music. Use smaller blocks!')
8321 call stop1()
8322 end if
8323 dotq = 'x'
8324 c
8325 c Check if this is 'r ' and previous note was full-bar-pause
8326 c
8327 fulbrp = charq.eq.'r' .and. lineq(iccount+1:iccount+1) .eq.' '
8328 * .and. nnl(ivx).gt.1 .and. rest(ivx,max(1,nnl(ivx)-1)) .and.
8329 * nodur(ivx,max(1,nnl(ivx)-1)) .eq. lenbar
8330 2 call g1etchar(lineq,iccount,durq)
8331 ic = ichar(durq)
8332 if (ic.le.57 .and. ic.ge.48) then
8333 c
8334 c Digit
8335 c
8336 if (numnum .eq. 0) then
8337 nnodur = ic-48
8338 numnum = 1
8339 go to 2
8340 else if (numnum .eq. 1) then
8341 if (charq .eq. 'r') then
8342 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8343 * 'Only one digit allowed after rest symbol "r"!')
8344 call stop1()
8345 end if
8346 numnum = 2
8347 if (plusmin) then
8348 print*
8349 print*,'*********WARNING*********'
8350 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8351 * 'Before version 1.2, +/- was ignored if octave was!')
8352 print*,
8353 * 'explicitly specified. May need to edit old editions'
8354 end if
8355 go to 2
8356 else
8357 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8358 * '>2 digits in note symbol!')
8359 call stop1()
8360 end if
8361 else if (durq.eq.'d') then
8362 dotq = durq
8363 if (lineq(iccount+1:iccount+1) .eq. 'd') then
8364 iddot = 1
8365 iccount = iccount+1
8366 c
8367 c Since we flow out, double dots won't work with other dot options
8368 c
8369 end if
8370 if (index('+-',lineq(iccount+1:iccount+1)) .gt. 0) then
8371 c
8372 c move a dot, provided a number follows.
8373 c
8374 call g1etchar(lineq,iccount,durq)
8375 call g1etchar(lineq,iccount,durq)
8376 if (index('0123456789-.',durq) .eq. 0) then
8377 c
8378 c Backup, exit the loop normally
8379 c
8380 iccount = iccount-2
8381 go to 2
8382 end if
8383 call readnum(lineq,iccount,dumq,fnum)
8384 if (index('+-',dumq) .gt. 0) then
8385 c
8386 c Vertical shift also
8387 c
8388 call g1etchar(lineq,iccount,durq)
8389 if (index('0123456789-.',durq) .eq. 0) then
8390 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8391 * 'Expected number after 2nd +/- (shift dot)!')
8392 call stop1()
8393 end if
8394 call readnum(lineq,iccount,durq,fnum)
8395 end if
8396 iccount = iccount-1
8397 end if
8398 go to 2
8399 else if (index('<>',durq) .gt. 0) then
8400 c
8401 c Accidental shift
8402 c
8403 if (index('fsnA',lineq(iccount-1:iccount-1)) .eq. 0) then
8404 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8405 * 'Expected "f", "s", "n" or "A" before "<" or ">"!')
8406 call stop1()
8407 end if
8408 ipm = 1
8409 if (durq .eq. '<') ipm=-1
8410 call g1etchar(lineq,iccount,durq)
8411 if (index('123456789.0',durq) .eq. 0) then
8412 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8413 * 'Expected number after </> (accidental shift)!')
8414 call stop1()
8415 end if
8416 call readnum(lineq,iccount,durq,fnum)
8417 fnum = ipm*fnum
8418 if (fnum.lt.-5.35 .or. fnum.gt.1.0) then
8419 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8420 * 'Horizontal accidental shift must be >-5.35 and <1.0!')
8421 call stop1()
8422 end if
8423 iccount = iccount-1
8424 go to 2
8425 else if (index('+-',durq) .gt. 0) then
8426 if (charq .ne. 'r') then
8427 if (index('fsnA',lineq(iccount-1:iccount-1)) .gt. 0) then
8428 ipm = 1
8429 if (durq .eq. '-') ipm=-1
8430 if (index('0123456789',lineq(iccount+1:iccount+1))
8431 * .gt.0) then
8432 c
8433 c This may be start of accidental shift, but may be octave jump; then duration
8434 c
8435 icsav = iccount
8436 iccount = iccount+1
8437 call readnum(lineq,iccount,durq,fnum)
8438 if (index('+-',durq) .gt. 0) then
8439 c
8440 c This is an accid shift since there's a 2nd consecutive signed number.
8441 c Check size of 1st number.
8442 c
8443 if (fnum .gt. 30.5) then
8444 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8445 * 'Vertical accidental shift must be less than 31!')
8446 call stop1()
8447 end if
8448 ipm = 1
8449 if (durq .eq. '-') ipm = -1
8450 call g1etchar(lineq,iccount,durq)
8451 if (index('1234567890.',durq) .eq. 0) then
8452 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8453 * 'Expected 2nd number of accidental shift)!')
8454 call stop1()
8455 end if
8456 call readnum(lineq,iccount,durq,fnum)
8457 fnum = ipm*fnum
8458 if (fnum.lt.-5.35 .or. fnum.gt.1.0) then
8459 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8460 * 'Horiz. accidental shift must be >-5.35 and <1.0!')
8461 call stop1()
8462 end if
8463 iccount = iccount-1
8464 go to 2
8465 else
8466 c
8467 c Not accid shift, reset, then flow out
8468 c
8469 iccount = icsav
8470 end if
8471 end if
8472 end if
8473 plusmin = .true.
8474 if (numnum .eq. 2) then
8475 print*
8476 print*,'*********WARNING*********'
8477 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8478 * 'Before version 1.2, +/- was ignored if octave was!')
8479 print*,
8480 * 'explicitly specified. May need to edit old editions'
8481 end if
8482 go to 2
8483 c
8484 c It's a rest containing +|- . Must refer to a vertical shift. Read past.
8485 c
8486 else
8487 call g1etchar(lineq,iccount,durq)
8488 call readnum(lineq,iccount,durq,dum)
8489 if (lineq(iccount-1:iccount-1).eq.'.') iccount=iccount-1
8490 iccount = iccount-1
8491 go to 2
8492 end if
8493 c else if (index('ulare',durq) .gt. 0) then
8494 else if (index('ularec',durq) .gt. 0) then
8495 go to 2
8496 else if (index('LS',durq) .gt. 0) then
8497 c
8498 c Stemlength change
8499 c
8500 call g1etchar(lineq,iccount,durq)
8501 if (index('.0123456789:',durq) .eq. 0) then
8502 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8503 * 'There must be a number or colon here!')
8504 call stop1()
8505 end if
8506 if (durq .eq. ':') then
8507 if (.not.stickyS) then
8508 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8509 * 'Turned off sticky stemlegth changes without turning on!')
8510 call stop1()
8511 end if
8512 stickyS = .false.
8513 go to 2
8514 end if
8515 call readnum(lineq,iccount,durq,dum)
8516 c if (dum.lt..5 .or. dum.gt.4.) then
8517 if ((durq.eq.'L'.and.dum.gt.20.).or.
8518 * (durq.eq.'S'.and.dum.gt.4.)) then
8519 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8520 * 'Stemlength change amount too big!')
8521 call stop1()
8522 end if
8523 if (durq .ne. ':') then
8524 iccount = iccount-1
8525 else
8526 if (stickyS) then
8527 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8528 * 'Turned on sticky stemshrinks when already on!')
8529 call stop1()
8530 end if
8531 stickyS = .true.
8532 end if
8533 go to 2
8534 else if (index('fsn',durq) .gt. 0) then
8535 c
8536 c Check for midi-only accid. CANNOT coesist with accidental position tweaks, so
8537 c MUST come right after "f,s,n"
8538 c
8539 if (lineq(iccount+1:iccount+1) .eq. 'i') iccount=iccount+1
8540 go to 2
8541 else if (durq .eq. 'p') then
8542 fulbrp = charq.eq.'r'
8543 if (.not. fulbrp) then
8544 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8545 * 'The option "p" only works with "r" (rest)!')
8546 call stop1()
8547 end if
8548 go to 2
8549 else if (durq .eq. 'b') then
8550 if (charq .ne. 'r') then
8551 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8552 * 'You entered "b"; I expected "rb"!')
8553 call stop1()
8554 else if (numnum .eq. 2) then
8555 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8556 * 'You entered "r" & "b" with two numbers!')
8557 end if
8558 go to 2
8559 else if (durq .eq. 'x') then
8560 c
8561 c Xtuplet. Count number of doubled notes (for unequal xtups)
8562 c
8563 if (btest(nacc(ivx,nnl(ivx)),18)) then
8564 ndoub = 1
8565 else
8566 ndoub = 0
8567 end if
8568 c
8569 c Will set all durations to 0 except last one.
8570 c
8571 call g1etchar(lineq,iccount,durq)
8572 if (index('123456789T',durq) .eq. 0) then
8573 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8574 * 'First char after "x" in xtuplet must be "1"-"9" or "T"!')
8575 call stop1()
8576 end if
8577 if (durq .eq. 'T') then
8578 c
8579 c Set a flag for checking 2nd note inputs if dot is moved
8580 c
8581 twotrem = .true.
8582 c
8583 c Check all x-tremolo inputs here; set fnum=2
8584 c
8585 fnum = 2
8586 call getchar(lineq,iccount,durq)
8587 if (index('0123 ',durq).eq.0) then
8588 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8589 * 'First char after "T" in xtuplet must be "0"-"3" or blank!')
8590 call stop1()
8591 else if (durq .ne. ' ') then
8592 call getchar(lineq,iccount,durq)
8593 if (index('0123 ',durq).eq.0) then
8594 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8595 * 'This char must be "0"-"3" or blank!')
8596 call stop1()
8597 else if (durq .ne. ' ') then
8598 call getchar(lineq,iccount,durq)
8599 c
8600 c Probably blank unles other options entered
8601 c
8602 end if
8603 end if
8604 else
8605 c
8606 c durq is digit, normal xtup
8607 c
8608 call readnum(lineq,iccount,durq,fnum)
8609 c
8610 c Leaves durq at next char after number
8611 c
8612 if (fnum .gt. 99) then
8613 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8614 * 'Xtuplet cannot have more than 99 notes!')
8615 call stop1()
8616 else if (index(' DFnd',durq) .eq. 0) then
8617 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8618 * 'Only legal characters here are " ","D","F","n"!')
8619 call stop1()
8620 end if
8621 end if
8622 c
8623 c End of mandatory xtup inputs. Check for options. Note D,F,d must precede n.
8624 c
8625 if (index('DF',durq) .gt. 0) then
8626 c
8627 c Double xtup note to make an un= xtup. Here, number already set, but may also
8628 c have used this before number was set.
8629 c
8630 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
8631 ndoub = 1
8632 call g1etchar(lineq,iccount,durq)
8633 else if (durq .eq. 'd') then
8634 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),27)
8635 call g1etchar(lineq,iccount,durq)
8636 end if
8637 if (durq .eq. 'n') then
8638 c
8639 c Number alteration stuff. After 'n', require '+-123456789fs ', no more 'DF'.
8640 c
8641 numshft = 0
8642 30 call g1etchar(lineq,iccount,durq)
8643 if (durq .eq. 'f') then
8644 go to 30
8645 else if (index('+-',durq) .gt. 0) then
8646 numshft = numshft+1
8647 if (numshft .eq. 3) then
8648 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8649 * 'Only 2 shifts are allowed after "n" in xtup!')
8650 call stop1()
8651 end if
8652 call g1etchar(lineq,iccount,durq)
8653 if (index('0123456789.',durq) .eq. 0) then
8654 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8655 * 'This character should be a digit or "."!')
8656 call stop1()
8657 end if
8658 call readnum(lineq,iccount,durq,snum)
8659 iccount = iccount-1
8660 if ((numshft.eq.1 .and. snum.gt.64.) .or.
8661 * (numshft.eq.2 .and. snum.gt.1.51)) then
8662 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8663 * 'Shift number after "n" in xtup is out of range!')
8664 call stop1()
8665 end if
8666 go to 30
8667 else if (durq .eq. 's') then
8668 c
8669 c Slope alteration for bracket
8670 c
8671 call getchar(lineq,iccount,durq)
8672 if (index('+-',durq) .eq. 0) then
8673 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8674 * 'For slope adjustment, this character must be "+" or "-"!')
8675 call stop1()
8676 end if
8677 call g1etchar(lineq,iccount,durq)
8678 if (index('123456789',durq) .eq. 0) then
8679 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8680 * 'This character should be a digit!')
8681 call stop1()
8682 end if
8683 call readnum(lineq,iccount,durq,snum)
8684 iccount = iccount-1
8685 if (nint(snum) .gt. 15) then
8686 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8687 * 'Slope adjustment cannot exceed 15!')
8688 call stop1()
8689 end if
8690 go to 30
8691 else if (index('123456789',durq) .gt. 0) then
8692 c
8693 c Unsigned integer => alternate printed number
8694 c
8695 call readnum(lineq,iccount,durq,snum)
8696 if (snum .gt. 15.1) then
8697 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8698 * 'Alternate xtup number after "n" must be <16!')
8699 call stop1()
8700 end if
8701 iccount = iccount-1
8702 go to 30
8703 else if (durq .ne. ' ') then
8704 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8705 * 'Illegal character after "n" in xtup!')
8706 call stop1()
8707 end if
8708 end if
8709 ntup = nint(fnum)
8710 do 6 itup = 2 , ntup
8711 nodur(ivx,nnl(ivx)) = 0
8712 nnl(ivx) = nnl(ivx)+1
8713 110 call g1etchar(lineq,iccount,durq)
8714 if (durq.eq.' ') then
8715 go to 110
8716 else if (durq .eq. 'o') then
8717 c
8718 c Ornament in xtup. "o" symbol must come AFTER the affected note
8719 c
8720 call g1etchar(lineq,iccount,dumq)
8721 if (index('(stmx+Tup._)e:>^bc',dumq) .eq. 0 ) then
8722 if (index('fg',dumq) .gt. 0) then
8723 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8724 * 'Fermata or segno not allowed in xtuplet!')
8725 else
8726 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8727 * 'Illegal ornament!')
8728 end if
8729 call stop1()
8730 end if
8731 if (dumq .eq. 'T') then
8732 c
8733 c Trill. may be followed by 't' and/or number. read 'til blank
8734 c
8735 29 call g1etchar(lineq,iccount,dumq)
8736 if (dumq .ne. ' ') go to 29
8737 else if (dumq .eq. 'e') then
8738 call g1etchar(lineq,iccount,dumq)
8739 if (index('sfn?',dumq) .eq. 0) then
8740 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8741 * 'Illegal character after "e" in edit. accid. symbol!')
8742 call stop1()
8743 end if
8744 call g1etchar(lineq,iccount,dumq)
8745 if (dumq .eq. '?') call g1etchar(lineq,iccount,dumq)
8746 else if (dumq .eq. ':') then
8747 if (lineq(iccount+1:iccount+1) .ne. ' ') then
8748 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8749 * '":" must be followed by blank in "o: "!')
8750 call stop1()
8751 else if (.not.ornrpt) then
8752 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8753 * 'Turned off repeated ornaments before they were on!')
8754 call stop1()
8755 end if
8756 ornrpt = .false.
8757 else
8758 call g1etchar(lineq,iccount,dumq)
8759 end if
8760 if (index('+- :',dumq) .eq. 0) then
8761 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8762 * 'Illegal character in ornament symbol!')
8763 call stop1()
8764 end if
8765 if (dumq .eq. ':') then
8766 if (lineq(iccount+1:iccount+1) .ne. ' ') then
8767 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8768 * '":" must be followed by blank in "o: "!')
8769 call stop1()
8770 else if (ornrpt) then
8771 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8772 * 'Turned on repeated ornaments but already on!')
8773 call stop1()
8774 end if
8775 ornrpt = .true.
8776 end if
8777 if (index('+-',dumq) .gt. 0) then
8778 if (index('0123456789',lineq(iccount+1:iccount+1))
8779 * .eq. 0) then
8780 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
8781 * 'There should be an integer here!')
8782 call stop1()
8783 end if
8784 call readnum(lineq,iccount,durq,fnum)
8785 if (durq .eq. ':') then
8786 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8787 * 'Cannot shift AND repeat an ornament!')
8788 call stop1()
8789 end if
8790 c
8791 c 12/7/03 Allow horizontal shift on any ornament, not just breath and ceas.
8792 c
8793 if (index('+-',durq) .gt. 0) then
8794 if (index('.0123456789',lineq(iccount+1:iccount+1))
8795 * .eq. 0) then
8796 call errmsg(lineq,iccount+1,
8797 * ibarcnt-ibaroff+nbars+1,
8798 * 'There should be a number here!')
8799 call stop1()
8800 end if
8801 call readnum(lineq,iccount,durq,fnum)
8802 end if
8803 end if
8804 go to 110
8805 else if (index('st(){}',durq) .gt. 0) then
8806 c
8807 c Slur in xtup
8808 c
8809 iposn = 0
8810 numint = 0
8811 15 call g1etchar(lineq,iccount,dumq)
8812 iposn = iposn+1
8813 if (index('udlbfnhtv',dumq) .gt. 0) then
8814 if (dumq.eq.'t' .and. durq.eq.'t') then
8815 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8816 * 'Cannot use "t" as an option on a tie!')
8817 call stop1()
8818 end if
8819 go to 15
8820 else if (index('+-',dumq) .gt. 0) then
8821 numint = numint+1
8822 iccount = iccount+1
8823 call readnum(lineq,iccount,durq,fnum)
8824 if (numint .eq. 1) then
8825 if (nint(fnum) .gt. 30) then
8826 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8827 * 'Magnitude of slur height adjustment cannot exceed 30!')
8828 call stop1()
8829 end if
8830 else if (numint .eq. 2) then
8831 if (abs(fnum).gt.6.3) then
8832 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8833 * 'Slur horiz shift must be in the range (-6.3,6.3)!')
8834 call stop1()
8835 end if
8836 else
8837 c
8838 c Third signed integer, must be a midslur or curve spec.
8839 c
8840 if (abs(fnum).gt.31) then
8841 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8842 * 'Slur midheight must be in the range (-31,31)!')
8843 call stop1()
8844 end if
8845 if (durq .eq. ':') then
8846 c
8847 c Expecting curve parameters. Get two numbers
8848 c
8849 do 40 i = 1 , 2
8850 iccount = iccount+1
8851 fnum = ichar(lineq(iccount:iccount))-48
8852 if (abs(fnum-3.5) .gt. 3.6) then
8853 call errmsg(lineq,iccount,
8854 * ibarcnt-ibaroff+nbars+1,
8855 * 'Slur curve parameter must be in range (0,7)!')
8856 call stop1()
8857 end if
8858 40 continue
8859 iccount = iccount+1
8860 end if
8861 end if
8862 iccount = iccount-1
8863 go to 15
8864
8865 else if (dumq .eq. 's') then
8866 c
8867 c What follows should be one or two signed numbers for adjustment of line break
8868 c slur, end of 1st segment or start of second.
8869 c
8870 if (fontslur) then
8871 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8872 * 'May not use linebreak slur options with font-based slurs!')
8873 call stop1()
8874 end if
8875 call g1etchar(lineq,iccount,dumq)
8876 if (index('+-',dumq) .eq. 0) then
8877 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8878 * 'This character must be "+" or "-"!')
8879 call stop1()
8880 end if
8881 iccount = iccount+1
8882 call readnum(lineq,iccount,dumq,fnum)
8883 if (nint(fnum) .gt. 30) then
8884 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8885 * 'Magnitude of slur height adjustment cannot exceed 30!')
8886 call stop1()
8887 end if
8888 if (index('+-',dumq) .gt. 0) then
8889 iccount = iccount+1
8890 call readnum(lineq,iccount,dumq,fnum)
8891 if (abs(fnum) .gt. 6.3) then
8892 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
8893 * 'Slur horiz shift must be in range (-6.3,6.3)!')
8894 call stop1()
8895 end if
8896 end if
8897 iccount = iccount-1
8898 go to 15
8899 else if (dumq .eq. 'H' .and. iposn.gt.1) then
8900 if (lineq(iccount+1:iccount+1) .eq. 'H')
8901 * iccount=iccount+1
8902 go to 15
8903 else if (dumq .eq. 'p') then
8904 c
8905 c local change in postscript slur/tie adjustment default
8906 c
8907 if (fontslur) then
8908 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8909 * 'Must use postscript slurs ("Ap") to use this option!')
8910 call stop1()
8911 end if
8912 call g1etchar(lineq,iccount,dumq)
8913 if (index('+-',dumq) .eq. 0) then
8914 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8915 * 'Expected "+" or "-" here!')
8916 call stop1()
8917 end if
8918 call g1etchar(lineq,iccount,dumq)
8919 if (index('st',dumq) .eq. 0) then
8920 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8921 * 'Expected "s" or "t" here!')
8922 call stop1()
8923 end if
8924 go to 15
8925 else if (dumq .ne. ' ') then
8926 ic = ichar(dumq)
8927 if ((ic.ge.48.and.ic.le.57) .or.
8928 * (ic.ge.65.and.ic.le.90)) then
8929 if (iposn .eq. 1) then
8930 if (durq.eq.'t' .and. fontslur) then
8931 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8932 * 'Slur ID not allowed on non-postscript tie!')
8933 call stop1()
8934 end if
8935 if (lineq(iccount+1:iccount+1).eq.'x')
8936 * iccount = iccount+1
8937 go to 15
8938 end if
8939 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8940 * 'Slur ID must be 2nd character in slur symbol!')
8941 call stop1()
8942 end if
8943 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8944 * 'Illegal character in slur symbol!')
8945 call stop1()
8946 end if
8947 go to 110
8948 else if (index('0123456789#-nx_',durq) .gt. 0) then
8949 c
8950 c We have a figure. Only allow on 1st note of xtup
8951 c
8952 if (itup .ne. 2) then
8953 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8954 * 'Figure in xtup only allowed on 1st note!')
8955 call stop1()
8956 else if (durq.eq.'x') then
8957 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8958 * 'No floating figures in xtuplets!')
8959 call stop1()
8960 end if
8961 if (usefig .and. ivx.eq.1) ifig = 1
8962 26 call g1etchar(lineq,iccount,durq)
8963 if (index('0123456789#-n_.:v',durq) .gt. 0) then
8964 go to 26
8965 else if (durq .eq. 's') then
8966 isligfont = .true.
8967 go to 26
8968 else if (durq .eq. '+') then
8969 c
8970 c vertical offset, must be integer then blank
8971 c
8972 call g1etchar(lineq,iccount,durq)
8973 if (index('123456789',durq) .ne. 0) then
8974 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8975 * 'Integer for vertical offset expected here!')
8976 call stop1()
8977 end if
8978 call readnum(lineq,iccount,durq,fnum)
8979 if (durq .ne. ' ') then
8980 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8981 * 'Vertical offset must terminate figure!')
8982 call stop1()
8983 end if
8984 iccount = iccount-1
8985 go to 26
8986 else if (durq .ne. ' ') then
8987 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
8988 * 'Illegal character in figure in xtuplet!')
8989 call stop1()
8990 end if
8991 go to 110
8992 else if (durq .eq. 'G') then
8993 ngr = 1
8994 79 call g1etchar(lineq,iccount,charq)
8995 if (index('123456789',charq) .gt. 0) then
8996 call readnum(lineq,iccount,durq,fnum)
8997 ngr = nint(fnum)
8998 iccount = iccount-1
8999 go to 79
9000 else if (index('AWulxs',charq) .gt. 0) then
9001 go to 79
9002 else if (charq .eq. 'm') then
9003 call g1etchar(lineq,iccount,charq)
9004 if (index('01234',charq) .eq. 0) then
9005 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9006 * 'A digit less than 5 must follow "m" in a grace note!')
9007 call stop1()
9008 end if
9009 go to 79
9010 else if (charq .eq. 'X') then
9011 c
9012 c Space before main note
9013 c
9014 call g1etchar(lineq,iccount,charq)
9015 if (index('0123456789.',charq) .gt. 0) then
9016 call readnum(lineq,iccount,durq,fnum)
9017 iccount = iccount-1
9018 go to 79
9019 else
9020 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9021 * 'A number must follow "X" in a grace note!')
9022 call stop1()
9023 end if
9024 end if
9025 c
9026 c At this point, charq is first note name in rest (grace?)
9027 c
9028 do 71 igr = 1 , ngr
9029 numnum = 0
9030 if (igr .gt. 1) then
9031 75 call g1etchar(lineq,iccount,charq)
9032 if (charq .eq. ' ') go to 75
9033 end if
9034 if (index('abcdefg',charq) .eq. 0) then
9035 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9036 * 'In grace, expected "a"-"g"!')
9037 call stop1()
9038 end if
9039 78 call g1etchar(lineq,iccount,charq)
9040 if (charq .ne. ' ') then
9041 if (index('1234567',charq) .gt. 0) then
9042 if (numnum .eq. 1) then
9043 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9044 * 'Only one of "+-1234567" allowed here in grace!')
9045 call stop1()
9046 end if
9047 numnum = 1
9048 go to 78
9049 else if (index('+-nfs',charq) .gt. 0) then
9050 go to 78
9051 end if
9052 c
9053 c Digits are possible octave numbers
9054 c
9055 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9056 * 'Illegal character after note name in grace!')
9057 call stop1()
9058 end if
9059 71 continue
9060 go to 110
9061 else if (durq .eq. chax(92)) then
9062 call chklit(lineq,iccount,literr)
9063 if (literr .gt. 0) then
9064 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9065 * literq(literr))
9066 call stop1()
9067 end if
9068 go to 110
9069 else if (durq .eq. chax(34)) then
9070 c
9071 c pmx lyric
9072 c
9073 call chkpmxlyr(lineq,iccount,lyrerr)
9074 if (lyrerr .gt. 0) then
9075 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9076 * lyrerq(lyrerr))
9077 call stop1()
9078 end if
9079 go to 110
9080 else if (durq .eq. 'M') then
9081 c
9082 c Temporary trap until I get around putting this in pmxb
9083 c
9084 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9085 * 'Macros not yet allowed in xtuplets!')
9086 call stop1()
9087 else if (durq .eq. 'X') then
9088 call g1etx(lineq,iccount,shifton,
9089 * ibarcnt-ibaroff+nbars+1,udsp(ibarcnt+nbars+1),wheadpt)
9090 go to 110
9091 else if (durq .eq. 'z') then
9092 c
9093 c Chord note in xtup. Read past for now.
9094 c
9095 33 call g1etchar(lineq,iccount,durq)
9096 if (durq .ne. ' ') go to 33
9097 go to 110
9098 else if (durq .eq. 'D') then
9099 c
9100 c Dynamic mark
9101 c
9102 call checkdyn(lineq,iccount,ibarcnt-ibaroff+nbars+1)
9103 go to 110
9104 else if (durq .eq. '%') then
9105 if (iccount .ne. 1) then
9106 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9107 * 'Comment must have "%" in column 1!')
9108 call stop1()
9109 end if
9110 iccount = 128
9111 go to 110
9112 else if (durq .eq. '?') then
9113 call getchar(lineq,iccount,durq)
9114 if (durq .eq. ' ') then
9115 iccount = iccount-1
9116 go to 110
9117 end if
9118 if (durq .ne. '-') then
9119 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9120 * 'Expecting "-"')
9121 call stop1()
9122 end if
9123 call getchar(lineq,iccount,durq)
9124 if (index('0123456789.',durq) .eq. 0) then
9125 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9126 * 'Expecting number')
9127 call stop1()
9128 end if
9129 call readnum(lineq,iccount,durq,fnum)
9130 iccount = iccount-1
9131 go to 110
9132 c
9133 c 140215 Allow clef change inside xtup
9134 c
9135 else if (durq .eq. 'C') then
9136 call g1etchar(lineq,iccount,durq)
9137 if (.not.(index('tsmanrbf',durq).gt.0 .or.
9138 c * (ichar(durq).ge.48 .and. ichar(durq).le.55))) then
9139 * (ichar(durq).ge.48 .and. ichar(durq).le.56))) then
9140 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9141 * 'Must have t,s,m,a,n,r,b,f or 0-8 after C!')
9142 call stop1()
9143 end if
9144 go to 110
9145 c+++
9146 else if (durq.eq.']' .and. lineq(iccount+1:iccount+1).eq.'['
9147 * .and. lineq(iccount+2:iccount+2).eq.' ') then
9148 iccount = iccount+2
9149 go to 110
9150 c+++
9151 c
9152 c Added 200118 to allow dot to be moved on 2nd note of 2-note tremolo
9153 c
9154 end if
9155 c
9156 c End of xtup options. At this point symbol can only be note or rest
9157 c
9158 if (index('abcdefgr',durq) .eq. 0) then
9159 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9160 * 'In xtup, this character is not allowed!')
9161 call stop1()
9162 end if
9163 7 call g1etchar(lineq,iccount,durq)
9164 if (index('12345678ulcb',durq) .gt. 0) then
9165 go to 7
9166 else if (index('sfn',durq) .gt. 0) then
9167 c
9168 c Check for MIDI-only accidental. Cannot coexist with accid. pos'n shift.
9169 c
9170 if (lineq(iccount+1:iccount+1) .eq. 'i') iccount=iccount+1
9171 go to 7
9172 else if (index('+-<>',durq) .gt. 0) then
9173 c
9174 c May have either octave jump or shifted accid. on main xtup note
9175 c
9176 if (index('+-',durq).gt.0 .and.
9177 * index('01234567890',lineq(iccount+1:iccount+1)).eq.0)
9178 * go to 7
9179 iccount = iccount+1
9180 call readnum(lineq,iccount,durq,fnum)
9181 iccount = iccount-1
9182 go to 7
9183 else if (index('DF',durq) .gt. 0) then
9184 c
9185 c Double an xtup note to make an unequal xtup
9186 c
9187 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
9188 ndoub = ndoub+1
9189 go to 7
9190 else if (durq .eq. 'd') then
9191 if (twotrem) then
9192 c
9193 c 2-note trem, get shift
9194 c
9195 call g1etchar(lineq,iccount,durq)
9196 if (index('+-',durq) .eq. 0) then
9197 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9198 * 'Expected +/- for shifted dot on end of 2-note trem!')
9199 call stop1()
9200 end if
9201 call g1etchar(lineq,iccount,durq)
9202 if (index('0123456789.',durq) .eq. 0) then
9203 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9204 * 'Expected number here!')
9205 call stop1()
9206 end if
9207 call readnum(lineq,iccount,dumq,fnum)
9208 if (index('+-',dumq) .gt. 0) then
9209 c
9210 c Vertical shift also
9211 c
9212 call g1etchar(lineq,iccount,durq)
9213 if (index('0123456789-.',durq) .eq. 0) then
9214 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9215 * 'Expected number after 2nd +/- (shift dot)!')
9216 call stop1()
9217 end if
9218 call readnum(lineq,iccount,durq,fnum)
9219 end if
9220 iccount = iccount-1
9221 go to 7
9222 else
9223 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),27)
9224 end if
9225 go to 7
9226 else if (durq .ne. ' ') then
9227 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9228 * 'Illegal option on xtuplet note!')
9229 call stop1()
9230 end if
9231 if (itup .eq. ntup-ndoub) go to 3
9232 6 continue
9233 3 continue
9234 c
9235 c 6==End of loop for xtuplet input
9236 c
9237 else if (durq .eq. 'm') then
9238 c
9239 c Multi-bar rest: next 1 or two digits are # of bars.
9240 c
9241 if (mod(itsofar(iv),lenbar) .ne. 0) then
9242 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9243 * 'Multibar rest must start at beginning of bar!')
9244 call stop1()
9245 else if (iv.eq.1.and.ibarmbr.gt.0) then
9246 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9247 * 'Multibar rest only OK at one time per block!')
9248 call stop1()
9249 end if
9250 c
9251 c For some purposes, pretend its one bar only
9252 c
9253 nodur(iv,nnl(iv)) = lenbar
9254 ibarmbr = nbars+1
9255 mbrest = 0
9256 call g1etchar(lineq,iccount,durq)
9257 if (index('123456789',durq) .eq. 0) then
9258 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9259 * 'Expected an integer after "rm"!')
9260 call stop1()
9261 end if
9262 call readnum(lineq,iccount,durq,fnum)
9263 mbrest = nint(fnum)
9264 if (nv .gt. 1) then
9265 if (iv .eq. 1) then
9266 mbrestsav = mbrest
9267 else
9268 if (mbrest .ne. mbrestsav) then
9269 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9270 * 'Must enter same multi-bar rest in every voice!')
9271 call stop1()
9272 end if
9273 end if
9274 c
9275 c Zero out mbrestsav so can check at end of input block whether
9276 c all voices have one
9277 c
9278 if (iv .eq. nv) mbrestsav=0
9279 end if
9280 if (durq .eq. 'n') then
9281 c
9282 c Get new height
9283 c
9284 call g1etchar(lineq,iccount,durq)
9285 if (index('+-123456789',durq) .eq. 0) then
9286 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9287 * 'Expected an integer after "rm[x]n"!')
9288 call stop1()
9289 end if
9290 if (index('+-',durq).ne.0) iccount = iccount+1
9291 call readnum(lineq,iccount,durq,fnum)
9292 end if
9293 if (durq .ne. ' ') then
9294 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9295 * 'Illegal character after "rm"!')
9296 call stop1()
9297 end if
9298 else if (durq .eq. '.') then
9299 c
9300 c Dotted pattern. Close out note. Mult time by 3/4.
9301 c Set time for next note to 1/4. Start the note.
9302 c
9303 idotform = 1
9304 else if (durq .eq. ',') then
9305 idotform = 3
9306 c
9307 c Now flow to duration setting, as if durq=' '
9308 c
9309 else if (index('oL',durq) .gt. 0) then
9310 c
9311 c Suppress full bar rest, or look left for height
9312 c
9313 if (charq .ne. 'r') then
9314 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9315 * '"o","L" options only legal for rest, not note!')
9316 call stop1()
9317 end if
9318 go to 2
9319 else if (index('DF',durq) .gt. 0) then
9320 c
9321 c Double note for xtup. Must check here in case "D" or "F" came before "x" or on
9322 c last note of xtup. Need to flag it in pmxa since affects horiz. spacing.
9323 c
9324 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
9325 go to 2
9326 else if (durq .eq. 'A') then
9327 c
9328 c Main note accidental option
9329 c
9330 call getchar(lineq,iccount,durq)
9331 if (index('o+-<>',durq) .eq. 0) then
9332 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9333 * '"o",+","-","<",">" are the only legal options here!')
9334 call stop1()
9335 end if
9336 c
9337 c Need more stuff here
9338 c
9339 if (durq .ne. "o") then
9340 c
9341 c Back up 1, flow out, will get +|-|<|> next loop preceded by "A", and will
9342 c proceed to number input checking
9343 c
9344 iccount = iccount-1
9345 end if
9346 go to 2
9347 else if (durq .eq. 'T') then
9348 c
9349 c Single stem tremolo. Only option (optional) is 1,2,3, or 4.
9350 c
9351 call getchar(lineq,iccount,durq)
9352 if (index('1234',durq) .eq. 0) iccount = iccount-1
9353 go to 2
9354 else if (durq .ne. ' ') then
9355 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9356 * 'Illegal character!')
9357 print*,'ASCII code:',ichar(durq)
9358 call stop1()
9359 end if
9360 c
9361 c End of block for note options.
9362 c
9363 c Set the duration
9364 c
9365 if (idotform .gt. 0) then
9366 if (idotform .eq. 1) then
9367 nodur(ivx,nnl(ivx)) = i1fnodur(nnodur,dotq)*3/2
9368 else if (idotform .eq. 2) then
9369 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/3
9370 else if (idotform .eq. 3) then
9371 nodur(ivx,nnl(ivx)) = i1fnodur(nnodur,dotq)
9372 else if (idotform .eq. 4) then
9373 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/2
9374 end if
9375 else if (ibarmbr.ne.nbars+1 .and. .not.fulbrp) then
9376 nodur(ivx,nnl(ivx)) = i1fnodur(nnodur,dotq)
9377 c
9378 c Check for double dot
9379 c
9380 if (iddot .eq. 1) then
9381 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx))*7/6
9382 iddot = 0
9383 end if
9384 else if (fulbrp) then
9385 nodur(ivx,nnl(ivx)) = lenbar
9386 c
9387 c Use a one-line function to set nnodur. It gives inverse of ifnodur.
9388 c
9389 nnodur = index('62514x0x37',
9390 * chax(48+int(log(.1+lenbar)/.69315)))-1
9391 fulbrp = .false.
9392 end if
9393 rest(ivx,nnl(ivx)) = charq.eq.'r'
9394 c
9395 c If inside forced beam, check if note is beamable
9396 c
9397 if (fbon) then
9398 if (nodur(ivx,nnl(ivx)) .lt. 16) go to 120
9399 if (nnl(ivx) .gt. 1) then
9400 if (nodur(ivx,nnl(ivx)-1) .eq. 0) go to 120
9401 end if
9402 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9403 * 'Unbeamable thing in forced beam!')
9404 call stop1()
9405 end if
9406 120 continue
9407 c
9408 c Get number of prior bars for later check on whether note spans bar line
9409 c
9410 nbb4 = itsofar(ivx)/lenbar
9411 itsofar(ivx) = itsofar(ivx)+nodur(ivx,nnl(ivx))
9412 if (mod(itsofar(ivx),lenbar) .eq. 0) then
9413 nbars = nbars+1
9414 if (shifton) barend = .true.
9415 c
9416 c Will check barend when 1st note of next bar is entered.
9417 c
9418 if (nbars .gt. 15) then
9419 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9420 * 'Cannot have more than 15 bars in an input block!')
9421 call stop1()
9422 end if
9423 nib(ivx,nbars) = nnl(ivx)
9424 if (firstline .and. lenbar.ne.lenbr1) then
9425 c
9426 c Just finished the pickup bar for this voice.
9427 c
9428 if (itsofar(ivx) .ne. lenbr0) then
9429 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9430 * 'Pickup bar length disagrees with mtrnum0!')
9431 call stop1()
9432 end if
9433 lenbar = lenbr1
9434 itsofar(ivx) = 0
9435 end if
9436 else if (barend) then
9437 if (shifton) then
9438 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9439 * 'Bar ended with user-defined shift still on!')
9440 call stop1()
9441 end if
9442 barend = .false.
9443 else if (itsofar(ivx)/lenbar .gt. nbb4) then
9444 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9445 * 'This note spans a bar line!')
9446 call stop1()
9447 end if
9448 if (idotform.eq.1 .or. idotform.eq.3) then
9449 call g1etchar(lineq,iccount,charq)
9450 if (index('abcedfgr',charq) .eq. 0) then
9451 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9452 * 'Expected note name or "r" here!')
9453 call stop1()
9454 end if
9455 idotform = idotform+1
9456 numnum = 1
9457 go to 28
9458 end if
9459 c
9460 c End of sub block for note-rest
9461 c
9462 else if (charq .eq. 'z') then
9463 call g1etchar(lineq,iccount,charq)
9464 if (index('abcdefg',charq) .eq. 0) then
9465 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9466 * 'Expected chord note name here!')
9467 call stop1()
9468 end if
9469 25 call g1etchar(lineq,iccount,durq)
9470 if (index('dre12345678c',durq) .gt. 0) then
9471 go to 25
9472 else if (index('fsn',durq) .gt. 0) then
9473 c
9474 c Check for midi-only accid. CANNOT coesist with accidental position tweaks, so
9475 c MUST come right after "f,s,n"
9476 c
9477 if (lineq(iccount+1:iccount+1) .eq. 'i') iccount=iccount+1
9478 go to 25
9479 else if (durq .eq. 'A') then
9480 if (index('fsn',lineq(iccount-1:iccount-1)) .eq. 0) then
9481 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9482 * 'Must have "f,s,n" before "A" in chord note!')
9483 call stop1()
9484 end if
9485 go to 25
9486 else if (index('<>',durq) .gt. 0) then
9487 if (index('fsnA',lineq(iccount-1:iccount-1)) .eq. 0) then
9488 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9489 * 'Must have "f,s,n,A" before "<" or ">"!')
9490 call stop1()
9491 end if
9492 call g1etchar(lineq,iccount,durq)
9493 if (index('1234567890.',durq) .eq. 0) then
9494 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9495 * 'Expected a number to start here for accidental shift!')
9496 call stop1()
9497 end if
9498 call readnum(lineq,iccount,durq,fnum)
9499 iccount = iccount-1
9500 go to 25
9501 else if (index('+-',durq) .gt. 0) then
9502 if (index('1234567890.',lineq(iccount+1:iccount+1)) .eq. 0)
9503 * go to 25
9504 c
9505 c Number or '.' (durq) follows +/- . Get it.
9506 c
9507 call g1etchar(lineq,iccount,durq)
9508 if (durq .eq. '.' .and. index('1234567890',
9509 * lineq(iccount+1:iccount+1)) .eq. 0) then
9510 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9511 * '"." here must be followed by a digit!')
9512 call stop1()
9513 else if (index('sfndA',lineq(iccount-2:iccount-2)).eq.0) then
9514 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9515 * 'Number after +/- must follow "d,s,f,n,A"!')
9516 call stop1()
9517 end if
9518 call readnum(lineq,iccount,durq,fnum)
9519 if (index('+-',durq) .eq. 0) then
9520 iccount = iccount-1
9521 go to 25
9522 end if
9523 c
9524 c 2nd +/-
9525 c
9526 call g1etchar(lineq,iccount,durq)
9527 if (durq .eq. '.') call g1etchar(lineq,iccount,durq)
9528 if (index('1234567890',durq) .eq. 0) then
9529 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9530 * 'Expected a number here!')
9531 call stop1()
9532 end if
9533 call readnum(lineq,iccount,durq,fnum)
9534 iccount = iccount-1
9535 go to 25
9536 else if (durq .ne. ' ') then
9537 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9538 * 'Illegal character in chord note!')
9539 call stop1()
9540 end if
9541 else if (charq .eq. 'G') then
9542 ngr = 1
9543 9 call g1etchar(lineq,iccount,charq)
9544 if (index('123456789',charq) .gt. 0) then
9545 call readnum(lineq,iccount,durq,fnum)
9546 ngr = nint(fnum)
9547 iccount = iccount-1
9548 go to 9
9549 else if (index('AWulxs',charq) .gt. 0) then
9550 go to 9
9551 else if (charq .eq. 'm') then
9552 call g1etchar(lineq,iccount,charq)
9553 if (index('01234',charq) .eq. 0) then
9554 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9555 * 'A digit less than 5 must follow "m" in a grace note!')
9556 call stop1()
9557 end if
9558 go to 9
9559 else if (charq .eq. 'X') then
9560 c
9561 c Space before main note
9562 c
9563 call g1etchar(lineq,iccount,charq)
9564 if (index('0123456789.',charq) .gt. 0) then
9565 call readnum(lineq,iccount,durq,fnum)
9566 iccount = iccount-1
9567 go to 9
9568 else
9569 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9570 * 'A number must follow "X" in a grace note!')
9571 call stop1()
9572 end if
9573 end if
9574 c
9575 c At this point, charq is first note name in rest (grace?)
9576 c
9577 do 19 igr = 1 , ngr
9578 numnum = 0
9579 if (igr .gt. 1) then
9580 55 call g1etchar(lineq,iccount,charq)
9581 if (charq .eq. ' ') go to 55
9582 end if
9583 if (index('abcdefg',charq) .eq. 0) then
9584 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9585 * 'In grace, expected "a"-"g"!')
9586 call stop1()
9587 end if
9588 18 call g1etchar(lineq,iccount,charq)
9589 if (charq .ne. ' ') then
9590 if (index('1234567',charq) .gt. 0) then
9591 if (numnum .eq. 1) then
9592 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9593 * 'Only one of "+-1234567" allowed here in grace!')
9594 call stop1()
9595 end if
9596 numnum = 1
9597 go to 18
9598 c else if (index('nfs',charq) .gt. 0) then
9599 else if (index('+-nfs',charq) .gt. 0) then
9600 go to 18
9601 end if
9602 c
9603 c Digits are possible octave numbers
9604 c
9605 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9606 * 'Illegal character after note name in grace!')
9607 call stop1()
9608 end if
9609 19 continue
9610 else if (charq .eq. chax(92)) then
9611 call chklit(lineq,iccount,literr)
9612 if (literr .gt. 0) then
9613 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9614 * literq(literr))
9615 call stop1()
9616 end if
9617 else if (charq .eq. chax(34)) then
9618 c
9619 c pmx lyric
9620 c
9621 call chkpmxlyr(lineq,iccount,lyrerr)
9622 if (lyrerr .gt. 0) then
9623 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9624 * lyrerq(lyrerr))
9625 call stop1()
9626 end if
9627 else if (charq .eq. 'o') then
9628 c
9629 c Ornament on non-xtup note. "o" symbol must come AFTER the affected note
9630 c
9631 if (nnl(ivx) .eq. 0) then
9632 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9633 * '"o" must be in same input block, after affected note!')
9634 call stop1()
9635 end if
9636 call g1etchar(lineq,iccount,dumq)
9637 c if (index('(stmgx+Tupf._)e:>^bc',dumq) .eq. 0 ) then
9638 if (index('(stmgx+Tupf._)e:>^bcCG',dumq) .eq. 0 ) then
9639 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9640 * 'Illegal ornament!')
9641 call stop1()
9642 end if
9643 if (dumq .eq. ':') then
9644 call g1etchar(lineq,iccount,dumq)
9645 if (dumq .ne. ' ') then
9646 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9647 * 'Expected blank after "o:"!')
9648 call stop1()
9649 else if (.not.ornrpt) then
9650 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9651 * 'Turned off repeated ornaments before they were on!')
9652 call stop1()
9653 end if
9654 ornrpt = .false.
9655 else if (dumq .eq. 'g') then
9656 if (issegno) then
9657 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9658 * 'Sorry, only one "segno" per input block!')
9659 call stop1()
9660 else if (ivx .ne. 1) then
9661 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9662 * 'segno can only be in voice 1!')
9663 call stop1()
9664 end if
9665 issegno = .true.
9666 12 call g1etchar(lineq,iccount,dumq)
9667 if (dumq.eq.'-' .or.
9668 * (ichar(dumq).ge.48.and.ichar(dumq).le.58)) go to 12
9669 if (dumq .ne. ' ') then
9670 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9671 * 'Illegal character in segno ornament symbol!')
9672 call stop1()
9673 end if
9674 else if (dumq .eq. 'T') then
9675 c
9676 c Trill. may be followed by 't' and/or number. read 'til blank
9677 c
9678 22 call g1etchar(lineq,iccount,dumq)
9679 if (dumq .eq. ':') then
9680 if (lineq(iccount+1:iccount+1) .ne. ' ') then
9681 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9682 * 'Expected blank after ":"!')
9683 call stop1()
9684 end if
9685 go to 32
9686 else if (dumq .ne. ' ') then
9687 go to 22
9688 end if
9689 else if (dumq .eq. 'f') then
9690 call g1etchar(lineq,iccount,dumq)
9691 if (index(' d+-:',dumq) .eq. 0) then
9692 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9693 * 'Illegal character after "f" in fermata ornament symbol!')
9694 call stop1()
9695 end if
9696 if (dumq .eq. 'd') call g1etchar(lineq,iccount,dumq)
9697 if (dumq .eq. ':') go to 32
9698 else if (dumq .eq. 'e') then
9699 call g1etchar(lineq,iccount,dumq)
9700 if (index('sfn?',dumq) .eq. 0) then
9701 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9702 * 'Illegal character after "e" in edit. accid. symbol!')
9703 call stop1()
9704 end if
9705 call g1etchar(lineq,iccount,dumq)
9706 if (dumq .eq. '?') call g1etchar(lineq,iccount,dumq)
9707 else
9708 call g1etchar(lineq,iccount,dumq)
9709 end if
9710 if (index('+- :',dumq) .eq. 0) then
9711 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9712 * 'Illegal character in ornament symbol!')
9713 call stop1()
9714 end if
9715 if (index('+-',dumq) .gt. 0) then
9716 if (index('0123456789',lineq(iccount+1:iccount+1)).eq.0) then
9717 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
9718 * 'There should be an integer here!')
9719 call stop1()
9720 end if
9721 call readnum(lineq,iccount,durq,fnum)
9722 if (durq .eq. ':') then
9723 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9724 * 'Cannot shift AND repeat an ornament!')
9725 call stop1()
9726 end if
9727 c
9728 c 12/7/03 Allow horizontal shift on any ornament, not just breath and caes.
9729 c
9730 if (index('+-',durq) .gt. 0) then
9731 if (index('.0123456789',lineq(iccount+1:iccount+1))
9732 * .eq. 0) then
9733 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
9734 * 'There should be a number here!')
9735 call stop1()
9736 end if
9737 call readnum(lineq,iccount,durq,fnum)
9738 end if
9739 end if
9740 32 continue
9741 if (dumq .eq. ':') then
9742 if (lineq(iccount+1:iccount+1) .ne. ' ') then
9743 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9744 * '":" must be followed by blank in "o: "!')
9745 call stop1()
9746 else if (ornrpt) then
9747 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9748 * 'Turned on repeated ornaments but already on!')
9749 call stop1()
9750 end if
9751 ornrpt = .true.
9752 end if
9753 else if (index('st(){}',charq) .gt. 0) then
9754 numint = 0
9755 iposn = 0
9756 8 call g1etchar(lineq,iccount,dumq)
9757 iposn = iposn+1
9758 if (charq.eq.'t' .and. dumq.eq.'t') then
9759 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9760 * 'Cannot use "t" as an option on a tie!')
9761 call stop1()
9762 end if
9763 if (index('udltb+-fnhHpsv ',dumq) .eq. 0) then
9764 c
9765 c Check for explicit ID code.
9766 c
9767 ic = ichar(dumq)
9768 if (ic.lt.48 .or. (ic.gt.57.and.ic.lt.65) .or.
9769 * ic.gt.90) then
9770 c
9771 c Not 0-9 or A-Z, so exit
9772 c
9773 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9774 * 'Illegal character in slur symbol!')
9775 call stop1()
9776 else
9777 c
9778 c It is a possible ID code. Right place?
9779 c
9780 if (iposn .ne. 1) then
9781 c
9782 c Slur ID is not 2nd!
9783 c
9784 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9785 * 'Slur ID must be second character in slur symbol!')
9786 call stop1()
9787 else if (charq.eq.'t' .and. fontslur) then
9788 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9789 * 'Slur ID not allowed on non-postscript tie!')
9790 call stop1()
9791 else if (lineq(iccount+1:iccount+1).eq.'x') then
9792 iccount = iccount+1
9793 end if
9794 end if
9795 c
9796 c Slur ID is OK. Note it cannot be "H" at this point..
9797 c
9798 go to 8
9799 else if (dumq .eq. 'H') then
9800 if (iposn .eq. 1) go to 8
9801 c
9802 c "H" is NOT an ID code.
9803 c
9804 if (.not.fontslur .and. charq.eq.'t') then
9805 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9806 * 'Cannot reshape postscript ties this way!')
9807 call stop1()
9808 end if
9809 if (lineq(iccount+1:iccount+1) .eq. 'H') then
9810 iccount=iccount+1
9811 iposn = iposn+1
9812 end if
9813 go to 8
9814 else if (index('fh',dumq).gt.0 .and. .not.fontslur
9815 * .and. charq.eq.'t') then
9816 c
9817 c 3/9/03 Can't reshape postscript tie.
9818 c
9819 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9820 * 'Cannot reshape postscript ties this way!')
9821 call stop1()
9822 else if (dumq .eq. 'p') then
9823 c
9824 c local change in postscript slur/tie adjustment default
9825 c
9826 if (fontslur) then
9827 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9828 * 'Must use postscript slurs ("Ap") to use this option!')
9829 call stop1()
9830 end if
9831 call g1etchar(lineq,iccount,dumq)
9832 if (index('+-',dumq) .eq. 0) then
9833 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9834 * 'Expected "+" or "-" here!')
9835 call stop1()
9836 end if
9837 call g1etchar(lineq,iccount,dumq)
9838 if (index('st',dumq) .eq. 0) then
9839 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9840 * 'Expected "s" or "t" here!')
9841 call stop1()
9842 end if
9843 iposn = iposn+2
9844 go to 8
9845 end if
9846 if (index('udltbfnh',dumq) .gt. 0) then
9847 go to 8
9848 else if (index('+-',dumq) .gt. 0) then
9849 numint = numint+1
9850 if (fontslur .and. charq.eq.'t') then
9851 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9852 * '"+|-" for slur height only allowed in "s"-slurs!')
9853 call stop1()
9854 end if
9855 iccount = iccount+1
9856 call readnum(lineq,iccount,durq,fnum)
9857 if (numint .eq. 1) then
9858 if (nint(fnum) .gt. 30) then
9859 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9860 * 'Magnitude of slur height adjustment cannot exceed 30!')
9861 call stop1()
9862 end if
9863 else if (numint .eq. 2) then
9864 if (abs(fnum) .gt. 6.3) then
9865 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9866 * 'Slur horiz shift must be in range (-6.3,6.3)!')
9867 call stop1()
9868 end if
9869 else
9870 c
9871 c Third signed integer, must be a midslur or curve spec.
9872 c
9873 if (abs(fnum).gt.31) then
9874 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9875 * 'Slur midheight must be in the range (-31,31)!')
9876 call stop1()
9877 end if
9878 if (durq .eq. ':') then
9879 c
9880 c Expecting curve parameters. Get two numbers
9881 c
9882 do 41 i = 1 , 2
9883 iccount = iccount+1
9884 fnum = ichar(lineq(iccount:iccount))-48
9885 if (abs(fnum-3.5) .gt. 3.6) then
9886 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9887 * 'Slur curve parameter must be in range (0,7)!')
9888 call stop1()
9889 end if
9890 41 continue
9891 iccount = iccount+1
9892 end if
9893 end if
9894 iccount = iccount-1
9895 go to 8
9896 else if (dumq .eq. 's') then
9897 c
9898 c What follows should be one or two signed numbers for adjustment of line break
9899 c slur, end of 1st segment or start of second.
9900 c
9901 if (fontslur) then
9902 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9903 * 'May not use linebreak slur options with font-based slurs!')
9904 call stop1()
9905 end if
9906 call g1etchar(lineq,iccount,dumq)
9907 if (index('+-',dumq) .eq. 0) then
9908 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9909 * 'This character must be "+" or "-"!')
9910 call stop1()
9911 end if
9912 iccount = iccount+1
9913 call readnum(lineq,iccount,dumq,fnum)
9914 if (nint(fnum) .gt. 30) then
9915 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9916 * 'Magnitude of slur height adjustment cannot exceed 30!')
9917 call stop1()
9918 end if
9919 if (index('+-',dumq) .gt. 0) then
9920 iccount = iccount+1
9921 call readnum(lineq,iccount,dumq,fnum)
9922 if (abs(fnum) .gt. 6.3) then
9923 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
9924 * 'Slur horiz shift must be in range (-6.3,6.3)!')
9925 call stop1()
9926 end if
9927 end if
9928 iccount = iccount-1
9929 go to 8
9930 else if (dumq .eq. 'H' .and. iposn.gt.1) then
9931 if (lineq(iccount+1:iccount+1) .eq. 'H') iccount=iccount+1
9932 go to 8
9933 end if
9934 else if (charq .eq. '?') then
9935 call getchar(lineq,iccount,durq)
9936 if (durq .eq. ' ') then
9937 iccount = iccount-1
9938 else
9939 if (durq .ne. '-') then
9940 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9941 * 'Expecting "-"!')
9942 call stop1()
9943 end if
9944 call getchar(lineq,iccount,durq)
9945 if (index('0123456789.',durq) .eq. 0) then
9946 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9947 * 'Expecting number!')
9948 call stop1()
9949 end if
9950 call readnum(lineq,iccount,durq,fnum)
9951 iccount = iccount-1
9952 end if
9953 else if ((ichar(charq).ge.48.and.ichar(charq).le.57) .or.
9954 * index('#-nx_',charq) .gt. 0) then
9955 c
9956 c We have a figure. Must come AFTER the note it goes under
9957 c
9958 if (itsofar(ivx).eq.0 .and.
9959 * (.not.firstline.or.lenbr0.eq.0.or.lenbar.eq.lenbr0)) then
9960 c
9961 c Figure before first note in block
9962 c
9963 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9964 * 'Cannot put figure before first note in block!')
9965 call stop1()
9966 end if
9967 if (charq.eq.'x') then
9968 indxb = index(lineq(iccount:128),' ')
9969 if (indxb .lt. 5) then
9970 call errmsg(lineq,iccount+indxb-1,ibarcnt-ibaroff+nbars+1,
9971 * 'Cannot have a blank here in floating figure!')
9972 call stop1()
9973 end if
9974 end if
9975 if (usefig) ifig = 1
9976 5 call g1etchar(lineq,iccount,charq)
9977 if (index(' 0123456789#-nx_.:+sv',charq) .eq. 0) then
9978 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9979 * 'Illegal character in figure!')
9980 call stop1()
9981 else if (charq .eq. '+') then
9982 c
9983 c vertical offset, must be integer, then blank
9984 c
9985 call g1etchar(lineq,iccount,charq)
9986 if (index('123456789',charq) .eq. 0) then
9987 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9988 * 'Integer for vertical offset expected here!')
9989 call stop1()
9990 end if
9991 call readnum(lineq,iccount,charq,fnum)
9992 if (charq .ne. ' ') then
9993 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
9994 * 'Vertical offset must terminate figure!')
9995 call stop1()
9996 end if
9997 iccount = iccount-1
9998 go to 5
9999 else if (charq .eq. 's') then
10000 isligfont = .true.
10001 end if
10002 if (charq .ne. ' ') go to 5
10003 else if (charq .eq. '[') then
10004 if (fbon) then
10005 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10006 * 'Started forced beam while another was open!')
10007 call stop1()
10008 end if
10009 fbon = .true.
10010 17 call g1etchar(lineq,iccount,charq)
10011 if (index('uljhf:',charq) .gt. 0) then
10012 go to 17
10013 else if (index('+-',charq) .gt. 0) then
10014 iccount = iccount+1
10015 call readnum(lineq,iccount,durq,fnum)
10016 iccount = iccount-1
10017 go to 17
10018 else if (charq .eq. 'm') then
10019 c
10020 c Forced multiplicity, next char should be 1-4
10021 c
10022 call g1etchar(lineq,iccount,charq)
10023 if (index('1234',charq) .eq. 0) then
10024 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10025 * 'Forced multiplicity for a beam must be 1, 2, 3, or 4!')
10026 call stop1()
10027 end if
10028 go to 17
10029 else if (charq .ne. ' ') then
10030 if (index('0123456789',charq) .gt. 0) then
10031 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10032 * 'After "[", digits must now be preceeded by "+" or "-"!')
10033 print*,'You will have to edit older sources to meet this rqmt,'
10034 print*,'but it was needed to allow 2-digit height adjustments.'
10035 print*,'Sorry for the inconvenience. --The Management'
10036 else
10037 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10038 * 'Illegal character after [!')
10039 end if
10040 call stop1()
10041 end if
10042 else if (charq .eq. ']') then
10043 if (.not.fbon) then
10044 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10045 * 'Forced beam stop with no corresponding start!')
10046 call stop1()
10047 end if
10048 call g1etchar(lineq,iccount,charq)
10049 if (charq .eq. '-') then
10050 if (lineq(iccount+1:iccount+2) .ne. '[ ') then
10051 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
10052 * 'Only sequence allowed here is "[ "!')
10053 call stop1()
10054 else
10055 iccount = iccount+2
10056 end if
10057 else if (charq .eq. '[') then
10058 if (lineq(iccount+1:iccount+1) .ne. ' ') then
10059 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
10060 * 'This character must be a blank!')
10061 call stop1()
10062 end if
10063 else
10064 c
10065 c Forced beam is really ending
10066 c
10067 fbon = .false.
10068 if (charq .eq. 'j') then
10069 if (lineq(iccount+1:iccount+1) .ne. ' ') then
10070 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
10071 * 'This character must be a blank!')
10072 call stop1()
10073 end if
10074 else if (charq .ne. ' ') then
10075 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10076 * '"]" must be followed by blank, "j", "-", or "["!')
10077 call stop1()
10078 end if
10079 end if
10080 else if (charq .eq. 'D') then
10081 c
10082 c Dynamic mark
10083 c
10084 if (nnl(ivx) .eq. 0) then
10085 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10086 * '"D" must not come before any notes have been entered!')
10087 call stop1()
10088 end if
10089 call checkdyn(lineq,iccount,ibarcnt-ibaroff+nbars+1)
10090 else if (index('lhw',charq) .gt. 0) then
10091 c
10092 c Save position for later check
10093 c
10094 icclhw = iccount
10095 call g1etchar(lineq,iccount,durq)
10096 if (index('0123456789.+- ',durq) .eq. 0) then
10097 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10098 * 'Illegal character after "l", "w", or "h"!')
10099 call stop1()
10100 end if
10101 isheadr = isheadr .or. charq .eq. 'h'
10102 if (index(' +-',durq) .gt. 0) then
10103 c
10104 c There is a header (or lower string?)
10105 c
10106 if (index('+-',durq) .gt. 0) then
10107 c
10108 c User-defined vert offset (\internote).
10109 c
10110 if (charq .ne. 'h') then
10111 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10112 * '"+" or "-" not permitted here!')
10113 call stop1()
10114 end if
10115 c
10116 c Have "h" followed by +/- . Check for digit.
10117 c Can blow durq since not using fnum for now, but...
10118 c
10119 call g1etchar(lineq,iccount,durq)
10120 if (index('123456789',durq) .eq. 0) then
10121 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10122 * 'There must be a digit here!')
10123 call stop1()
10124 end if
10125 c
10126 c Have "h" followed by +/- followed by a digit. No need to get the number.
10127 c
10128 c call readnum(lineq,iccount,durq,fnum)
10129 end if
10130 if (charq .ne. 'w') then
10131 c
10132 c Header or lower string.
10133 c
10134 if (icclhw .ne. 1) then
10135 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10136 * '"h" or "l" must be first character in line!')
10137 call stop1()
10138 end if
10139 c
10140 c Read past the next line, which has the string.
10141 c
10142 call read10(charq,lastchar)
10143 nline = nline+1
10144 iccount = 128
10145 else
10146 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10147 * 'Symbol "w" (width) must be followed by a digit!')
10148 call stop1()
10149 end if
10150 else
10151 c
10152 c Height or width change spec. Check if at start of piece.
10153 c
10154 if (ibarcnt .gt. 0) then
10155 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10156 * 'Symbol must go at top of first input block!')
10157 call stop1()
10158 end if
10159 call readnum(lineq,iccount,durq,dimen)
10160 c
10161 c Check units. Convert to points
10162 c
10163 if (durq .eq. ' ' .or. durq .eq. 'p') then
10164 dimen = dimen+.5
10165 else if (durq .eq. 'i') then
10166 dimen = dimen*72+.5
10167 else if (durq .eq. 'm') then
10168 dimen = dimen/25.4*72+.5
10169 else
10170 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10171 * 'Illegal unit; must be "p","i",or"m"!')
10172 call stop1()
10173 end if
10174 c
10175 c 151211 fix. May have extra character.
10176 c
10177 if (index('pim',durq) .gt. 0) then
10178 c
10179 c Get another character, see if it's blank
10180 c
10181 if (lineq(iccount+1:iccount+1) .ne. ' ') then
10182 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
10183 * 'This character should be a blank!')
10184 call stop1()
10185 end if
10186 end if
10187 if (charq .eq. 'h') then
10188 ptheight = int(dimen)
10189 else
10190 widthpt = int(dimen)
10191 end if
10192 end if
10193 else if (charq .eq. 'm') then
10194 c
10195 c Time signature change. Only allow at beginning of block.
10196 c mtrnuml, mtrdenl (logical) and p (printable) will be input.
10197 c mtrnuml=0 initially. (In common)
10198 c
10199 c Check whether at beginning of a block
10200 c
10201 if (ivx.ne.1 .or. nnl(1).ne.0) then
10202 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10203 * 'Meter change only OK in voice 1, at start of block!')
10204 print*,'voice number is',ivx
10205 call stop1()
10206 end if
10207 newmeter = .true.
10208 if (index('o0123456789',lineq(iccount+1:iccount+1)).eq.0) then
10209 call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
10210 * 'Illegal character in "m" command for meter change!')
10211 call stop1()
10212 end if
10213 call readmeter(lineq,iccount,mtrnuml,mtrdenl)
10214 if (mtrnuml .eq. 0) then
10215 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10216 * 'Digit 0 not allowed here!')
10217 call stop1()
10218 end if
10219 call readmeter(lineq,iccount,mtrnmp,mtrdnp)
10220 c
10221 c Read past printed time signature; not used in pmxa.
10222 c
10223 lenbeat = i1fnodur(mtrdenl,'x')
10224 lenmult = 1
10225 if (mtrdenl .eq. 2) then
10226 lenbeat = 16
10227 lenmult = 2
10228 end if
10229 lenbar = lenmult*mtrnuml*lenbeat
10230 mtrnuml = 0
10231 else if (charq .eq. 'C') then
10232 call g1etchar(lineq,iccount,durq)
10233 if (.not.(index('tsmanrbf',durq).gt.0 .or.
10234 * (ichar(durq).ge.48 .and. ichar(durq).le.56))) then
10235 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10236 * 'Must have t,s,m,a,n,r,b,f or 0-8 after C!')
10237 call stop1()
10238 end if
10239 else if (charq .eq. 'R') then
10240 if (ivx .ne. 1) then
10241 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10242 * 'Repeats can only go in voice 1!')
10243 call stop1()
10244 end if
10245 call g1etchar(lineq,iccount,durq)
10246 call g1etchar(lineq,iccount,dumq)
10247 if (index('l Xr Xd XD Xb Xz XlrXdlX',durq//dumq) .eq. 0) then
10248 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10249 * 'Illegal character after "R*" (repeat/double bar)!')
10250 call stop1()
10251 end if
10252 if (dumq .ne. ' ') then
10253 call g1etchar(lineq,iccount,durq)
10254 if (durq .ne. ' ') then
10255 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10256 * 'Must have blank after "R**" (repeat/double bar)!')
10257 call stop1()
10258 end if
10259 end if
10260 else if (charq .eq. 'V') then
10261 c
10262 c Ending
10263 c
10264 if (iv .ne. 1) then
10265 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10266 * 'Voltas are only allowed in voice #1!')
10267 call stop1()
10268 else if (isvolt) then
10269 print*
10270 print*,'*******WARNING********'
10271 write(15,'(/,a)')'*******WARNING********'
10272 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10273 * 'There is more than one volta in this input block.!')
10274 print*,'This may work in a score, but WILL NOT work in parts.'
10275 print*,
10276 *'Safest to have only 1 volta per block, at the start of the block'
10277 write(15,'(a)')
10278 * 'This may work in a score, but WILL NOT work in parts.'
10279 write(15,'(a)')
10280 *'Safest to have only 1 volta per block, at the start of the block'
10281 end if
10282 isvolt = .true.
10283 lvoltxt = 0
10284 11 call g1etchar(lineq,iccount,durq)
10285 if (durq .ne.' ') then
10286 go to 11
10287 end if
10288 else if (charq .eq. 'B') then
10289 continue
10290 else if (charq .eq. 'P') then
10291 if (ivx.ne.1 .or. nnl(1).ne.0) then
10292 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10293 * 'Only allowed at beginning of block!')
10294 call stop1()
10295 end if
10296 16 call g1etchar(lineq,iccount,durq)
10297 if (durq.eq.'l'.or.durq.eq.'r'.or.(ichar(durq).ge.48 .and.
10298 * ichar(durq).le.57)) go to 16
10299 if (durq .eq. 'c') then
10300 c
10301 c Expect a centered name, and it has to be last option
10302 c
10303 call g1etchar(lineq,iccount,durq)
10304 if (durq .eq. chax(34)) then
10305 c
10306 c Quoted name, go to next quote mark
10307 c
10308 do 35 iccount = iccount+1 , 127
10309 if (lineq(iccount:iccount).eq.chax(34) .and.
10310 * lineq(iccount-1:iccount-1).ne.chax(92)) go to 36
10311 35 continue
10312 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10313 * 'Missing close quote after page number command (P)!')
10314 call stop1()
10315 36 continue
10316 else if (durq .ne. ' ') then
10317 c
10318 c Space-delimited name, look for next blank
10319 c
10320 do 37 iccount = iccount+1 , 127
10321 if (lineq(iccount:iccount) .eq. ' ') go to 38
10322 37 continue
10323 38 continue
10324 end if
10325 else if (durq .ne. ' ') then
10326 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10327 * 'Only "l","r","c" or digit allowed after "P"!')
10328 call stop1()
10329 end if
10330 else if (charq .eq. 'W') then
10331 call g1etchar(lineq,iccount,durq)
10332 if (index('.0123456789',durq) .eq. 0) then
10333 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10334 * 'Expected a number to start here!')
10335 call stop1()
10336 end if
10337 call readnum(lineq,iccount,durq,wminnh(ibarcnt+nbars+1))
10338 else if (charq .eq. 'T') then
10339 c
10340 c Titles
10341 c
10342 call g1etchar(lineq,iccount,durq)
10343 if (index('itc',durq) .eq. 0) then
10344 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10345 * 'Must put "i", "t", or "c" after "T"!')
10346 call stop1()
10347 end if
10348 ihead = ihead+2**(index('itc',durq)-1)
10349 c
10350 c Maybe a number after 'Tt', but ignore here. Read past string on next line.
10351 c
10352 call read10(charq,lastchar)
10353 nline = nline+1
10354 iccount = 128
10355 else if (charq .eq. 'A') then
10356 27 call g1etchar(lineq,iccount,durq)
10357 if (index('rbsdK',durq) .gt. 0) then
10358 go to 27
10359 else if (durq .eq. 'e') then
10360 c
10361 c Check for is4bignv. Must do here to catch first \internote, written in topfile
10362 c before ever calling getnote. Initialize as .false. in pmxa. Make it true only
10363 c if nv>7, AI not set, Ai not set.
10364 c
10365 is4bignv = nv.gt.7 .and. .not.AIset
10366 go to 27
10367 else if (durq .eq. 'v') then
10368 if (ibarcnt .eq. 0) novshrinktop = .true.
10369 go to 27
10370 else if (durq .eq. 'a') then
10371 call g1etchar(lineq,iccount,durq)
10372 if (index('0123456789.',durq) .eq. 0) then
10373 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10374 * 'After "Aa", need decimal number!')
10375 call stop1()
10376 end if
10377 call readnum(lineq,iccount,durq,fbar)
10378 iccount = iccount-1
10379 go to 27
10380 else if (durq .eq. 'i') then
10381 is4bignv = .false.
10382 AIset = .true.
10383 call g1etchar(lineq,iccount,durq)
10384 c
10385 c Local interstaff correction. Set to -1. if not specifiec, or after use,
10386 c or anytime except at top, since pmxb handles all times except at top.
10387 c
10388 call readnum(lineq,iccount,durq,tintstf)
10389 if (ibarcnt .eq. 0) fintstf = tintstf
10390 iccount = iccount-1
10391 go to 27
10392 else if (durq .eq. 'I') then
10393 c
10394 c Global interstaff correction. Use in place of fintstf if fintstf<0
10395 c
10396 is4bignv = .false.
10397 AIset = .true.
10398 call g1etchar(lineq,iccount,durq)
10399 call readnum(lineq,iccount,durq,gintstf)
10400 iccount = iccount-1
10401 go to 27
10402 else if (durq .eq. 'o') then
10403 optimize = .true.
10404 go to 27
10405 else if (durq .eq. 'S') then
10406 do 50 iiv = 1 , noinst
10407 call g1etchar(lineq,iccount,durq)
10408 if (index('-0st',durq) .eq. 0) then
10409 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10410 * 'After "AS", need nv instances of "s,t,-,0"!')
10411 call stop1()
10412 end if
10413 if (durq.eq.'-'.or.durq.eq.'s') then
10414 isize(iiv) = 1
10415 else if (durq.eq.'t') then
10416 isize(iiv) = 2
10417 end if
10418 50 continue
10419 go to 27
10420 else if (durq .eq. 'p') then
10421 fontslur = .false.
10422 42 continue
10423 call g1etchar(lineq,iccount,durq)
10424 if (index('+-',durq) .gt. 0) then
10425 c
10426 c Characters to change defaults for ps slurs
10427 c
10428 call g1etchar(lineq,iccount,durq)
10429 if (index('shtc',durq) .eq. 0) then
10430 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10431 * 'Only letters allowed here are "s","h","t","c"!')
10432 call stop1()
10433 end if
10434 c
10435 c Now check for another default modifier
10436 c
10437 go to 42
10438 else if (index('lh',durq) .gt. 0) then
10439 c
10440 c Flags for optional linebreak ties or header specials
10441 c
10442 go to 42
10443 else
10444 iccount = iccount-1
10445 end if
10446 go to 27
10447 else if (durq .eq. 'N') then
10448 c
10449 c Override default name for a part file. Must have part number, then
10450 c partname in quotes. Must be on line by itself, and start in column 1.
10451 c Will only be passed thru to scor2prt.
10452 c
10453 if (iccount .ne. 2) then
10454 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10455 * '"AN" must start in column 1!')
10456 call stop1()
10457 end if
10458 ndxquote = index(lineq,chax(34))
10459 if (ndxquote.lt.4 .or. ndxquote.gt.5 .or.
10460 * index('123456789',lineq(3:3)).eq.0 .or.
10461 * (ndxquote.eq.5.and.index('012',lineq(4:4)).eq.0)) then
10462 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10463 * '"AN" must be followed by inst. #, then quote!')
10464 call stop1()
10465 end if
10466 ndxquote = index(lineq(ndxquote+1:128),chax(34))
10467 if (ndxquote .eq. 0) then
10468 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10469 * 'In "AN", file name must be in quotes!')
10470 call stop1()
10471 end if
10472 iccount = 128
10473 else if (durq .eq. 'T') then
10474 cstuplet = .true.
10475 else if (durq .eq. 'R') then
10476 c
10477 c Get full name of normal include file; must occupy remainder of line
10478 c
10479 call getpmxmod(.false.,lineq(iccount+1:128))
10480 iccount = 128
10481 else if (durq .eq. 'c') then
10482 call g1etchar(lineq,iccount,durq)
10483 if (index('l4',durq) .eq. 0) then
10484 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10485 * 'Only "l" or "4" is allowed here!')
10486 call stop1()
10487 end if
10488 if (durq .eq. 'l' ) then
10489 hoffpt = -25
10490 voffpt = -45
10491 else if (durq .eq. '4') then
10492 ptheight = 745
10493 widthpt = 499
10494 hoffpt = -24
10495 voffpt = -24
10496 end if
10497 go to 27
10498 else if (durq .eq. 'V') then
10499 call g1etchar(lineq,iccount,durq)
10500 if (index('+-',durq) .eq. 0) then
10501 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10502 * 'Only "+" or "-" is allowed here!')
10503 call stop1()
10504 end if
10505 call g1etchar(lineq,iccount,durq)
10506 if (index('0123456789.',durq) .eq. 0) then
10507 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10508 * 'A number for vert shift before \eject must start here!')
10509 call stop1()
10510 end if
10511 call readnum(lineq,iccount,durq,fnum)
10512 if (index('+-',durq) .eq. 0) then
10513 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10514 * 'Only "+" or "-" is allowed here!')
10515 call stop1()
10516 end if
10517 call g1etchar(lineq,iccount,durq)
10518 if (index('0123456789.',durq) .eq. 0) then
10519 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10520 * 'A number for vert shift after \eject must start here!')
10521 call stop1()
10522 end if
10523 call readnum(lineq,iccount,durq,fnum)
10524 iccount = iccount-1
10525 go to 27
10526 else if (durq .eq. 'B')then
10527 if (lineq(iccount+1:iccount+1).eq.'f') then
10528 iccount = iccount+1
10529 go to 27
10530 end if
10531 go to 27
10532 else if (durq .ne. ' ') then
10533 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10534 c * 'After "A" must follow one of the letters abBcdeiINprRsST!')
10535 * 'After "A" must follow one of abcdeiILNprRsSTvV!')
10536 print*,'For AS, since ver. 2.7, must only have noinst args.'
10537 write(15,'(a)')
10538 * 'For AS, since ver. 2.7, must only have noinst args.'
10539 call stop1()
10540 end if
10541 else if (charq .eq. 'K') then
10542 c
10543 c Rules and function of K command
10544 c
10545 c Only 1 K +/-n +/-m allowed per block if n.ne.0 (transposition). isig1 is
10546 c initial sig, and must be passed to pmxb because it is needed when topfile
10547 c is called, which is before the K+n+m command is read in pmxb. Also, we
10548 c compute and save ibrkch and newkey for each syst, accounting for key changes,
10549 c then adjust fbar to make poenom much more accurate.
10550 c Jan 02: Now K-0+[n] is used to transpose e.g. from f to f#.
10551 c
10552 77 continue
10553 call g1etchar(lineq,iccount,durq)
10554 if (index('+-in',durq) .eq. 0) then
10555 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10556 * '"K" (transpose or key change) must be followed by "+,-,i,n"!')
10557 call stop1()
10558 end if
10559 if (durq .eq. 'n') go to 77
10560 if (durq .ne. 'i') then
10561 c
10562 c Normal key change and/or transposition)
10563 c
10564 num1 = 44-ichar(durq)
10565 c
10566 c num1= +1 or -1
10567 c
10568 ztrans = num1.eq.-1
10569 call g1etchar(lineq,iccount,durq)
10570 if (index('0123456789',durq) .eq. 0) then
10571 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10572 * '1st +/- must be followed by a number!')
10573 call stop1()
10574 end if
10575 c iccount = iccount+1
10576 call readnum(lineq,iccount,durq,fnum)
10577 num1 = nint(fnum)*num1
10578 ztrans = ztrans .and. num1.eq.0
10579 if (index('+-',durq) .eq. 0) then
10580 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10581 * '1st number after "K" must be followed by "+,-"!')
10582 call stop1()
10583 end if
10584 iccount = iccount+1
10585 num2 = 44-ichar(durq)
10586 call readnum(lineq,iccount,durq,fnum)
10587 num2 = num2*int(fnum+.1)
10588 if (num1.eq.0 .and. .not.ztrans) then
10589 c
10590 c Key change, only one per block allowed
10591 c
10592 if (iskchb) then
10593 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10594 * 'Only one key change allowed per input block!')
10595 call stop1()
10596 end if
10597 iskchb = .true.
10598 nkeys = nkeys+1
10599 kchmid(nkeys) = mod(itsofar(ivx),lenbar).ne.0
10600 c
10601 c Make ibrkch = barnum-1 if at start of bar, so fsyst advances ok at linebreak.
10602 c
10603 ibrkch(nkeys) = ibarcnt+nbars
10604 if (kchmid(nkeys)) ibrkch(nkeys) = ibrkch(nkeys)+1
10605 newkey(nkeys) = num2+idsig
10606 midisig = newkey(nkeys)
10607 else
10608 c
10609 c Transposition
10610 c
10611 fulltrans = .true.
10612 if (ibarcnt .gt. 0) then
10613 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10614 * 'Transposition must be at top of first input block!')
10615 call stop1()
10616 end if
10617 isig1 = num2
10618 idsig = isig1-newkey(1)
10619 c
10620 c idsig is the difference between sig after transposition, and sig in setup.
10621 c It may alter # of accid's in key changes if there is transposition.
10622 c
10623 end if
10624 else ! durq='i'
10625 c
10626 c 110522/110529
10627 c Instrument-wise transposition Ki[iInstTrans][+/-][iTransAmt][+/-][iTransKey]
10628 c and repeat i[...] for multiple instruments. Store info here if ibarcnt=0
10629 c so can pass to topfile (via comInstTrans), which is called before getnote.
10630 c Otherwise, will store info from getnote. Initialize EarlyTransOn and
10631 c LaterInstTrans to .false. in blockdata. Set EarlyTransOn from here;
10632 c LaterInstTrans from g1etnote. Zero both out after use. nInstTrans really
10633 c only needed for instrument-signatures, not transpositions. iTransAmt is
10634 c ALWAYS active per instrument. Set up instno(iv) so can fetch iTransAmt for
10635 c each staff.
10636 c
10637 call GetiTransInfo(.true.,ibarcnt,lineq,iccount,
10638 * ibaroff,nbars,noinst)
10639 end if
10640 else if (charq .eq. '|') then
10641 c
10642 c Optional bar symbol
10643 c
10644 if (mod(itsofar(ivx),lenbar).ne.0) then
10645 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10646 * 'Bar line marker out of place!')
10647 call stop1()
10648 else if (shifton) then
10649 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10650 * 'Bar ended with user-defined shift still on!')
10651 call stop1()
10652 end if
10653 else if (charq .eq. chax(47)) then
10654 if (ornrpt) then
10655 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10656 * 'WARNING: Block ended with repeated ornament still on!')
10657 ornrpt = .false.
10658 end if
10659 if (stickyS) then
10660 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10661 * 'WARNING: Block ended with sticky stemshrink still on!')
10662 stickyS = .false.
10663 end if
10664 if (fbon) then
10665 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10666 * 'Block ended with forced beam open!')
10667 call stop1()
10668 else if (shifton) then
10669 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10670 * 'Bar ended with user-defined shift still on!')
10671 call stop1()
10672 end if
10673 barend = .false.
10674 c
10675 c Perform time checks
10676 c
10677 if (mod(itsofar(ivx),lenbar).ne.0) then
10678 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10679 * 'Block duration not divisible by lenbar!')
10680 print*,'lenbar, timesofar are ',lenbar,itsofar(ivx)
10681 call stop1()
10682 else if (ivx.gt.1 .and. itsofar(ivx).ne.itsofar(1)) then
10683 print*
10684 print*,'No of bars in voice 1, current voice:',
10685 * itsofar(1)/lenbar,itsofar(ivx)/lenbar
10686 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10687 * 'Block duration not equal to voice 1!')
10688 call stop1()
10689 end if
10690 call g1etchar(lineq,iccount,durq)
10691 if (durq .eq. ' ' .and. iv.eq.nv) then
10692 c
10693 c End of input block
10694 c
10695 loop = .false.
10696 else
10697 c
10698 c Start a new voice
10699 c
10700 if (lenbr0.ne.0 .and. firstline) lenbar = lenbr0
10701 nbars = 0
10702 if (durq .eq. ' ') then
10703 c
10704 c New voice is on next staff
10705 c
10706 iv = iv+1
10707 ivx = iv
10708 else
10709 c
10710 c New voice is on same staff. Set up for it
10711 c
10712 ivx = nv+1
10713 do 23 iiv = 1 , nv
10714 if (nvmx(iiv) .eq. 2) ivx = ivx+1
10715 23 continue
10716 if (ivx .gt. nm) then
10717 write(*,'(1x,a21,i3,a23)')'Cannot have more than',nm,
10718 * ' lines of music at once'
10719 call stop1()
10720 end if
10721 nvmx(iv) = 2
10722 ivmx(iv,2) = ivx
10723 itsofar(ivx) = 0
10724 nnl(ivx) = 0
10725 do 24 j = 1 , 200
10726 rest(ivx,j) = .false.
10727 nacc(ivx,j) = 0
10728 24 continue
10729 c
10730 c For midi stuff, record that there is a 2nd line of music in this voice
10731 c
10732 if (ismidi) twoline(iv) = .true.
10733 end if
10734 end if
10735 iccount = 128
10736 else if (charq .eq. 'S') then
10737 c
10738 c New nsyst: for use with partmaker scor2prt, for parts w/ diff # of systs.
10739 c
10740 if (ibarcnt .gt. 0) then
10741 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10742 * '"S" can only be in first input block!')
10743 call stop1()
10744 end if
10745 call g1etchar(lineq,iccount,durq)
10746 if (index('123456789 ',durq) .eq. 0) then
10747 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10748 * 'A digit must follow "S"!')
10749 call stop1()
10750 end if
10751 call readnum(lineq,iccount,durq,fnsyst)
10752 nsyst = nint(fnsyst)
10753 14 continue
10754 if (durq .eq. 'P') then
10755 c
10756 c New npages for parts.
10757 c
10758 call g1etchar(lineq,iccount,durq)
10759 if (index('123456789 ',durq) .eq. 0) then
10760 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10761 * 'Must have a number here!')
10762 call stop1()
10763 end if
10764 call readnum(lineq,iccount,durq,fnsyst)
10765 npages = nint(fnsyst)
10766 go to 14
10767 else if (durq .eq. 'm') then
10768 c
10769 c Reset musize (musicsize).
10770 c
10771 call g1etchar(lineq,iccount,durq)
10772 if (index('123456789 ',durq) .eq. 0) then
10773 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10774 * 'Must have a number here!')
10775 call stop1()
10776 end if
10777 call readnum(lineq,iccount,durq,fnsyst)
10778 musize = nint(fnsyst)
10779 wheadpt = whead20*musize
10780 go to 14
10781 else if (durq .ne. ' ') then
10782 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10783 * 'Illegal character in "S" symbol!')
10784 call stop1()
10785 end if
10786 else if (charq .eq. 'L') then
10787 c
10788 c Force line break
10789 c
10790 call g1etchar(lineq,iccount,durq)
10791 if (durq .eq. 'C') then
10792 c
10793 c Coda, no real line break, just get coda length
10794 c
10795 if (ishort .ne. 1) then
10796 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10797 * 'Cannot use "LC" without first using "L[n]S"!')
10798 call stop1()
10799 end if
10800 ishort = 0
10801 call g1etchar(lineq,iccount,durq)
10802 if (index('1234567890.',durq) .eq. 0) then
10803 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10804 * 'Need number to define coda length!')
10805 call stop1()
10806 end if
10807 call readnum(lineq,iccount,durq,codafrac)
10808 poefa(isysflb(nflb)) = poefa(isysflb(nflb))+codafrac
10809 if (index(' n',durq) .eq. 0) then
10810 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10811 * 'Need blank or "n" here!')
10812 call stop1()
10813 end if
10814 return
10815 end if
10816 nflb = nflb+1
10817 ibarflb(nflb) = ibarcnt+nbars+1
10818 if (index('123456789',durq) .eq. 0) then
10819 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10820 * 'Need integer to define forced line break!')
10821 call stop1()
10822 end if
10823 call readnum(lineq,iccount,durq,sysflb)
10824 isysflb(nflb) = nint(sysflb)
10825 if (isysflb(nflb) .eq. 1) then
10826 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10827 * 'For now, "L1" not allowed!')
10828 call stop1()
10829 end if
10830 if (nflb .gt. 1) then
10831 c
10832 c Check if new number is > prior one
10833 c
10834 if (isysflb(nflb) .le. isysflb(nflb-1)) then
10835 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10836 * 'You already forced a line break at a later line!')
10837 call stop1()
10838 end if
10839 end if
10840 if (npages .eq. 0) then
10841 print*
10842 print*,'WARNING! You forced a line break at line ',
10843 * isysflb(nflb),' but npage = 0. Continue?'
10844 else if (isysflb(nflb) .gt. nsyst) then
10845 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10846 * 'Forced line break at line num > nsyst!')
10847 call stop1()
10848 else if (index(' PMS',durq) .eq. 0) then
10849 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10850 * 'Must have " ", "P", "M", or "S" here!')
10851 call stop1()
10852 end if
10853 49 continue ! Transfer up from below to allow S after M
10854 if (durq .eq. 'S') then
10855 c
10856 c Shortened line, get shortening fraction
10857 c
10858 ishort = 1
10859 call g1etchar(lineq,iccount,durq)
10860 if (index('1234567890.',durq) .eq. 0) then
10861 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10862 * 'Need number to define line shortening fraction!')
10863 call stop1()
10864 end if
10865 call readnum(lineq,iccount,durq,shortfrac)
10866 poefa(isysflb(nflb)) = shortfrac
10867 if (durq .ne. ' ') then
10868 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10869 * 'Need blank here!')
10870 end if
10871 end if
10872 if (durq .eq. 'P') then
10873 c
10874 c Forced page break here, get page number.
10875 c
10876 call g1etchar(lineq,iccount,durq)
10877 if (index('123456789',durq) .eq. 0) then
10878 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10879 * 'Need integer to define forced page break!')
10880 call stop1()
10881 end if
10882 call readnum(lineq,iccount,durq,fnum)
10883 nfpb = nfpb+1
10884 ipagfpb(nfpb) = nint(fnum)
10885 isysfpb(nfpb) = isysflb(nflb)
10886 if (ipagfpb(nfpb) .gt. npages) then
10887 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10888 * 'Forced page break at page num > npages!')
10889 call stop1()
10890 else if (nfpb .gt. 1) then
10891 if (ipagfpb(nfpb) .le. (ipagfpb(nfpb-1))) then
10892 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
10893 * 'Forced page break numbers must increase!')
10894 call stop1()
10895 end if
10896 end if
10897 end if
10898 if (index(' M',durq) .eq. 0) then
10899 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10900 * 'Illegal character in linebreak symbol!')
10901 call stop1()
10902 else if (durq .eq. 'M') then
10903 nmovbrk = nmovbrk+1
10904 isysmb(nmovbrk) = isysflb(nflb)
10905 call g1etchar(lineq,iccount,durq)
10906 31 if (durq .eq. '+') then
10907 c
10908 c Vertical spacing, read past number.
10909 c
10910 call g1etchar(lineq,iccount,durq)
10911 if (index('123456789',durq) .eq. 0) then
10912 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10913 * 'Integer required here!')
10914 call stop1()
10915 end if
10916 call readnum(lineq,iccount,durq,fnum)
10917 go to 31
10918 else if (durq .eq. 'i') then
10919 c
10920 c Change indentation,
10921 c
10922 call g1etchar(lineq,iccount,durq)
10923 if (index('.123456789',durq) .eq. 0) then
10924 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10925 * 'Decimal number required here!')
10926 call stop1()
10927 end if
10928 c
10929 c fracsys was initialized in block data to all 0.'s
10930 c
10931 call readnum(lineq,iccount,durq,fracsys(nmovbrk))
10932 go to 31
10933 else if (durq .eq. 'c') then
10934 call g1etchar(lineq,iccount,durq)
10935 go to 31
10936 else if (durq .eq. 'r') then
10937 call g1etchar(lineq,iccount,durq)
10938 if (index('+-',durq) .eq. 0) then
10939 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10940 * 'Must have "+" or "-" after "r" as movement break option!')
10941 call stop1()
10942 end if
10943 call g1etchar(lineq,iccount,durq)
10944 go to 31
10945 else if (durq .eq. 'n') then
10946 c
10947 c Change # of voices. Input ninow, iorig(1...ninow). Will use names,
10948 c staves per inst. and clefs corr. to iorig in original list of instruments.
10949 c
10950 nv = 0
10951 call g1etchar(lineq,iccount,durq)
10952 if (durq .eq. ':') then
10953 c
10954 c Signals a 2-digit number, get next two characters
10955 c
10956 call g1etchar(lineq,iccount,durq)
10957 call g1etchar(lineq,iccount,dumq)
10958 if (index('12',durq).eq.0
10959 * .or.index('0123456789',dumq).eq.0) then
10960 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10961 * 'Illegal new number of instruments '//durq//dumq//
10962 * ' at movement break!')
10963 call stop1()
10964 end if
10965 read(lineq(iccount-1:iccount),'(i2)')ninow
10966 else
10967 c
10968 c durq is a single digit number for noinow
10969 c
10970 if (index('123456789',durq) .eq. 0) then
10971 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10972 * 'Illegal new number of instruments '//durq//
10973 * ' at movement break!')
10974 call stop1()
10975 end if
10976 ninow = ichar(durq)-48
10977 end if
10978 if (ninow.gt.noinst) then
10979 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10980 * 'New number of instruments must be <= original!')
10981 call stop1()
10982 end if
10983 do 63 iinow = 1 , ninow
10984 call g1etchar(lineq,iccount,durq)
10985 if (durq .eq. ':') then
10986 c
10987 c Signals a 2-digit number
10988 c
10989 call g1etchar(lineq,iccount,durq)
10990 call g1etchar(lineq,iccount,dumq)
10991 if (index('12',durq).eq.0
10992 * .or.index('0123456789',dumq).eq.0) then
10993 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
10994 * 'Illegal 2-digit instrument number '//durq//dumq//
10995 * ' at movement break!')
10996 call stop1()
10997 end if
10998 read(lineq(iccount-1:iccount),'(i2)')iorig
10999 else
11000 c
11001 c durq is a single digit number for iorig
11002 c
11003 if (index('123456789',durq) .eq. 0) then
11004 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11005 * 'Illegal instrument number '//durq//
11006 * ' at movement break!')
11007 call stop1()
11008 end if
11009 iorig = ichar(durq)-48
11010 end if
11011 if (iorig .gt. noinst) then
11012 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11013 * 'New instrument number must be <= original noinst!')
11014 call stop1()
11015 end if
11016 nv = nv+nsperi(iorig)
11017 63 continue
11018 do 61 iiv = 1 , nv
11019 c
11020 c Get clef names
11021 c
11022 call g1etchar(lineq,iccount,durq)
11023 if (.not.(index('tsmanrbf',durq).gt.0 .or.
11024 c * (ichar(durq).ge.48 .and. ichar(durq).le.55))) then
11025 * (ichar(durq).ge.48 .and. ichar(durq).le.56))) then
11026 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11027 * 'Must have t,s,m,a,n,r,b,f or 1-7 as clef symbol here!')
11028 call stop1()
11029 end if
11030 c
11031 c Initialize new voices
11032 c
11033 nvmx(iiv) = 1
11034 ivmx(iiv,1) = iiv
11035 itsofar(iiv) = 0
11036 nnl(iiv) = 0
11037 do 62 j = 1 , 200
11038 rest(iiv,j) = .false.
11039 62 continue
11040 61 continue
11041 c
11042 c Loop back up, this might not be last option in M
11043 c
11044 call g1etchar(lineq,iccount,durq)
11045 go to 31
11046 else if (durq .eq. 'S') then
11047 go to 49
11048 else if (durq .ne. ' ') then
11049 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11050 * 'Illegal character after Movement break symbol!')
11051 call stop1()
11052 end if
11053 if (fracsys(nmovbrk) .lt. 0.001) then
11054 c
11055 c Since fracsys was not explicitly set, set it to prior value.
11056 c
11057 if (nmovbrk .eq. 1) then
11058 fracsys(nmovbrk) = fracindent
11059 else
11060 fracsys(nmovbrk) = fracsys(nmovbrk-1)
11061 end if
11062 end if
11063 end if
11064 c
11065 c Just before exiting if-block for forced line breaks, set counter to use when
11066 c dealing with vertical space calcs
11067 c
11068 nistaff(nflb) = nv-1
11069 else if (charq .eq. 'F') then
11070 usefig = .false.
11071 else if (charq .eq. 'X') then
11072 call g1etx(lineq,iccount,shifton,ibarcnt-ibaroff+nbars+1,
11073 * udsp(ibarcnt+nbars+1),wheadpt)
11074 else if (charq .eq. 'I') then
11075 c
11076 c MIDI settings.
11077 c
11078 if (ivx.ne.1 .or. nnl(1).ne.0) then
11079 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11080 * 'MIDI stuff only allowed at start of block!')
11081 call stop1()
11082 end if
11083 if (nv .gt. 15) then
11084 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11085 * 'Sorry but MIDI does not work with more than 15 voices!')
11086 call stop1()
11087 end if
11088 ismidi = .true.
11089 call getmidi(noinst,lineq,iccount,ibarcnt,ibaroff,nbars,lenbar,
11090 * mtrdenl,nv,.true.)
11091 else if (charq .eq. 'M') then
11092 call setmac(lineq,iccount,ibarcnt,ibaroff,nbars,charq,durq,ivx,
11093 * nline)
11094 else if (index(',.',charq) .gt. 0) then
11095 c
11096 c Continued rhythmic shortcut
11097 c
11098 idotform = index('. ,',charq)
11099 if (idotform .eq. 1) then
11100 c
11101 c Change duration of prior note
11102 c
11103 itsofar(ivx) = itsofar(ivx)-nodur(ivx,nnl(ivx))
11104 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx))*3/2
11105 itsofar(ivx) = itsofar(ivx)+nodur(ivx,nnl(ivx))
11106 end if
11107 idotform = idotform+1
11108 numnum = 1
11109 cdot = .true.
11110 go to 1
11111 else
11112 print*,'ASCII code:',ichar(charq)
11113 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11114 * 'This character is not allowed here!')
11115 print*,'ASCII code:',ichar(charq)
11116 call stop1()
11117 end if
11118 return
11119 end
11120 subroutine g1etset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,
11121 * xmtrnum0,newkey,npages,nsyst,musize,bottreb)
11122 parameter(nm=24,maxblks=9600)
11123 character*131072 bufq
11124 character*1 chax
11125 integer*2 lbuf(maxblks)
11126 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
11127 character*128 lineq
11128 logical lastchar,issegno,isheadr,isvolt,fbon,bottreb,
11129 * newway
11130 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
11131 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
11132 common /commidisig/ midisig
11133 c
11134 c Get the first line
11135 c
11136 iccount = 0
11137 nline = 1
11138 9 call getbuf(lineq)
11139 if (lineq(1:1) .eq. '%') then
11140 nline = nline+1
11141 go to 9
11142 end if
11143 if (lineq(1:3) .eq. '---') then
11144 c
11145 c Have TeX input until next line that starts with '---'
11146 c
11147 3 nline = nline+1
11148 call getbuf(lineq)
11149 if (ilbuf .gt. nlbuf) go to 1
11150 go to 2
11151 1 print*,'You did not terminate type 0 TeX input with "---"'
11152 call stop1()
11153 2 continue
11154 if (lineq(1:3) .ne. '---') go to 3
11155 c
11156 c Force a new line read on first call to readin
11157 c
11158 iccount = 128
11159 end if
11160 c
11161 c Here, lineq and nline are first non-TeX lines.
11162 c
11163 nv = nint(readin(lineq,iccount,nline))
11164 if (nv .gt. nm) then
11165 write(*,'(1x,a46,i3)')
11166 * 'In setup data, number of voices cannot exceed',nm
11167 call stop1()
11168 end if
11169 noinst = nint(readin(lineq,iccount,nline))
11170 if (noinst .gt. nv) then
11171 write(*,'(a)')
11172 * 'In setup data, cannot have more instruments than staves'
11173 call stop1()
11174 end if
11175 newway = noinst.le.0
11176 if (newway) noinst = -noinst
11177 do 10 iinst = 1 , noinst
11178 c
11179 c Seve # of staves per inst in case later drop some inst's.
11180 c
11181 if (newway) then
11182 nsperi(iinst) = nint(readin(lineq,iccount,nline))
11183 else if (iinst .gt. 1 ) then
11184 nsperi(iinst) = 1
11185 else
11186 nsperi(iinst) = nv-noinst+1
11187 end if
11188 10 continue
11189 mtrnuml = nint(readin(lineq,iccount,nline))
11190 mtrdenl = nint(readin(lineq,iccount,nline))
11191 mtrnmp = nint(readin(lineq,iccount,nline))
11192 mtrdnp = nint(readin(lineq,iccount,nline))
11193 if (mtrnmp.eq.0 .and. mtrdnp .ge. 8) then
11194 write(*,'(a)')'In setup data, with mtrnmp=0, mtrdnp must be <8'
11195 call stop1()
11196 end if
11197 xmtrnum0 = readin(lineq,iccount,nline)
11198 newkey = nint(readin(lineq,iccount,nline))
11199 midisig = newkey
11200 npages = nint(readin(lineq,iccount,nline))
11201 nsyst = nint(readin(lineq,iccount,nline))
11202 musize = nint(readin(lineq,iccount,nline))
11203 fracindent = readin(lineq,iccount,nline)
11204 if (fracindent .ge. 1.) then
11205 write(*,'(a)')'In setup data, fracindent must be <1'
11206 call stop1()
11207 end if
11208 if (npages .gt. nsyst) then
11209 print*,'Error in input file: npages > nsyst'
11210 call stop1()
11211 else if((musize-16)*(musize-20)*(musize-24)*(musize-29).ne.0) then
11212 call printl('Musicsize must be 16, 20, 24, or 29')
11213 call stop1()
11214 end if
11215 c
11216 c Next noinst non-comment lines are names of instruments.
11217 c
11218 do 4 i = 1 , abs(noinst)
11219 5 call getbuf(lineq)
11220 nline = nline+1
11221 if (lineq(1:1) .eq. '%') go to 5
11222 4 continue
11223 c
11224 c Mext non-comment line has nv clef names
11225 c
11226 6 call getbuf(lineq)
11227 nline = nline+1
11228 if (lineq(1:1) .eq. '%') go to 6
11229 do 7 iv = 1 , nv
11230 c if (index('brnamstf01234567',lineq(iv:iv)) .eq. 0) then
11231 if (index('brnamstf012345678',lineq(iv:iv)) .eq. 0) then
11232 call errmsg(lineq,iv,0,
11233 * 'There should be a clef symbol here!')
11234 call stop1()
11235 end if
11236 7 continue
11237 if (lineq(nv+1:nv+1) .ne. ' ') then
11238 call errmsg(lineq,nv+1,0,
11239 * 'There should be a blank here!')
11240 call stop1()
11241 end if
11242 c
11243 c Set flag if voice 1 is treble, since it affects vertical spacing
11244 c
11245 c bottreb = lineq(1:1).eq.'t'
11246 bottreb = index('t08',lineq(1:1)).gt.0
11247 c
11248 c Next non-comment line has path name
11249 c
11250 8 call getbuf(lineq)
11251 nline = nline+1
11252 if (lineq(1:1) .eq. '%') go to 8
11253 lpath = index(lineq,' ')-1
11254 if (index('/:'//chax(92),lineq(lpath:lpath)) .eq. 0) then
11255 call errmsg(lineq,lpath,0,
11256 * 'Last character of pathname is not "/",":", or "'
11257 * //chax(92)//'"!')
11258 call stop1()
11259 end if
11260 return
11261 end
11262 subroutine g1etx(lineq,iccount,shifton,ibar,udsp,wheadpt)
11263 c
11264 c Parse "X" commands. Ignore all "B"; "P" means to ignore whole symbol.
11265 c In scor2prt, must strip out "P", copy only "B" and "P"-type "X"-symbols.
11266 c
11267 logical shifton,number,btest
11268 character*128 lineq
11269 character*1 charq,dumq
11270 number = .false.
11271 nPBSc = 0
11272 1 call g1etchar(lineq,iccount,charq)
11273 if (index('PBS:',charq) .gt. 0) then
11274 c
11275 c Continue checking here even if "P".
11276 c
11277 ipbsc = index('PBS:',charq)
11278 if (btest(nPBSc,ipbsc)) then
11279 call errmsg(lineq,iccount,ibar,'Only one allowed per symbol!')
11280 call stop1()
11281 end if
11282 nPBSc = ibset(nPBSc,ipbsc)
11283 go to 1
11284 else if (index('+-.0123456789',charq) .gt. 0) then
11285 number = .true.
11286 if (index('+-',charq) .gt. 0) then
11287 call g1etchar(lineq,iccount,dumq)
11288 if (index('.0123456789',dumq) .eq. 0) then
11289 call errmsg(lineq,iccount,ibar,'Expected a number here!')
11290 call stop1()
11291 end if
11292 end if
11293 call readnum(lineq,iccount,dumq,fnum)
11294 if (charq.eq.'-') fnum = -fnum
11295 if (dumq .ne. 'p') then
11296 iccount = iccount-1
11297 fnum = fnum*wheadpt
11298 end if
11299 go to 1
11300 else if (charq .ne. ' ') then
11301 call errmsg(lineq,iccount,ibar,'Not allowed in "X" symbol!')
11302 call stop1()
11303 end if
11304 c
11305 c Done with parsing. Other checks
11306 c
11307 if (iand(6,nPBSc).eq.6 .or. iand(24,nPBSc).eq.24) then
11308 call errmsg(lineq,iccount-1,ibar,
11309 * 'Cannot have both "P" and "B" or "S" and ":"!')
11310 call stop1()
11311 end if
11312 if (btest(nPBSc,4)) then
11313 if (number) then
11314 if (shifton) then
11315 call errmsg(lineq,iccount-1,ibar,
11316 * 'Started a group shift without stopping prior one!')
11317 call stop1()
11318 else
11319 shifton = .true.
11320 end if
11321 else
11322 if (.not. shifton) then
11323 call errmsg(lineq,iccount-1,ibar,
11324 * 'Ended a group shift without starting one!')
11325 call stop1()
11326 else
11327 shifton = .false.
11328 end if
11329 end if
11330 end if
11331 c
11332 c P off, S off, c off => normal user-defined space. Add to udsp (later fsyst)
11333 c
11334 if (iand(nPBSc,26).eq.0) udsp = udsp+fnum
11335 if (.not.number .and. .not.btest(nPBSc,4)) then
11336 call errmsg(lineq,iccount-1,ibar,
11337 * 'Must have either a number or a colon in "X" symbol!')
11338 call stop1()
11339 end if
11340 return
11341 end
11342 subroutine getbuf(lineq)
11343 parameter (maxblks=9600)
11344 character*(*) lineq
11345 character*131072 bufq
11346 integer*2 lbuf(maxblks)
11347 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
11348 lineq = bufq(ipbuf+1:ipbuf+lbuf(ilbuf))
11349 ipbuf = ipbuf+lbuf(ilbuf)
11350 ilbuf = ilbuf+1
11351 return
11352 end
11353 subroutine getchar(lineq,iccount,charq)
11354 parameter (nm=24)
11355 c
11356 c Gets the next character out of lineq*128. If pointer iccount=128 on entry,
11357 c then reads in a new line. Resets iccount. Ends program if no more input.
11358 c
11359 common /comget/ lastchar,rptnd1,sluron(nm,2),fbon,ornrpt,stickyS,
11360 * movbrk,movnmp,movdnp,movgap,parmov,fintstf,gintstf,
11361 * rptprev,equalize,rptfq1,rptfq2
11362 logical lastchar,rptnd1,sluron,fbon,rptprev,ornrpt
11363 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
11364 logical mrecord,mplay,endmac,equalize,stickyS
11365 character*1 charq,rptfq1,rptfq2
11366 character*128 lineq,lnholdq
11367 if (iccount .eq. 128) then
11368 call read10(lineq,lastchar)
11369 if (lastchar) return
11370 if (.not. endmac) then
11371 iccount = 0
11372 else
11373 endmac = .false.
11374 iccount = icchold
11375 lineq = lnholdq
11376 end if
11377 if (mrecord) then
11378 call mrec1(lineq,iccount,ndxm)
11379 end if
11380 end if
11381 iccount = iccount+1
11382 charq = lineq(iccount:iccount)
11383 return
11384 end
11385 subroutine getdyn(ivx,ip,irest,iornq,lineq,iccount)
11386 parameter (nm=24)
11387 common /comdyn/ ndyn,idyndat(99),levdsav(nm),ivowg(12),hoh1(12),
11388 * hoh2(12),hoh2h1(2),ntxtdyn,ivxiptxt(41),txtdynq(41),
11389 * idynda2(99),levhssav(nm),listcresc,listdecresc
11390 character*128 txtdynq
11391 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
11392 * ,WrotePsslurDefaults,SlurCurve
11393 logical fontslur,upslur,WrotePsslurDefaults
11394 character*1 durq,chax
11395 character*4 dynsymq
11396 character*128 lineq
11397 c
11398 c Get info for dynamic mark. Enter after getting "D", iccount sits on "D"
11399 c Bits in idyndat are as follows
11400 c 00-03 ivx
11401 c 04-11 ip
11402 c 12-15 code for type of mark
11403 c 0 => arbitrary text
11404 c 1-12 => pppp,ppp,pp,p,mp,mf,f,fp,sfz,ff,fff,ffff
11405 c If (.not. fontslur)
11406 c 13 => hairpin start, 14,15 => <,> (ending)
11407 c else
11408 c 13 < start, 14 > start, 15 ending
11409 c end if
11410 c 16 flag for vertical offset
11411 c 17-23 vertical offset + 64 , \internote
11412 c 31 Hairpin start (0), stop (1)
11413 c
11414 c idynda2
11415 c
11416 c 00 flag for horizontal offset
11417 c 01-09 (horizontal offset)/10 + 25.6 notehead widths
11418 c 10 5th bit for ivx (5/15/10)
11419 c
11420 irest = ibset(irest,26)
11421 ndyn = ndyn+1
11422 idyn = ivx
11423 idynda2(ndyn) = 0
11424 if (ivx .ge. 16) call setbits(idynda2(ndyn),1,10,1)
11425 call setbits(idyn,8,4,ip)
11426 if (lineq(iccount+1:iccount+1) .eq. chax(34)) then
11427 c
11428 c text-dynamic
11429 c
11430 ntxtdyn = ntxtdyn+1
11431 iccountt = iccount
11432 3 continue
11433 iend = iccountt+index(lineq(iccountt+2:128),chax(34))+2
11434 if (lineq(iend-2:iend-2) .eq. chax(92)) then
11435 iccountt = iend-2
11436 go to 3
11437 end if
11438 txtdynq(ntxtdyn) = lineq(iccount+2:iend-2)
11439 c
11440 c Store ivx, ip in bits 0-12
11441 c
11442 ivxiptxt(ntxtdyn) = ivx+32*ip
11443 ipm = index('- +',lineq(iend:iend))
11444 idno = 0
11445 else
11446 c
11447 c Word-group or hairpin
11448 c
11449 do 1 iend = iccount+2 , 128
11450 ipm = index('- +',lineq(iend:iend))
11451 c
11452 c Exit the loop at first blank, "+", or "-"
11453 c
11454 if (ipm .gt. 0) go to 2
11455 1 continue
11456 2 continue
11457 read(lineq(iccount+1:iend-1),'(a'//chax(47+iend-iccount)//')')
11458 * dynsymq
11459 idno = (index(
11460 * 'ppppppp pp p mp mf f fp sfz ff fff ffff < > ',
11461 * dynsymq)+3)/4
11462 c
11463 c Save for later down
11464 c
11465 idno1 = idno
11466 end if
11467 c
11468 c Set flag to check level later if in beam
11469 c
11470 iornq = ibset(iornq,23)
11471 if (idno.ge.14) then
11472 c
11473 c Hairpin here. Check if opposite type from one that's already on
11474 c
11475 if (idno.eq.14.and.btest(listdecresc,ivx) .or.
11476 * idno.eq.15.and.btest(listcresc,ivx)) then
11477 call printl(' ')
11478 call printl('Started one kind of hairpin while other is on')
11479 call stop1()
11480 end if
11481 c
11482 c Start or stop?
11483 c
11484 if (btest(listcresc,ivx) .or. btest(listdecresc,ivx)) then
11485 c
11486 c Cresc/decresc is on, this is an ending. If fontslur, leave idno as is.
11487 c
11488 if (.not.fontslur) idno = 15
11489 else if (fontslur) then
11490 c
11491 c Start of font slur
11492 c
11493 idno = 13
11494 else
11495 c
11496 c Start of postscript slur
11497 c
11498 idno = idno-1
11499 end if
11500 end if
11501 c
11502 c Now that we used list[de]cresc, update
11503 c
11504 if (idno .ge.13) then
11505 if (idno.eq.15 .or. (fontslur.and.idno.eq.14)) then
11506 c
11507 c Something's ending
11508 c
11509 if (btest(listcresc,ivx)) then
11510 c
11511 c It's a cresc!
11512 c
11513 listcresc = ibclr(listcresc,ivx)
11514 else
11515 listdecresc = ibclr(listdecresc,ivx)
11516 end if
11517 else
11518 c
11519 c Something's starting
11520 c
11521 if (idno1 .eq. 14) then
11522 c
11523 c It's a cresc!
11524 c
11525 listcresc = ibset(listcresc,ivx)
11526 else
11527 listdecresc = ibset(listdecresc,ivx)
11528 end if
11529 end if
11530 end if
11531 call setbits(idyn,4,12,idno)
11532 iccount = iend
11533 if (ipm .ne. 2) then
11534 c
11535 c There is a vertical shift
11536 c
11537 idyn = ibset(idyn,16)
11538 iccount = iccount+1
11539 call readnum(lineq,iccount,durq,fnum)
11540 idno = nint(fnum)
11541 call setbits(idyn,7,17,(ipm-2)*idno+64)
11542 ipm = index('- +',durq)
11543 if (ipm .ne. 2) then
11544 c
11545 c There is a horizontal shift
11546 c
11547 c idynda2(ndyn) = ibset(idyn,23)
11548 idynda2(ndyn) = ibset(idynda2(ndyn),0)
11549 iccount = iccount+1
11550 call readnum(lineq,iccount,durq,fnum)
11551 idno = nint(10*fnum)
11552 call setbits(idynda2(ndyn),9,1,(ipm-2)*idno+256)
11553 end if
11554 c
11555 c iccount should be on the blank at the end of the entire symbol
11556 c
11557 end if
11558 idyndat(ndyn) = idyn
11559 return
11560 end
11561 subroutine getfig(itoff,charq,lineq,iccount,isfig,itfig,
11562 * itsofar,nodur,figq,ivupfig,ivvfig,nfigs)
11563 logical isfig
11564 character*1 charq
11565 character*10 figq
11566 character*128 lineq
11567 nfigs = nfigs+1
11568 ivupfig = 0
11569 ivvfig = 0
11570 itoff = 0
11571 if (charq .eq. 'x') then
11572 c
11573 c Floating figure.
11574 c
11575 call getchar(lineq,iccount,charq)
11576 read(charq,'(i1)')noff
11577 call getchar(lineq,iccount,charq)
11578 read(charq,'(i1)')loff
11579 itoff = noff*ifnodur(loff,'x')
11580 call getchar(lineq,iccount,charq)
11581 else
11582 c
11583 c Figure on a note
11584 c
11585 isfig = .true.
11586 end if
11587 itfig = itsofar+itoff-nodur
11588 lfig = 1
11589 figq = charq
11590 5 call getchar(lineq,iccount,charq)
11591 if (index(' +v',charq) .eq. 0) then
11592 figq = figq(1:lfig)//charq
11593 lfig = lfig+1
11594 go to 5
11595 else if (charq .eq. '+') then
11596 c
11597 c Get vertical offset for figure. Next character after number has to be blank.
11598 c
11599 iccount = iccount+1
11600 call readnum(lineq,iccount,charq,fnum)
11601 ivupfig = nint(fnum)
11602 else if (charq .eq. 'v') then
11603 c
11604 c Get vertical change in figdrop. Must be last item in figure word.
11605 c
11606 isign = 1
11607 call getchar(lineq,iccount,charq)
11608 if (charq .eq. '-') then
11609 isign=-1
11610 call getchar(lineq,iccount,charq)
11611 end if
11612 ivvfig = isign*(ichar(charq)-48)
11613 end if
11614 return
11615 end
11616 subroutine getgrace(ivx,nnl,lineq,iccount,islur,iornq,ipl,ndlev,
11617 * lastlev,iv,nv)
11618 parameter (nm=24)
11619 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
11620 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
11621 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
11622 * graspace(37),
11623 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
11624 * naccg(74),voltxtq(6),litq(83)
11625 logical upg,slurg,slashg
11626 character*1 charq,durq
11627 character*20 voltxtq
11628 character*128 lineq,litq
11629 integer*4 islur(nm,200),iornq(nm,0:200),ipl(nm,200),nnl(nm),
11630 * ndlev(nm,2)
11631 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
11632 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
11633 logical EarlyTransOn,LaterInstTrans
11634 c
11635 c Grace, comes *before* main note:
11636 c UNLESS there's an 'A' or 'W' after the 'G'
11637 c ngrace = # of grace note groups so far in block
11638 c ivg(ngrace), ipg(ngrace)
11639 c nng(ngrace) = # of notes in this group: default = 1
11640 c ngstrt(ngrace) = starting position in nolevg of levels for this grace
11641 c multg(ngrace) = multiplicity: default = 1; input as 'm(digit)'
11642 c upg(ngrace) = logical for beam or stem dirn: default T, input'u,l'
11643 c slurg(ngrace) = logical for slur; default F, input 's'
11644 c slashg(ngrace) = T if slash; default is F, input 'x'
11645 c These data MUST precede note name of first note
11646 c nolevg, naccg: lists of levels and accid's, indexed as described above.
11647 c
11648 ngrace = ngrace+1
11649 ivg(ngrace) = ivx
11650 ipg(ngrace) = nnl(ivx)+1
11651 if (ngrace .eq. 1) then
11652 ngstrt(ngrace) = 1
11653 else
11654 ngstrt(ngrace) = ngstrt(ngrace-1)+nng(ngrace-1)
11655 end if
11656 islur(ivx,nnl(ivx)+1) = ibset(islur(ivx,nnl(ivx)+1),4)
11657 nng(ngrace) = 1
11658 multg(ngrace) = 1
11659 upg(ngrace) = .true.
11660 slurg(ngrace) = .false.
11661 slashg(ngrace) = .false.
11662 18 call getchar(lineq,iccount,charq)
11663 if (index('WA',charq) .gt. 0) then
11664 c
11665 c Grace is on note that was already done, so shift flags forward one note.
11666 c This puts flag on actual note with grace; later for W will go ahead one more.
11667 c
11668 ipg(ngrace) = nnl(ivx)
11669 islur(ivx,nnl(ivx)+1) = ibclr(islur(ivx,nnl(ivx)+1),4)
11670 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),4)
11671 if (slurg(ngrace))
11672 * iornq(ivx,nnl(ivx)) = ibset(iornq(ivx,nnl(ivx)),24)
11673 if (charq .eq. 'A') then
11674 c
11675 c close After, clear way-after bit, to ensure priority of most recent A/W
11676 c
11677 ipl(ivx,nnl(ivx)) = ibset(ibclr(ipl(ivx,nnl(ivx)),31),29)
11678 else
11679 c
11680 c Way after; later assign to following note, and position like normal grace.
11681 c
11682 ipl(ivx,nnl(ivx)) = ibset(ibclr(ipl(ivx,nnl(ivx)),29),31)
11683 end if
11684 else if (charq .eq. 'm') then
11685 call getchar(lineq,iccount,charq)
11686 multg(ngrace) = ichar(charq)-48
11687 else if (index('123456789',charq) .gt. 0) then
11688 call readnum(lineq,iccount,durq,fnum)
11689 iccount = iccount-1
11690 nng(ngrace) = nint(fnum)
11691 else if (charq .eq. 'l') then
11692 upg(ngrace) = .false.
11693 else if (charq .eq. 's') then
11694 slurg(ngrace) = .true.
11695 if (nnl(ivx) .gt. 0) then
11696 c
11697 c If A- or W-grace, set signal to start slur on main note.
11698 c
11699 if(btest(ipl(ivx,nnl(ivx)),31) .or.
11700 * btest(ipl(ivx,nnl(ivx)),29))
11701 * iornq(ivx,nnl(ivx))=ibset(iornq(ivx,nnl(ivx)),24)
11702 end if
11703 else if (charq .eq. 'x') then
11704 slashg(ngrace) = .true.
11705 else if (charq .eq. 'u') then
11706 else if (charq .eq. 'X') then
11707 c
11708 c Space before main note of grace. Number will come next.
11709 c
11710 iccount = iccount+1
11711 call readnum(lineq,iccount,durq,graspace(ngrace))
11712 iccount = iccount-1
11713 end if
11714 if (index('abcdefg',charq) .eq. 0) go to 18
11715 c
11716 c At this point, charq is first note name in grace
11717 c
11718 do 19 ing = ngstrt(ngrace), ngstrt(ngrace)+nng(ngrace)-1
11719 naccg(ing) = 0
11720 ioct = 0
11721 if (ing .gt. ngstrt(ngrace)) then
11722 55 call getchar(lineq,iccount,charq)
11723 if (charq .eq. ' ') go to 55
11724 endif
11725 iclastlev = 0
11726 9 call getchar(lineq,iccount,durq)
11727 if (durq .ne. ' ') then
11728 if (durq.eq.'+') then
11729 lastlev = lastlev+7
11730 iclastlev = iclastlev+7
11731 else if (durq.eq.'-') then
11732 lastlev = lastlev-7
11733 iclastlev = iclastlev-7
11734 else if (index('fsn',durq) .gt. 0) then
11735 if (naccg(ing) .eq. 0) then
11736 naccg(ing) = index('fsn',durq)
11737 else
11738 c
11739 c Double accidental
11740 c
11741 naccg(ing) = ibset(naccg(ing),2)
11742 end if
11743 else
11744 ioct = ichar(durq)-48
11745 end if
11746 go to 9
11747 end if
11748 if (ioct .gt. 0) then
11749 lastlev = ifnolev(charq,ioct,iTransAmt(instno(iv)))
11750 else
11751 if (nnl(ivx).eq.0 .and. ing.eq.ngstrt(ngrace)) then
11752 if (ivx .le. nv) then
11753 kv = 1
11754 else
11755 kv = 2
11756 end if
11757 lastlev = ndlev(iv,kv)+iclastlev
11758 end if
11759 lastlev = lastlev-3
11760 * +mod(ifnolev(charq,10,iTransAmt(instno(iv)))-lastlev+3,7)
11761 end if
11762 nolevg(ing) = lastlev
11763 19 continue
11764 c
11765 c Grace could come before first note of block, so reset end level.
11766 c
11767 if (nnl(ivx).eq.0) then
11768 if (ivx .le. nv) then
11769 kv = 1
11770 else
11771 kv = 2
11772 end if
11773 ndlev(iv,kv) = lastlev
11774 end if
11775 return
11776 end
11777 subroutine GetiTransInfo(From1,ibarcnt,lineq,iccount,
11778 * ibaroff,nbars,noinst)
11779 cccccccccccccccccccccccc
11780 cc
11781 cc GetiTransInfo.for
11782 cc
11783 cccccccccccccccccccccccc
11784 c
11785 c Called from both g1etnote and getnote, after first 'i' in Ki[...]
11786 c On entry, iccount points to last char retrieved, which is 'i'
11787 c
11788 c From1: locgical, true if called from g1etnote
11789 c ibarcnt: tells whether to set EarlyTransOn to true.
11790 c EarlyTransOn set false in blkdata, true here, back to false in topfile.
11791 c
11792 c 110522/110529
11793 c Instrument-wise transposition Ki[iInstTrans][+/-][iTransAmt][+/-][iTransKey]
11794 c and repeat i[...] for multiple instruments. Store info in g1etnot if ibarcnt=0
11795 c so can pass to topfile (via comInstTrans), which is called before getnote.
11796 c Otherwise, will store info from getnote. Initialize EarlyTransOn and
11797 c LaterInstTrans to .false. in blockdata. Set EarlyTransOn from g1etnote;
11798 c LaterInstTrans from getnote. Zero both out after use. nInstTrans really
11799 c only needed for instrument-signatures, not transpositions. iTransAmt is
11800 c ALWAYS active per instrument. Set up instno(iv) so can fetch iTransAmt for
11801 c each staff.
11802 c
11803 c iTransAmt stored as fn of instrument #, not like iTransKey which is
11804 c fn. of nm, just a counter, where corr. inst num is iInstTrans(nm). This
11805 c simplifies use of iTransAmt for all calls to ifnolev.
11806 c
11807 parameter (nm=24)
11808 logical From1
11809 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
11810 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
11811 logical EarlyTransOn,LaterInstTrans,store
11812 character*128 lineq
11813 character*1 durq
11814 durq = 'x' ! Can't initialize in declaration stmt, only works once.
11815 if(.not.EarlyTransOn) EarlyTransOn = From1 .and. ibarcnt.eq.0
11816 store = (EarlyTransOn.and.ibarcnt.eq.0) .or.
11817 * (ibarcnt.gt.0.and..not.From1)
11818 LaterInstTrans = .not.From1 .and. ibarcnt.gt.0
11819 if (store) nInstTrans = 0
11820 1 continue
11821 if (durq .eq. ' ') return
11822 call g1etchar(lineq,iccount,durq)
11823 if (index('123456789',durq) .eq. 0) then
11824 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11825 * 'There must be an instrument number here!')
11826 call stop1()
11827 end if
11828 if (store) nInstTrans = nInstTrans+1
11829 call readnum(lineq,iccount,durq,fnum)
11830 instn = nint(fnum)
11831 if (instn.gt.noinst) then
11832 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11833 * 'Instrument number out of range!')
11834 call stop1()
11835 end if
11836 if (store) iInstTrans(nInstTrans) = instn
11837 c
11838 c durq is +/- following inst # (for iTransAmt), iccount is on it.
11839 c
11840 if (index('+-',durq) .eq. 0) then
11841 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11842 * '1st character after instrument number must be "+,-"!')
11843 call stop1()
11844 end if
11845 itramt = 44-ichar(durq) ! +1/-1 for itramt
11846 call g1etchar(lineq,iccount,durq)
11847 if (index('0123456789',durq) .eq. 0) then
11848 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11849 * 'There must be a transposition amount here!')
11850 call stop1()
11851 end if
11852 call readnum(lineq,iccount,durq,fnum)
11853 if (store) iTransAmt(instn) = nint(fnum)*itramt
11854 c
11855 c durq is +/- following iTransAmt (for iTransKey), iccount is on it.
11856 c
11857 if (index('+-',durq) .eq. 0) then
11858 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11859 * '1st character after transposition amount must be "+,-"!')
11860 call stop1()
11861 end if
11862 ikey = 44-ichar(durq) ! +1/-1
11863 call g1etchar(lineq,iccount,durq)
11864 if (index('0123456789',durq) .eq. 0) then
11865 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11866 * 'There must be a key indicator here!')
11867 call stop1()
11868 end if
11869 call readnum(lineq,iccount,durq,fnum)
11870 if (store) iTransKey(nInstTrans) = nint(fnum)*ikey
11871 c
11872 c durq is now 1st character after iTransKey, should be either 'i' or ' '
11873 c
11874 if (durq.ne.'i'.and.durq.ne.' ') then
11875 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11876 * 'There must be blank or "i" here!')
11877 call stop1()
11878 end if
11879 go to 1
11880 end
11881 subroutine getmidi(noinstarg,lineq,iccount,ibarcnt,ibaroff,nbars,
11882 * lenbar,mtrdenl,nv,first)
11883 c
11884 c Use this from both pmxa and pmxb to input and check midi data. "first" tells
11885 c whether pmxa or pmxb. If .not.first, then tempo and pause commands cause
11886 c things to be written immediately into the midi storage buffers.
11887 c
11888 parameter (nm=24,mv=24576)
11889 common /comevent/ miditime,lasttime
11890 logical mmacrec,gottempo
11891 common /commmac/ mmacstrt(0:nm,20),mmacend(0:nm,20),immac,
11892 * mmactime(20),nmidsec,msecstrt(0:nm,60),msecend(0:nm,60),
11893 * mmacrec,gottempo
11894 c
11895 c immac(i) is the index of i-th macro, i=1,nmac. Also make a list containing
11896 c nmidsec section starts and stops based on PLAYING macros (not recording).
11897 c
11898 integer*2 mmidi,midinum(26)
11899 logical restpend,relacc,notmain,twoline,ismidi,crdacc
11900 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
11901 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
11902 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
11903 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
11904 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
11905 * debugmidi
11906 logical debugmidi
11907 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
11908 * ,miditran(nm),midtc(0:nm),noinstdum,iinsiv(nm)
11909 integer*2 iinsiv
11910 character*1 durq
11911 character*2 instq
11912 character*128 lineq
11913 logical first
11914 common /comdiag/ n69(0:nm),n34(0:nm)
11915 c
11916 c Instrument codes
11917 c
11918 data midinum
11919 * / 1, 5, 7, 13,20,25,33,41,42,43,44,57,58,59,61,65,66,67,
11920 c XXpiXrhXhaXmaXorXguXabXvlXvaXvcXcbXtrXtbXtuXfrXsoXalXteX
11921 c
11922 * 68,69,71,72,74,75, 8,55 /
11923 c bsXobXbaXclXflXreXctXvo
11924 c
11925 1 call getchar(lineq,iccount,durq)
11926 if (durq .eq. 't') then
11927 c
11928 c Tempo in beats ber minute
11929 c
11930 call getchar(lineq,iccount,durq)
11931 if (index('0123456789',durq) .eq. 0) then
11932 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11933 * 'Expected an integer here for the pause!')
11934 call stop1()
11935 end if
11936 call readnum(lineq,iccount,durq,qpm)
11937 iccount = iccount-1
11938 if (.not.first) then
11939 call midievent('t',nint(qpm),0)
11940 gottempo = .true.
11941 end if
11942 go to 1
11943 else if (durq .eq. 'p') then
11944 c
11945 c Insert a pause. pausemid = pause in 1/4's
11946 c
11947 call getchar(lineq,iccount,durq)
11948 if (index('0123456789.',durq) .eq. 0) then
11949 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11950 * 'Expected a number here for the pause!')
11951 call stop1()
11952 end if
11953 call readnum(lineq,iccount,durq,pausemid)
11954 iccount = iccount-1
11955 if (.not.first) then
11956 c
11957 c Compute a meter for the pause. This is only to keep MidiNotate on track.
11958 c Round pause to nearest 16th. Let denominator always be 16.
11959 c
11960 numb16 = nint(pausemid*4)
11961 call midievent('m',numb16,16)
11962 c
11963 c Put in pausemid beats of rest
11964 c
11965 do 3 icm = 0 , numchan-1
11966 call addmidi(icm,0,0,0,4.*numb16,.true.,.false.)
11967 3 continue
11968 miditime = miditime+nint(240*pausemid)
11969 c
11970 c Restore meter
11971 c
11972 call midievent('m',mtrdenl*lenbar/64,mtrdenl)
11973 end if
11974 go to 1
11975 else if (durq .eq. 'i') then
11976 c
11977 c Instrument numbers or letters. Expect noinst of them.
11978 c
11979 do 2 ivx = 1 , noinstarg
11980 call getchar(lineq,iccount,durq)
11981 if (ichar(durq) .gt. 96) then
11982 c
11983 c It's a lowercase letter. Get another, find corr. instrument #.
11984 c
11985 instq(1:1) = durq
11986 call getchar(lineq,iccount,durq)
11987 instq = instq(1:1)//durq
11988 iname = index('XXpiXrhXhaXmaXorXguXabXvlXvaXvcXcbXtrXtbX'//
11989 * 'tuXfrXsoXalXteXbsXobXbaXclXflXreXctXvo',instq)/3
11990 if (iname .eq. 0) then
11991 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
11992 * 'Unrecognized 2-letter midi instrument name!')
11993 call stop1()
11994 end if
11995 midinst(ivx) = midinum(iname)-1
11996 else
11997 c
11998 c Expect a number, followed by ":" if that is followed by another number.
11999 c I.e., if after call to readnum, durq is not ":", it must be either blank
12000 c or next instrument letter.
12001 c
12002 if (index('123456789',durq) .eq. 0) then
12003 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12004 * 'Expected a midi instrument number here!')
12005 call stop1()
12006 end if
12007 call readnum(lineq,iccount,durq,fnum)
12008 midinst(ivx) = nint(fnum)-1
12009 if (midinst(ivx).lt.0 .or. midinst(ivx).gt.255) then
12010 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
12011 * 'Midi instrument number must be in range 1-128!')
12012 call stop1()
12013 end if
12014 if (durq .ne. ':') iccount = iccount-1
12015 end if
12016 2 continue
12017 go to 1
12018 else if (durq .eq. 'v') then
12019 c
12020 c Get volumes for each instrument. Expect noinst of them.
12021 c Follow same pattern as for insttrument numbers above.
12022 c
12023 do 7 ivx = 1 , noinstarg
12024 call getchar(lineq,iccount,durq)
12025 if (index('123456789',durq) .eq. 0) then
12026 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12027 * 'Expected a midi velocity number here!')
12028 call stop1()
12029 end if
12030 call readnum(lineq,iccount,durq,fnum)
12031 midivel(ivx) = nint(fnum)-1
12032 if (midivel(ivx).lt.0 .or. midivel(ivx).gt.127) then
12033 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
12034 * 'Midi velocity must be in range 1-128!')
12035 call stop1()
12036 end if
12037 if (durq .ne. ':') iccount = iccount-1
12038 7 continue
12039 if (.not. first) then
12040 call inst2chan(midvelc,midivel,midchan,nv,iinsiv,twoline)
12041 end if
12042 go to 1
12043 else if (durq .eq. 'b') then
12044 c
12045 c Get balance for each instrument. Expect noinst of them.
12046 c Follow same pattern as for instrument numbers above.
12047 c
12048 do 8 ivx = 1 , noinstarg
12049 call getchar(lineq,iccount,durq)
12050 if (index('123456789',durq) .eq. 0) then
12051 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12052 * 'Expected a balance number here!')
12053 call stop1()
12054 end if
12055 call readnum(lineq,iccount,durq,fnum)
12056 midibal(ivx) = nint(fnum)-1
12057 if (midibal(ivx).lt.0 .or. midibal(ivx).gt.127) then
12058 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
12059 * 'Midi balance must be in range 1-128!')
12060 call stop1()
12061 end if
12062 if (durq .ne. ':') iccount = iccount-1
12063 8 continue
12064 if (.not. first) then
12065 call inst2chan(midbc,midibal,midchan,nv,iinsiv,twoline)
12066 end if
12067 go to 1
12068 else if (durq .eq. 'T') then
12069 c
12070 c Get transposition for each instrument. Expect noinst of them.
12071 c Follow similar pattern as above, but separator is +|-.
12072 c
12073 do 9 ivx = 1 , noinstarg
12074 call getchar(lineq,iccount,durq)
12075 ipm = index('-+',durq)
12076 if (ipm .eq. 0) then
12077 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12078 * 'Expected "+" or "-" for midi transposition here!')
12079 call stop1()
12080 end if
12081 ipm = 2*ipm-3
12082 call getchar(lineq,iccount,durq)
12083 if (index('0123456789',durq) .eq. 0) then
12084 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12085 * 'Expected a number here!')
12086 call stop1()
12087 end if
12088 call readnum(lineq,iccount,durq,fnum)
12089 miditran(ivx) = ipm*nint(fnum)
12090 iccount = iccount-1
12091 9 continue
12092 if (.not. first) then
12093 call inst2chan(midtc,miditran,midchan,nv,iinsiv,twoline)
12094 end if
12095 go to 1
12096 else if (durq .eq. 'g') then
12097 call getchar(lineq,iccount,durq)
12098 if (index('0123456789',durq) .eq. 0) then
12099 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12100 * 'Expected an integer here for the midi gap!')
12101 call stop1()
12102 end if
12103 call readnum(lineq,iccount,durq,fnum)
12104 mgap = nint(fnum)
12105 iccount = iccount-1
12106 go to 1
12107 else if (durq .eq. 'M') then
12108 c
12109 c MidiMacros
12110 c
12111 call getchar(lineq,iccount,durq)
12112 if (durq .eq. 'R') then
12113 c
12114 c Start recording
12115 c
12116 if (mmacrec) then
12117 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12118 * 'You tried to record a MidiMacro while already recording!')
12119 call stop1()
12120 end if
12121 mmacrec = .true.
12122 call getchar(lineq,iccount,durq)
12123 if (index('123456789',durq) .eq. 0) then
12124 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12125 * 'Expected MidiMacro ID number here!')
12126 call stop1()
12127 end if
12128 call readnum(lineq,iccount,durq,fnum)
12129 iccount = iccount-1
12130 if (.not.first) then
12131 immac = nint(fnum)
12132 if (immac .gt. 20) then
12133 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12134 * 'MidiMacro ID cannot exceed 20!')
12135 call stop1()
12136 end if
12137 c
12138 c Save the start time
12139 c
12140 mmactime(immac) = miditime
12141 do 4 icm = 0 , numchan
12142 if (icm .lt. numchan) then
12143 if (restpend(icm)) then
12144 c
12145 c Adjust if there's a rest at end of prior section. Insert dummy turnoff.
12146 c (This causes two turn-offs in a row, which testmidi sees as an error).
12147 c
12148 c Before: section1 ------rest------- section2(to be recorded)
12149 c After: section1 rest1 now rest2 section2(recorded)
12150 c
12151 call addmidi(icm,30,0,0,trest(icm),.false.,.true.)
12152 trest(icm) = 0
12153 restpend(icm) = .false.
12154 end if
12155 else
12156 if (miditime .gt. lasttime) then
12157 c
12158 c Insert a dummy turnoff in conductor track
12159 c
12160 call addmidi(icm,30,0,0,(miditime-lasttime)/15.,
12161 * .false.,.true.)
12162 lasttime = miditime
12163 end if
12164 end if
12165 mmacstrt(icm,immac) = imidi(icm)+1
12166 4 continue
12167 end if
12168 go to 1
12169 else if (index('123456789P',durq) .eq. 0) then
12170 c
12171 c End recording; close the open macro. Get immac from common.
12172 c
12173 if (.not.mmacrec) then
12174 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
12175 * 'You tried to end a MidiMacro before starting one!')
12176 call stop1()
12177 end if
12178 mmacrec = .false.
12179 iccount = iccount-1
12180 if (.not.first) then
12181 c
12182 c Save the macro duration
12183 c
12184 mmactime(immac) = miditime-mmactime(immac)
12185 do 5 icm = 0 , numchan
12186 if (icm .lt. numchan) then
12187 if (restpend(icm)) then
12188 call addmidi(icm,30,0,0,trest(icm),.false.,.true.)
12189 trest(icm) = 0
12190 restpend(icm) = .false.
12191 end if
12192 else
12193 if (miditime .gt. lasttime) then
12194 c
12195 c Insert a dummy turnoff in conductor track if needed.
12196 c
12197 call addmidi(icm,30,0,0,(miditime-lasttime)/15.,
12198 * .false.,.true.)
12199 lasttime = miditime
12200 end if
12201 end if
12202 mmacend(icm,immac) = imidi(icm)
12203 5 continue
12204 end if
12205 if (durq .ne. ' ')go to 1
12206 else if (durq .eq. 'P') then
12207 c
12208 c Play Back a Macro
12209 c
12210 call getchar(lineq,iccount,durq)
12211 if (index('123456789',durq) .eq. 0) then
12212 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12213 * 'Expected MidiMacro ID number here!')
12214 call stop1()
12215 end if
12216 if (mmacrec) then
12217 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12218 * 'You tried to play a MidiMacro before ending recording!')
12219 call stop1()
12220 end if
12221 call readnum(lineq,iccount,durq,fnum)
12222 iccount = iccount-1
12223 if (.not.first) then
12224 immac = nint(fnum)
12225 if (mmactime(immac) .eq. 0) then
12226 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12227 * 'Cannot play a MIDI macro before recording it!')
12228 call stop1()
12229 end if
12230 do 6 icm = 0 , numchan
12231 if (icm .lt. numchan) then
12232 if (restpend(icm)) then
12233 call addmidi(icm,30,0,0,trest(icm),.false.,.true.)
12234 trest(icm) = 0.
12235 restpend(icm) = .false.
12236 end if
12237 else
12238 if (miditime .gt. lasttime) then
12239 c
12240 c Insert a dummy turnoff in conductor track
12241 c
12242 call addmidi(icm,30,0,0,(miditime-lasttime)/15.,
12243 * .false.,.true.)
12244 end if
12245 end if
12246 msecend(icm,nmidsec) = imidi(icm)
12247 msecstrt(icm,nmidsec+1) = mmacstrt(icm,immac)
12248 msecend(icm,nmidsec+1) = mmacend(icm,immac)
12249 msecstrt(icm,nmidsec+2) = imidi(icm)+1
12250 6 continue
12251 nmidsec = nmidsec+2
12252 c
12253 c Update running time
12254 c
12255 miditime = miditime+mmactime(immac)
12256 lasttime = miditime
12257 end if
12258 go to 1
12259 else
12260 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12261 * 'Illegal character in MidiMacro sub-command!')
12262 call stop1()
12263 end if
12264 else if (durq .eq. 'd') then
12265 debugmidi = .true.
12266 go to 1
12267 else if (durq .ne. ' ') then
12268 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
12269 * 'Illegal character in MIDI input data!')
12270 write(*,'(a)')
12271 * 'May be too many args to i,v,b, or T. As of Ver. 2.7, '//
12272 * 'should be noinst, not nv'
12273 write(15,'(a)')
12274 * 'May be too many args to i,v,b, or T. As of Ver. 2.7, '//
12275 * 'should be noinst, not nv'
12276 call stop1()
12277 end if
12278 if (.not.gottempo .and. .not.first) then
12279 c
12280 c If no tempo is set on first call on the pmxb pass, then set it
12281 c
12282 call midievent('t',96,0)
12283 gottempo = .true.
12284 end if
12285 return
12286 end
12287 subroutine getnote(loop)
12288 parameter (nm=24,mv=24576)
12289 common /comlast/ islast,usevshrink
12290 logical islast,usevshrink,ignorenats,newmbrhgt
12291 common /comignorenats/ mbrhgt,newmbrhgt,ignorenats
12292 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
12293 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
12294 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
12295 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
12296 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
12297 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
12298 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
12299 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
12300 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
12301 character*10 figq
12302 character*1 ulq,sepsymq,sq,rptfq1,rptfq2,clefq,chax
12303 logical beamon,firstgulp,figbass,figchk,isfig
12304 character*60 cheadq
12305 character*120 instrq,titleq,compoq
12306 integer*2 mmidi
12307 logical restpend,relacc,notmain,twoline,ismidi,crdacc,autofbon
12308 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
12309 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
12310 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
12311 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
12312 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
12313 * debugmidi
12314 logical debugmidi
12315 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
12316 common /comtitl/ instrq,titleq,compoq,headlog,inskip,ncskip,
12317 * inhead
12318 common /cominbot/ inbothd
12319 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
12320 * fullsize(nm),ivxfig2,ivvfig(2,74)
12321 common /comnotes/ nnodur,lastlev,ndlev(nm,2),shifton,setis,notcrd,
12322 * npreslur,was2(nm),ninow,nobar1,nsystp(75),ipage,
12323 * OptLineBreakTies,HeaderSpecial
12324 common /comget/ lastchar,rptnd1,sluron(nm,2),fbon,ornrpt,stickyS,
12325 * movbrk,movnmp,movdnp,movgap,parmov,fintstf,gintstf,
12326 * rptprev,equalize,rptfq1,rptfq2
12327 common /comhead/ ihdht,lower,headrq,lowerq,ihdvrt
12328 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
12329 * tautofb,autofbon,t1autofb
12330 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
12331 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
12332 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
12333 * graspace(37),
12334 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
12335 * naccg(74),voltxtq(6),litq(83)
12336 logical upg,slurg,slashg,fbon,ornrpt,shifton,setis,notcrd,isbjmp,
12337 * was2,nobar1,quoted,isbj2,stickyS,
12338 * OptLineBreakTies,HeaderSpecial
12339 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
12340 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
12341 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
12342 character*128 litq
12343 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
12344 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
12345 common /combc/ bcspec
12346 common /comas3/ ask(2500),iask,topmods
12347 c
12348 c nvmx is either 1 or 2. ivmx(iv,1)=iv, ; ivmx(iv,2)>nv if defined
12349 c ivx is current ivmx, and is the index for all notes, acc's etc.
12350 c
12351 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
12352 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
12353 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
12354 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
12355 * rtshfac
12356 common /comtrans/ cheadq
12357 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
12358 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
12359 * lnam(nm),inameq(nm)
12360 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
12361 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
12362 common /comask/ bar1syst,fixednew,scaldold,
12363 * wheadpt,fbar,poenom
12364 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
12365 * ,WrotePsslurDefaults,SlurCurve
12366 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
12367 * xinsnow,lowdot
12368 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
12369 common /c1ommac/ ip1mac(20),il1mac(20),ip2mac(20),il2mac(20),
12370 * ic1mac(20),ilmac,iplmac
12371 common /comdyn/ ndyn,idyndat(99),levdsav(nm),ivowg(12),hoh1(12),
12372 * hoh2(12),hoh2h1(2),ntxtdyn,ivxiptxt(41),txtdynq(41),
12373 * idynda2(99),levhssav(nm),listcresc,listdecresc
12374 common /comclefq/ clefq(nm)
12375 common /comtol/ tol
12376 common /comArpShift/NumArpShift,IvArpShift(20),IpArpShift(20),
12377 * ArpShift(20)
12378 character*128 txtdynq
12379 logical mrecord,mplay,endmac,lowdot,rename,bar1syst,upslur,
12380 * fontslur,WrotePsslurDefaults
12381 character*128 lineq,lnholdq,lineqt
12382 character*80 headrq, lowerq
12383 character*79 inameq
12384 character*59 hdlndq
12385 character*20 voltxtq
12386 character*1 charq,dotq,durq,ulfbq,dumq
12387 logical loop,lastchar,lower,rptnd1,rptprev,bcspec,moved,
12388 * topmods,headlog,btest,sluron,cdot,equalize
12389 character*24 tempq
12390 logical novshrinktop,cstuplet
12391 common /comnvst/ novshrinktop,cstuplet
12392 logical kbdrests
12393 common /comkbdrests/ levbotr(8),levtopr(8),kbdrests
12394 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
12395 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
12396 logical EarlyTransOn,LaterInstTrans
12397 common /comkeys/ nkeys,ibrkch(18),newkey(18),iskchb,idumm1,isig1,
12398 * mbrestsav,kchmid(18),logdumm1,logdumm2,barend,noinst,logdumm3
12399 logical barend,iskchb,kchmid,logdumm1,logdumm2,logdumm3
12400 common /combibarcnt/ ibarcnt
12401 common /commidisig/ midisig
12402 common /comlyr/ inputmlyr
12403 logical inputmlyr
12404 common /combottop/ botamt,topamt,bottopgap
12405 logical bottopgap
12406 logical inxtup
12407 common /comshort/ shortfrac,codafrac,ishort,mbrsum,nmbr,nocodabn,
12408 * poefa
12409 real*4 poefa(125)
12410 logical nocodabn
12411 c
12412 common /comslope/ bigslope,novbm
12413 logical bigslope,novbm
12414 c
12415 cdot = .false.
12416 inxtup = .false.
12417 1 call getchar(lineq,iccount,charq)
12418 if (lastchar) return
12419 if (charq .eq. ' ') go to 1
12420 if (charq .eq. '%') then
12421 c
12422 c Check for a bar number format:
12423 c
12424 if (iccount.eq.1 .and. lineq(2:2).eq.' ' .and.
12425 * index('bB1234567890',lineq(3:3)).gt.0) then
12426 if (islast) write(11,'(a)')lineq(1:lenstr(lineq,128))
12427 end if
12428 iccount = 128
12429 go to 1
12430 end if
12431 c
12432 c Closing repeat iff charq='/' and the prev. char was 'R' with 'd' or 'r'
12433 c
12434 if (rptprev) then
12435 rptnd1 = charq .eq. chax(47)
12436 rptprev = .false.
12437 end if
12438 c
12439 c Repeat at end of a piece
12440 c
12441 if ((ichar(charq).ge.97.and.ichar(charq).le.103) .or.
12442 * charq.eq.'r') then
12443 if (cdot) go to 28
12444 c
12445 c This is a note/rest.
12446 c
12447 idotform = 0
12448 numnum = 0
12449 c
12450 c If start of line of music, set pitch from previous
12451 c
12452 if (ivx .le. nv) then
12453 kv = 1
12454 else
12455 kv = 2
12456 end if
12457 if (nnl(ivx).eq.0) lastlev = ndlev(iv,kv)
12458 c
12459 c notcrd is used to tell if orn. goes on main note or chord note
12460 c
12461 c notcrd = .true. !Move dow. Was not observed if dotted shortcut.
12462 c
12463 c Increase note count, then loop 'til blank. Label 28 is for dotted shortcuts.
12464 c
12465 28 continue
12466 c
12467 c Moved this from just above, 2 Feb 02
12468 c
12469 notcrd = .true.
12470 nnl(ivx) = nnl(ivx)+1
12471 if (ornrpt) then
12472 c
12473 c Replicate ornament bits, also bit 23 for beam handling if chord.
12474 c
12475 iornq(ivx,nnl(ivx)) = ior(iornq(ivx,nnl(ivx)),iornq(ivx,0))
12476 if (iand(iornq(ivx,nnl(ivx)),32896) .gt. 0) then
12477 c
12478 c This is a trill (bit 7 or 15) so must dup the parameters
12479 c
12480 ntrill = ntrill + 1
12481 ivtrill(ntrill) = ivx
12482 iptrill(ntrill) = nnl(ivx)
12483 xnsktr(ntrill) = xnsktr(ntrill-1)
12484 end if
12485 end if
12486 if (stickyS) then
12487 c
12488 c Grab stemlength shortening parameters from prior note
12489 c
12490 mult(ivx,nnl(ivx)) = ibset(mult(ivx,nnl(ivx)),27)
12491 call setbits (mult(ivx,nnl(ivx)),6,10,
12492 * igetbits(mult(ivx,nnl(ivx)-1),6,10))
12493 end if
12494 if (autofbon .and. tautofb.gt.tol .and. .not.fbon) then
12495 c
12496 c Doing auto forced beams, and period has been set, so check if this note
12497 c starts a period.
12498 c
12499 if (mod(itsofar(ivx)-t1autofb,tautofb) .lt. tol) then
12500 c
12501 c Start a forced beam here
12502 c
12503 nfb(ivx) = nfb(ivx)+1
12504 fbon = .true.
12505 ulfbq(ivx,nfb(ivx)) = 'x'
12506 t1fb(ivx,nfb(ivx)) = itsofar(ivx)
12507 end if
12508 end if
12509 if (fbon) ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),30)
12510 dotq = 'x'
12511 if (charq.eq.'r')
12512 * irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),0)
12513 if (btest(irest(ivx,nnl(ivx)),0)) then
12514 c
12515 c Rest stuff. First check if previous note was full-bar-pause
12516 c
12517 if (lineq(iccount+1:iccount+1) .eq.' '
12518 * .and. nnl(ivx).gt.1) then
12519 if (btest(islur(ivx,nnl(ivx)-1),19))
12520 * islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),19)
12521 end if
12522 c
12523 c Set default rest level at 0 unless 2 voices/staff in which case it's -4 or 2
12524 c for voice a or b. Set a-types at 0 as encountered and adjust later
12525 c after '//'. (Override heights will be set to 100+offset)
12526 c
12527 if (ivx .le. nv) then
12528 nolev(ivx,nnl(ivx)) = 0
12529 else
12530 nolev(ivx,nnl(ivx)) = 2
12531 end if
12532 end if
12533 2 call getchar(lineq,iccount,durq)
12534 ic = ichar(durq)
12535 if (ic.le.57 .and. ic.ge.48) then
12536 c
12537 c Digit
12538 c
12539 if (numnum .eq. 0) then
12540 nnodur = ic-48
12541 numnum = 1
12542 go to 2
12543 else if (numnum .eq. 1) then
12544 ioct = ic-48
12545 numnum = 2
12546 go to 2
12547 else
12548 print*,'>2 digits in note sym., ivx,nn:',ivx,nnl(ivx)
12549 call stop1()
12550 end if
12551 else if (durq .eq. 'd') then
12552 dotq = durq
12553 if (lineq(iccount+1:iccount+1) .eq. 'd') then
12554 c
12555 c Double dot.
12556 c
12557 iccount = iccount+1
12558 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),3)
12559 end if
12560 if (index('+-',lineq(iccount+1:iccount+1)) .gt. 0) then
12561 c
12562 c move a dot, unless next char is not part of a number
12563 c
12564 if (index('0123456789.',lineq(iccount+2:iccount+2)) .eq. 0)
12565 * go to 2
12566 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),19)
12567 call getchar(lineq,iccount,durq)
12568 ndotmv(ivx) = ndotmv(ivx)+1
12569 iccount=iccount+1
12570 call readnum(lineq,iccount,dumq,updot(ivx,ndotmv(ivx)))
12571 if (durq .eq. '-')
12572 * updot(ivx,ndotmv(ivx)) = -updot(ivx,ndotmv(ivx))
12573 if (index('+-',dumq) .gt. 0) then
12574 c
12575 c Vertical shift also
12576 c
12577 iccount=iccount+1
12578 call readnum(lineq,iccount,durq,rtdot(ivx,ndotmv(ivx)))
12579 if (dumq .eq. '-')
12580 * rtdot(ivx,ndotmv(ivx)) = -rtdot(ivx,ndotmv(ivx))
12581 else
12582 rtdot(ivx,ndotmv(ivx)) = 0.
12583 end if
12584 iccount = iccount-1
12585 end if
12586 go to 2
12587 else if (durq .eq. 'p') then
12588 c
12589 c Full-bar rest as pause
12590 c
12591 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),19)
12592 go to 2
12593 else if (durq .eq. 'b') then
12594 c
12595 c Blank rest
12596 c
12597 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),29)
12598 go to 2
12599 else if (index('fsn',durq) .gt. 0) then
12600 c
12601 c Accidental
12602 c
12603 c if (nacc(ivx,nnl(ivx)) .eq. 0) then
12604 if (igetbits(nacc(ivx,nnl(ivx)),2,0) .eq. 0) then
12605 c
12606 c No accidental has been set yet
12607 c
12608 c nacc(ivx,nnl(ivx)) = index('fsn',durq)
12609 nacc(ivx,nnl(ivx)) =
12610 * ior(nacc(ivx,nnl(ivx)),index('fsn',durq))
12611 else
12612 c
12613 c Repeated accid, so must be double
12614 c
12615 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),2)
12616 end if
12617 go to 2
12618 else if (durq .eq. 'i') then
12619 c
12620 c Set flag for MIDI-only accidental.
12621 c
12622 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),17)
12623 go to 2
12624 else if (durq .eq. 'c') then
12625 c
12626 c Set flags for cautionary accidental
12627 c
12628 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),31)
12629 iornq(ivx,nnl(ivx)) = ibset(iornq(ivx,nnl(ivx)),31)
12630 go to 2
12631 else if (index('+-<>',durq) .gt. 0) then
12632 ipm = index('- +',durq)-2
12633 if (.not.btest(irest(ivx,nnl(ivx)),0)) then
12634 c
12635 c A note, not a rest.
12636 c
12637 call chkpm4ac(lineq,iccount,nacc(ivx,nnl(ivx)),moved)
12638 if (moved) go to 2
12639 c
12640 c Octave jump with a note
12641 c
12642 if (numnum .lt. 2) then
12643 lastlev = lastlev+ipm*7
12644 else
12645 ioct = ioct+ipm*1
12646 end if
12647 go to 2
12648 else
12649 c
12650 c Override default height of a rest
12651 c
12652 iccount = iccount+1
12653 call readnum(lineq,iccount,durq,fnum)
12654 if (lineq(iccount-1:iccount-1) .eq. '.') then
12655 c
12656 c Kluge in case there is a shortcut ".". It will have been sucked up by
12657 c readnum. (Same doesn't hold for ",")
12658 c
12659 iccount = iccount-1
12660 c go to 2
12661 end if
12662 nolev(ivx,nnl(ivx)) = 100+ipm*nint(fnum)
12663 c
12664 c There may be more characters for this rest
12665 c
12666 iccount = iccount-1
12667 go to 2
12668 end if
12669 else if (durq .eq. 'x') then
12670 c
12671 c Xtuplet. Count number of doubled notes (for unequal xtups)
12672 c
12673 if (btest(nacc(ivx,nnl(ivx)),18)) then
12674 ndoub = 1
12675 else
12676 ndoub = 0
12677 end if
12678 c
12679 c Initialize counter for # of non-rests, so can later unbeam if = 1.
12680 c
12681 inxtup = .true.
12682 note1xtup = nnl(ivx)
12683 nnb = 0
12684 if (.not.btest(irest(ivx,nnl(ivx)),0)) nnb = 1
12685 c
12686 c Will set all durations to 0 except last one. Set flag on this note.
12687 c
12688 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),28)
12689 c
12690 c Next input will be digit unless its a "T"
12691 c
12692 iccount = iccount+1
12693 if (lineq(iccount:iccount) .eq. 'T') then
12694 c
12695 c Set up tremolo
12696 c
12697 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),2)
12698 ntup = 2
12699 c
12700 c Set default beaming, based on Wikipedia article
12701 c May be a problem here is nnodur is inherited
12702 c
12703 if (nnodur .eq. 4) then
12704 nsolid = 0
12705 nindent = 3
12706 else if (nnodur .eq. 2) then
12707 nsolid = 3
12708 nindent = 0
12709 else if (nnodur .eq. 8) then
12710 nsolid = 1
12711 nindent = 2
12712 end if
12713 call getchar(lineq,iccount,durq)
12714 if (index('0123456789',durq) .gt. 0) then
12715 nsolid = index('0123456789',durq)-1
12716 if (nsolid.eq.0 .and. nnodur.eq.2) then
12717 print*,''
12718 print*,'Unbeamed half-note 2-note tremolo forbidden.'
12719 call stop1()
12720 end if
12721 call getchar(lineq,iccount,durq)
12722 if (index('0123456789',durq) .gt. 0) then
12723 nindent = index('0123456789',durq)-1
12724 end if
12725 end if
12726 call setbits(irest(ivx,nnl(ivx)),2,3,nsolid)
12727 call setbits(irest(ivx,nnl(ivx)),2,5,nindent)
12728 if (nsolid .eq. 0) then
12729 islur(ivx,nnl(ivx)) =
12730 * ibset(islur(ivx,nnl(ivx)),18)
12731 end if
12732 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),31)
12733 islur(ivx,nnl(ivx)+1) = ibset(islur(ivx,nnl(ivx)+1),21)
12734 call setbits(islur(ivx,nnl(ivx)+1),3,22,nsolid)
12735 c
12736 c Set some force-beam parameters for the tremolo
12737 c
12738 c Need to check if there's already a forced beam explicitly set here.
12739 c If there was, shouldn't do any harm resetting parameters.
12740 c
12741 if (nfb(ivx).eq.0 .or. t1fb(ivx,nfb(ivx)).ne.itsofar(ivx))
12742 * nfb(ivx) = nfb(ivx)+1
12743 fbon = .true.
12744 ulfbq(ivx,nfb(ivx)) = 'x'
12745 t1fb(ivx,nfb(ivx)) = itsofar(ivx)
12746 t2fb(ivx,nfb(ivx)) = itsofar(ivx) + ifnodur(nnodur,dotq)
12747 nadj = 0
12748 c
12749 c Set open beamed notehead flag for half-note tremolo
12750 c Just gave 2 quarters with or without flag set. Need to fix
12751 c
12752 else
12753 call readnum(lineq,iccount,durq,fnum)
12754 ntup = nint(fnum)
12755 end if
12756 if (index('DF',durq) .gt. 0) then
12757 c
12758 c
12759 c Double xtup note to make an un= xtup. Here xtup number already set but may also
12760 c have this command before.
12761 c
12762 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
12763 if (durq .eq. 'F') nacc(ivx,nnl(ivx)) =
12764 * ibset(nacc(ivx,nnl(ivx)),19)
12765 ndoub = 1
12766 call getchar(lineq,iccount,durq)
12767 else if (durq .eq. 'd') then
12768 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),27)
12769 call getchar(lineq,iccount,durq)
12770 end if
12771 c
12772 c Only other possibilities here are ' ' or 'n'
12773 c
12774 if (durq .eq. 'n') then
12775 c
12776 c Alter xtup number
12777 c
12778 if (lineq(iccount+1:iccount+1) .eq. ' ') then
12779 c
12780 c If the only modifier is 'n', cancel the number
12781 c
12782 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),31)
12783 else
12784 numshft = 0
12785 30 call getchar(lineq,iccount,durq)
12786 if (durq .eq. 'f') then
12787 c
12788 c Flip up-down-ness
12789 c
12790 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),14)
12791 go to 30
12792 else if (index('+-',durq) .gt. 0) then
12793 c
12794 c Vertical or horiz shift
12795 c
12796 numshft = numshft+1
12797 iofforn = 1
12798 if (durq .eq. '-') iofforn = -1
12799 iccount = iccount+1
12800 call readnum(lineq,iccount,durq,xofforn)
12801 iccount = iccount-1
12802 if (numshft .eq. 1) then
12803 c
12804 c Vertical shift
12805 c 160214 Allow (-64,64)
12806 iofforn = iofforn*nint(xofforn) + 64
12807 c
12808 c Turn on bit 1 of irest; set bits 16-22 of mult to iofforn
12809 c
12810 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),1)
12811 call setbits(mult(ivx,nnl(ivx)),8,16,iofforn)
12812 else
12813 c
12814 c Horizontal shift
12815 c
12816 iofforn = iofforn*nint(xofforn*10)+16
12817 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),7)
12818 call setbits(irest(ivx,nnl(ivx)),5,9,iofforn)
12819 end if
12820 go to 30
12821 else if (durq .eq. 's') then
12822 c
12823 c Slope adjustment for bracket
12824 c
12825 mult(ivx,nnl(ivx)) = ibset(mult(ivx,nnl(ivx)),4)
12826 call getchar(lineq,iccount,durq)
12827 iofforn = index('- +',durq)-2
12828 iccount = iccount+1
12829 call readnum(lineq,iccount,durq,xofforn)
12830 iccount = iccount-1
12831 iofforn = nint(iofforn*xofforn+16)
12832 call setbits(mult(ivx,nnl(ivx)),5,5,iofforn)
12833 else if (index('123456789',durq) .gt. 0) then
12834 c
12835 c Replacement printed number
12836 c
12837 call readnum(lineq,iccount,durq,xofforn)
12838 call setbits(nacc(ivx,nnl(ivx)),5,22,nint(xofforn))
12839 iccount = iccount-1
12840 go to 30
12841 end if
12842 end if
12843 end if
12844 c
12845 c Set note level of 1st note of xtup, provided not a rest
12846 c
12847 if (.not.btest(irest(ivx,nnl(ivx)),0)) then
12848 if (numnum .eq. 2) then
12849 lastlev = ifnolev(charq,ioct,iTransAmt(instno(iv)))
12850 nolev(ivx,nnl(ivx)) = lastlev
12851 else
12852 lastlev = lastlev-3
12853 * +mod(ifnolev(charq,10,iTransAmt(instno(iv)))-lastlev+3,7)
12854 nolev(ivx,nnl(ivx)) = lastlev
12855 end if
12856 end if
12857 do 40 npreslur = npreslur , 1 , -1
12858 c
12859 c Set note level for preslur on starting note of xtuplet
12860 c
12861 call setbits(isdat2(nsdat-npreslur+1),7,19,lastlev)
12862 40 continue
12863 numnum = 0
12864 nodur(ivx,nnl(ivx)) = 0
12865 do 6 itup = 2 , ntup
12866 if (ornrpt) then
12867 iornq(ivx,nnl(ivx)) = ior(iornq(ivx,nnl(ivx)),
12868 * iand(iornq(ivx,nnl(ivx)-1),10026991))
12869 if (iand(iornq(ivx,nnl(ivx)),32896) .gt. 0) then
12870 c
12871 c This is a trill (bit 7 or 15) so must dup the parameters
12872 c
12873 ntrill = ntrill + 1
12874 ivtrill(ntrill) = ivx
12875 iptrill(ntrill) = nnl(ivx)
12876 xnsktr(ntrill) = xnsktr(ntrill-1)
12877 end if
12878 end if
12879 nnl(ivx) = nnl(ivx)+1
12880 if (fbon) ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),30)
12881 7 call getchar(lineq,iccount,charq)
12882 if (charq .eq. ' ') then
12883 go to 7
12884 else if (charq .eq. '%') then
12885 iccount = 128
12886 go to 7
12887 else if (charq .eq. 'o') then
12888 c
12889 c Ornament in xtuplet. "o" symbol must come AFTER the affected note
12890 c
12891 if (notcrd) then
12892 nole = nolev(ivx,nnl(ivx)-1)
12893 else
12894 nole = iand(127,ishft(icrdat(ncrd),-12))
12895 end if
12896 call getorn(lineq,iccount,iornq(ivx,nnl(ivx)-1),
12897 * iornq(ivx,0),ornrpt,noffseg,
12898 * nnl(ivx)-1,ivx,.false.,notcrd,nole)
12899 go to 7
12900 else if (index('st(){}',charq) .gt. 0) then
12901 nnlivx = nnl(ivx)-1
12902 if (charq.eq.'(' .or. charq.eq.'{') then
12903 c
12904 c Detected preslur in xtuplet loop, non-chord note
12905 c
12906 nnlivx = nnlivx+1
12907 npreslur = npreslur+1
12908 end if
12909 islur(ivx,nnlivx) = ibset(islur(ivx,nnlivx),0)
12910 if (charq.eq.'t') islur(ivx,nnlivx) =
12911 * ibset(islur(ivx,nnlivx),1)
12912 if (ivx .le. nv) then
12913 kv = 1
12914 else
12915 kv = 2
12916 end if
12917 if (fontslur) then
12918 call sslur(lineq,iccount,iv,kv,nnlivx,isdat1,isdat2,
12919 * isdat3,nsdat,notcrd,nolev(ivx,nnlivx),charq)
12920 else
12921 call spsslur(lineq,iccount,iv,kv,nnlivx,isdat1,isdat2,
12922 * isdat3,isdat4,nsdat,notcrd,nolev(ivx,nnlivx),charq)
12923 end if
12924 go to 7
12925 else if (charq .eq. 'G') then
12926 c
12927 c Kluge to get grace in xtup at right location
12928 c
12929 nnl(ivx) = nnl(ivx)-1
12930 call getgrace(ivx,nnl,lineq,iccount,islur,iornq,ipl,ndlev,
12931 * lastlev,iv,nv)
12932 nnl(ivx) = nnl(ivx)+1
12933 go to 7
12934 else if (charq .eq. sq) then
12935 call littex(islur,nnl(ivx),ivx,topmods,lineq,iccount)
12936 go to 7
12937 else if (charq .eq. chax(34)) then
12938 c
12939 c pmxlyr string in xtup. Expand "..." to \pmxlyr{...}\
12940 c
12941 if (.not. inputmlyr) then
12942 ictemp = 0
12943 lineqt = sq//sq//sq//'input musixlyr '//sq
12944 call littex(islur,nnl(ivx)+1,ivx,topmods,lineqt,ictemp)
12945 inputmlyr = .true.
12946 end if
12947 call dopmxlyr(lineq,iccount)
12948 charq = sq
12949 call littex(islur,nnl(ivx),ivx,topmods,lineq,iccount)
12950 go to 7
12951 else if (index('0123456789#-nx_',charq) .gt. 0) then
12952 c
12953 c Figure. Must come AFTER the first note of xtup
12954 c
12955 ivf = 1
12956 if (ivx .gt. 1) then
12957 if (ivxfig2 .eq. 0) then
12958 ivxfig2 = ivx
12959 else if (ivx .ne. ivxfig2) then
12960 print*
12961 print*,'Figures not allowed in >1 voice above first'
12962 stop
12963 end if
12964 ivf = 2
12965 end if
12966 nfig1 = nfigs(ivf)+1
12967 call getfig(itoff(ivf,nfig1),charq,lineq,iccount,
12968 * isfig(ivf,nnl(ivx)-1),itfig(ivf,nfig1),itsofar(ivx),
12969 * 0,figq(ivf,nfig1),ivupfig(ivf,nfig1),ivvfig(ivf,nfig1),
12970 * nfigs(ivf))
12971 go to 7
12972 else if (charq .eq. 'X') then
12973 call getx(lineq,iccount,irest(ivx,max(1,nnl(ivx)-1)),
12974 * shifton,wheadpt,iornq(ivx,nnl(ivx)),ivx,
12975 * irest(ivx,nnl(ivx)),itsofar(ivx),ntup,itup,nnodur,
12976 * dotq,ndoub)
12977 go to 7
12978 else if (charq .eq. 'z') then
12979 c
12980 c Chord note in xtup. Goes with *prior* note.
12981 c
12982 notcrd = .false.
12983 ncrd = ncrd+1
12984 ipl(ivx,nnl(ivx)-1) = ibset(ipl(ivx,nnl(ivx)-1),10)
12985 numnum = 0
12986 icrdat(ncrd) = nnl(ivx)-1
12987 call setbits(icrdat(ncrd),4,8,mod(ivx,16))
12988 if (ivx .ge. 16) icrdat(ncrd) = ibset(icrdat(ncrd),28)
12989 icrdorn(ncrd) = 0
12990 c
12991 c Get note name
12992 c
12993 call getchar(lineq,iccount,charq)
12994 c
12995 c Get optional inputs
12996 c
12997 34 call getchar(lineq,iccount,durq)
12998 c
12999 c When chord note is done, will get ' ', making ndx=0, so go past this block
13000 c
13001 ndx = index('fsn+-<>12345678reicd',durq)
13002 if (ndx .gt. 0) then
13003 if (ndx .le. 3) then
13004 if (.not.btest(icrdat(ncrd),19)) then
13005 icrdat(ncrd) = ibset(icrdat(ncrd),19)
13006 icrdat(ncrd) = ior(icrdat(ncrd),ishft(ndx,20))
13007 else
13008 icrdat(ncrd) = ibset(icrdat(ncrd),22)
13009 end if
13010 else if (durq .eq. 'd') then
13011 c
13012 c Get dot on chord note in xtup. Assume +n+n
13013 c
13014 icrdat(ncrd) = ibset(icrdat(ncrd),26)
13015 call getchar(lineq,iccount,durq)
13016 iccount=iccount+1
13017 call readnum(lineq,iccount,dumq,fnum)
13018 if (durq .eq. '+') then
13019 icrdot(ncrd) = ior(icrdot(ncrd),nint(fnum*10)+64)
13020 else
13021 icrdot(ncrd) = ior(icrdot(ncrd),-nint(fnum*10)+64)
13022 end if
13023 if (index('+-',dumq) .gt. 0) then
13024 c
13025 c Vertical shift specified also
13026 c
13027 iccount=iccount+1
13028 call readnum(lineq,iccount,durq,fnum)
13029 if (dumq .eq. '+') then
13030 ifnum = nint(fnum*10)+64
13031 else
13032 ifnum = -nint(fnum*10)+64
13033 end if
13034 else
13035 ifnum = 64
13036 end if
13037 icrdot(ncrd) = ior(icrdot(ncrd),ishft(ifnum,7))
13038 iccount = iccount-1
13039 c iccount = iccount+4
13040 c
13041 c
13042 c
13043 else if (ndx .eq. 19) then
13044 c
13045 c Set flags for cautionary accidental
13046 c
13047 icrdat(ncrd) = ibset(icrdat(ncrd),31)
13048 iornq(ivx,nnl(ivx)-1) =
13049 * ibset(iornq(ivx,nnl(ivx)-1),31)
13050 else if (ndx .le. 7) then
13051 c
13052 c +/-/</> Check whether octave or accidental shift
13053 c
13054 nactmp = 0
13055 call chkpm4ac(lineq,iccount,nactmp,moved)
13056 if (moved) then
13057 c
13058 c Transfer accidental shift values
13059 c
13060 call setbits(icrdot(ncrd),6,14,
13061 * igetbits(nactmp,6,4))
13062 call setbits(icrdot(ncrd),7,20,
13063 * igetbits(nactmp,7,10))
13064 else
13065 if (durq .eq. '+') then
13066 lastlev = lastlev+7
13067 else if (durq .eq. '-') then
13068 lastlev = lastlev-7
13069 end if
13070 end if
13071 else if (durq .eq. 'e') then
13072 icrdat(ncrd) = ibset(icrdat(ncrd),23)
13073 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),27)
13074 else if (durq .eq. 'r') then
13075 icrdat(ncrd) = ibset(icrdat(ncrd),24)
13076 irest(ivx,nnl(ivx)-1) =
13077 * ibset(irest(ivx,nnl(ivx)-1),20)
13078 else if (durq .eq. 'i') then
13079 c
13080 c Midi-only accidental
13081 c
13082 icrdat(ncrd) = ibset(icrdat(ncrd),27)
13083 else
13084 c
13085 c must be a number, save it in ioct
13086 c
13087 numnum = 1
13088 ioct = ndx-7
13089 end if
13090 go to 34
13091 end if
13092 if (numnum .eq. 1) then
13093 lastlev = ifnolev(charq,ioct,iTransAmt(instno(iv)))
13094 else
13095 lastlev = lastlev-3
13096 * +mod(ifnolev(charq,10,iTransAmt(instno(iv)))-lastlev+3,7)
13097 end if
13098 icrdat(ncrd) = ior(icrdat(ncrd),ishft(lastlev,12))
13099 do 41 npreslur = npreslur , 1 , -1
13100 c
13101 c Set note level for preslur on chord note in xtup
13102 c
13103 call setbits (isdat2(nsdat-npreslur+1),7,19,lastlev)
13104 c
13105 c Following lines copied from loop for non-xtup, chord note, preslur
13106 c Initially I assigned the slur(s) to next note, so fix.
13107 c
13108 islur(ivx,nnl(ivx)) = ibclr(islur(ivx,nnl(ivx)),0)
13109 islur(ivx,nnl(ivx)-1) = ibset(islur(ivx,nnl(ivx)-1),0)
13110 isdat2(nsdat-npreslur+1) =
13111 * ibset(isdat2(nsdat-npreslur+1),0)
13112 call setbits(isdat1(nsdat-npreslur+1),8,3,
13113 * igetbits(isdat1(nsdat-npreslur+1),8,3)-1)
13114 41 continue
13115 go to 7
13116 else if (charq .eq. '?') then
13117 c
13118 c Arpeggio
13119 c
13120 if (btest(ipl(ivx,nnl(ivx)-1),10)) then
13121 c
13122 c This is a chordal note. Set a bit in icrdat. But if *main* (spacing) note
13123 c of chord, will not set icrdat(25), but iornq(27)
13124 c
13125 icrdat(ncrd) = ibset(icrdat(ncrd),25)
13126 else
13127 iornq(ivx,nnl(ivx)-1) = ibset(iornq(ivx,nnl(ivx)-1),27)
13128 end if
13129 c
13130 c Check for shift
13131 c
13132 call getchar(lineq,iccount,durq)
13133 if (durq .eq. ' ') then
13134 iccount = iccount-1
13135 else
13136 c
13137 c durq must be "-"
13138 c
13139 iccount = iccount+1
13140 call readnum(lineq,iccount,durq,fnum)
13141 iccount = iccount-1
13142 c
13143 c record the shift
13144 c
13145 NumArpShift = NumArpShift+1
13146 IvArpShift(NumArpShift) = ivx
13147 IpArpShift(NumArpShift) = nnl(ivx)-1
13148 ArpShift(NumArpShift) = fnum
13149 end if
13150 go to 7
13151 else if (charq .eq. 'D') then
13152 call getdyn(ivx,nnl(ivx)-1,irest(ivx,nnl(ivx)-1),
13153 * iornq(ivx,nnl(ivx)-1),lineq,iccount)
13154 go to 7
13155 c
13156 c 140215 Allow clef change inside xtuplet. With normal code, came out one
13157 c note too late, so try making it come earlier.
13158 c
13159 else if (charq .eq. 'C') then
13160 c
13161 c Clef change on next note. Set bits 11-15. Won't allow in 2nd line of music.
13162 c
13163 if (nnl(iv)-1 .gt. 0) ncc(iv) = ncc(iv)+1
13164 c
13165 c 140218 Need to get time differently inside xtup, since itsofar doesn't get
13166 c updated until after xtup is done
13167 c
13168 nodurt = ifnodur(nnodur,dotq)
13169 tcc(iv,ncc(iv)) = itsofar(iv)+int(1.*nodurt/ntup*(itup-1))
13170 isl = ibset(islur(iv,nnl(iv)),11)
13171 call getchar(lineq,iccount,durq)
13172 c
13173 c Store clef number, or 7 if clef number = 9 (French violin clef)
13174 c
13175 isl = ior(isl,ishft(min(numclef(durq),7),12))
13176 ncmidcc(iv,ncc(iv)) = ncmidf(durq)
13177 if (durq .eq. '8') then
13178 ipl(iv,nnl(iv))=ibset(ipl(iv,nnl(iv)),2)
13179 iTransAmt(instno(iv)) = 7+iTransAmt(instno(iv))
13180 end if
13181 c
13182 c Set marker on note with lowest voice # starting at same time.
13183 c
13184 if (iv .eq. 1) then
13185 isl = ibset(isl,15)
13186 else
13187 do 70 iiv = 1 , iv
13188 c nnliiv = nnl(iiv)
13189 nnliiv = nnl(iiv)-1
13190 if (iiv .eq. iv) nnliiv = nnliiv+1
13191 itother = 0
13192 do 71 iip = 1 , nnliiv
13193 if (itother .lt. itsofar(iv)) then
13194 itother = itother+nodur(iiv,iip)
13195 go to 71
13196 else if (itother .eq. itsofar(iv)) then
13197 islur(iiv,iip) = ibset(islur(iiv,iip),15)
13198 go to 72
13199 end if
13200 71 continue
13201 70 continue
13202 72 continue
13203 end if
13204 c
13205 c Need 'or' since may have set bit 15 in the above loop
13206 c
13207 islur(iv,nnl(iv)) = ior(isl,islur(iv,nnl(iv)))
13208 go to 7
13209 else if (charq .eq. ']') then
13210 c
13211 c Multiplicity up-down, must have '][ '
13212 c
13213 islur(ivx,nnl(ivx)-1) = ibset(islur(ivx,nnl(ivx)-1),20)
13214 iccount = iccount+2
13215 go to 7
13216 end if
13217 c
13218 c End of loop for xtup options. If here, charq must be a (non-crd) note name.
13219 c or rest
13220 c
13221 if (charq .eq. 'r') then
13222 c
13223 c Rest in xtup
13224 c
13225 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),0)
13226 if (index('+-b',lineq(iccount+1:iccount+1)) .gt. 0) then
13227 call getchar(lineq,iccount,durq)
13228 if (durq .eq. 'b') then
13229 c
13230 c Blank rest in middle of xtup
13231 c
13232 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),29)
13233 else
13234 c
13235 c Override height of embedded xtup rest
13236 c
13237 ipm = index('- +',durq)-2
13238 iccount = iccount+1
13239 call readnum(lineq,iccount,durq,fnum)
13240 nolev(ivx,nnl(ivx)) = 100+ipm*nint(fnum)
13241 iccount = iccount-1
13242 end if
13243 else if (ivx .le. nv) then
13244 nolev(ivx,nnl(ivx)) = 0
13245 else
13246 nolev(ivx,nnl(ivx)) = 2
13247 end if
13248 else
13249 c
13250 c Counter for non-rests
13251 c
13252 nnb = nnb+1
13253 end if
13254 notcrd = .true.
13255 8 call getchar(lineq,iccount,durq)
13256 if (durq .ne. ' ') then
13257 if (index('+-<>',durq) .gt. 0) then
13258 c
13259 c Accidental horizontal shift
13260 c
13261 call chkpm4ac(lineq,iccount,nacc(ivx,nnl(ivx)),moved)
13262 if (.not.moved) then
13263 if (durq.eq.'+') then
13264 lastlev = lastlev+7
13265 else if (durq.eq.'-') then
13266 lastlev = lastlev-7
13267 end if
13268 end if
13269 else if (index('fsn',durq) .gt. 0) then
13270 if (igetbits(nacc(ivx,nnl(ivx)),2,0) .eq. 0) then
13271 c
13272 c No accid set yet
13273 c
13274 nacc(ivx,nnl(ivx)) =
13275 * ior(nacc(ivx,nnl(ivx)),index('fsn',durq))
13276 else
13277 c
13278 c Symbol must be repeated, so it's a double
13279 c
13280 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),2)
13281 end if
13282 else if (durq .eq. 'i') then
13283 c
13284 c Set flag for midi-only accidental
13285 c
13286 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),17)
13287
13288 else if (durq .eq. 'c') then
13289 c
13290 c Set flags for cautionary accidental
13291 c
13292 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),31)
13293 iornq(ivx,nnl(ivx)) = ibset(iornq(ivx,nnl(ivx)),31)
13294 else if (index('ul',durq) .gt. 0) then
13295 c
13296 c Force stem direction for non-beamed xtup note
13297 c
13298 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),30)
13299 if (durq .eq. 'u') islur(ivx,nnl(ivx)) =
13300 * ibset(islur(ivx,nnl(ivx)),17)
13301 else if (durq .eq. 'e') then
13302 c
13303 c Left-shift main xtup note
13304 c
13305 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),8)
13306 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),27)
13307 else if (durq .eq. 'r') then
13308 c
13309 c Right-shift main xtup note
13310 c
13311 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),9)
13312 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),20)
13313 else if (index('DF',durq) .gt. 0) then
13314 c
13315 c Double an xtup note to make an unequal xtup
13316 c
13317 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
13318 if (durq .eq. 'F') nacc(ivx,nnl(ivx)) =
13319 * ibset(nacc(ivx,nnl(ivx)),19)
13320 ndoub = ndoub+1
13321 else if (durq .eq. 'd') then
13322 c
13323 c Dotted xtup note
13324 c
13325 if (btest(irest(ivx,nnl(ivx)-1),2)) then
13326 c
13327 c Move dot on 2nd note of 2-note tremolo
13328 c
13329 ndotmv(ivx) = ndotmv(ivx)+1
13330 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),19)
13331 call g1etchar(lineq,iccount,durq) ! Will be + or -
13332 iccount = iccount+1
13333 call readnum(lineq,iccount,dumq,
13334 * updot(ivx,ndotmv(ivx)))
13335 if (durq .eq. '-') updot(ivx,ndotmv(ivx)) =
13336 * -updot(ivx,ndotmv(ivx))
13337 if (index('+-',dumq) .gt. 0) then
13338 c
13339 c Vertical shift also
13340 c
13341 call readnum(lineq,iccount,durq,
13342 * rtdot(ivx,ndotmv(ivx)))
13343 if (durq .eq. '-') rtdot(ivx,ndotmv(ivx))
13344 * = -rtdot(ivx,ndotmv(ivx))
13345 end if
13346 iccount = iccount-1
13347 else
13348 c
13349 c Dot for 3:1 pair of xtup notes
13350 c
13351 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),27)
13352 end if
13353 else
13354 c
13355 c Must be an octave number
13356 c
13357 lastlev = ifnolev(charq,ichar(durq)-48
13358 * ,iTransAmt(instno(iv)))
13359 end if
13360 go to 8
13361 end if
13362 if (itup .lt. ntup) then
13363 c
13364 c Last note is handled *after* flowing out of the xtup if block, but still
13365 c within block for a note-rest. Set note level now (rest already done).
13366 c Could have problem here if rests & doubled notes are combined in xtup,
13367 c since might exit the loop at the wrong place. Worry about it later.
13368 c
13369 if (.not.btest(irest(ivx,nnl(ivx)),0)) then
13370 lastlev = lastlev-3+mod(ifnolev(charq,10,
13371 * iTransAmt(instno(iv)))-lastlev+3,7)
13372 nolev(ivx,nnl(ivx)) = lastlev
13373 end if
13374 nodur(ivx,nnl(ivx)) = 0
13375 do 42 npreslur = npreslur , 1 , -1
13376 c
13377 c Set note level for preslur on internal xtup note
13378 c
13379 call setbits (isdat2(nsdat-npreslur+1),7,19,lastlev)
13380 42 continue
13381 end if
13382 if (itup .eq. ntup-ndoub) go to 12
13383 6 continue
13384 12 continue
13385 if (ornrpt) then
13386 iornq(ivx,nnl(ivx)) = ior(iornq(ivx,nnl(ivx)),
13387 * iand(iornq(ivx,nnl(ivx)-1),10026991))
13388 if (iand(iornq(ivx,nnl(ivx)),32896) .gt. 0) then
13389 c
13390 c This is a trill (bit 7 or 15) so must dup the parameters
13391 c
13392 ntrill = ntrill + 1
13393 ivtrill(ntrill) = ivx
13394 iptrill(ntrill) = nnl(ivx)
13395 xnsktr(ntrill) = xnsktr(ntrill-1)
13396 end if
13397 end if
13398 c
13399 c End of if-block for xtuplet input
13400 c
13401 else if (durq .eq. 'm') then
13402 c
13403 c Multi-bar rest: next 1 or two digits are # of bars.
13404 c For some purposes, pretend its one bar only
13405 c
13406 nodur(ivx,nnl(ivx)) = lenbar
13407 ibarmbr = nbars+1
13408 mbrest = 0
13409 xb4mbr = 0.
13410 20 call getchar(lineq,iccount,durq)
13411 if (ichar(durq).ge.48.and.ichar(durq).le.57) then
13412 mbrest = 10*mbrest+ichar(durq)-48
13413 go to 20
13414 end if
13415 c
13416 c durq will either be blank or 'n'
13417 if (durq .eq. 'n') then
13418 c
13419 c Get new height
13420 c
13421 iplmi = 1
13422 call g1etchar(lineq,iccount,durq)
13423 if (durq .eq. '-') then
13424 iplmi = -1
13425 iccount = iccount+1
13426 end if
13427 call readnum(lineq,iccount,durq,hgt)
13428 mbrhgt = nint(iplmi*hgt)
13429 newmbrhgt = .true.
13430 end if
13431 else if (index('ul',durq) .gt. 0) then
13432 c
13433 c Set stem flipper
13434 c
13435 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),30)
13436 if (durq .eq. 'u') islur(ivx,nnl(ivx)) =
13437 * ibset(islur(ivx,nnl(ivx)),17)
13438 go to 2
13439 else if (durq .eq. 'a') then
13440 c
13441 c "Alone", i.e., prohibit beam
13442 c
13443 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),18)
13444 go to 2
13445 else if (durq .eq. 'r') then
13446 c
13447 c Right offset by one notehead
13448 c
13449 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),9)
13450 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),20)
13451 go to 2
13452 else if (durq .eq. 'e') then
13453 c
13454 c Left offset by one notehead
13455 c
13456 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),8)
13457 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),27)
13458 go to 2
13459 else if (index('LS',durq) .gt. 0) then
13460 c
13461 c Stemlength change. Get dstemlen in \internotes. Allowable values are -4 to 27.5
13462 c Set mult(27). Map value to 0 to 63, store in mult(10-15). Later convert to
13463 c interbeams = internotes*2/3.
13464 c
13465 isign = 1
13466 if (durq .eq. 'S') isign = -1
13467 mult(ivx,nnl(ivx)) = ibset(mult(ivx,nnl(ivx)),27)
13468 call getchar(lineq,iccount,durq)
13469 if (durq .eq. ':') then
13470 c
13471 c End stickyS. Grab data now from prior note, since we have to shut off stickyS.
13472 c
13473 call setbits (mult(ivx,nnl(ivx)),6,10,
13474 * igetbits(mult(ivx,nnl(ivx)-1),6,10))
13475 stickyS = .false.
13476 go to 2
13477 end if
13478 c
13479 c If durq .ne. ':' then iccount is now on the start of the number
13480 c
13481 call readnum(lineq,iccount,durq,dum)
13482 dum = isign*dum
13483 call setbits (mult(ivx,nnl(ivx)),6,10,nint((dum+4.)*2))
13484 if (durq .eq. ':') then
13485 stickyS = .true.
13486 else
13487 iccount = iccount-1
13488 end if
13489 go to 2
13490 else if (durq .eq. ',') then
13491 c
13492 c 2:1 pattern
13493 c
13494 idotform = 3
13495 c
13496 c Now flow to duration setting, as if durq=' '
13497 c
13498 else if (durq .eq. '.') then
13499 c
13500 c Dotted pattern. Close out note. Mult time by 3/4.
13501 c Set time for next note to 1/4. Start the note.
13502 c
13503 idotform = 1
13504 else if (durq .eq. 'o') then
13505 c
13506 c Suppress rest centering
13507 c
13508 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),25)
13509 go to 2
13510 else if (durq .eq.'L') then
13511 c
13512 c With keyboard rest option, look left
13513 c
13514 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),1)
13515 go to 2
13516 else if (index('DF',durq) .gt. 0) then
13517 c
13518 c Double note for xtup. Must check here in case "D" came before "x" or on
13519 c last note of xtup. Need to flag it in pmxa since affects horiz. spacing.
13520 c
13521 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),18)
13522 if (durq .eq. 'F') nacc(ivx,nnl(ivx)) =
13523 * ibset(nacc(ivx,nnl(ivx)),19)
13524 go to 2
13525 else if (durq .eq. 'A') then
13526 c
13527 c Accidental option
13528 c
13529 call getchar(lineq,iccount,durq)
13530 c
13531 if (durq .eq. 'o') then
13532 c
13533 c Ordered accidentals in a chord. Mark the main note.
13534 c
13535 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),28)
13536 else
13537 c
13538 c Only other possibility is +-<> . Set tag, reduce iccount and loop to get #'s
13539 c
13540 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),29)
13541 iccount = iccount-1
13542 end if
13543 go to 2
13544 else if (durq .eq. 'T') then
13545 call getchar(lineq,iccount,durq)
13546 multtrem = index('1234',durq)
13547 if (multtrem .eq. 0) then
13548 iccount = iccount-1
13549 multtrem = 1
13550 end if
13551 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),4)
13552 call setbits(ipl(ivx,nnl(ivx)),2,5,multtrem-1)
13553 go to 2
13554 else if (durq .ne. ' ') then
13555 print*,'Illegal character in note: ',durq,', ivx,nn:',
13556 * ivx,nnl(ivx)
13557 call stop1()
13558 end if
13559 c
13560 c Done with note/rest options. Set level and duration.
13561 c
13562 if (.not.btest(irest(ivx,nnl(ivx)),0)) then
13563 if (numnum .eq. 2) then
13564 lastlev = ifnolev(charq,ioct,iTransAmt(instno(iv)))
13565 nolev(ivx,nnl(ivx)) = lastlev
13566 else
13567 lastlev = lastlev-3
13568 * +mod(ifnolev(charq,10,iTransAmt(instno(iv)))-lastlev+3,7)
13569 nolev(ivx,nnl(ivx)) = lastlev
13570 end if
13571 do 43 npreslur = npreslur , 1 , -1
13572 c
13573 c Set level for preslur on normal note, non-chord
13574 c
13575 call setbits(isdat2(nsdat-npreslur+1),7,19,lastlev)
13576 43 continue
13577 c
13578 c Only matters if last note, non-rest of xtuplet
13579 c
13580 nnb = nnb+1
13581 end if
13582 c
13583 c Set flag for unbeamed xtup if it just has 1 note
13584 c
13585 if (inxtup .and. nnb.eq.1) then
13586 islur(ivx,note1xtup) = ibset(islur(ivx,note1xtup),18)
13587 end if
13588 if (idotform .gt. 0) then
13589 if (idotform .eq. 1) then
13590 nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)*3/2
13591 else if (idotform .eq. 2) then
13592 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/3
13593 else if (idotform .eq. 3) then
13594 nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)
13595 else if (idotform .eq. 4) then
13596 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/2
13597 end if
13598 else if (btest(islur(ivx,nnl(ivx)),19)) then
13599 c
13600 c Set duration of full-bar rest as pause
13601 c
13602 nodur(ivx,nnl(ivx)) = lenbar
13603 c
13604 c Use a one-line function to set nnodur. It gives inverse of ifnodur.
13605 c
13606 nnodur = index('62514x0x37',
13607 * chax(48+int(log(.1+lenbar)/.69315)))-1
13608 else if (ibarmbr.ne.nbars+1) then
13609 nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)
13610 if (btest(islur(ivx,nnl(ivx)),3))
13611 * nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx))*7/6
13612 end if
13613 if (shifton .and. .not.btest(irest(ivx,nnl(ivx)),16)) then
13614 c
13615 c Shift is on, and this is not first shifted note. Check for duration change
13616 c
13617 if (nodur(ivx,nnl(ivx)) .ne. nodur(ivx,nnl(ivx)-1)) then
13618 c
13619 c Must stop and restart the offset.
13620 c
13621 irest(ivx,nnl(ivx)-1) = ibset(irest(ivx,nnl(ivx)-1),17)
13622 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),16)
13623 nudoff(ivx) = nudoff(ivx)+1
13624 udoff(ivx,nudoff(ivx)) = udoff(ivx,nudoff(ivx)-1)
13625 end if
13626 end if
13627 itsofar(ivx) = itsofar(ivx)+nodur(ivx,nnl(ivx))
13628 if (autofbon .and. tautofb.gt.tol .and. fbon) then
13629 c
13630 c Check to see if need to terminate auto forced beam
13631 c
13632 if (mod(itsofar(ivx)-t1autofb,tautofb) .lt. tol) then
13633 c
13634 c Terminate autofb
13635 c
13636 t2fb(ivx,nfb(ivx)) = itsofar(ivx)
13637 fbon = .false.
13638 end if
13639 end if
13640 if (mod(itsofar(ivx)-lenb0,lenbar) .eq. 0) then
13641 c
13642 c Finished a bar
13643 c
13644 nbars = nbars+1
13645 nib(ivx,nbars) = nnl(ivx)
13646 if (firstgulp.and.lenb0.ne.0.and.nbars.eq.1) then
13647 c
13648 c Just finished the pickup bar for this voice.
13649 c
13650 lenbar = lenb1
13651 end if
13652 end if
13653 if (idotform .eq. 1) then
13654 call getchar(lineq,iccount,charq)
13655 idotform = 2
13656 numnum = 1
13657 go to 28
13658 else if (idotform .eq. 3) then
13659 call getchar(lineq,iccount,charq)
13660 idotform = 4
13661 numnum = 1
13662 go to 28
13663 end if
13664 c
13665 c End of sub block for note-rest
13666 c
13667 else if (charq .eq. 'z') then
13668 c
13669 c Chord note. Must have note name, may have octave#,+,-,s,f,n,d
13670 c Actually the 'd' is not used, since time value comes from
13671 c basic note. Unless dot is to be shifted!
13672 c Doesn't increase # of notes, so must handle separately
13673 c ncrd: index of crd
13674 c Set bit 10 of ipl on main note as flag
13675 c Bits in icrdat:
13676 c 0-7 ip within voice
13677 c 8-11 ivx
13678 c 12-18 note level
13679 c 19 accidental?
13680 c 20-22 accidental value (1=natural, 2=flat, 3=sharp, 6=dflat, 7=dsharp)
13681 c 23 shift left
13682 c 24 shift right
13683 c 25 arpeggio start or stop
13684 c 26 flag for moved dot (here, not icrdot, since this is always reset!)
13685 c 27 Midi-only accidental
13686 c 29 Tag for accidental shift...means add to autoshifts.
13687 c 31 Cautionary accidental
13688 c
13689 c Bits in icrdot:
13690 c 0-6 10*abs(vertical dot shift in \internote) + 64
13691 c 7-13 10*abs(horizontal dot shift in \internote) + 64
13692 c 14-19 vert accidental shift-32
13693 c 20-26 20*(horiz accidental shift+3.2)
13694 c 27-29 top-down level rank of chord note w/accid. Set in crdaccs.
13695 c
13696 c Bits in icrdorn are same as in iornq, even tho most orns won't go in crds.
13697 c
13698 ncrd = ncrd+1
13699 ipl(ivx,nnl(ivx)) = ibset(ipl(ivx,nnl(ivx)),10)
13700 numnum = 0
13701 icrdat(ncrd) = nnl(ivx)
13702 call setbits(icrdat(ncrd),4,8,mod(ivx,16))
13703 if (ivx .ge. 16) icrdat(ncrd) = ibset(icrdat(ncrd),28)
13704 icrdot(ncrd) = 0
13705 icrdorn(ncrd) = 0
13706 c
13707 c Get note name
13708 c
13709 call getchar(lineq,iccount,charq)
13710 c
13711 c Get optional inputs
13712 c
13713 25 call getchar(lineq,iccount,durq)
13714 ndx = index('fsn+-<>12345678rediAc',durq)
13715 if (ndx .eq. 20) then
13716 c
13717 c Expect +|-|<|> , set tag, loop
13718 c
13719 icrdat(ncrd) = ibset(icrdat(ncrd),29)
13720 go to 25
13721 else if (ndx .gt. 0) then
13722 if (ndx .le. 3) then
13723 if (.not.btest(icrdat(ncrd),19)) then
13724 icrdat(ncrd) = ibset(icrdat(ncrd),19)
13725 icrdat(ncrd) = ior(icrdat(ncrd),ishft(ndx,20))
13726 else
13727 icrdat(ncrd) = ibset(icrdat(ncrd),22)
13728 end if
13729 else if (ndx .eq. 21) then
13730 c
13731 c Set flags for cautionary accidental
13732 c
13733 icrdat(ncrd) = ibset(icrdat(ncrd),31)
13734 iornq(ivx,nnl(ivx)) = ibset(iornq(ivx,nnl(ivx)),31)
13735 else if (ndx .le. 7) then
13736 c
13737 c +/-/</> Check whether octave or accidental shift
13738 c
13739 nactmp = 0
13740 call chkpm4ac(lineq,iccount,nactmp,moved)
13741 if (moved) then
13742 c
13743 c Transfer accidental shift values
13744 c
13745 call setbits(icrdot(ncrd),6,14,igetbits(nactmp,6,4))
13746 call setbits(icrdot(ncrd),7,20,igetbits(nactmp,7,10))
13747 else
13748 if (durq .eq. '+') then
13749 lastlev = lastlev+7
13750 else if (durq .eq. '-') then
13751 lastlev = lastlev-7
13752 end if
13753 end if
13754 else if (durq .eq. 'e') then
13755 icrdat(ncrd) = ibset(icrdat(ncrd),23)
13756 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),27)
13757 else if (durq .eq. 'r') then
13758 icrdat(ncrd) = ibset(icrdat(ncrd),24)
13759 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),20)
13760 else if (durq .eq. 'i') then
13761 c
13762 c Midi-only accidental on chord note
13763 c
13764 icrdat(ncrd) = ibset(icrdat(ncrd),27)
13765 else if (durq .eq. 'd') then
13766 c
13767 c Must keep 'd' optional (backward compatibility), unless it is moved!
13768 c
13769 if (index('+-',lineq(iccount+1:iccount+1)) .gt. 0) then
13770 c
13771 c move a dot, unless next char is not part of a number
13772 c
13773 if (index('0123456789.',lineq(iccount+2:iccount+2))
13774 * .eq. 0) go to 25
13775 icrdat(ncrd) = ibset(icrdat(ncrd),26)
13776 call getchar(lineq,iccount,durq)
13777 iccount=iccount+1
13778 call readnum(lineq,iccount,dumq,fnum)
13779 if (durq .eq. '+') then
13780 icrdot(ncrd) = ior(icrdot(ncrd),nint(fnum*10)+64)
13781 else
13782 icrdot(ncrd) = ior(icrdot(ncrd),-nint(fnum*10)+64)
13783 end if
13784 if (index('+-',dumq) .gt. 0) then
13785 c
13786 c Vertical shift specified also
13787 c
13788 iccount=iccount+1
13789 call readnum(lineq,iccount,durq,fnum)
13790 if (dumq .eq. '+') then
13791 ifnum = nint(fnum*10)+64
13792 else
13793 ifnum = -nint(fnum*10)+64
13794 end if
13795 else
13796 ifnum = 64
13797 end if
13798 icrdot(ncrd) = ior(icrdot(ncrd),ishft(ifnum,7))
13799 iccount = iccount-1
13800 end if
13801 else
13802 c
13803 c must be a single digit, save it in ioct
13804 c
13805 numnum = 1
13806 ioct = ndx-7
13807 end if
13808 go to 25
13809 end if
13810 if (numnum .eq. 1) then
13811 lastlev = ifnolev(charq,ioct,iTransAmt(instno(iv)))
13812 else
13813 lastlev = lastlev-3
13814 * +mod(ifnolev(charq,10,iTransAmt(instno(iv)))-lastlev+3,7)
13815 end if
13816 icrdat(ncrd) = ior(icrdat(ncrd),ishft(lastlev,12))
13817 do 44 npreslur = npreslur , 1 , -1
13818 call setbits (isdat2(nsdat-npreslur+1),7,19,lastlev)
13819 c
13820 c Set level for chord note.
13821 c Initially I assigned the slur(s) to next note, so fix.
13822 c
13823 islur(ivx,nnl(ivx)+1) = ibclr(islur(ivx,nnl(ivx)+1),0)
13824 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),0)
13825 isdat2(nsdat-npreslur+1) = ibset(isdat2(nsdat-npreslur+1),0)
13826 call setbits(isdat1(nsdat-npreslur+1),8,3,
13827 * igetbits(isdat1(nsdat-npreslur+1),8,3)-1)
13828 44 continue
13829 if (notcrd) then
13830 c
13831 c This is the first chord note in this chord.
13832 c
13833 minlev = min(nolev(ivx,nnl(ivx)),lastlev)
13834 maxlev = max(nolev(ivx,nnl(ivx)),lastlev)
13835 else
13836 minlev = min(minlev,lastlev)
13837 maxlev = max(maxlev,lastlev)
13838 end if
13839 notcrd = .false.
13840 else if (charq .eq. 'G') then
13841 call getgrace(ivx,nnl,lineq,iccount,islur,iornq,ipl,ndlev,
13842 * lastlev,iv,nv)
13843 c
13844 c Grace, comes *before* main note:
13845 c UNLESS there's an 'A' or 'W' after the 'G'
13846 c ngrace = # of grace note groups so far in block
13847 c ivg(ngrace), ipg(ngrace)
13848 c nng(ngrace) = # of notes in this group: default = 1
13849 c ngstrt(ngrace) = starting position in nolevg of levels for this grace
13850 c multg(ngrace) = multiplicity: default = 1; input as 'm(digit)'
13851 c upg(ngrace) = logical for beam or stem dirn: default T, input'u,l'
13852 c slurg(ngrace) = logical for slur; default F, input 's'
13853 c slashg(ngrace) = T if slash; default is F, input 'x'
13854 c These data MUST precede note name of first note
13855 c nolevg, naccg: lists of levels and accid's, indexed as described above.
13856 c
13857 else if (charq .eq. sq) then
13858 c
13859 c Literal TeX string
13860 c
13861 call littex(islur,nnl(ivx)+1,ivx,topmods,lineq,iccount)
13862 else if (charq .eq. chax(34)) then
13863 c
13864 c pmxlyr string. Expand "..." to \pmxlyr{...}\
13865 c
13866 if (.not. inputmlyr) then
13867 ictemp = 0
13868 lineqt = sq//sq//sq//'input musixlyr '//sq
13869 call littex(islur,nnl(ivx)+1,ivx,topmods,lineqt,ictemp)
13870 inputmlyr = .true.
13871 end if
13872 call dopmxlyr(lineq,iccount)
13873 charq = sq
13874 call littex(islur,nnl(ivx)+1,ivx,topmods,lineq,iccount)
13875 else if (charq .eq. 'o') then
13876 c
13877 c Ornament on non-xtup note. Symbol must come AFTER the affected note
13878 c
13879 if (notcrd) then
13880 nole = nolev(ivx,nnl(ivx))
13881 else
13882 nole = iand(127,ishft(icrdat(ncrd),-12))
13883 end if
13884 call getorn(lineq,iccount,iornq(ivx,nnl(ivx)),
13885 * iornq(ivx,0),ornrpt,noffseg,nnl(ivx),ivx,
13886 * .true.,notcrd,nole)
13887 else if (index('st(){}',charq) .gt. 0) then
13888 nnlivx = nnl(ivx)
13889 if (charq.eq.'(' .or. charq.eq.'{') then
13890 c
13891 c Detect preslur on normal non-chord note
13892 c
13893 nnlivx = nnlivx+1
13894 npreslur = npreslur+1
13895 end if
13896 islur(ivx,nnlivx) = ibset(islur(ivx,nnlivx),0)
13897 if (charq.eq.'t')
13898 * islur(ivx,nnlivx) = ibset(islur(ivx,nnlivx),1)
13899 if (ivx .le. nv) then
13900 kv = 1
13901 else
13902 kv = 2
13903 end if
13904 if (fontslur) then
13905 call sslur(lineq,iccount,iv,kv,nnlivx,isdat1,isdat2,isdat3,
13906 * nsdat,notcrd,nolev(ivx,nnlivx),charq)
13907 else
13908 call spsslur(lineq,iccount,iv,kv,nnlivx,isdat1,isdat2,isdat3,
13909 * isdat4,nsdat,notcrd,nolev(ivx,nnlivx),charq)
13910 end if
13911 else if (charq .eq. '?') then
13912 c
13913 c Arpeggio
13914 c
13915 if (btest(ipl(ivx,nnl(ivx)),10)) then
13916 c
13917 c This is a chordal note. Set a bit in icrdat. But if *main* (spacing) note
13918 c of chord, will not set icrdat(25), but iornq(27)
13919 c
13920 icrdat(ncrd) = ibset(icrdat(ncrd),25)
13921 else
13922 iornq(ivx,nnl(ivx)) = ibset(iornq(ivx,nnl(ivx)),27)
13923 end if
13924 c
13925 c Check for shift
13926 c
13927 call getchar(lineq,iccount,durq)
13928 if (durq .eq. ' ') then
13929 iccount = iccount-1
13930 else
13931 c
13932 c durq must be "-"
13933 c
13934 iccount = iccount+1
13935 call readnum(lineq,iccount,durq,fnum)
13936 iccount = iccount-1
13937 c
13938 c record the shift
13939 c
13940 NumArpShift = NumArpShift+1
13941 IvArpShift(NumArpShift) = ivx
13942 IpArpShift(NumArpShift) = nnl(ivx)
13943 ArpShift(NumArpShift) = fnum
13944 end if
13945 else if (index('0123456789#-nx_',charq) .gt. 0) then
13946 c
13947 c We have a figure. Must come AFTER the note it goes under
13948 c
13949
13950 ivf = 1
13951 if (ivx .gt. 1) then
13952 if (ivxfig2 .eq. 0) then
13953 ivxfig2 = ivx
13954 else if (ivx .ne. ivxfig2) then
13955 print*
13956 print*,'Figures not allowed in >1 voice above first'
13957 stop
13958 end if
13959 ivf = 2
13960 end if
13961 nfig1 = nfigs(ivf)+1
13962 call getfig(itoff(ivf,nfig1),charq,lineq,iccount,
13963 * isfig(ivf,nnl(ivx)),itfig(ivf,nfig1),itsofar(ivx),
13964 * nodur(ivx,nnl(ivx)),figq(ivf,nfig1),
13965 * ivupfig(ivf,nfig1),ivvfig(ivf,nfig1),nfigs(ivf))
13966 else if (charq .eq. '[') then
13967 c
13968 c Start forced beam. Record barno & time since start of inp. blk. Set signal
13969 c
13970 nfb(ivx) = nfb(ivx)+1
13971 fbon = .true.
13972 ulfbq(ivx,nfb(ivx)) = 'x'
13973 t1fb(ivx,nfb(ivx)) = itsofar(ivx)
13974 nadj = 0
13975 if (autofbon) then
13976 autofbon = .false.
13977 end if
13978 17 call getchar(lineq,iccount,charq)
13979 if (index('ulf',charq) .gt. 0) then
13980 ulfbq(ivx,nfb(ivx)) = charq
13981 go to 17
13982 else if (charq .eq. 'j') then
13983 c
13984 c Continuing a jumped beam here
13985 c
13986 irest(ivx,nnl(ivx)+1) = ibset(irest(ivx,nnl(ivx)+1),24)
13987 c
13988 c Set flag to watch for END of this forced beam, so can set flag rest(30) on
13989 c NEXT note as signal to start a new notes group there.
13990 c
13991 isbj2 = .true.
13992 go to 17
13993 else if (charq .eq. 'h') then
13994 islur(ivx,nnl(ivx)+1) = ibset(islur(ivx,nnl(ivx)+1),2)
13995 go to 17
13996 else if (charq .eq. 'm') then
13997 c
13998 c Force multiplicity. Next input is digit
13999 c
14000 call getchar(lineq,iccount,charq)
14001 islur(ivx,nnl(ivx)+1) = ibset(islur(ivx,nnl(ivx)+1),21)
14002 call setbits(islur(ivx,nnl(ivx)+1),3,22,ichar(charq)-48)
14003 go to 17
14004 else if (charq .eq. ':') then
14005 c
14006 c Start auto forced beam pattern
14007 c
14008 autofbon = .true.
14009 c
14010 c When forced later beam ends, check whether tautofv <=0; if so set it.
14011 c
14012 tautofb = -itsofar(ivx)
14013 t1autofb = itsofar(ivx)
14014 go to 17
14015 else if (charq .ne. ' ') then
14016 c
14017 c Must be '+/-' for height or slope shift
14018 c
14019 nadj = nadj+1
14020 c
14021 c nadj = 1,2, or 3 for normal start level, slope, or beam-thk start level.
14022 c
14023 iccount = iccount+1
14024 call readnum(lineq,iccount,durq,fnum)
14025 iccount = iccount-1
14026 iadj = nint(fnum)
14027 if (charq .eq. '-') iadj = -iadj
14028 if (nadj .eq. 1) then
14029 c
14030 c This is a level shift. Note if 0 was entered, iadj = 30
14031 c
14032 call setbits(ipl(ivx,nnl(ivx)+1),6,11,iadj+30)
14033 else if (nadj .eq. 2) then
14034 c
14035 c Must be a slope shift
14036 c
14037 call setbits(ipl(ivx,nnl(ivx)+1),6,17,iadj+30)
14038 else
14039 c
14040 c Beam-thk fine tune
14041 c
14042 call setbits(islur(ivx,nnl(ivx)+1),2,27,iadj)
14043 end if
14044 go to 17
14045 end if
14046 else if (charq .eq. ']') then
14047 if (autofbon .and. tautofb.lt.tol) then
14048 tautofb=itsofar(ivx)+tautofb
14049 end if
14050 call getchar(lineq,iccount,charq)
14051 if (index('j ',charq) .gt. 0) then
14052 c
14053 c Since ']' comes AFTER note, itsofar has been updated. Set ending signal.
14054 c
14055 t2fb(ivx,nfb(ivx)) = itsofar(ivx)
14056 fbon = .false.
14057 if (charq .eq. 'j') then
14058 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),23)
14059 end if
14060 if (isbj2) then
14061 c
14062 c This is the end of a fb segment of a jump beam. Set flag on NEXT note to
14063 c force start of new notes group, provided this is not last note in bar.
14064 c
14065 if (mod(itsofar(ivx),lenbar) .ne. 0)
14066 * irest(ivx,nnl(ivx)+1) = ibset(irest(ivx,nnl(ivx)+1),30)
14067 isbj2 = .false.
14068 end if
14069 else if (charq .eq. '[') then
14070 c
14071 c Multiplicity down-up signal
14072 c
14073 islur(ivx,nnl(ivx)) = ibset(islur(ivx,nnl(ivx)),20)
14074 else if (charq .eq. '-') then
14075 c
14076 c Set signals for gap in single-slope beam [...]-[...]
14077 c
14078 nacc(ivx,nnl(ivx)) = ibset(nacc(ivx,nnl(ivx)),20)
14079 nacc(ivx,nnl(ivx)+1) = ibset(nacc(ivx,nnl(ivx)+1),21)
14080 c
14081 c Next two characters must be "[ ". Skip over them.
14082 c
14083 iccount = iccount+2
14084 end if
14085 else if (charq .eq. 'D') then
14086 call getdyn(ivx,nnl(ivx),irest(ivx,nnl(ivx)),
14087 * iornq(ivx,nnl(ivx)),lineq,iccount)
14088 else if (charq .eq. 'h') then
14089 c
14090 c Heading or height. For heading, only OK if at start of block
14091 c Check whether at beginning of a block
14092 c
14093 if (iv.ne.1 .or. nnl(1).ne.0) then
14094 print*,'You entered "h" not at beginning of block'
14095 call stop1()
14096 end if
14097 call getchar(lineq,iccount,durq)
14098 ihdvrt = 0
14099 if (index('+-',durq) .gt. 0) then
14100 c
14101 c Vertical offset
14102 c
14103 iccount = iccount+1
14104 call readnum(lineq,iccount,charq,fnum)
14105 ihdvrt = fnum+.1
14106 if (durq .eq. '-') ihdvrt = -ihdvrt
14107 durq = charq
14108 end if
14109 if (durq .ne. ' ') then
14110 c
14111 c Height symbol. Read past (until next blank)
14112 c
14113 3 call getchar(lineq,iccount,durq)
14114 if (durq .ne. ' ') go to 3
14115 else
14116 c
14117 c Set flag for header & read it in
14118 c
14119 ihdht = 16
14120 call getbuf(headrq)
14121 iccount = 128
14122 end if
14123 else if (charq .eq. 'L') then
14124 c
14125 c Linebreak, already handled some in pmxa, but need to get data for
14126 c shortened line or coda lengths
14127 c
14128 iccount = iccount+1
14129 if (lineq(iccount:iccount) .eq. 'C') then
14130 c
14131 c Coda, get length
14132 c
14133 iccount = iccount+1
14134 call readnum(lineq,iccount,durq,codafrac)
14135 ishort = 3
14136 if (durq .eq. 'n') nocodabn = .true.
14137 return
14138 end if
14139 c
14140 c Get line number
14141 c
14142 call readnum(lineq,iccount,durq,fmovbrk)
14143 48 continue ! Allow transfer up from below if S follows M
14144 if (durq .eq. 'S') then
14145 c
14146 c Shortened line, get shortening fraction
14147 c
14148 iccount = iccount+1
14149 call readnum(lineq,iccount,durq,shortfrac)
14150 ishort = 1
14151 codafrac = 0.
14152 end if
14153 c
14154 c Begin check for movement break
14155 c
14156 if (durq .eq. 'P') then
14157 iccount = iccount+1
14158 call readnum(lineq,iccount,durq,fnum)
14159 end if
14160 if (durq .eq. 'M') then
14161 movbrk = nint(fmovbrk)
14162 movgap = 0
14163 parmov = -1.
14164 call getchar(lineq,iccount,durq)
14165 31 if (durq .eq. '+') then
14166 c
14167 c Get vertical space (\internotes)
14168 c
14169 iccount = iccount+1
14170 call readnum(lineq,iccount,durq,fnum)
14171 movgap = nint(fnum)
14172 go to 31
14173 else if (durq .eq. 'i') then
14174 iccount = iccount+1
14175 call readnum(lineq,iccount,durq,parmov)
14176 go to 31
14177 else if (durq .eq. 'c') then
14178 nobar1 = .true.
14179 call getchar(lineq,iccount,durq)
14180 go to 31
14181 else if (durq .eq. 'r') then
14182 c
14183 c "rename" can be set on or off.
14184 c
14185 call getchar(lineq,iccount,durq)
14186 rename = durq.eq.'+'
14187 call getchar(lineq,iccount,durq)
14188 go to 31
14189 else if (durq .eq. 'n') then
14190 c
14191 c Change # of voices. Input ninow, iiorig(1...ninow). Will use names,
14192 c staves per inst. and clefs corr. to iiorig in original list of instruments.
14193 c
14194 nvold = nv
14195 nv = 0
14196 rename = .true.
14197 call getchar(lineq,iccount,durq)
14198 if (durq .eq. ':') then
14199 iccount = iccount+2
14200 read(lineq(iccount-1:iccount),'(i2)')ninow
14201 else
14202 ninow = ichar(durq)-48
14203 end if
14204 iiv = 0
14205 do 63 iinow = 1 , ninow
14206 call getchar(lineq,iccount,durq)
14207 if (durq .eq. ':') then
14208 iccount = iccount+2
14209 read(lineq(iccount-1:iccount),'(i2)')iiorig(iinow)
14210 else
14211 iiorig(iinow) = ichar(durq)-48
14212 end if
14213 nspern(iinow) = nsperi(iiorig(iinow))
14214 nv = nv+nspern(iinow)
14215 sepsymq(iiv+nspern(iinow)) = '&'
14216 if (nspern(iinow) .gt. 1) then
14217 do 64 iis = 1 , nspern(iinow)-1
14218 sepsymq(iiv+iis) = '|'
14219 64 continue
14220 end if
14221 iiv = iiv+nspern(iinow)
14222 63 continue
14223 if (nv.eq.1 .and. nvold.gt.1) then
14224 if (islast) write(11,'(a)')sq//'nostartrule'
14225 else if (nv.gt.1 .and. nvold.eq.1) then
14226 if (islast) write(11,'(a)')sq//'startrule'
14227 end if
14228 iiv = 0
14229 do 60 iinow = 1 , ninow
14230 do 61 iis = 1 , nspern(iinow)
14231 iiv = iiv+1
14232 c
14233 c May not really need to re-enter clefs, but it's easier to program since
14234 c clef names are not saved but are needed in newvoice to set ncmidcc.
14235 c
14236 call getchar(lineq,iccount,clefq(iiv))
14237 call newvoice(iiv,clefq(iiv),.true.)
14238 if (nspern(iinow) .eq. 1) then
14239 hdlndq = chax(48+numclef(clefq(iiv)))
14240 lclf = 1
14241 else if (iis .eq. 1) then
14242 hdlndq = '{'//chax(48+numclef(clefq(iiv)))
14243 lclf = 2
14244 else if (iis .lt. nspern(iinow)) then
14245 hdlndq = hdlndq(1:lclf)//chax(48+numclef(clefq(iiv)))
14246 lclf = lclf+1
14247 else
14248 hdlndq =
14249 * hdlndq(1:lclf)//chax(48+numclef(clefq(iiv)))//'}'
14250 lclf = lclf+2
14251 end if
14252 61 continue
14253 c
14254 c setstaffs & setclef go by instrument, not voice
14255 c
14256 if (islast) then
14257 if (iinow .lt. 10) then
14258 write(11,'(a)')sq//'setstaffs'
14259 * //chax(48+iinow)//chax(48+nspern(iinow))//'%'
14260 write(11,'(a)')sq//'setclef'//chax(48+iinow)
14261 * //hdlndq(1:lclf)//'%'
14262 if (fullsize(iiorig(iinow)).gt.0.9) then
14263 write(11,'(a)')sq//'setsize'//chax(48+iinow)
14264 * //sq//'normalvalue%'
14265 c
14266 c 140526 Account for staff size specs when noinst changes. May be confusion
14267 c here if more than one staff per instrument
14268 c
14269 else if (fullsize(iiorig(iinow)).gt..7) then
14270 write(11,'(a)')sq//'setsize'//chax(48+iinow)
14271 * //sq//'smallvalue%'
14272 else
14273 write(11,'(a)')sq//'setsize'//chax(48+iinow)
14274 * //sq//'tinyvalue%'
14275 end if
14276 else
14277 write(11,'(a11,i2,a)')sq//'setstaffs{',iinow,
14278 * '}'//chax(48+nspern(iinow))//'%'
14279 write(11,'(a9,i2,a)')sq//'setclef{',iinow,
14280 * '}'//hdlndq(1:lclf)//'%'
14281 end if
14282 end if
14283 60 continue
14284 c
14285 c Loop back up, this may not be last option in M. Note flow out if durq=' '
14286 c
14287 call getchar(lineq,iccount,durq)
14288 go to 31
14289 else if (durq .eq. 'S') then
14290 go to 48
14291 end if
14292 c
14293 c Write instrument names
14294 c
14295 if (.not.rename) then
14296 do 62 iinst = 1 , ninow
14297 if (islast) then
14298 if (iinst .lt. 10) then
14299 write(11,'(a8,i1,a3)')sq//'setname',iinst,'{}%'
14300 else
14301 write(11,'(a9,i2,a4)')sq//'setname{',iinst,'}{}%'
14302 end if
14303 end if
14304 62 continue
14305 else
14306 do 65 iinst = 1 , ninow
14307 if (islast) then
14308 if (iinst .lt. 10) then
14309 write(11,'(a8,i1,a)')sq//'setname',iinst,'{'//
14310 * inameq(iiorig(iinst))(1:lnam(iiorig(iinst)))//'}%'
14311 else
14312 write(11,'(a9,i2,a)')sq//'setname{',iinst,'}{'//
14313 * inameq(iiorig(iinst))(1:lnam(iiorig(iinst)))//'}%'
14314 end if
14315 end if
14316 65 continue
14317 if (ishort.ne.4.and.ishort.ne.2) rename = .false.
14318 c
14319 c Reset later and rewrite setname{} in shortening case mcm, since if
14320 c written here it will be inside {{...}} and will be ignored
14321 c
14322 end if
14323 end if
14324 else if (charq .eq.'|' ) then
14325 c
14326 c End of bar symbol. Check about end of bar hardspace.
14327 c
14328 if (btest(iornq(ivx,nnl(ivx)+1),26)) then
14329 c
14330 c There was a hardspace followed by a bar line. Remove it from the hardspace
14331 c list, store with shifts instead, set special bit. Need to repeat this code
14332 c at '/'.
14333 c
14334 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),18)
14335 nudoff(ivx) = nudoff(ivx)+1
14336 udoff(ivx,nudoff(ivx)) = udsp(nudsp)
14337 nudsp = nudsp-1
14338 iornq(ivx,nnl(ivx)+1) = ibclr(iornq(ivx,nnl(ivx)+1),26)
14339 end if
14340 else if (index('wS',charq) .gt. 0) then
14341 c
14342 c Width symbol or new nsyst. Read past (until blank)
14343 c
14344 4 call getchar(lineq,iccount,durq)
14345 if (durq .ne. ' ') go to 4
14346 else if (charq .eq. 'l') then
14347 c
14348 c Lower string. Only OK if at start of block
14349 c Check whether at beginning of a block
14350 c
14351 if (iv.ne.1 .or. nnl(1).ne.0) then
14352 print*,'You entered "l" not at beginning of block'
14353 call stop1()
14354 end if
14355 c
14356 c Set flag for lower string & read it in
14357 c
14358 lower = .true.
14359 call getbuf(lowerq)
14360 iccount = 128
14361 else if (charq .eq. 'm') then
14362 c
14363 c Meter change. Only allow at beginning of block.
14364 c mtrnuml, mtrdenl (logical) and p (printable) will be input.
14365 c mtrnuml=0 initially. (In common)
14366 c
14367 c Check whether at beginning of a block
14368 c
14369 if (iv.ne.1 .or. nnl(1).ne.0) then
14370 print*,'You entered "m" not at beginning of block'
14371 call stop1()
14372 end if
14373 call readmeter(lineq,iccount,mtrnuml,mtrdenl)
14374 call readmeter(lineq,iccount,mtrnmp,mtrdnp)
14375 lenbeat = ifnodur(mtrdenl,'x')
14376 if (mtrdenl .eq. 2) lenbeat = 16
14377 lenbar = mtrnuml*lenbeat
14378 if (mtrdenl .eq. 2) lenbar = lenbar*2
14379 lenb1 = lenbar
14380 lenb0 = 0
14381 if (ismidi) call midievent('m',mtrnuml,mtrdenl)
14382 else if (charq .eq. 'C') then
14383 c
14384 c Clef change on next note. Set bits 11-15. Won't allow in 2nd line of music.
14385 c
14386 if (nnl(iv) .gt. 0) ncc(iv) = ncc(iv)+1
14387 tcc(iv,ncc(iv)) = itsofar(iv)
14388 isl = ibset(islur(iv,nnl(iv)+1),11)
14389 call getchar(lineq,iccount,durq)
14390 c
14391 c Store clef number, or 7 if clef number = 9 (French violin clef)
14392 c
14393 isl = ior(isl,ishft(min(numclef(durq),7),12))
14394 ncmidcc(iv,ncc(iv)) = ncmidf(durq)
14395 if (durq .eq. '8') then
14396 ipl(iv,nnl(iv)+1)=ibset(ipl(iv,nnl(iv)+1),2)
14397 iTransAmt(instno(iv)) = 7+iTransAmt(instno(iv))
14398 lastlev = lastlev+7
14399 if (nnl(iv).eq.0) then
14400 ndlev(iv,1) = ndlev(iv,1)+7
14401 ndlev(iv,2) = ndlev(iv,2)+7
14402 end if
14403 else
14404 c
14405 c This won't work if you really had an octave transposition with some
14406 c other clef. Need a check on whether prior clef was an octave clef.
14407 c
14408 if (iTransAmt(instno(iv)).eq.7) then
14409 iTransAmt(instno(iv))=iTransAmt(instno(iv))-7
14410 lastlev = lastlev-7
14411 if (nnl(iv).eq.0) then
14412 ndlev(iv,1) = ndlev(iv,1)-7
14413 ndlev(iv,2) = ndlev(iv,2)-7
14414 end if
14415 end if
14416 end if
14417 c
14418 c Set marker on note with lowest voice # starting at same time.
14419 c
14420 if (iv .eq. 1) then
14421 isl = ibset(isl,15)
14422 else
14423 do 13 iiv = 1 , iv
14424 nnliiv = nnl(iiv)
14425 if (iiv .eq. iv) nnliiv = nnliiv+1
14426 itother = 0
14427 do 14 iip = 1 , nnliiv
14428 if (itother .lt. itsofar(iv)) then
14429 itother = itother+nodur(iiv,iip)
14430 go to 14
14431 else if (itother .eq. itsofar(iv)) then
14432 islur(iiv,iip) = ibset(islur(iiv,iip),15)
14433 go to 15
14434 end if
14435 14 continue
14436 13 continue
14437 15 continue
14438 end if
14439 c
14440 c Need 'or' since may have set bit 15 in the above loop
14441 c
14442 islur(iv,nnl(iv)+1) = ior(isl,islur(iv,nnl(iv)+1))
14443 else if (charq .eq. 'R') then
14444 c
14445 c Repeats. set bits 5, 6, and/or 8 of islur(1,ip+1)
14446 c
14447 10 call getchar(lineq,iccount,durq)
14448 c
14449 c Save designator in case it's a terminal Rr or Rd
14450 c
14451 if (durq .eq. 'l') then
14452 islur(1,nnl(1)+1) = ibset(islur(1,nnl(1)+1),5)
14453 go to 10
14454 else if (index('rdDbz',durq) .gt. 0) then
14455 if (durq .eq. 'r') then
14456 islur(1,nnl(1)+1) = ibset(islur(1,nnl(1)+1),6)
14457 else if (durq .eq. 'd') then
14458 islur(1,nnl(1)+1) = ibset(islur(1,nnl(1)+1),8)
14459 else if (durq .eq. 'D') then
14460 islur(1,nnl(1)+1) = ibset(islur(1,nnl(1)+1),26)
14461 else if (durq .eq. 'b') then
14462 islur(1,nnl(1)+1) = ibset(islur(1,nnl(1)+1),25)
14463 else if (durq .eq. 'z') then
14464 c iornq(1,nnl(1)+1) = ibset(iornq(1,nnl(1)+1),29)
14465 ipl(1,nnl(1)+1) = ibset(ipl(1,nnl(1)+1),0)
14466 end if
14467 rptprev = .true.
14468 rptfq1 = durq
14469 go to 10
14470 end if
14471 else if (charq .eq. 'V') then
14472 c
14473 c Ending
14474 c
14475 nnnl = nnl(1)+1
14476 lvoltxt = 0
14477 11 call getchar(lineq,iccount,durq)
14478 if (durq.eq.'b' .or. durq .eq.'x') then
14479 c
14480 c End Volta, set bit9, and bit10 on if 'b' (end w/ box)
14481 c
14482 islur(1,nnnl) = ibset(islur(1,nnnl),9)
14483 if (durq .eq. 'b') islur(1,nnnl) = ibset(islur(1,nnnl),10)
14484 go to 11
14485 else if (durq .ne. ' ') then
14486 c
14487 c Start volta; Get text
14488 c
14489 if (lvoltxt .eq. 0) then
14490 c
14491 c First character for text
14492 c
14493 lvoltxt = 1
14494 islur(1,nnnl) = ibset(islur(1,nnnl),7)
14495 nvolt = nvolt+1
14496 voltxtq(nvolt) = durq
14497 else
14498 voltxtq(nvolt) = voltxtq(nvolt)(1:lvoltxt)//durq
14499 lvoltxt = lvoltxt+1
14500 end if
14501 go to 11
14502 end if
14503 else if (charq .eq. 'B') then
14504 bcspec = .not.bcspec
14505 else if (charq .eq. 'P') then
14506 c
14507 c Page numbers. Print stuff right now.
14508 c
14509 npg1 = 0
14510 c
14511 c Will use ltopnam to signal whether there's a centered heading
14512 c
14513 ltopnam = 0
14514 ipg1r = 0
14515 16 call getchar(lineq,iccount,durq)
14516 if (ichar(durq).ge.48 .and. ichar(durq).le.57) then
14517 npg1 = npg1*10+ichar(durq)-48
14518 go to 16
14519 else if (durq .eq. 'l') then
14520 if (npg1.eq.0 .or. mod(npg1,2).eq.1) ipg1r = 1
14521 go to 16
14522 else if (durq .eq. 'r') then
14523 if (npg1.gt.0 .and. mod(npg1,2).eq.0) ipg1r = 1
14524 go to 16
14525 else if (durq .eq. 'c') then
14526 c
14527 c Top-centered name. Assume this is last option. Read the name.
14528 c May surround name in double quotes (to allow blanks).
14529 c
14530 call getchar(lineq,iccount,durq)
14531 if (durq .eq. ' ') then
14532 ltopnam = lenstr(cheadq,60)
14533 else
14534 namstrt = iccount
14535 if (durq .eq. chax(34)) then
14536 c
14537 c Using quote delimiters.
14538 c
14539 quoted = .true.
14540 namstrt = namstrt+1
14541 else
14542 quoted = .false.
14543 end if
14544 do 35 iccount = namstrt+1, 128
14545 if ((quoted .and. lineq(iccount:iccount).eq.chax(34) .and.
14546 * lineq(iccount-1:iccount-1).ne.chax(92)) .or.
14547 * (.not.quoted .and. lineq(iccount:iccount) .eq. ' '))
14548 * go to 36
14549 c
14550 c On exit, iccount is OK, and name is in (namstrt:iccount-1)
14551 c
14552 35 continue
14553 print*,'Awww, cmon, should not be here.'
14554 call stop1()
14555 36 continue
14556 ltopnam = iccount-namstrt
14557 cheadq = lineq(namstrt:iccount-1)
14558 end if
14559 end if
14560 c
14561 c Done getting data, now assemble the command
14562 c
14563 if (npg1.eq.0) npg1=1
14564 c
14565 c 2/23/03 Don't use \atnextline if on first page and only one system
14566 c
14567 hdlndq = sq//'def'//sq//'atnextline{'//sq//'toppageno{'
14568 lhead = 27
14569 if (npg1 .lt. 10) then
14570 c
14571 c Note we are overwriting the last "{"
14572 c
14573 write(hdlndq(lhead:lhead),'(i1)')npg1
14574 else if (npg1 .lt. 100) then
14575 lhead = lhead+3
14576 write(hdlndq(lhead-2:lhead),'(i2,a1)')npg1,'}'
14577 else
14578 lhead = lhead+4
14579 write(hdlndq(lhead-3:lhead),'(i3,a1)')npg1,'}'
14580 end if
14581 hdlndq = hdlndq(1:lhead)//chax(ipg1r+48)//'{'
14582 lhead = lhead+2
14583 if (ltopnam .eq. 0) then
14584 if (islast) write(11,'(a)')hdlndq(1:lhead)//'}}%'
14585 else
14586 if (islast)
14587 * write(11,'(a)')hdlndq(1:lhead)//cheadq(1:ltopnam)//'}}%'
14588 end if
14589 else if (charq .eq. 'W') then
14590 c
14591 c Just eat the number that must follow, it was used in pmxa
14592 c
14593 iccount = iccount+1
14594 call readnum(lineq,iccount,durq,fnum)
14595 else if (charq .eq. 'T') then
14596 headlog = .true.
14597 inhead = 0
14598 call getchar(lineq,iccount,durq)
14599 if (durq .eq. 'i') then
14600 call getbuf(instrq)
14601 c
14602 c A kluge for parts from separate score file for later movements.
14603 c
14604 if (instrq(1:1) .eq. ' ') headlog = .false.
14605 cheadq = instrq(1:60)
14606 else if (durq .eq. 't') then
14607 call getchar(lineq,iccount,durq)
14608 c
14609 c Optionally can include extra vertical \internotes above inbothd
14610 c
14611 if (index('-+0123456789',durq) .gt. 0) then
14612 ipm = 1
14613 if (index('+-',durq) .gt. 0) then
14614 c
14615 c Don't trust readnum to round this negative integer properly
14616 c
14617 iccount = iccount+1
14618 if (durq .eq. '-') ipm = -1
14619 end if
14620 call readnum(lineq,iccount,durq,fnum)
14621 inhead = ipm*nint(fnum)
14622 end if
14623 call getbuf(titleq)
14624 else
14625 call getbuf(compoq)
14626 end if
14627 inhead = inhead+inbothd
14628 iccount = 128
14629 else if (charq .eq. 'A') then
14630 c
14631 c Accidental handling etc.
14632 c
14633 27 call getchar(lineq,iccount,durq)
14634 if (durq .eq. 'r') then
14635 if (islast) then
14636 relacc = .true.
14637 write(11,'(a)')sq//'relativeaccid%'
14638 end if
14639 else if (durq .eq. 's') then
14640 bacfac = 1.e6
14641 else if (durq .eq. 'b') then
14642 if (islast) write(11,'(a)')sq//'bigaccid%'
14643 accfac = bacfac
14644 else if (durq .eq. 'a') then
14645 call getchar(lineq,iccount,durq)
14646 call readnum(lineq,iccount,durq,fnum)
14647 iccount = iccount-1
14648 else if (durq .eq. 'i') then
14649 call getchar(lineq,iccount,durq)
14650 call readnum(lineq,iccount,durq,tintstf)
14651 if (.not.firstgulp) fintstf = tintstf
14652 c
14653 c Local corrections for first page were handled by pmxa
14654 c
14655 iccount = iccount-1
14656 else if (durq .eq. 'I') then
14657 call getchar(lineq,iccount,durq)
14658 call readnum(lineq,iccount,durq,gintstf)
14659 iccount = iccount-1
14660 else if (durq .eq. 'd') then
14661 lowdot = .true.
14662 else if (durq .eq. 'o') then
14663 continue
14664 else if (durq .eq. 'S') then
14665 do 50 iiv = 1 , noinst
14666 call getchar(lineq,iccount,durq)
14667 if (index('-s',durq) .gt. 0) then
14668 fullsize(iiv) = 0.8
14669 else if (durq .eq. 't') then
14670 fullsize(iiv) = 0.64
14671 else
14672 c fullsize(ivx) = 1.0
14673 fullsize(iiv) = 1.0
14674 end if
14675 50 continue
14676 else if (durq .eq. 'e') then
14677 c
14678 c Line-spacing equalization
14679 c
14680 equalize = .true.
14681 c
14682 c The following redefinition of \parskip was put into pmx.tex in version 2.25 or so.
14683 c But it causes problems with some older scores and when excerpts are combined
14684 c with LaTeX. So as of 2.352 we write it here.
14685 c
14686 write(11,'(a)')sq//'global'//sq//'parskip 0pt plus 12'//sq
14687 * //'Interligne minus 99'//sq//'Interligne%'
14688 tempq = sepsymq(1)
14689 lentemp = 1
14690 do 51 iiv = 2 , nv-1
14691 tempq = tempq(1:lentemp)//sepsymq(iiv)
14692 lentemp = lentemp+1
14693 51 continue
14694 write(11,'(a)')sq//'def'//sq//'upstrut{'//sq//'znotes'
14695 * //tempq(1:lentemp)//sq//'zcharnote{'//sq//'upamt}{~}'
14696 * //sq//'en}%'
14697 else if (durq .eq. 'v') then
14698 c
14699 c Toggle usevshrink
14700 c
14701 usevshrink = .not.usevshrink
14702 else if (durq .eq.'p') then
14703 c
14704 c Postscript slurs. fontslur is already false (set in g1etnote)
14705 c
14706 if (.not.WrotePsslurDefaults) then
14707 c
14708 c Set postscrirpt slur adjustment defaults
14709 c
14710 write(11,'(a)')sq//'Nosluradjust'//sq//'Notieadjust'
14711 * //sq//'nohalfties'
14712 WrotePsslurDefaults = .true.
14713 end if
14714 52 continue
14715 call g1etchar(lineq,iccount,durq) ! might be "+", "-", "h" or "l"
14716 if (index('+-',durq) .gt. 0) then
14717 c
14718 c Characters to change defaults for ps slurs
14719 c
14720 call g1etchar(lineq,iccount,charq) ! charq will be "s,t,h,c"
14721 if (durq .eq. '+') then
14722 if (charq .eq. 's') then
14723 write(11,'(a)')sq//'Sluradjust'
14724 else if (charq .eq. 't') then
14725 write(11,'(a)')sq//'Tieadjust'
14726 else if (charq .eq. 'h') then
14727 write(11,'(a)')sq//'halfties'
14728 else
14729 SlurCurve = SlurCurve + 1
14730 if (SlurCurve .gt. 3.1) then
14731 call printl('WARNING!')
14732 call printl
14733 * ('Default slur curvature advanced past HH, resetting')
14734 SlurCurve = 3
14735 end if
14736 end if
14737 else
14738 if (charq .eq. 's') then
14739 write(11,'(a)')sq//'Nosluradjust'
14740 else if (charq .eq. 't') then
14741 write(11,'(a)')sq//'Notieadjust'
14742 else if (charq .eq. 'h') then
14743 write(11,'(a)')sq//'nohalfties'
14744 else
14745 SlurCurve = SlurCurve - 1
14746 if (SlurCurve .lt. -1.1) then
14747 call printl('WARNING!')
14748 call printl(
14749 * 'Default slur curvature decremented below f, resetting')
14750 SlurCurve = -1
14751 end if
14752 end if
14753 end if
14754 go to 52 ! Check for another set of default changes
14755 else if (durq .eq. 'l') then
14756 c
14757 c Set optional linebreak ties
14758 c
14759 OptLineBreakTies = .true.
14760 go to 52
14761 else if (durq .eq. 'h') then
14762 c
14763 c Set flag to write header special on every page
14764 c
14765 HeaderSpecial = .true.
14766 go to 52
14767 else
14768 iccount = iccount-1
14769 end if
14770 else if (durq .eq. 'K') then
14771 c
14772 c Toggle keyboard rest placement flag
14773 c
14774 kbdrests = .not.kbdrests
14775 else if (durq .eq. 'c') then
14776 call g1etchar(lineq,iccount,durq)
14777 c
14778 c Just eat the input; it was used in pmxa
14779 c
14780 go to 27
14781 else if (durq .eq. 'V') then
14782 bottopgap = .true.
14783 topamt = 0.
14784 call getchar(lineq,iccount,durq)
14785 pmfac = index('- +',durq)-2
14786 call g1etchar(lineq,iccount,durq)
14787 call readnum(lineq,iccount,durq,botamt)
14788 botamt = botamt*pmfac
14789 pmfac = index('- +',durq)-2
14790 call g1etchar(lineq,iccount,durq)
14791 call readnum(lineq,iccount,durq,topamt)
14792 topamt = topamt*pmfac
14793 iccount = iccount-1
14794 go to 27
14795 end if
14796 if (index('NR',durq) .gt. 0) then
14797 c
14798 c Override default part names for scor2prt, or normal include file.
14799 c Just bypass rest of input line
14800 c
14801 iccount = 128
14802 else if (durq .eq. 'B') then
14803 bigslope = .true.
14804 if (lineq(iccount+1:iccount+1) .eq. 'f') then
14805 novbm = .true.
14806 iccount = iccount+1
14807 else
14808 write(11,'(a)')sq//'input musixvbm'
14809 end if
14810 go to 27
14811 else if (durq .ne. ' ') then
14812 go to 27
14813 end if
14814 else if (charq .eq. 'K') then
14815 77 continue
14816 call getchar(lineq,iccount,durq)
14817 if (durq .eq. 'n') then
14818 ignorenats = .true.
14819 go to 77
14820 end if
14821 if (durq .ne. 'i') then
14822 c
14823 c Normal, full-score key change and/or transposition
14824 c
14825 num1 = 44-ichar(durq)
14826 iccount = iccount+1
14827 call readnum(lineq,iccount,durq,fnum)
14828 num1 = num1*nint(fnum)
14829 c
14830 c On exit, durq='+','-'. But only need isig if after start, else done in pmxa
14831 c
14832 iccount = iccount+1
14833 call readnum(lineq,iccount,charq,fnum)
14834 if (ismidi) then
14835 midisig = nint(fnum)
14836 if (durq.eq.'-') midisig = -midisig
14837 c 130317
14838 midisig = midisig+idsig
14839 call midievent('k',midisig,0)
14840
14841 end if
14842 if (num1 .eq. 0) then
14843 c
14844 c Key change, not transposition.
14845 c
14846 ipl(ivx,nnl(ivx)+1) = ibset(ipl(ivx,nnl(ivx)+1),28)
14847 lastisig = isig
14848 isig = nint(fnum)
14849 if (durq .eq. '-') isig = -isig
14850 isig = isig+idsig
14851 if (ismidi) call midievent('k',isig,0)
14852 else
14853 c
14854 c num1 .ne. 0, so transposition, so must be at beginning. isig came with K...
14855 c but was passed to pmxb through pmxtex.dat. isig0 comes from setup data
14856 c (signature before transposition). idsig must be added to future key changes.
14857 c
14858 jv = 0
14859 do while (jv .lt. nm)
14860 jv = jv+1
14861 iTransAmt(jv) = num1
14862 end do
14863 idsig = isig-isig0
14864 end if
14865 else
14866 c
14867 c Instrument specific transposition.
14868 c
14869 call GetiTransInfo(.false.,ibarcnt,lineq,iccount,
14870 * ibaroff,nbars,noinst)
14871 c
14872 c The sig parameters will have been set 1st time but that's OK
14873 c
14874 end if
14875 else if (charq .eq. chax(47)) then
14876 if (btest(iornq(ivx,nnl(ivx)+1),26)) then
14877 c
14878 c There was a hardspace followed by end of block. Remove it from the hardspace
14879 c list, store with shifts instead, set special bit. This code also at '|'
14880 c
14881 irest(ivx,nnl(ivx)) = ibset(irest(ivx,nnl(ivx)),18)
14882 nudoff(ivx) = nudoff(ivx)+1
14883 udoff(ivx,nudoff(ivx)) = udsp(nudsp)
14884 nudsp = nudsp-1
14885 iornq(ivx,nnl(ivx)+1) = ibclr(iornq(ivx,nnl(ivx)+1),26)
14886 end if
14887 call getchar(lineq,iccount,durq)
14888 c
14889 c Save ending note level:
14890 c
14891 if (ivx .le. nv) then
14892 c
14893 c This is the first line of music on this staff. If previous block had only 1
14894 c voice, save last pitch from line 1 of prev. block to line 2, in case a
14895 c 2nd line is started just below
14896 c
14897 if (.not.was2(iv)) ndlev(iv,2) = ndlev(iv,1)
14898 was2(iv) = .false.
14899 ndlev(iv,1) = lastlev
14900 else
14901 c
14902 c This is the 2nd line of music on this staff.
14903 c
14904 was2(iv) = .true.
14905 ndlev(iv,2) = lastlev
14906 end if
14907 if (durq .eq. ' ' .and. iv.eq.nv) then
14908 c
14909 c End of input block
14910 c
14911 loop = .false.
14912 else
14913 c
14914 c Start a new line of music
14915 c
14916 if (lenb0.ne.0 .and. firstgulp) lenbar = lenb0
14917 nbars = 0
14918 if (durq .eq. ' ') then
14919 c
14920 c New line of music is on next staff
14921 c
14922 iv = iv+1
14923 ivx = iv
14924 else
14925 c
14926 c durq must be 2nd '/'. New line of music is on same staff. Set up for it
14927 c
14928 ivx = nv+1
14929 do 23 iiv = 1 , nv
14930 if (nvmx(iiv) .eq. 2) ivx = ivx+1
14931 23 continue
14932 nvmx(iv) = 2
14933 ivmx(iv,2) = ivx
14934 itsofar(ivx) = 0
14935 nnl(ivx) = 0
14936 nfb(ivx) = 0
14937 nudoff(ivx) = 0
14938 ndotmv(ivx) = 0
14939 do 24 j = 1 , 200
14940 irest(ivx,j) = 0
14941 islur(ivx,j) = 0
14942 nacc(ivx,j) = 0
14943 iornq(ivx,j) = 0
14944 ipl(ivx,j) = 0
14945 mult(ivx,j) = 0
14946 24 continue
14947 c
14948 c Go back and lower the rests in voice "a" that don't have over-ridden heights
14949 c
14950 do 26 j = 1 , nnl(iv)
14951 if (btest(irest(iv,j),0) .and. nolev(iv,j).eq.0)
14952 * nolev(iv,j) = -4
14953 26 continue
14954 end if
14955 end if
14956 iccount = 128
14957 else if (charq .eq. 'X') then
14958 c
14959 c 3rd arg is only for termination of group shifts. Use "max" to avoid zero index,
14960 c which only happens for normal X at block start, and we took special measures to
14961 c keep group shifts for crossing block boundaries.
14962 c
14963 call getx(lineq,iccount,irest(ivx,max(1,nnl(ivx))),
14964 * shifton,wheadpt,iornq(ivx,nnl(ivx)+1),ivx,
14965 * irest(ivx,nnl(ivx)+1),itsofar(ivx),0,0,0,' ',ndoub)
14966 else if (charq .eq. 'I') then
14967 c
14968 c Midi controls.
14969 c
14970 call getmidi(noinst,lineq,iccount,ibarcnt,ibaroff,nbars,lenbar,
14971 * mtrdenl,nv,.false.)
14972 else if (charq .eq. 'M') then
14973 c
14974 c Macro action
14975 c
14976 call getchar(lineq,iccount,charq)
14977 if (index('RS',charq) .gt. 0) then
14978 c
14979 c Record or save a macro. Get the number of the macro.
14980 c
14981 call getchar(lineq,iccount,durq)
14982 call readnum(lineq,iccount,durq,fnum)
14983 macnum = nint(fnum)
14984 macuse = ibset(macuse,macnum)
14985 if (charq .eq. 'R') then
14986 call mrec1(lineq,iccount,ndxm)
14987 else
14988 c
14989 c Save (Record but don't activate)
14990 c
14991 5 call mrec1(lineq,iccount,ndxm)
14992 if (mrecord) then
14993 call getbuf(lineq)
14994 iccount = 0
14995 go to 5
14996 end if
14997 iccount = iccount+ndxm+1
14998 end if
14999 else if (charq .eq. 'P') then
15000 c
15001 c Playback the macro
15002 c
15003 call getchar(lineq,iccount,charq)
15004 call readnum(lineq,iccount,durq,fnum)
15005 macnum = nint(fnum)
15006 icchold = iccount
15007 lnholdq = lineq
15008 iccount = 128
15009 ilmac = il1mac(macnum)
15010 mplay = .true.
15011 end if
15012 else if (index(',.',charq) .gt. 0) then
15013 c
15014 c Continued rhythmic shortcut
15015 c
15016 idotform = index('. ,',charq)
15017 if (idotform .eq. 1) then
15018 c
15019 c Check for start of forced beam on 2nd member of dotform=1 shortcut
15020 c
15021 if (fbon) then
15022 if (t1fb(ivx,nfb(ivx)).eq.itsofar(ivx))
15023 * t1fb(ivx,nfb(ivx)) =
15024 * t1fb(ivx,nfb(ivx))+nodur(ivx,nnl(ivx))/2
15025 end if
15026 c
15027 c Change duration of prior note
15028 c
15029 itsofar(ivx) = itsofar(ivx)-nodur(ivx,nnl(ivx))
15030 nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx))*3/2
15031 itsofar(ivx) = itsofar(ivx)+nodur(ivx,nnl(ivx))
15032 end if
15033 idotform = idotform+1
15034 numnum = 1
15035 cdot = .true.
15036 go to 1
15037 end if
15038 return
15039 end
15040 subroutine getorn(lineq,iccount,iornq,iornq0,ornrpt,noffseg,
15041 * ip,ivx,noxtup,notcrd,nole)
15042 c
15043 c iornq: Main note. Do not alter if chord note, except turn on bit 23
15044 c iornq0: Store iorni + bit 23, in case of repeated ornaments
15045 c iorni: Internal use, 1st 21 bits of iornq or icrdorn, dep. on notcrd.
15046 c noffseg: horiz. offset for segno
15047 c nole: level of note w/ orn, used to ID the note/orn if there's a level shift.
15048 c
15049
15050 common /comivxudorn/ivxudorn(63)
15051 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
15052 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
15053 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
15054 common /comcb/ nbc,ibcdata(36)
15055 character*1 charq,durq
15056 character*128 lineq
15057 logical ornrpt,negseg,noxtup,notcrd
15058 c
15059 c Bits 0-13: (stmgx+Tupf._), 14: Down fermata, was F, 15: Trill w/o "tr", was U
15060 c 16-18 Editorial sharp, flat, natural "oes,f,n"; 19-20: >^, 21 ? for ed. accid.
15061 c
15062 call getchar(lineq,iccount,charq)
15063 if (index('bc',charq) .gt. 0) then
15064 c
15065 c caesura or breath, handle specially and exit. Set up data in ibcdata(1...nbc)
15066 c ivx(0-3,28), ip(4-12),
15067 c vshift (vshift+32 in bits 13-18),
15068 c hshift (nint(10*vshift)+128 in bits 19-26)
15069 c bit 27 = 0 if caesura, 1 if breath
15070 c bit 28: 5th bit of ivx
15071 c
15072 iornq = ibset(iornq,28)
15073 nbc = nbc+1
15074 ibcdata(nbc) = mod(ivx,16)+16*ip
15075 if (ivx.ge.16) ibcdata(nbc) = ibset(ibcdata(nbc),28)
15076 if (charq .eq. 'b') ibcdata(nbc) = ibset(ibcdata(nbc),27)
15077 call getchar(lineq,iccount,durq)
15078 if (index('+-',durq) .gt. 0) then
15079 c
15080 c We have a vertical shift, get it
15081 c
15082 iccount = iccount+1
15083 call readnum(lineq,iccount,charq,fnum)
15084 if (durq .eq. '-') fnum=-fnum
15085 call setbits(ibcdata(nbc),6,13,nint(32+fnum))
15086 if (index('+-',charq) .gt. 0) then
15087 c
15088 c Horizontal shift, get it
15089 c
15090 iccount = iccount+1
15091 call readnum(lineq,iccount,durq,fnum)
15092 if (charq .eq. '-') fnum=-fnum
15093 call setbits(ibcdata(nbc),8,19,nint(10*fnum)+128)
15094 end if
15095 end if
15096 return
15097 end if
15098 c
15099 c Set signal on main note that some note at this time has ornament. ONLY used
15100 c in beamstrt to activate further tests for whether ihornb is needed.
15101 c
15102 iornq = ibset(iornq,23)
15103 c
15104 c Isolate 21 bits defining exisiting ornaments
15105 c
15106 if (notcrd) then
15107 c iorni = iand(4194303,iornq)
15108 c iorni = iand(541065215,iornq)
15109 iorni = iand(1614807039,iornq)
15110 else
15111 iorni = iand(4194303,icrdorn(ncrd))
15112 end if
15113 c korn = index('stmgx+Tupf._)e:XXX>^',charq)
15114 korn = index('stmgx+Tupf._)e:XXX>^XXXXXXXXCG',charq)
15115 if (korn .ne. 15) iorni = ibset(iorni,korn)
15116 c
15117 c Note that korn=0 => charq='(', and we set bit 0. if "e" (14), alter later
15118 c as follows: korn=16-18 for sfn, and or 21 for bare ?.
15119 c When this if-block is done, korn will = bit# of actual ornament (unless "?").
15120 c
15121 if (korn .eq. 15) then
15122 c
15123 c Turn off repeated ornament ('o:'), Replicate bits 0-3,5-15,19-21,29 prev iornq
15124 c
15125 iorni = ior(iorni,iand(iornq0,1614348271))
15126 ornrpt = .false.
15127 call getchar(lineq,iccount,durq)
15128 c
15129 c durq will be ' '
15130 c
15131 else if (korn .eq. 14) then
15132 c
15133 c Editorial accidental
15134 c
15135 call getchar(lineq,iccount,durq)
15136 korn = 15+index('sfn?',durq)
15137 if (korn .eq. 19) korn=21
15138 iorni = ibset(ibclr(iorni,14),korn)
15139 call getchar(lineq,iccount,durq)
15140 if (durq .eq. '?') then
15141 c
15142 c This is "oe[s|f|n]?". Set 21st bit also.
15143 c
15144 iorni = ibset(iorni,21)
15145 korn = korn+6
15146 call getchar(lineq,iccount,durq)
15147 end if
15148 c iorni = ibset(ibclr(iorni,14),korn)
15149 else if (korn.eq.4 .and. noxtup) then
15150 c
15151 c segno. Check in pmxa for just 1/block & notcrd. Get horiz. offset in points
15152 c
15153 noffseg = 0
15154 negseg = .false.
15155 call getchar(lineq,iccount,durq)
15156 if (durq .ne. ' ') then
15157 c
15158 c Segno shift is specified
15159 c
15160 if (durq .eq. '-') then
15161 negseg = .true.
15162 call getchar(lineq,iccount,durq)
15163 end if
15164 call readnum(lineq,iccount,durq,fnum)
15165 noffseg = int(fnum)
15166 if (negseg) noffseg = -noffseg
15167 end if
15168 else if (korn .eq. 7) then
15169 c
15170 c Trill. Check in pmxa for notcrd. Default is 1 noteskip long, with "tr"
15171 c
15172 ntrill = ntrill + 1
15173 ivtrill(ntrill) = ivx
15174 iptrill(ntrill) = ip
15175 xnsktr(ntrill) = 1.
15176 call getchar(lineq,iccount,durq)
15177 if (durq .eq. 't') then
15178 c
15179 c Convert to new internal symbol for non-'"tr" trill
15180 c
15181 korn = 15
15182 iorni = ibset(ibclr(iorni,7),15)
15183 call getchar(lineq,iccount,durq)
15184 end if
15185 if (index('0123456789.',durq) .gt. 0) then
15186 c
15187 c We have a number for the length
15188 c
15189 call readnum(lineq,iccount,durq,xnsktr(ntrill))
15190 end if
15191 else if (korn.eq.10 .and. noxtup) then
15192 c
15193 c Fermata
15194 c
15195 call getchar(lineq,iccount,durq)
15196 if (durq .eq. 'd') then
15197 korn = 14
15198 iorni = ibset(ibclr(iorni,10),14)
15199 call getchar(lineq,iccount,durq)
15200 end if
15201 else
15202 call getchar(lineq,iccount,durq)
15203 end if
15204 if (index('+- :',durq) .eq. 0) then
15205 print*,'Unexpected character at end of ornament: ',durq
15206 call stop1()
15207 end if
15208 if (index('+-',durq) .gt. 0) then
15209 c
15210 c Shift ornament up or down
15211 c
15212 nudorn = nudorn+1
15213 c
15214 c Set bit 25 in iorni as a signal. This may not really be necessary.
15215 c
15216 iorni = ibset(iorni,25)
15217 c
15218 c Assemble info to put in kudorn(nudorn) Bits 0-7:ip, 8-11:ivx, 12-18:nolev,
15219 c 19-24: type of ornament to be shifted, 25-30: shift+32, 31:h-shft present
15220 c
15221 xofforn = 44-ichar(durq)
15222 iccount = iccount+1
15223 call readnum(lineq,iccount,durq,fnum)
15224 iofforn = nint(xofforn*fnum)
15225 kudorn(nudorn) = ip+ishft(mod(ivx,16),8)+ishft(nole,12)
15226 * +ishft(korn,19)+ishft(iofforn+32,25)
15227 ivxudorn(nudorn) = ivx
15228 if (index('+-',durq) .gt. 0) then
15229 c
15230 c Horizontal shift
15231 c
15232 kudorn(nudorn) = ibset(kudorn(nudorn),31)
15233 xofforn = 44-ichar(durq)
15234 iccount = iccount+1
15235 call readnum(lineq,iccount,durq,fnum)
15236 ornhshft(nudorn) = xofforn*fnum
15237 end if
15238 else if (durq .eq. ':') then
15239 c
15240 c Turn on repeated ornaments
15241 c
15242 ornrpt = .true.
15243 c
15244 c Save the ornament value just set
15245 c
15246 iornq0 = iorni
15247 end if
15248 if (notcrd) then
15249 iornq = ior(iornq,iorni)
15250 else
15251 icrdorn(ncrd) = ior(icrdorn(ncrd),iorni)
15252 end if
15253 return
15254 end
15255 subroutine getpmxmod(global,includeq)
15256 c
15257 c If global=.true., checks for environment variable with path to pmx.mod.
15258 c Then, if variable exists and points to pmx.mod, insert lines from
15259 c pmx.mod into buffer
15260 c If global=.false., checks for existence of includeq and uses it.
15261 c
15262 c lenbuf0 = total length of bufq on entry
15263 c lbuf(i) = length of line (i)
15264 c nlbuf = number of lines stored in bufq
15265 c ilbuf = index of first line after setup stuff (on entry). In general, index of
15266 c next line to be sucked from buffer.
15267 c ilbufmod = counter for lines in pmx.mod as they are grabbed.
15268 c Starts at ilbuf. Points to position of next line after
15269 c pmx.mod stuff in bufq on exiting loop 1
15270 c ilbuff = transient counter for shifting operations
15271 c ipbuf = on entry, points to last character in setup stuff. In general, points
15272 c to last character of most recent line sucked from buffer.
15273 c ipbufmod = points to last character of most recent inserted line
15274 c from pmx.mod
15275 c
15276 parameter (maxblks=9600,nm=24)
15277 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
15278 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
15279 logical lastchar,fbon,issegno,isheadr,isvolt
15280 character*(*)includeq
15281 character*80 pmxmoddirq
15282 character*128 lnholdq
15283 character*131072 bufq
15284 integer*2 lbuf(maxblks)
15285 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
15286 logical fexist,global
15287 line1pmxmod = ilbuf
15288 if (.not.global) then
15289 inquire(file=includeq,EXIST=fexist)
15290 c
15291 c Transfer includeq to temporary char variable with known length
15292 c
15293 pmxmoddirq = includeq
15294 lpmxmoddirq = lenstr(pmxmoddirq,80)
15295 print*
15296 write(15,'()')
15297 if (.not.fexist) then
15298 call printl('Could not find '//pmxmoddirq(1:lpmxmoddirq)
15299 * //', checking further.')
15300 c
15301 c File named includeq doesn't not exist. Get directory from PMXMODDIR and
15302 c see if it's there
15303 c
15304 call getenv('PMXMODDIR',pmxmoddirq)
15305 lpmxmoddirq = lenstr(pmxmoddirq,80)
15306 if (lpmxmoddirq. gt. 0) then
15307 pmxmoddirq = pmxmoddirq(1:lpmxmoddirq)//includeq
15308 lpmxmoddirq = lenstr(pmxmoddirq,80)
15309 else
15310 call printl(
15311 * 'No other directory defined by PMXMODDIR, stopping')
15312 call stop1()
15313 end if
15314 inquire(file=pmxmoddirq,EXIST=fexist)
15315 if (.not.fexist) then
15316 call printl('Could not find '//pmxmoddirq(1:lpmxmoddirq)
15317 * //', stopping.')
15318 call stop1()
15319 end if
15320 end if
15321 call printl('Opening normal include file '
15322 * //pmxmoddirq(1:lpmxmoddirq))
15323 open(18,file=pmxmoddirq)
15324 else
15325 c
15326 c Check for existence of pmx.mod
15327 c
15328 call getenv('PMXMODDIR',pmxmoddirq)
15329 lpmxmoddirq = lenstr(pmxmoddirq,80)
15330 if (lpmxmoddirq .eq. 0) return
15331 pmxmoddirq = pmxmoddirq(1:lpmxmoddirq)//'pmx.mod'
15332 lpmxmoddirq = lpmxmoddirq+7
15333 inquire(file=pmxmoddirq,EXIST=fexist)
15334 if (.not.fexist) return
15335 call printl('Opening global include file '
15336 * //pmxmoddirq(1:lpmxmoddirq))
15337 open(18,file=pmxmoddirq(1:lpmxmoddirq))
15338 end if
15339 call printl('Adding include data')
15340 c
15341 c Read lines in from pmx.mod one at a time
15342 c
15343 ipbufmod = ipbuf
15344 lenbufmod = lenbuf0
15345 do 1 ilbufmod = ilbuf , maxblks
15346 read(18,'(a)',end=3)lnholdq
15347 c
15348 c A line was read. Slide all existing lengths from here forward ahead by 1
15349 c
15350 do 2 ilbuff = nlbuf , ilbufmod , -1
15351 lbuf(ilbuff+1) = lbuf(ilbuff)
15352 2 continue
15353 c
15354 c Get length of line from include file
15355 c
15356 lenmodline = lenstr(lnholdq,128)
15357 if (lenmodline .eq. 0) then
15358 c
15359 c Blank line. Make it a single blank with length 1
15360 c
15361 lenmodline = 1
15362 lnholdq = ' '
15363 end if
15364 lbuf(ilbufmod) = lenmodline
15365 call printl(lnholdq(1:lenmodline))
15366 c
15367 c Insert new stuff into bufq
15368 c
15369 bufq = bufq(1:ipbufmod)//lnholdq(1:lenmodline)//
15370 * bufq(ipbufmod+1:lenbufmod)
15371 c
15372 c Update internal parameters
15373 c
15374 ipbufmod = ipbufmod+lbuf(ilbufmod)
15375 lenbufmod = lenbufmod+lbuf(ilbufmod)
15376 nlbuf = nlbuf+1
15377 1 continue
15378 3 continue
15379 call printl('Closing '//pmxmoddirq(1:lpmxmoddirq))
15380 close(18)
15381 linesinpmxmod = linesinpmxmod+ilbufmod-ilbuf
15382 lenbuf0 = lenbufmod
15383 c
15384 c Fix Andre's error reporting problem 101211 leading to log(neg#) due
15385 c to nline being 2 bigger than it should be
15386 c
15387 nline=nline-2
15388 c
15389 return
15390 end
15391 subroutine getset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,
15392 * xmtrnum0,npages,nsyst,musicsize,fracindent,istype0,
15393 * inameq,clefq,sepsymq,pathnameq,lpath,isig0)
15394 parameter (nm=24)
15395 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
15396 character*1 clefq(nm),sepsymq(nm),chax
15397 character*40 pathnameq
15398 character*79 inameq(nm)
15399 character*128 lineq
15400 logical istype0,newway,rename
15401 common /commidisig/ midisig
15402 c
15403 c Get the first line
15404 c
15405 iccount = 0
15406 9 call getbuf(lineq)
15407 if (lineq(1:1) .eq. '%') go to 9
15408 istype0 = lineq(1:3).eq.'---'
15409 if (istype0) then
15410 c
15411 c Have TeX input until next line that starts with '---'. Save in scratch.
15412 c
15413 open(17,status='SCRATCH')
15414 3 call getbuf(lineq)
15415 if (lineq(1:3) .ne. '---') then
15416 write(17,'(a)')lineq
15417 go to 3
15418 end if
15419 c
15420 c Force a new line read on first call to readin
15421 c
15422 iccount = 128
15423 end if
15424 c
15425 c Here, lineq is first line w/ numerical setup data.
15426 c
15427 nv = nint(readin(lineq,iccount,nline))
15428 noinst = nint(readin(lineq,iccount,nline))
15429 newway = noinst.le.0
15430 if (newway) noinst = -noinst
15431 do 2 iinst = 1 , noinst
15432 c
15433 c Seve # of staves per inst in case later drop some inst's.
15434 c
15435 if (newway) then
15436 c
15437 c Read in nvi for each instrument
15438 c
15439 nsperi(iinst) = nint(readin(lineq,iccount,nline))
15440 else if (iinst .gt. 1 ) then
15441 nsperi(iinst) = 1
15442 else
15443 nsperi(iinst) = nv-noinst+1
15444 end if
15445 iiorig(iinst) = iinst
15446 nspern(iinst) = nsperi(iinst)
15447 2 continue
15448 mtrnuml = nint(readin(lineq,iccount,nline))
15449 mtrdenl = nint(readin(lineq,iccount,nline))
15450 mtrnmp = nint(readin(lineq,iccount,nline))
15451 mtrdnp = nint(readin(lineq,iccount,nline))
15452 xmtrnum0 = readin(lineq,iccount,nline)
15453 c
15454 c Original key sig (before any trnasposition) in next position. Transposed
15455 c sig for topfile was transferred thru pmxtex.dat. Need isig0 for key
15456 c changes if transposed.
15457 c
15458 isig0 = nint(readin(lineq,iccount,nline))
15459 midisig = isig0
15460 npages = nint(readin(lineq,iccount,nline))
15461 nsyst = nint(readin(lineq,iccount,nline))
15462 musicsize = nint(readin(lineq,iccount,nline))
15463 fracindent = readin(lineq,iccount,nline)
15464 c
15465 c Next noinst non-comment lines are names of instruments.
15466 c
15467 do 4 i = 1 , noinst
15468 5 call getbuf(inameq(i))
15469 if (inameq(i)(1:1) .eq. '%') go to 5
15470 4 continue
15471 c
15472 c Next non-comment line has nv clef names
15473 c
15474 6 call getbuf(lineq)
15475 if (lineq(1:1) .eq. '%') go to 6
15476 iv = 0
15477 nvsofar = 0
15478 do 1 jinst = 1 , noinst
15479 nvsofar = nvsofar+nsperi(jinst)
15480 do 10 ivi = 1 , nsperi(jinst)
15481 iv = iv+1
15482 clefq(iv) = lineq(iv:iv)
15483 if (iv .eq. nvsofar) then
15484 sepsymq(iv) = '&'
15485 else
15486 sepsymq(iv) = '|'
15487 end if
15488 10 continue
15489 1 continue
15490 c
15491 c Mext non-comment line has path name
15492 c
15493 8 call getbuf(pathnameq)
15494 if (pathnameq(1:1) .eq. '%') go to 8
15495 lpath = index(pathnameq,' ')-1
15496 12 ipos = index(pathnameq,chax(92))
15497 if (ipos .gt. 0) then
15498 pathnameq(ipos:ipos)=chax(47)
15499 go to 12
15500 end if
15501 return
15502 end
15503 function getsquez(n,ntot,space,tnote,to)
15504 real*4 tnote(600),to(600)
15505 common /comtol/ tol
15506 c
15507 c Get the squez factor by checking space against tgovern=minimum duration
15508 c of all notes sounding at time of n-th note in the list.
15509 c The starting time of base increment is to(n) and ending time is to(n)+space
15510 c Sounding notes are those that start at or before to(n) .and. end at or
15511 c after tend=to(n)+space
15512 c Since notes are ordered by increasing start times, as soon as we find one
15513 c that starts too late, we are done checking.
15514 c
15515 tgovern = 1000.
15516 tend = to(n)+space
15517 do 1 in = 1 , ntot
15518 c
15519 c Since to() is ordered by start times, exit loop after first note that
15520 c starts later than note of interest.
15521 c
15522 if (to(in) .gt. to(n)+tol) go to 2
15523 if (to(in)+tnote(in) .gt. tend-tol) then
15524 c
15525 c If here, this note overlaps and must be tested.
15526 c
15527 tgovern = min(tgovern,tnote(in))
15528 end if
15529 1 continue
15530 2 continue
15531 getsquez = space/tgovern
15532 return
15533 end
15534 subroutine getx(lineq,iccount,irest,shifton,wheadpt,iornq1,ivx,
15535 * irest1,itsofar,ntup,itup,nnodur,dotq,ndoub)
15536 parameter(nm=24)
15537 c
15538 c Parse "X" commands. Ignore all "B"; "P" means to ignore whole symbol.
15539 c In scor2prt, must strip out "P", copy only "B" and "P"-type "X"-symbols.
15540 c Since during getnote phase time is integer itsofar, which is not updated
15541 c during xtups, we use itup and ntup to get actual time. On entry, ntup=0 if
15542 c not in xtup.
15543 c
15544 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
15545 logical shifton,colon,ess,number
15546 character*128 lineq
15547 character*1 charq,durq,dotq
15548 colon = .false.
15549 ess = .false.
15550 number = .false.
15551 nextbl = iccount+index(lineq(iccount:128),' ')-1
15552 if (index(lineq(iccount:nextbl),'P') .gt. 0) then
15553 c
15554 c "Parts only", ignore entire symbol
15555 c
15556 iccount = nextbl
15557 return
15558 end if
15559 1 call getchar(lineq,iccount,charq)
15560 if (charq.eq.'B') then
15561 c
15562 c "Both parts and score," ignore character
15563 c
15564 go to 1
15565 else if (charq .eq. ':') then
15566 colon = .true.
15567 go to 1
15568 else if (charq .eq. 'S') then
15569 ess = .true.
15570 go to 1
15571 else if (index('+-.0123456789',charq) .gt. 0) then
15572 number = .true.
15573 if (charq.eq.'-') iccount = iccount+1
15574 call readnum(lineq,iccount,durq,fnum)
15575 if (charq .eq. '-') fnum = -fnum
15576 if (durq .ne. 'p') then
15577 fnum = fnum*wheadpt
15578 iccount = iccount-1
15579 end if
15580 go to 1
15581 end if
15582 c
15583 c charq must be blank, so done parsing
15584 c
15585 if (.not.ess .and. .not.colon) then
15586 c
15587 c Ordinary hardspace. Goes before next note.
15588 c (Later, at "|" or "/", check for presence and switch to udoff if there!)
15589 c
15590 nudsp = nudsp+1
15591 iornq1 = ibset(iornq1,26)
15592 udsp(nudsp) = fnum
15593 tudsp(nudsp) = itsofar
15594 if (ntup .gt. 0) tudsp(nudsp) = tudsp(nudsp)
15595 * +float(itup-1+ndoub)/ntup*ifnodur(nnodur,dotq)
15596 else if (.not.number) then
15597 c
15598 c Must be "X:" End a group offset.
15599 c
15600 irest = ibset(irest,17)
15601 shifton = .false.
15602 return
15603 else
15604 c
15605 c Only other possibility is start offset, "S" for single, ':' for multiple
15606 c
15607 nudoff(ivx) = nudoff(ivx)+1
15608 udoff(ivx,nudoff(ivx)) = fnum
15609 if (ess) then
15610 irest1 = ibset(irest1,15)
15611 else
15612 irest1 = ibset(irest1,16)
15613 shifton = .true.
15614 end if
15615 end if
15616 return
15617 end
15618 function i1fnodur(idur,dotq)
15619 character*1 dotq
15620 if (idur .eq. 6) then
15621 i1fnodur=1
15622 else if (idur .eq. 3) then
15623 i1fnodur=2
15624 else if (idur .eq. 1) then
15625 i1fnodur=4
15626 else if (idur .eq. 8) then
15627 i1fnodur=8
15628 else if (idur .eq. 4) then
15629 i1fnodur=16
15630 else if (idur .eq. 2) then
15631 i1fnodur=32
15632 else if (idur .eq. 0) then
15633 i1fnodur=64
15634 else if (idur .eq. 16) then
15635 c
15636 c Only used for denominator of time signatures, not for notes
15637 c
15638 i1fnodur=4
15639 else if (idur .eq. 9) then
15640 i1fnodur = 128
15641 else
15642 print*
15643 print*,'You entered an invalid note-length value:',idur
15644 call stop1()
15645 end if
15646 if (dotq .eq. 'd') i1fnodur = i1fnodur*3/2
15647 return
15648 end
15649 function iashft(nacc)
15650 integer*4 ias(6)
15651 data ias /-1,1,0,0,-2,2/
15652 iashft = ias(nacc)
15653 return
15654 end
15655 function ifnodur(idur,dotq)
15656 character*1 dotq
15657 if (idur .eq. 6) then
15658 ifnodur=1
15659 else if (idur .eq. 3)then
15660 ifnodur=2
15661 else if(idur .eq. 1) then
15662 ifnodur=4
15663 else if(idur .eq. 8) then
15664 ifnodur=8
15665 else if(idur .eq. 4) then
15666 ifnodur=16
15667 else if(idur .eq. 2) then
15668 ifnodur=32
15669 else if(idur .eq. 0) then
15670 ifnodur=64
15671 else if(idur .eq. 9) then
15672 ifnodur=128
15673 else if (idur .eq. 16) then
15674 c
15675 c Only used for denominator of time signatures, not for notes
15676 c
15677 ifnodur=4
15678 else
15679 print*,'You entered an invalid note value'
15680 stop
15681 end if
15682 if (dotq .eq. 'd') ifnodur = ifnodur*3/2
15683 return
15684 end
15685 function ifnolev(noq,oct,ntrans)
15686 character*1 noq
15687 integer oct
15688 ifnolev = 7*oct+mod(ichar(noq)-92,7)+1+ntrans
15689 return
15690 end
15691 function igetbits(isdata,iwidbit,ishift)
15692 c
15693 c Extracts integer given by iwidbit bits of isdata, shifted by ishift, and
15694 c then added to ioff
15695 c
15696 igetbits = iand(2**iwidbit-1,ishft(isdata,-ishift))
15697 return
15698 end
15699 function igetvarlen(mmidi,icm,imidi,nbytes)
15700 c
15701 c Gets variable-length integer starting in mmidi at imidi+1. Returns nbytes.
15702 c
15703 parameter (nm=24,mv=24576)
15704 integer*2 mmidi(0:nm,mv)
15705 igetvarlen = 0
15706 do 1 nbytes = 1 , 4
15707 mmidi4 = mmidi(icm,imidi+nbytes)
15708 igetvarlen = 128*igetvarlen
15709 * +iand(127,mmidi4)
15710 if (.not.btest(mmidi4,7)) return
15711 1 continue
15712 print*,'Messup in igetvarlen'
15713 call stop1()
15714 end
15715 logical function isdotted(nodur,ivx,ip)
15716 parameter (nm=24)
15717 c
15718 c Function returns true if note is dotted or double-dotted.
15719 c Return false for any xtuplet.
15720 c
15721 common /comtol/ tol
15722 integer*4 nodur(nm,200)
15723 if (nodur(ivx,ip) .eq. 0) then
15724 isdotted = .false.
15725 return
15726 else if (ip .gt. 1) then
15727 if (nodur(ivx,ip-1) .eq. 0) then
15728 isdotted = .false.
15729 return
15730 end if
15731 end if
15732 c
15733 c Ruled out all xtups, so is dotted or double-dotted if not a power of 2.
15734 c
15735 isdotted =
15736 * mod(alog(float(nodur(ivx,ip)))/.69314718+.5*tol,1.) .gt. tol
15737 return
15738 end
15739 function isetvarlen(idur,nbytes)
15740 isetvarlen = 0
15741 itemp = idur
15742 do 1 nbytes = 1 , 4
15743 isetvarlen = isetvarlen + iand(itemp,127)*256**(nbytes-1)
15744 itemp = ishft(itemp,-7)
15745 if (itemp .gt. 0) then
15746 isetvarlen = isetvarlen+2**(8*nbytes+7)
15747 else
15748 return
15749 end if
15750 1 continue
15751 print*,'Problem in fn. isetvarlen'
15752 call stop1()
15753 end
15754 subroutine istring(i,string,len)
15755 c
15756 c Returns string with integer only if length is 1, otherwise enclosed in
15757 c brackets.
15758 c
15759 character*(*) string
15760 if (i .ne. 0) then
15761 len = alog10(abs(i)*1.0001)+1
15762 if (i .lt. 0) len = len+1
15763 else
15764 string = '0'
15765 len = 1
15766 return
15767 end if
15768 if (len .eq. 1) then
15769 string = char(48+i)
15770 else
15771 string = '{'
15772 write(string(2:1+len),'(i'//char(48+len)//')')i
15773 string = string(1:len+1)//'}'
15774 len = len+2
15775 end if
15776 return
15777 end
15778 function lenstr(string,n)
15779 character*(*) string
15780 do 1 lenstr = n , 1 , -1
15781 if (string(lenstr:lenstr) .ne. ' ') return
15782 1 continue
15783 lenstr = 0
15784 return
15785 end
15786 function levrn(nolev,irest,iud,ncm,mult)
15787 c
15788 c Used for placing numbers in xtups. Returns note level if not a rest,
15789 c else level of top or bottom of rest symbol opposite beam. iud=-1 for upstm.
15790 c
15791 logical btest
15792 if (.not.btest(irest,0)) then
15793 levrn = nolev
15794 else
15795 c
15796 c Restlevel is -4, 0, 2 or 100+offset. First get offset from 1-voice default.
15797 c
15798 if (mult .gt. 0) then
15799 if (mult .eq. 2) then
15800 ioff = -1+2*iud
15801 else if (mult .ne. 4) then
15802 ioff = iud*mult
15803 else
15804 ioff = 1+4*iud
15805 end if
15806 else
15807 c
15808 c May need to futz with this later for non-beamed xtups (quarter, half rests)
15809 c
15810 ioff = iud*2
15811 end if
15812 levrn = mod(nolev+20,100)-20+ncm+ioff
15813 endif
15814 return
15815 end
15816 function lfmt1(x)
15817 c
15818 c Computes total length of an "f" format with one decimal place.
15819 c First round to nearest 0.1
15820 c
15821 if (abs(x) .lt. .001) then
15822 lfmt1 = 2
15823 else
15824 y = sign(.1*int(10*abs(x)+.5),x)
15825 lfmt1 = int(log10(1000*abs(y)+.001))
15826 if (y .lt. 0) lfmt1 = lfmt1+1
15827 end if
15828 return
15829 end
15830 subroutine LineBreakTies(isdat1,isdat2,isdat3,isdat4,nsdat,
15831 * ispstie,sepsymq)
15832 parameter (nm=24)
15833 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
15834 * ,WrotePsslurDefaults,SlurCurve
15835 common /comoct/ noctup
15836 integer*4 isdat1(202),isdat2(202),isdat3(202),isdat4(202)
15837 logical fontslur,WrotePsslurDefaults,btest,upslur,ispstie,tie
15838 character*1 udq,chax,sepsymq(nm)
15839 character*8 noteq
15840 character*128 notexq
15841 c
15842 c This is called twice from pmxb after having input an entire block, before
15843 c making a bar that starts a new system. So nsdat reflects all slur starts
15844 c and stops in new block, while listslur, which is only set when bars are
15845 c made, reflects only open slurs from the old block. So we must check
15846 c listslur to find open ties, not all nsdat.
15847 c First of two calls (ispstie=.false. on entry) terminates tie at end of line.
15848 c Second (ispstie=.true. on entry) restarts tie at start of new line. Only
15849 c need data from original tie-start for both of these. Tie/slur data from
15850 c closing of full tie are not used except for shape alterations.
15851 c
15852 do 1 ndx = 0 , 23
15853 if (btest(listslur,ndx)) then
15854 c
15855 c Slur or tie with index ndx is open. Find the one with right ndxb, see if tie
15856 c
15857 do 2 isdat = 1 , nsdat
15858 if (igetbits(isdat1(isdat),4,28)
15859 * +16*igetbits(isdat1(isdat),1,18) .ne. ndx) go to 2 ! Wrong index
15860 if (.not.btest(isdat1(isdat),11)) go to 2 ! Bypass if stop
15861 if (btest(isdat2(isdat),3)) go to 3 ! "st"
15862 idcode = igetbits(isdat1(isdat),7,19)
15863 if (idcode.eq.1) go to 3 ! "t"
15864 tie = .false.
15865 go to 5
15866 2 continue
15867 end if
15868 go to 1
15869 3 continue
15870 tie = .true.
15871 5 continue
15872 c
15873 c A slur or tie is open, with index ndx
15874 c
15875 iv = igetbits(isdat1(isdat),5,13)
15876 kv = igetbits(isdat1(isdat),1,12)+1
15877 udq = 'd'
15878 if (btest(isdat1(isdat),27)) udq='u'
15879 notexq = chax(92)//'znotes'
15880 lnote = 7
15881 do 4 iiv = 1 , iv-1
15882 notexq = notexq(1:lnote)//sepsymq(iiv)
15883 lnote = lnote+1
15884 4 continue
15885 if (kv .eq. 2) then
15886 notexq = notexq(1:lnote)//chax(92)//'nextvoice'
15887 lnote = lnote+10
15888 end if
15889 c
15890 c Compute horiz and vert offsets
15891 c
15892 islhgt = igetbits(isdat3(isdat),8,14)
15893 ilb12 = 0
15894 if (ispstie) ilb12 = 1
15895 ivoff = igetbits(isdat4(isdat),6,ilb12*16)-32
15896 if (ivoff .eq. -32) ivoff = 0
15897 islhgt = islhgt+ivoff
15898 ihoff = (igetbits(isdat4(isdat),7,ilb12*16+6)-64) ! This is 10X hoff
15899 if (ihoff .eq. -64) ihoff = 0
15900 c
15901 c Add starting stuff for command
15902 c
15903 if (.not.ispstie) then ! End 1st segment
15904 notexq = notexq(1:lnote)//chax(92)//'roffset{'
15905 lnote = lnote+9
15906 hoff = ihoff*.1-.4
15907 if (hoff .lt. 0) then
15908 hoff = -hoff
15909 notexq = notexq(1:lnote)//'-'
15910 lnote = lnote+1
15911 end if
15912 call writflot(hoff,notexq,lnote)
15913 notexq = notexq(1:lnote)//'}{'
15914 lnote = lnote+2
15915 else
15916 notexq = notexq(1:lnote)//chax(92)//'off{-'
15917 * //chax(92)//'afterruleskip}'
15918 lnote = lnote+21
15919 c
15920 c 091025 add dotting for 2nd segment if needed
15921 c
15922 if (btest(isdat2(isdat),4)) then
15923 notexq = chax(92)//'dotted'//notexq(1:lnote)
15924 lnote = lnote+7
15925 end if
15926 end if
15927 if (ispstie .and. tie) then
15928 notexq = notexq(1:lnote)//chax(92)//'tieforis'//udq
15929 lnote = lnote+10
15930 end if
15931 if (btest(isdat3(isdat),0)) then
15932 c
15933 c Curvature tweak on termination of 1st seg
15934 c
15935 imid = igetbits(isdat3(isdat),6,2)-32
15936 c
15937 c Invoke macro (from pmx.tex) that redefines \tslur as r'qd. mapping:
15938 c Abs(imid) Postscript slur type
15939 c 1 f
15940 c 4 h
15941 c 5 H
15942 c 6 HH
15943 c
15944 notexq = notexq(1:lnote)//chax(92)//'psforts'//chax(48+imid)
15945 lnote = lnote+9
15946 c
15947 c Zero out the flag in case there's a different curv on term of 2nd,
15948 c
15949 isdat3(isdat) = ibclr(isdat3(isdat),0)
15950 end if
15951 c
15952 c Add the command name
15953 c
15954 if (ispstie) then
15955 notexq = notexq(1:lnote)//chax(92)//'is'//udq
15956 lnote = lnote+4
15957 else if (tie) then
15958 notexq = notexq(1:lnote)//chax(92)//'ttie'
15959 lnote = lnote+5
15960 else
15961 notexq = notexq(1:lnote)//chax(92)//'tslur'
15962 lnote = lnote+6
15963 end if
15964 c
15965 c Add index
15966 c
15967 if (23-ndx .lt. 10) then
15968 notexq = notexq(1:lnote)//chax(71-ndx)
15969 lnote = lnote+1
15970 else if (23-ndx .lt. 20) then
15971 notexq = notexq(1:lnote)//'{1'//chax(61-ndx)//'}'
15972 lnote = lnote+4
15973 else
15974 notexq = notexq(1:lnote)//'{2'//chax(51-ndx)//'}'
15975 lnote = lnote+4
15976 end if
15977 if (ispstie .or. .not.tie) then
15978 c
15979 c Add note name for slur height
15980 c
15981 noctup = 0
15982 ncm = igetbits(isdat3(isdat),8,22)
15983 if (ncm .eq. 23) noctup = -2
15984 call notefq(noteq,lnoten,islhgt,ncm)
15985 notexq = notexq(1:lnote)//'{'//noteq(1:lnoten)//'}'
15986 lnote = lnote+1+lnoten+1
15987 end if
15988 if (ispstie) then
15989 c
15990 c Horizontal shift start of new thing
15991 c
15992 notexq = notexq(1:lnote)//'{'
15993 lnote = lnote+1
15994 if (tie) then
15995 ihoff = ihoff-12
15996 else
15997 ihoff = ihoff-7
15998 end if
15999 if (ihoff .lt. 0) then
16000 ihoff = -ihoff
16001 notexq = notexq(1:lnote)//'-'
16002 lnote = lnote+1
16003 end if
16004 call writflot(ihoff*.1,notexq,lnote)
16005 notexq = notexq(1:lnote)//'}'
16006 lnote = lnote+1
16007 end if
16008 c
16009 c Add closing stuff
16010 c
16011 if (ispstie) then
16012 notexq = notexq(1:lnote)//chax(92)//'off{'
16013 * //chax(92)//'afterruleskip}'
16014 lnote = lnote+20
16015 else
16016 notexq = notexq(1:lnote)//'}'
16017 lnote = lnote+1
16018 end if
16019 notexq = notexq(1:lnote)//chax(92)//'en%'
16020 lnote = lnote+4
16021 write(11,'(a)')notexq(1:lnote)
16022 1 continue
16023 ispstie = .not.ispstie
16024 return
16025 end
16026 subroutine littex(islur,nnl,iv,topmods,lineq,iccount)
16027 parameter (nm=24)
16028 common /comlast/ islast,usevshrink
16029 logical islast,usevshrink
16030 integer islur(nm,200)
16031 logical topmods
16032 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
16033 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
16034 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
16035 * graspace(37),
16036 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
16037 * naccg(74),voltxtq(6),litq(83)
16038 logical upg,slurg,slashg,merge
16039 character*128 lineq,litq
16040 character*20 voltxtq
16041 character*1 durq,chax
16042 merge = .false.
16043 if (nlit .gt. 0) then
16044 merge = iv.eq.ivlit(nlit) .and. nnl.eq.iplit(nlit)
16045 end if
16046 nlit = nlit+1
16047 ivlit(nlit) = iv
16048 iplit(nlit) = nnl
16049 itype = 1
16050 17 call getchar(lineq,iccount,durq)
16051 if (durq .eq. chax(92)) then
16052 itype=itype+1
16053 go to 17
16054 end if
16055 litq(nlit) = chax(92)//durq
16056 lenlit(nlit) = 2
16057 18 call getchar(lineq,iccount,durq)
16058 if (durq.eq.chax(92)) then
16059 call getchar(lineq,iccount,durq)
16060 if (durq .ne. ' ') then
16061 c
16062 c Starting a new tex command within the string
16063 c
16064 litq(nlit) = litq(nlit)(1:lenlit(nlit))//chax(92)//durq
16065 lenlit(nlit) = lenlit(nlit)+2
16066 go to 18
16067 end if
16068 else
16069 litq(nlit) = litq(nlit)(1:lenlit(nlit))//durq
16070 lenlit(nlit) = lenlit(nlit)+1
16071 go to 18
16072 end if
16073 c
16074 c If here, just read backslash-blank so string is done
16075 c
16076 if (itype .eq. 1) then
16077 islur(iv,nnl) = ibset(islur(iv,nnl),16)
16078 if (merge) then
16079 c
16080 c There are 2 separate strings on the same note, so merge them.
16081 c
16082 nlit = nlit-1
16083 litq(nlit) = litq(nlit)(1:lenlit(nlit))
16084 * //litq(nlit+1)(1:lenlit(nlit+1))
16085 lenlit(nlit) = lenlit(nlit)+lenlit(nlit+1)
16086 if (lenlit(nlit) .gt. 128) then
16087 print*
16088 print*,
16089 * 'Merged type-1 TeX strings longer than 128 characters'
16090 write(15,'(/,a)')
16091 * 'Merged type-1 TeX strings longer than 128 characters'
16092 call stop1()
16093 end if
16094 end if
16095 else
16096 c
16097 c Type 2 or 3.
16098 c
16099 if (itype .eq. 3) then
16100 c
16101 c Write the string NOW
16102 c
16103 if (islast)
16104 * write(11,'(a)')litq(nlit)(1:lenlit(nlit))//'%'
16105 else
16106 c
16107 c Must go at top
16108 c
16109 if (.not.topmods) then
16110 topmods = .true.
16111 open(16,status='SCRATCH')
16112 end if
16113 c
16114 c Must write '%' here rather than later, in case string ends with blank.
16115 c
16116 write(16,'(a)')litq(nlit)(1:lenlit(nlit))//'%'
16117 end if
16118 nlit = nlit-1
16119 end if
16120 return
16121 end
16122 function llen(strq,n)
16123 character*129 strq
16124 do 1 llen = n , 0 , -1
16125 if (strq(llen:llen) .ne. ' ') return
16126 1 continue
16127 end
16128 function log2(n)
16129 c
16130 c 5/25/08 Modify to allow more slurs
16131 c
16132 log2 = dlog(1.d0*n)/0.693147181d0+.00000002d0
16133 return
16134 end
16135 subroutine logbeam(numnew,nip1,nip2)
16136 parameter (nm=24)
16137 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
16138 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
16139 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
16140 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
16141 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
16142 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
16143 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
16144 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
16145 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
16146 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
16147 * tautofb,autofbon,t1autofb
16148 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
16149 character*1 ulq,sepsymq,sq,ulfq,ulfbq
16150 logical beamon,firstgulp,figbass,figchk,isfig,isxtup,btest,
16151 * autofbon
16152 ibm1(ivx,numnew) = nip1
16153 ibm2(ivx,numnew) = nip2
16154 numnow = numnew
16155 if (numnew .gt. 1) then
16156 c
16157 c If it starts before any others, must put it in order
16158 c
16159 do 11 ib = numnew-1 , 1 , -1
16160 if (ibm1(ivx,ib) .lt. nip1) go to 12
16161 ibm1(ivx,ib+1) = ibm1(ivx,ib)
16162 ibm2(ivx,ib+1) = ibm2(ivx,ib)
16163 ulq(ivx,ib+1) = ulq(ivx,ib)
16164 ibm1(ivx,ib) = nip1
16165 ibm2(ivx,ib) = nip2
16166 numnow = ib
16167 11 continue
16168 12 continue
16169 end if
16170 sum = 0.
16171 c
16172 c Beam has non-xtup within
16173 c
16174 nrests = 0
16175 isxtup = .false.
16176 do 9 iip = nip1 , nip2
16177 if (btest(islur(ivx,nip1),21)) then
16178 c
16179 c Forced multiplicity
16180 c
16181 call setbits(mult(ivx,iip),4,0,
16182 * igetbits(islur(ivx,nip1),3,22)+8)
16183 else if (.not.isxtup) then
16184 if (nodur(ivx,iip) .gt. 0) then
16185 call setbits(mult(ivx,iip),4,0,4-log2(nodur(ivx,iip))+8)
16186 else
16187 c
16188 c Start xtup within forced beam
16189 c
16190 isxtup = .true.
16191 iip1 = iip
16192 end if
16193 else if (isxtup .and. nodur(ivx,iip).gt.0) then
16194 c
16195 c End of xtup within forced beam. Must count doubled notes
16196 c
16197 ndoub = 0
16198 do 1 iiip = iip1 , iip
16199 if (btest(nacc(ivx,iiip),18)) ndoub = ndoub+1
16200 1 continue
16201 multx = int(10.5+2.929+(0.952*alog(1.+iip-iip1+ndoub)-
16202 * alog(nodur(ivx,iip)/2.))/0.69315)-10
16203 do 74 iiip = iip1 , iip
16204 call setbits(mult(ivx,iiip),4,0,multx+8)
16205 c
16206 c Note the following still works after making mult only the 1st 4 bits.
16207 c
16208 if (btest(nacc(ivx,iiip),18))
16209 * mult(ivx,iiip) = mult(ivx,iiip)-1
16210 if (btest(nacc(ivx,iiip),19)) then
16211 mult(ivx,iiip) = mult(ivx,iiip)+1
16212 else if (iiip .gt. 1) then
16213 if (btest(nacc(ivx,iiip-1),19))
16214 * mult(ivx,iiip) = mult(ivx,iiip)+1
16215 end if
16216 74 continue
16217 isxtup = .false.
16218 end if
16219 if (btest(irest(ivx,iip),0)) then
16220 nrests = nrests+1
16221 else
16222 sum = sum+nolev(ivx,iip)
16223 end if
16224 9 continue
16225 c
16226 c Set beam up-down-ness
16227 c
16228 if (ifb.gt.0 .and. ulfbq(ivx,max(1,ifb)).ne.'x') then
16229 if (ulfbq(ivx,ifb) .eq. 'f') then
16230 c
16231 c Get default, then trade "l" and "u"
16232 c
16233 ulq(ivx,numnow) = char(225-ichar(
16234 * ulfq(sum/(nip2-nip1+1-nrests),ncmid(iv,nip1))))
16235 else
16236 ulq(ivx,ifb) = ulfbq(ivx,ifb)
16237 end if
16238 c
16239 c This probably works only because forced beams are done first, so they
16240 c don't have to be re-sorted within each voice. ????
16241 c
16242 else if (nvmx(iv) .eq. 2) then
16243 c
16244 c Multi-voice per staff
16245 c
16246 if (ivx .le. nv) then
16247 ulq(ivx,numnow) = 'l'
16248 else
16249 ulq(ivx,numnow) = 'u'
16250 end if
16251 else
16252 c
16253 c Defaults
16254 c
16255 ulq(ivx,numnow) =
16256 * ulfq(sum/(nip2-nip1+1-nrests),ncmid(iv,nip1))
16257 end if
16258 return
16259 end
16260 subroutine m1rec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
16261 c
16262 c This is called when (a) macro recording is just starting and
16263 c (b) at the start of a new line, if recording is on
16264 c
16265 parameter (maxblks=9600)
16266 character*128 lineq,lnholdq
16267 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
16268 common /c1ommac/ ip1mac(20),il1mac(20),ip2mac(20),il2mac(20),
16269 * ic1mac(20),ilmac,iplmac
16270 logical mrecord,mplay,endmac
16271 character*131072 bufq
16272 integer*2 lbuf(maxblks)
16273 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
16274 lbuf(1) = lbuf(1)
16275 if (.not.mrecord) then
16276 c
16277 c Starting the macro
16278 c
16279 ip1mac(macnum) = ipbuf-lbuf(ilbuf-1)+iccount
16280 il1mac(macnum) = ilbuf-1
16281 ic1mac(macnum) = iccount
16282 mrecord = .true.
16283 end if
16284 if (iccount .lt. 128) then
16285 ndxm = index(lineq(iccount+1:128),'M')
16286 if (ndxm .gt. 0) ndxm = ntindex(lineq(iccount+1:128),'M',
16287 * 128-iccount)
16288 if (ndxm .gt. 0) then
16289 c
16290 c This line ends the macro.
16291 c
16292 if (lineq(iccount+ndxm+1:iccount+ndxm+1) .ne. ' ') then
16293 call errmsg(lineq,iccount+ndxm+1,ibarcnt-ibaroff+nbars+1,
16294 * 'Improper macro termination!')
16295 call stop1()
16296 end if
16297 ip2mac(macnum) = ipbuf-lbuf(ilbuf-1)+iccount+ndxm
16298 il2mac(macnum) = ilbuf-1
16299 mrecord = .false.
16300 end if
16301 end if
16302 return
16303 end
16304 subroutine make1bar(ibmrep,tglp1,tstart,cwrest,squez,
16305 * istop,numbms,istart)
16306 parameter (nm=24,mv=24576)
16307 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
16308 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
16309 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
16310 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
16311 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
16312 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
16313 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
16314 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
16315 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
16316 common /comipl2/ ipl2(nm,200)
16317 character*10 figq
16318 character*1 ulq,sepsymq,sq
16319 logical beamon,firstgulp,figbass,figchk,isfig,bar1syst
16320 common /comeskz2/ eskz2(nm,200)
16321 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
16322 * fullsize(nm),ivxfig2,ivvfig(2,74)
16323 common /combeam/ ibmtyp
16324 common /comask/ bar1syst,fixednew,scaldold,
16325 * wheadpt,fbar,poenom
16326 common /comas1/ naskb,task(40),wask(40),elask(40)
16327 common /comas2/ nasksys,wasksys(800),elasksys(800)
16328 common /comhead/ ihdht,lower,headrq,lowerq,ihdvrt
16329 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
16330 * tautofb,autofbon,t1autofb
16331 common /comsln/ is1n1,is2n1,irzbnd,isnx
16332 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
16333 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
16334 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
16335 * graspace(37),
16336 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
16337 * naccg(74),voltxtq(6),litq(83)
16338 logical upg,slurg,slashg,autofbon
16339 character*128 litq
16340 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
16341 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
16342 integer cnn(nm),istart(80),istop(80),nxtnow(nm),ifbnow(nm),
16343 * numbms(nm),mapfb(24)
16344 real*4 xit(nm),t1xtup(20),tstart(80),squez(80)
16345 character*1 ulfbq
16346 character*79 inameq
16347 character*20 voltxtq
16348 common /comoct/ noctup
16349 character*80 headrq,lowerq
16350 logical cwrferm
16351 common /comcwrf/ cwrferm(nm)
16352 common /comnsp/ space(80),nb,prevtn(nm),
16353 * flgndv(nm),flgndb,eskgnd,ptsgnd,ivmxsav(nm,2),nvmxsav(nm)
16354 logical lower,cwrest(nm),vxtup,flgndb,btest,upslur,
16355 * infbmx(nm),lowdot,inxtup(nm),drawbm
16356 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
16357 * mtupv(nm,9),nxtinbm(nm),
16358 * islope(nm),xelsk(24),eloff(nm,9),
16359 * nssb(nm),issb(nm),lev1ssb(nm,20)
16360 common /comdraw/ drawbm(nm)
16361 common /comstart/ facmtr
16362 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
16363 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
16364 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
16365 * rtshfac
16366 c
16367 c Above are factors for grace note, clef spacing. (fraction of wheadpt)
16368 c In 1.04, moved to block data subprogram
16369 c
16370 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
16371 * ,WrotePsslurDefaults,SlurCurve
16372 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
16373 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
16374 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
16375 * lnam(nm),inameq(nm)
16376 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
16377 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
16378 * xinsnow,lowdot
16379 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
16380 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
16381 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
16382 common /comtol/ tol
16383 integer*2 mmidi
16384 logical restpend,relacc,notmain,twoline,ismidi,crdacc,fontslur,
16385 * WrotePsslurDefaults
16386 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
16387 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
16388 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
16389 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
16390 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
16391 * debugmidi
16392 logical debugmidi
16393 common /comntot/ ntot
16394 if (ismidi) then
16395 c
16396 c Initialize for this bar the accidental counter for the midi file.
16397 c naccim(icm) = # of accidentals from earlier in the bar
16398 c
16399 do 45 iv = 1 , nv
16400 do 4599 kv = 1 , nvmx(iv)
16401 naccim(midchan(iv,kv)) = 0
16402 4599 continue
16403 45 continue
16404 end if
16405 c
16406 c Time from start of gulp to end of bar, used with forced beams
16407 c
16408 tglp2 = lenb0+ibar*lenb1
16409 if (lenb0 .gt. 0) tglp2 = tglp2-lenb1
16410 tglp1 = tglp2-lenbar
16411 c
16412 c infbmx will only be true if in xtup that is NOT in explicit forced beam.
16413 c
16414 do 1 iv = 1 , nv
16415 do 1999 kv = 1 , nvmx(iv)
16416 ivx = ivmx(iv,kv)
16417 cwrest(ivx) = .false.
16418 infbmx(ivx) = .false.
16419 inxtup(ivx) = .false.
16420 if (ibar .gt. 1) then
16421 nn(ivx) = nib(ivx,ibar)-nib(ivx,ibar-1)
16422 else
16423 nn(ivx) = nib(ivx,ibar)
16424 end if
16425 1999 continue
16426 1 continue
16427 c
16428 c initialize list note counter, time(iv), curr. note(iv). The loop to 4
16429 c ONLY initializes each voice.
16430 c
16431 in = 1
16432 nxtup = 0
16433 narp = 0
16434 do 4 iv = 1 , nv
16435 do 4999 kv = 1 , nvmx(iv)
16436 ivx = ivmx(iv,kv)
16437 cwrferm(ivx) = .false.
16438 cnn(ivx) = 1
16439 ivxo(in) = ivx
16440 ipo(in) = cnn(ivx)
16441 tnote(in) = fnote(nodur,ivx,1,nacc)
16442 to(in) = 0.
16443 xit(ivx) = tnote(in)
16444 c
16445 c Note that xit(ivx) is to END of note in voice, but it1xtup is start time.
16446 c
16447 if (nodur(ivx,ipo(in)) .eq. 0) then
16448 c
16449 c First note of xtuplet at start of bar in voice ivx.
16450 c
16451 nxtup = nxtup+1
16452 nxtnow(ivx) = nxtup
16453 inxtup(ivx) = .true.
16454 t1xtup(nxtup) = 0.
16455 c
16456 c Xtup at start of bar. If no explicit forced beam, start one, set
16457 c signal infbmx, and save number ifbnow for use at termination.
16458 c
16459 if (nfb(ivx) .gt. 0) then
16460 do 60 ifb = 1 , nfb(ivx)
16461 if (t1fb(ivx,ifb) .gt. tglp1+xit(ivx)+tol) then
16462 c
16463 c No explicit fb here; so exit loop and insert one.
16464 c
16465 go to 61
16466 else if (t1fb(ivx,ifb) .lt. tglp1+xit(ivx)+tol .and.
16467 * t2fb(ivx,ifb) .gt. tglp1+xit(ivx)+tol) then
16468 c
16469 c IS explicit fb here; must NOT insert one
16470 c
16471 go to 62
16472 end if
16473 60 continue
16474 end if
16475 61 continue
16476 c
16477 c If here, xtup isn't in explicit fb, so must insert one
16478 c
16479 infbmx(ivx) = .true.
16480 call addfb(nfb,ivx,t1xtup(nxtup)+
16481 * tglp1,t1fb,t2fb,ulfbq,ifbadd)
16482 ifbnow(ivx) = ifbadd
16483 end if
16484 62 continue
16485 if (abs(xit(ivx)-lenbar) .lt. tol) xit(ivx) = 1000.
16486 in = in+1
16487 4999 continue
16488 4 continue
16489 c
16490 c Build the list: This is a manual loop starting at 5
16491 c
16492 5 continue
16493 c
16494 c Determine which voice comes next from end of notes done so far.
16495 c tmin is the earliest ending time of notes done so far
16496 c
16497 tmin = 1000.
16498 do 6 iiv = 1 , nv
16499 do 6999 kv = 1 , nvmx(iiv)
16500 iivx = ivmx(iiv,kv)
16501 tminn = min(tmin,xit(iivx))
16502 if(tminn .lt. tmin-tol) then
16503 tmin = tminn
16504 ivx = iivx
16505 end if
16506 6999 continue
16507 6 continue
16508 if (abs(tmin-1000.) .lt. tol) go to 7
16509 ivxo(in) = ivx
16510 cnn(ivx) = cnn(ivx)+1
16511 ipo(in) = cnn(ivx)
16512 to(in) = tmin
16513 c
16514 c Check if this voice is done
16515 c
16516 tnote(in) = fnote(nodur,ivx,cnn(ivx),nacc)
16517 if (cnn(ivx) .eq. nn(ivx)) then
16518 xit(ivx) = 1000.
16519 else
16520 xit(ivx) = xit(ivx)+tnote(in)
16521 end if
16522 c
16523 c Flag xtups
16524 c
16525 if (nodur(ivx,cnn(ivx)) .eq. 0) then
16526 if (.not.inxtup(ivx)) then
16527 c
16528 c First note of xtup, not at start of bar.
16529 c
16530 nxtup = nxtup+1
16531 nxtnow(ivx) = nxtup
16532 inxtup(ivx) = .true.
16533 t1xtup(nxtup) = xit(ivx)-tnote(in)
16534 c
16535 c (Note: can't be on last note in voice, so xit(ivx) <> 1000)
16536 c Put xtuplet in a forced beam if not already in forced beam
16537 c
16538 if (nfb(ivx) .gt. 0) then
16539 do 70 ifb = 1 , nfb(ivx)
16540 if (t1fb(ivx,ifb) .gt. tglp1+xit(ivx)+tol) then
16541 c
16542 c NO explicit bm; put one in
16543 c
16544 go to 71
16545 else if (t1fb(ivx,ifb) .lt. tglp1+xit(ivx)+tol .and.
16546 * t2fb(ivx,ifb) .gt. tglp1+xit(ivx)+tol) then
16547 c
16548 c IS explicit bm. Don't put one
16549 c
16550 go to 72
16551 end if
16552 70 continue
16553 end if
16554 71 continue
16555 c
16556 c If here, no explicit bm, so put one in
16557 c
16558 infbmx(ivx) = .true.
16559 call addfb(nfb,ivx,t1xtup(nxtup)+tglp1,
16560 * t1fb,t2fb,ulfbq,ifbadd)
16561 ifbnow(ivx) = ifbadd
16562 end if
16563 72 continue
16564 else if (inxtup(ivx)) then
16565 c
16566 c This test is sufficient because already know nodur>0
16567 c
16568 inxtup(ivx) = .false.
16569 if (infbmx(ivx)) then
16570 c
16571 c Xtup is in auto-forced beam, so end it
16572 c
16573 t2fb(ivx,ifbnow(ivx)) =
16574 * t1xtup(nxtnow(ivx))+nodur(ivx,cnn(ivx))+tglp1
16575 infbmx(ivx) = .false.
16576 end if
16577 end if
16578 if (btest(irest(ivxo(in),ipo(in)),24) .or.
16579 * btest(irest(ivxo(in),ipo(in)),30)) then
16580 c
16581 c For staff jumped beam, flag the first note (lowest voice) at same time.
16582 c Later will start new notes group here.
16583 c
16584 inj = in
16585 if (ivxo(in) .gt. 1) then
16586 do 40 iin = in-1 , 1 , -1
16587 if (to(iin)+tol .lt. to(in)) go to 41
16588 if (abs(to(iin)-to(in)) .lt. tol) then
16589 inj = iin
16590 go to 40
16591 end if
16592 40 continue
16593 end if
16594 41 continue
16595 irest(ivxo(inj),ipo(inj)) = ibset(irest(ivxo(inj),ipo(inj)),29)
16596 end if
16597 in = in+1
16598 go to 5
16599 7 continue
16600 ntot = in-1
16601 do 8 in = 1 , ntot-1
16602 tno(in) = to(in+1)-to(in)
16603 8 continue
16604 tno(ntot) = tnote(ntot)
16605 c
16606 c Done w/ list. Loop for parsing into note blocks:
16607 c
16608 ib = 1
16609 istart(1) = 1
16610 space(1) = 0.
16611 in = 1
16612 c
16613 c A manual loop to set space(ib) and istop(ib)
16614 c
16615 9 continue
16616
16617 ivx = ivxo(min(in+1,ntot))
16618 ip = ipo(min(in+1,ntot))
16619 isl = islur(ivx,ip)
16620 if (in.eq.ntot .or. ((ivx.eq.1 .and.
16621 * (iand(isl,67109216).gt.0 .or. btest(ipl(1,ip),28)
16622 c * .or. ornq(1,ip).eq.'g')) .or. btest(isl,15) )) then
16623 c Bits 1-13: stmgx+Tupf._)
16624 c 14: Down fermata, was F
16625 c 15: Trill w/o "tr", was U
16626 * .or. btest(iornq(1,ip),4))) .or. btest(isl,15) )
16627 c
16628 c Checking for start of 2nd part of jumped beam
16629 c
16630 * .or. btest(irest(ivx,ip),29) ) then
16631 c
16632 c Bar end, segno, int. rpt or sig change, clef,end of 1st part of jumped beam;
16633 c flow out of if-loop and into block-wrapup
16634 c
16635 c 10/18/97: Problem with clef alignment. Got isl{15} set on lowest-numbered
16636 c voice, but it wasn't first in the list at the same time. So check if
16637 c prior notes in list have same time
16638 c 5/25/98: This stuff causes trouble with just "c2 Ct c", maybe when clef
16639 c changes on last note in the list?
16640 c
16641 if (btest(isl,15) .and. in.lt.ntot) then
16642 do 50 iin = in , 1 , -1
16643 if (tno(iin) .gt. tol) then
16644 in = iin
16645 islur(ivx,ip) = ibclr(islur(ivx,ip),15)
16646 islur(ivxo(in+1),ipo(in+1)) =
16647 * ibset(islur(ivxo(in+1),ipo(in+1)),15)
16648 go to 51
16649 end if
16650 50 continue
16651 51 continue
16652 end if
16653 if (space(ib) .lt. tol) then
16654 space(ib) = tno(in)
16655 squez(ib) = 1.
16656 end if
16657 istop(ib) = in
16658 else if (space(ib) .lt. tol) then
16659 c
16660 c space hasn't been set yet, so tentatively set:
16661 c
16662 space(ib) = tno(in)
16663 if (space(ib) .lt. tol) then
16664 in=in+1
16665 else
16666 squez(ib) = getsquez(in,ntot,space(ib),tnote,to)
16667 istop(ib) = in
16668 end if
16669 go to 9
16670 else if (tno(in+1) .lt. tol) then
16671 c
16672 c This is not the last note in the group, so
16673 c
16674 in = in+1
16675 go to 9
16676 else if (abs(tno(in+1)-space(ib)) .lt. tol) then
16677 xsquez = getsquez(in+1,ntot,space(ib),tnote,to)
16678 if (abs(xsquez-squez(ib)) .lt. tol) then
16679 c
16680 c Keep spacing the same, update tentative stop point
16681 c
16682 in = in+1
16683 istop(ib) = in
16684 go to 9
16685 end if
16686 end if
16687 c
16688 c At this point istart and istop are good, so finalize block
16689 c
16690 tstart(ib) = to(istart(ib))
16691 if (istop(ib) .eq. ntot) go to 15
16692 ib = ib+1
16693 istart(ib) = istop(ib-1)+1
16694 in = istart(ib)
16695 c
16696 c Set tentative block space and squeeze-factor for upcoming block
16697 c
16698 space(ib) = tno(in)
16699 if (space(ib).gt.tol)
16700 * squez(ib)= getsquez(in,ntot,space(ib),tnote,to)
16701 istop(ib) = in
16702 go to 9
16703 15 continue
16704 nb = ib
16705 c
16706 c Invert the list of places into ipl(0-7), making it easier to analyze a voice
16707 c
16708 do 13 in = 1 , ntot
16709 c
16710 c ??? This may fix extra \loff's (bit 8 of ipl) in measures with >255 notes.
16711 c
16712 ipl2(ivxo(in),ipo(in)) = in
16713 13 continue
16714 c
16715 c Compute elemskips from start of bar to each note in the bar, for beam slopes
16716 c
16717 eskzb = 0.
16718 ib = 1
16719 do 30 in = 1 , ntot
16720 if (in .eq. istart(ib)) then
16721 deskb = squez(ib)*feon(space(ib)/squez(ib))
16722 else if (tno(in-1) .gt. tol) then
16723 eskzb = eskzb+deskb
16724 end if
16725 eskz(ivxo(in),ipo(in)) = eskzb
16726 eskz2(ivxo(in),ipo(in)) = eskzb
16727 if (in .eq. istop(ib)) then
16728 eskzb = eskzb+deskb
16729 ib = ib+1
16730 end if
16731 30 continue
16732 c
16733 c Analyze for beams.
16734 c
16735 do 20 iv = 1 , nv
16736 do 2099 kv = 1 , nvmx(iv)
16737 ivx = ivmx(iv,kv)
16738 numbms(ivx) = 0
16739 mapfb(1) = 0
16740 mapfb(2) = 0
16741 mapfb(3) = 0
16742 mapfb(4) = 0
16743 mapfb(5) = 0
16744 mapfb(6) = 0
16745 c
16746 c First forced beams.
16747 c
16748 if (nfb(ivx) .gt. 0) then
16749 c
16750 c tglp2 is time from start of gulp to end of current bar.
16751 c
16752 nfbbar = 0
16753 do 80 ifb = 1 , nfb(ivx)
16754 if (t1fb(ivx,ifb).gt.tglp2-tol) go to 81
16755 nfbbar = nfbbar+1
16756 numbms(ivx) = numbms(ivx)+1
16757 numnew = numbms(ivx)
16758 c
16759 c Times from beginning of bar
16760 c
16761 itbb1 = int(t1fb(ivx,ifb)-tglp1+tol)
16762 itbb2 = int(t2fb(ivx,ifb)-tglp1+tol)
16763 do 83 ip = 1 , nn(ivx)
16764 if (int(to(ipl2(ivx,ip))+tol) .eq. itbb1) then
16765 nip1fb = ip
16766 do 84 ip1 = ip , nn(ivx)
16767 inip1 = ipl2(ivx,ip1)
16768 if (abs(to(inip1)+tnote(inip1)-itbb2) .lt. tol) then
16769 nip2fb = ip1
16770 itbb3 = itbb2-2
16771 go to 85
16772 end if
16773 84 continue
16774 end if
16775 83 continue
16776 print*
16777 print*,'Timing problem w/ forced beams'
16778 write(15,'(/a)')'Timing problem w/ forced beams'
16779 85 continue
16780 call logbeam(numnew,nip1fb,nip2fb)
16781 c
16782 c Set up mapfb for forced beam just logged:
16783 c
16784 ib1 = itbb1/2
16785 ib2 = itbb3/2
16786 ibrep = lenbar/ibmrep/2
16787 do 86 irep = 1 , ibmrep
16788 ib1now = max(0,ib1-(irep-1)*ibrep)
16789 ib2now = min(irep*ibrep-1,ib2-(irep-1)*ibrep)
16790 mapnow = 0
16791 do 87 ib = ib1now , ib2now
16792 mapnow = ibset(mapnow,ib)
16793 87 continue
16794 mapfb(irep) = ior(mapfb(irep),mapnow)
16795 86 continue
16796 c
16797 c Since we are cycling thru forced beams, for those that start with a rest and
16798 c have height & slope adjustments, move adjustments to next note.
16799 c 060924: Copy to ALL later notes in fb, in case there's more than 1 rest at
16800 c start of beam
16801 c
16802 if (btest(irest(ivx,nip1fb),0)) then
16803 do 88 kp = nip1fb+1 , nip2fb
16804 call setbits(ipl(ivx,kp),6,11,
16805 * igetbits(ipl(ivx,nip1fb),6,11))
16806 call setbits(ipl(ivx,kp),6,17,
16807 * igetbits(ipl(ivx,nip1fb),6,17))
16808 call setbits(islur(ivx,kp),2,27,
16809 * igetbits(islur(ivx,nip1fb),2,27))
16810 88 continue
16811 end if
16812 80 continue
16813 81 continue
16814 c
16815 c Slide down, reduce nfb(ivx). This lets us count up from 1 for each new bar.
16816 c Remember, makeabar is called 1/bar, and it calls findbeam once per voice.
16817 c
16818 if (nfbbar .gt. 0) then
16819 nfb(ivx) = nfb(ivx)-nfbbar
16820 do 82 ifb = 1 , nfb(ivx)
16821 t1fb(ivx,ifb) = t1fb(ivx,ifb+nfbbar)
16822 t2fb(ivx,ifb) = t2fb(ivx,ifb+nfbbar)
16823 ulfbq(ivx,ifb) = ulfbq(ivx,ifb+nfbbar)
16824 82 continue
16825 end if
16826 end if
16827 ifb = 0
16828 c
16829 c Done with forced beam masks for this bar and voice. Now get normal beams.
16830 c
16831 call findbeam(ibmrep,numbms,mapfb)
16832 2099 continue
16833 20 continue
16834 return
16835 end
16836 subroutine make2bar(ninow,tglp1,tstart,cwrest,squez,
16837 * istop,numbms,istart,clefq)
16838 parameter (nm=24,mv=24576)
16839 common /comlast/ islast,usevshrink
16840 logical islast,usevshrink
16841 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
16842 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
16843 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
16844 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
16845 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
16846 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
16847 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
16848 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
16849 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
16850 common /comipl2/ ipl2(nm,200)
16851 character*10 figq
16852 character*1 ulq,sepsymq,sq,chax
16853 logical beamon,firstgulp,figbass,figchk,isfig,bar1syst,isbjmp,
16854 * isbj2
16855 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
16856 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
16857 * fullsize(nm),ivxfig2,ivvfig(2,74)
16858 common /combeam/ ibmtyp
16859 common /comask/ bar1syst,fixednew,scaldold,
16860 * wheadpt,fbar,poenom
16861 common /comas1/ naskb,task(40),wask(40),elask(40)
16862 common /comas2/ nasksys,wasksys(800),elasksys(800)
16863 common /comhead/ ihdht,lower,headrq,lowerq,ihdvrt
16864 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
16865 * tautofb,autofbon,t1autofb
16866 common /comsln/ is1n1,is2n1,irzbnd,isnx
16867 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
16868 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
16869 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
16870 * graspace(37),
16871 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
16872 * naccg(74),voltxtq(6),litq(83)
16873 logical upg,slurg,slashg,issig,rpndot,autofbon
16874 character*128 litq
16875 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
16876 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
16877 integer istart(80),istop(80),iaskb(nm),numbms(nm),
16878 * nornb(nm),ihornb(nm,24),lcwr(nm),ibmcnt1(nm),ifig(2)
16879 character*1 ulfbq,udqq,clefq(nm),slurudq,udq
16880 character*8 noteq
16881 character*79 cwrq(nm),notexq,inameq
16882 character*20 voltxtq
16883 common /comoct/ noctup
16884 character*80 soutq,headrq,lowerq
16885 common /comnsp/ space(80),nb,prevtn(nm),
16886 * flgndv(nm),flgndb,eskgnd,ptsgnd,ivmxsav(nm,2),nvmxsav(nm)
16887 logical bspend,lower,cwrest(nm),vxtup,
16888 * isgrace,isclef,nofirst,iscln,isdot,isflag,
16889 * isacc,isfirst,flgndb,btest,stemup,upslur,
16890 * isgaft,isarp,isrshft,isaccs,iscacc,
16891 * lowdot,flipend,iscwr,isdotted,beamon1(nm)
16892 real*4 ptgr(37),ptclef(nm),ptsndg(nm),eskndg(nm),tstart(80),
16893 * squez(80)
16894 logical cwrferm,drawbm
16895 common /comcwrf/ cwrferm(nm)
16896 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
16897 * mtupv(nm,9),nxtinbm(nm),
16898 * islope(nm),xelsk(24),eloff(nm,9),
16899 * nssb(nm),issb(nm),lev1ssb(nm,20)
16900 common /comdraw/ drawbm(nm)
16901 common /comstart/ facmtr
16902 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
16903 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
16904 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
16905 * rtshfac
16906 c
16907 c Factors for grace note, clef spacing. (fraction of wheadpt)
16908 c In 1.04, moved to block data subprogram
16909 c
16910 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
16911 * ,WrotePsslurDefaults,SlurCurve
16912 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
16913 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
16914 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
16915 * lnam(nm),inameq(nm)
16916 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
16917 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
16918 * xinsnow,lowdot
16919 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
16920 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
16921 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
16922 common /strtmid/ ihnum3,flipend(nm),ixrest(nm)
16923 common /comtol/ tol
16924 common /comignorenats/ mbrhgt,newmbrhgt,ignorenats
16925 logical ignorenats,newmbrhgt
16926 integer*2 mmidi,iinsiv
16927 logical restpend,relacc,notmain,twoline,ismidi,crdacc,fontslur
16928 * ,WrotePsslurDefaults
16929 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
16930 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
16931 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
16932 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
16933 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
16934 * debugmidi
16935 logical debugmidi
16936 logical slmon,dbltie
16937 common /comslm/ levson(0:nm),levsoff(0:nm),imidso(0:nm),
16938 * naccbl(0:nm),laccbl(0:nm,10),jaccbl(0:nm,10),nusebl,
16939 * slmon(0:nm),dbltie
16940 common /comevent/ miditime,lasttime
16941 logical kbdrests
16942 common /comkbdrests/ levbotr(8),levtopr(8),kbdrests
16943 logical secondgrace
16944 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
16945 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
16946 logical EarlyTransOn,LaterInstTrans
16947 common /commidisig/ midisig
16948 c 130316
16949 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
16950 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
16951 common /comclefrests/ centrests
16952 logical centrests
16953 common /xjbeambrests/ nbrests
16954 common /comc8flag/ c8flag(nm)
16955 logical c8flag
16956 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
16957 character*4 ivxq
16958 logical rename
16959 common /comshort/ shortfrac,codafrac,ishort,mbrsum,nmbr,nocodabn,
16960 * poefa
16961 real*4 poefa(125)
16962 logical nocodabn
16963 nbrests = 0
16964 c
16965 c Set up main ib loop within which a block (notes group) is written
16966 c
16967 do 25 iv = 1 , nv
16968 do 2599 kv = 1 , nvmx(iv)
16969 ivx = ivmx(iv,kv)
16970 ibmcnt(ivx) = 1
16971 ibmcnt1(ivx) = 1
16972 beamon(ivx) = .false.
16973 beamon1(ivx) = .false.
16974 nornb(ivx) = 0
16975 iaskb(ivx) = 1
16976 vxtup(ivx) = .false.
16977 drawbm(ivx) = .true.
16978 2599 continue
16979 25 continue
16980 naskb = 0
16981 ifig(1) = 1
16982 ifig(2) = 1
16983 ixtup = 0
16984 bspend = .false.
16985 iscwr = .false.
16986 rpndot = .false.
16987 do 16 ib = 1 , nb
16988 c
16989 c Check for segno
16990 c
16991 if (btest(iornq(1,ipo(istart(ib))),4) .and.
16992 * ivxo(istart(ib)).eq.1) then
16993 if (noffseg.le.-10) then
16994 write(noteq(1:5),'(1H{,i3,1H})')noffseg
16995 lnoten = 5
16996 else if (noffseg.lt.0 .or. noffseg.ge.10) then
16997 write(noteq(1:4),'(1H{,i2,1H})')noffseg
16998 lnoten = 4
16999 else
17000 write(noteq(1:1),'(i1)')noffseg
17001 lnoten = 1
17002 end if
17003 notexq = sq//'znotes'//sq//'segnoo'//noteq(1:lnoten)//'9'
17004 lnote = 15+lnoten
17005 do 130 iv = 2 , nv
17006 if (lnote .gt. 60) then
17007 if (islast) write(11,'(a)')notexq(1:lnote)//'%'
17008 notexq = sepsymq(iv-1)//sq//'segnoo'
17009 * //noteq(1:lnoten)//'9'
17010 lnote = lnoten+9
17011 else
17012 notexq = notexq(1:lnote)//sepsymq(iv-1)//sq//'segnoo'
17013 * //noteq(1:lnoten)//'9'
17014 lnote = lnote+lnoten+9
17015 end if
17016 130 continue
17017 if (islast) write(11,'(a)')notexq(1:lnote)//sq//'en'
17018 lnote = 0
17019 end if
17020 c
17021 c Check for new clefs
17022 c
17023 isclef = .false.
17024 if (btest(islur(ivxo(istart(ib)),ipo(istart(ib))),15))
17025 * then
17026 c
17027 c In preceding line, fl32 gave wrong result for ... .gt.0 !!!
17028 c
17029 do 140 in = istart(ib) , istop(ib)
17030 if (btest(islur(ivxo(in),ipo(in)),11)) then
17031 call wsclef(ivxo(in),ninow,
17032 * iand(ishft(islur(ivxo(in),ipo(in)),-12),7))
17033 c
17034 c If clefq = '8', must add eg \settrebleclefsymbol3\treblelowoct%
17035 c
17036 if (btest(ipl(ivxo(in),ipo(in)),2)) then
17037 c
17038 c Find instrument number for voice ivso(in)
17039 c
17040 iv1 = 1
17041 do 1111 iinst = 1 , ninow
17042 if (ivxo(in) .lt. iv1+nspern(iinst)) go to 2222
17043 iv1 = iv1+nspern(iinst)
17044 1111 continue
17045 print*
17046 print*,'Should not be here in make2bar!'
17047 call stop1()
17048 2222 continue
17049 if (iinst .le. 9) then
17050 write(11,'(a20,i1,a)')sq//'settrebleclefsymbol',
17051 * iinst,sq//'treblelowoct%'
17052 else
17053 write(11,'(a20,i2,a)')sq//'settrebleclefsymbol',
17054 * iinst,sq//'treblelowoct%'
17055 end if
17056 c8flag(ivxo(in)) = .true.
17057 end if
17058 end if
17059 140 continue
17060 if (islast) write(11,'(a)')sq//'pmxnewclefs'
17061 isclef = .true.
17062 end if
17063 c
17064 c Start a notes group. We're just gonna define every one using pnotes{n},
17065 c where \def\pnotes#1{\vnotes#1\elemskip}
17066 c
17067 soutq = sq//'pnotes{'
17068 eonsqz = squez(ib)*feon(space(ib)/squez(ib))
17069 if (eonsqz .gt. 9.995) then
17070 write(soutq(9:12),'(f4.1)')eonsqz
17071 else if (eonsqz .gt. 0.995) then
17072 write(soutq(9:12),'(f4.2)')eonsqz
17073 else if (eonsqz .gt. 0.095) then
17074 soutq = soutq(1:8)//'0.'
17075 write(soutq(11:12),'(i2)')nint(100*eonsqz)
17076 else
17077 soutq = soutq(1:8)//'0.0'
17078 write(soutq(12:12),'(i1)')nint(100*eonsqz)
17079 end if
17080 soutq = soutq(1:12)//'}'
17081 lsout = 13
17082 c
17083 c Check whole block, flag accidentals etc that are too close, one per *time*.
17084 c Note about bar starts and after rpt's/boublebars: There is an afterruleskip
17085 c (fbar*wheadpt) following, but rpts seem to occupy some of that gap, so
17086 c (dotsfac*wheadpt) is presumed to be filled up.
17087 c
17088 in = istart(ib)-1
17089 itrpt = -1
17090 itsig = -1
17091 c
17092 c Begin big manual loop over notes in this block; ends at 112
17093 c
17094 111 in = in+1
17095 if (in .gt. istop(ib)) go to 112
17096 ip = ipo(in)
17097 ivx = ivxo(in)
17098 if (ivx .le. nv) then
17099 iv = ivx
17100 else
17101 do 128 iv = 1 , nv
17102 if (nvmx(iv) .eq. 2 .and. ivmx(iv,2).eq. ivx) go to 129
17103 128 continue
17104 print*,'Trouble finding iv!, ivx,nvmx,ivmx:',ivx,nvmx(1),nvmx(2)
17105 print*,ivmx(1,1),ivmx(1,2),ivmx(2,1),ivmx(2,2)
17106 stop
17107 end if
17108 129 continue
17109 c
17110 c Call precrd here so we know how much space to add for accid's in chords
17111 c After calling precrd, icashft>0 means there is a shifted chordal accid (incl.
17112 c main note.
17113 c
17114 c To call precrd, need up-downness, so must track if in beam.
17115 c
17116 c Deal w/ staff-jumping beams later
17117 c
17118 if ((numbms(ivx).gt.0 .and. ibmcnt1(ivx).le.numbms(ivx)
17119 * .and. ibm1(ivx,ibmcnt1(ivx)) .eq. ip)) then
17120 beamon1(ivx)=.true.
17121 end if
17122 icashft = 0
17123 if (btest(ipl(ivx,ip),10)) then
17124 c
17125 c There is a chord on this note. Need up-down-ness in precrd to auto shift for 2nds.
17126 c
17127 if (beamon1(ivx)) then
17128 call precrd(ivx,ip,nolev(ivx,ip),nacc(ivx,ip),
17129 * ipl(ivx,ip),irest(ivx,ip),ulq(ivx,ibmcnt1(ivx)),
17130 * .false.,icashft)
17131 else
17132 call precrd(ivx,ip,nolev(ivx,ip),nacc(ivx,ip),
17133 * ipl(ivx,ip),irest(ivx,ip),udqq(nolev(ivx,ip),
17134 * ncmid(iv,ip),islur(ivx,ip),nvmx(iv),ivx,nv),
17135 * .false.,icashft)
17136 end if
17137 end if
17138 c
17139 c Turn beam off?
17140 c
17141 if (beamon1(ivx) .and. ibm2(ivx,ibmcnt1(ivx)).eq.ip) then
17142 beamon1(ivx) = .false.
17143 ibmcnt1(ivx) = ibmcnt1(ivx)+1
17144 end if
17145 c
17146 c Remember, rpts & internal sigs can only come at start of (internal) block
17147 c
17148 isacc = iand(nacc(ivx,ip),3).gt.0
17149 * .and. .not.btest(nacc(ivx,ip),17)
17150 * .and. .not.btest(ipl(ivx,ip),10)
17151 c
17152 c i.e., do not set for chord. Now check for "(" as ornament on main note,
17153 c
17154 c!!! Need to do this for chord notes too. Maybe in chkarp?
17155 c
17156 isaccs = isacc .or. btest(iornq(ivx,ip),0)
17157 c
17158 isarp = btest(iornq(ivx,ip),27)
17159 iscacc = .false.
17160 if (btest(ipl(ivx,ip),10)) then
17161 c
17162 c There is a chord here; check for arpeggios and accidentals. Note accid shifts are
17163 c not of concern here, only whether there's an accid, whick causes iscacc=.true.
17164 c
17165 iscacc = igetbits(nacc(ivx,ip),3,0).gt.0 .and.
17166 * .not.btest(nacc(ivx,ip),17)
17167 call chkarp(ncrd,icrdat,ivx,ip,iscacc,isarp)
17168 end if
17169 c
17170 c When we get motivated, will do spacing for arpeggios here.
17171 c
17172 if (ivx.eq.1 .and. iand(islur(ivx,ip),96).gt.0)
17173 * itrpt = nint(to(in))
17174 issig = btest(ipl(ivx,ip),28)
17175 if (ivx.eq.1 .and. issig) itsig = nint(to(in))
17176 isgrace = btest(islur(ivx,ip),4) .and.
17177 * .not.btest(ipl(ivx,ip),29) .and. .not.btest(ipl(ivx,ip),31)
17178 isgaft = .false.
17179 if (ip .gt. 1) then
17180 xnd = tnote(ipl2(ivx,ip-1))
17181 isgaft = btest(ipl(ivx,ip-1),29) .or. btest(ipl(ivx,ip-1),31)
17182 isgrace = isgrace .or. isgaft
17183 end if
17184 iscln = isclef .and. btest(islur(ivx,ip),11)
17185 c
17186 c Is prev. note non-beamed, up-stemmed, & flagged? Recall if ip>1, have nd
17187 c
17188 isflag = ip.gt.1 .and. xnd.gt.tol .and. xnd.lt.16.-tol
17189 if (isflag)
17190 * isflag = .not.btest(irest(ivx,ip-1),0)
17191 * .and. udqq(nolev(ivx,ip-1),
17192 * ncmid(iv,ip-1),islur(ivx,ip-1),nvmx(iv),ivx,nv).eq.'u'
17193 if (isflag) then
17194 do 116 ibmchk = 1 , numbms(ivx)
17195 if (ip-1 .lt. ibm1(ivx,ibmchk)) then
17196 go to 117
17197 c
17198 c Add check for non-beamed xtuplets. May be problem with stem direction.
17199 c
17200 else if (ip-1.le.ibm2(ivx,ibmchk) .and.
17201 * .not.btest(islur(ivx,ibm1(ivx,ibmchk)),18)) then
17202 isflag = .false.
17203 go to 117
17204 end if
17205 116 continue
17206 end if
17207 117 continue
17208 c
17209 c If isflag, then won't need to check for dot on prev. note.
17210 c
17211 c 5/16/02 ??? Try using this for ) ornament.
17212 c
17213 isflag = isflag .or. btest(iornq(ivx,ip-1),13)
17214 isdot = ip.gt.1
17215 if (isdot) isdot = isdotted(nodur,ivx,ip-1)
17216 isrshft = ip .gt. 1
17217 if (isrshft) isrshft = btest(irest(ivx,ip-1),20)
17218 if (.not.(isaccs.or.isgrace.or.iscln.or.isflag.or.isrshft.or.
17219 * isdot.or.btest(iornq(ivx,ip),26).or.
17220 * btest(irest(ivx,ip),21).or.isarp.or.
17221 * btest(irest(ivx,ip),27).or.iscacc)) go to 111
17222 c
17223 c Here is an accid,grace,clef,flag,rtshft,dot,udsp,arpeg,left-shift.
17224 c Compute pts, the total occupied space including prior notehead.
17225 c
17226 c 130324
17227 wheadpt1 = wheadpt*fullsize(instno(iv))
17228 pts = wheadpt1
17229 c
17230 c Set up for possible cautionary accidental here
17231 c
17232 if (isaccs .or. iscacc) then
17233 if (.not.btest(iornq(ivx,ip),31)) then
17234 taccfac = accfac
17235 else
17236 taccfac = 1.4*accfac ! cautionary accidental
17237 end if
17238 end if
17239 if (isgrace) then
17240 secondgrace = .false.
17241 do 122 ig = 1 , ngrace
17242 if (.not. isgaft) then
17243 if (ipg(ig).eq.ip .and. ivg(ig).eq.ivx) go to 123
17244 else if (ip .gt. 1) then
17245 if (ipg(ig).eq.ip-1 .and. ivg(ig).eq.ivx) go to 123
17246 end if
17247 122 continue
17248 print*,'Problem finding grace index in makeabar'
17249 stop
17250 123 continue
17251 c
17252 c wgr = distance to backspace (in headwidths), less main acc.
17253 c ptgr = same in pts,+ main acc. Not used for after-grace. Distance to backspace.
17254 c spgr = total space needed (w/o main acc).
17255 c Also, spgr is same for b4 or after, but xb4fac-space will be in diff. place.
17256 c
17257 if (nng(ig) .eq. 1) then
17258 wgr = grafac
17259 if (multg(ig) .eq. 0) wgr = wgr-.4
17260 else
17261 wgr = nng(ig)*emgfac
17262 do 126 ing = 2 , nng(ig)
17263 if (naccg(ngstrt(ig)-1+ing) .gt. 0) wgr = wgr+acgfac
17264 126 continue
17265 end if
17266 if (graspace(ig) .gt. 0.) then
17267 c
17268 c User-defined space before grace
17269 c
17270 wgr = wgr+graspace(ig)
17271 end if
17272 ptgr(ig) = wgr*wheadpt1
17273 spgr = ptgr(ig)+xb4fac*wheadpt1
17274 c
17275 c!!! May need to mod for chord accid's
17276 c
17277 if (isaccs .or. iscacc) ptgr(ig) = ptgr(ig) + taccfac*wheadpt1
17278 if (naccg(ngstrt(ig)) .gt. 0) spgr = spgr+wheadpt1*agc1fac
17279 pts = pts+spgr
17280 c
17281 c Special check for after-grace on ip-1 and normal on ip. Must go back thru
17282 c loop again for the normal grace.
17283 c
17284 if (isgaft .and. ig.lt.ngrace .and. .not.secondgrace) then
17285 if (ipg(ig+1).eq.ip) then
17286 secondgrace = .true.
17287 ig = ig+1
17288 go to 123
17289 end if
17290 end if
17291 end if
17292 if (iscln) then
17293 pts = pts+clefac*wheadpt1
17294 c
17295 c How far to backspace when printing the clef
17296 c
17297 ptclef(ivx) = 0.
17298 c
17299 c!!! May need to mod for chord accid's
17300 c
17301 if (isaccs .or. iscacc)
17302 * ptclef(ivx) = ptclef(ivx)+taccfac*wheadpt1
17303 if (isgrace) ptclef(ivx) = ptclef(ivx)+spgr
17304 end if
17305 if (isrshft) then
17306 pts = pts+rtshfac*wheadpt1
17307 else if (isflag) then
17308 pts = pts+flagfac*wheadpt1
17309 else if (isdot) then
17310 pts = pts+dotfac*wheadpt1
17311 end if
17312 if (abs(to(in)-itrpt) .lt. tol) then
17313 c
17314 c Repeat, need a little extra space
17315 c
17316 pts = pts+dotsfac*wheadpt1
17317 end if
17318 if (isarp) then
17319 pts = pts+arpfac*wheadpt1
17320 end if
17321 c
17322 c Add in padding space
17323 c
17324 pts = pts+xspfac*wheadpt1
17325 c
17326 c Now done with all items needing space except accidentals,
17327 c accidental shifts, and left-notehead-shifts, and will later
17328 c subtract a notehead if at start of bar.
17329 c
17330 c Get available space in elemskips (esk)
17331 c
17332 isfirst = ip.eq.1 .or. abs(to(in)-itrpt).lt.tol .or.
17333 * abs(to(in)-itsig).lt.tol
17334 if (isfirst) then
17335 c
17336 c At start of bar or after repeat sign or new signature
17337 c
17338 if (abs(to(in)-itsig).lt.tol) then
17339 esk = 0.
17340 else
17341 esk = fbar
17342 end if
17343 else
17344 c
17345 c Not 1st note of bar
17346 c
17347 esk = eskz(ivx,ip)-eskz(ivx,ip-1)
17348 end if
17349 if (isgrace) then
17350 c
17351 c Since graces can be very long, cannot assume no interference if prior
17352 c note uses >1 noteskip. So must get elsk's back to prior note, whether or
17353 c not it used only one noteskip.
17354 c <<But if it was xtup. don't need to call eskb4.>>????
17355 c
17356 c 10/8/05 Kluge to not zero out esk if in xtup
17357 c
17358 esksav = esk
17359 if ((ip.le.2 .or. nodur(ivx,max(1,ip-2)).gt.0) .and.
17360 * abs(to(in)-itsig).gt.tol)
17361 * call eskb4(ip,ivx,in,ib,space,tstart,fbar,itrpt,esk)
17362 if (abs(esk) .lt. tol) esk = esksav
17363 end if
17364 c
17365 c Done getting available elemskips. Remove headwidth if first. Must do here
17366 c rather than earlier since check uses isfirst
17367 c
17368 if (isfirst) pts = pts-wheadpt1
17369 c
17370 c Deal with accidental shifts and left-notehead shifts
17371 c
17372 if (btest(ipl(ivx,ip),10)) then
17373 c
17374 c In a chord
17375 c
17376 ptsl = 0.
17377 if (btest(irest(ivx,ip),27)) ptsl = wheadpt1
17378 ptsadd = max(ptsl,icashft*.05*wheadpt1)
17379 c
17380 c Note: may have icashft=-20000 (if shftmin=-1000 in crdacc) but that's OK
17381 c
17382 else
17383 c
17384 c Not in a chord
17385 c
17386 ihshft = 0
17387 if (isaccs) then
17388 ihshft = igetbits(nacc(ivx,ip),7,10)
17389 if (ihshft .ne. 0) ihshft = max(0,107-ihshft)
17390 end if
17391 c
17392 c Check for left-shifted main note
17393 c
17394 if (btest(ipl(ivx,ip),8)) ihshft = max(20,ihshft)
17395 ptsadd = ihshft*.05*wheadpt1
17396 end if
17397 pts = pts+ptsadd
17398 if (isgrace) ptgr(ig) = ptgr(ig)+ptsadd
17399 if (iscln) ptclef(ivx) = ptclef(ivx)+ptsadd
17400 c
17401 c Left-shifted, non-chord note before?
17402 c
17403 if (ip .gt. 1) then
17404 if (.not.btest(ipl(ivx,ip-1),10) .and.
17405 * btest(irest(ivx,ip-1),27)) pts = pts-wheadpt1
17406 end if
17407 c
17408 c Try big accidentals first
17409 c
17410 ptbneed = pts
17411 if (isaccs .or. iscacc) then
17412 ptbneed = ptbneed+wheadpt1*bacfac
17413 end if
17414 if (poefa(iline)*poenom*esk .gt. ptbneed) then
17415 c
17416 c Set flag for big accidental
17417 c
17418 if (isacc) nacc(ivx,ip) = ibset(nacc(ivx,ip),3)
17419 go to 99
17420 end if
17421 c
17422 c Cannot use big, so try small
17423 c
17424 ptsneed = pts
17425 if (isaccs .or. iscacc) then
17426 ptsneed = ptsneed+taccfac*wheadpt1
17427 end if
17428 if (poefa(iline)*poenom*esk .lt. ptsneed) then
17429 call addask(to(in),ptsneed,poefa(iline)*esk,
17430 * fixednew,scaldold,0.,poefa(iline),.false.)
17431 end if
17432 99 continue
17433 if (btest(iornq(ivx,ip),26)) then
17434 c
17435 c User-defined space. Warning, "zero" may change value in addask!
17436 c
17437 zero = 0.
17438 call addask(to(in),ptsneed,zero,
17439 * fixednew,scaldold,tglp1,1.,.true.)
17440 end if
17441 c
17442 c End of big manual loop over "in" for accidental checking
17443 c
17444 go to 111
17445 112 continue
17446 c
17447 c End of ask analysis for this block.
17448 c
17449 c Adjust eskz if there are added spaces. Corrects length of xtup brackets.
17450 c
17451 if (naskb.gt.0) call adjusteskz(ib,istart,poenom)
17452 c
17453 c Check for internal repeat or sig change.
17454 c
17455 if (ib.gt.1 .and. ivxo(istart(ib)).eq.1) then
17456 iirpt = iand(islur(1,ipo(istart(ib))),67109216)
17457 if (iirpt .gt. 0) then
17458 c
17459 c Internal repeat
17460 c
17461 if (islast) write(11,'(a)')sq//'advance'//sq//'barno-1%'
17462 if (iirpt .eq. 96) then
17463 if (islast) write(11,'(a)')sq//'leftrightrepeat'
17464 fixednew = fixednew+lrrptfac*wheadpt
17465 else if (btest(iirpt,5)) then
17466 if (islast) write(11,'(a)')sq//'leftrepeat'
17467 fixednew = fixednew+rptfac*wheadpt
17468 else if (btest(iirpt,6)) then
17469 if (islast) write(11,'(a)')sq//'rightrepeat'
17470 fixednew = fixednew+rptfac*wheadpt
17471 else if (btest(iirpt,8)) then
17472 if (islast) write(11,'(a)')sq//'doublebar'
17473 else
17474 print*,'Unexpected mid-bar repeat command R*'
17475 call stop1()
17476 end if
17477 scaldold = scaldold-fbar
17478 end if
17479 if (btest(ipl(1,ipo(istart(ib))),28)) then
17480 c
17481 c Internal signature change.
17482 c
17483 notexq = sq//'generalsignature{'
17484 lnote = 18
17485 if (isig .lt. 0) then
17486 notexq = notexq(1:lnote)//'-'
17487 lnote = lnote+1
17488 end if
17489 if (islast) write(11,'(a)')notexq(1:lnote)
17490 * //chax(48+abs(isig))//'}%'
17491 if (islast .and. ignorenats)
17492 * write(11,'(a)')sq//'ignorenats%'
17493 if (islast) write(11,'(a)')sq//'zchangecontext'//sq
17494 * //'addspace{-.5'//sq//'afterruleskip}%'
17495 lnote = 0
17496 end if
17497 end if
17498 flgndb = .false.
17499 c
17500 c Done with start-of-block stuff. Begin main loop over voices.
17501 c
17502 do 11 iv = 1 , nv
17503 do 1199 kv = 1 , nvmx(iv)
17504 ivx = ivmx(iv,kv)
17505 icm = midchan(iv,kv)
17506 c
17507 c A rather klugey way to set flag for figure in this voice
17508 c Must always check figbass before figchk.
17509 c
17510 if (figbass) then
17511 ivf = 0
17512 if (ivx .eq. 1) then
17513 ivf = 1
17514 else if (ivx .eq. ivxfig2) then
17515 ivf = 2
17516 end if
17517 if (ivf.gt.0) figchk(ivf) = nfigs(ivf).gt.0
17518 end if
17519 if (ivx .gt. 1) then
17520 if (ivx .le. nv) then
17521 call addstr(sepsymq(iv-1),1,soutq,lsout)
17522 else
17523 call addstr(sq//'nextvoice',10,soutq,lsout)
17524 end if
17525 end if
17526 if (ihdht.gt.0 .and. ivx.eq.nv) then
17527 c
17528 c Write header. First adjust height if needed to miss barno.
17529 c
17530 if (bar1syst .and. iline.ne.1) then
17531 ihdht = 15+irzbnd+isnx
17532 end if
17533 c
17534 c Add user-defined vertical shift
17535 c
17536 ihdht = ihdht+ihdvrt
17537 lchead = lenstr(headrq,80)
17538 notexq = sq//'zcharnote{'
17539 write(notexq(12:13),'(i2)')ihdht
17540 notexq = notexq(1:13)//'}{'//sq//'bigfont'//sq//'kern-30pt '
17541 call addstr(notexq,34,soutq,lsout)
17542 call addstr(headrq(1:lchead)//'}',1+lchead,soutq,lsout)
17543 ihdht = 0
17544 end if
17545 if (lower .and. ivx.eq.nv) then
17546 lclow = lenstr(lowerq,80)
17547 call addstr(sq//'zcharnote{-6}{'//
17548 * sq//'tempo'//sq//'kern-10pt '//
17549 * lowerq(1:lclow)//'}',33+lclow,soutq,lsout)
17550 lower=.false.
17551 end if
17552 tnow = tstart(ib)
17553 nofirst = .true.
17554 c
17555 c Done setting up voice ivx for start of block ib. Loop over notes in voice.
17556 c
17557 do 10 jn = istart(ib), istop(ib)
17558 if (ivxo(jn) .ne. ivx) go to 10
17559 ip = ipo(jn)
17560 c
17561 c May have problem with not initializing islhgt, so do it here
17562 c
17563 islhgt = 0
17564 c
17565 if (nofirst) then
17566 noctup = 0
17567 if (ncmid(iv,ip) .eq. 23) noctup = -2
17568 nofirst = .false.
17569 end if
17570 c
17571 c Check for internal floating figure (before last note of group).
17572 c
17573 12 if (figbass) then
17574 if (ivx.eq.1 .or. ivx.eq.ivxfig2) then
17575 ivf = 1
17576 if (ivx .gt. 1) ivf = 2
17577 if (figchk(ivf) .and. itfig(ivf,ifig(ivf)).lt.tnow-tol)
17578 * then
17579 c
17580 c Bypassed figure location. Backup, place fig, return.
17581 c
17582 offnsk = (tnow-itfig(ivf,ifig(ivf)))/space(ib)
17583 call putfig(ivf,ifig(ivf),offnsk,figchk(ivf),soutq,
17584 * lsout)
17585 go to 12
17586 end if
17587 end if
17588 end if
17589 c
17590 c Put in \sk if needed
17591 c
17592 if (to(jn) .gt. tnow+tol) then
17593 call addstr(sq//'sk',3,soutq,lsout)
17594 tnow = tnow+space(ib)
17595 go to 12
17596 end if
17597 c
17598 c Check for user-defined shifts
17599 c
17600 if (btest(irest(ivx,ip),15).or.btest(irest(ivx,ip),16))
17601 * call putshft(ivx,.true.,soutq,lsout)
17602 21 if (iaskb(ivx).le.naskb .and.
17603 * tnow.gt.task(iaskb(ivx))-tol) then
17604 if (task(iaskb(ivx)) .gt. tstart(ib)-tol) then
17605 c
17606 c Insert placeholder for accidental skip
17607 c
17608 call addstr(sq//'ask ',9,soutq,lsout)
17609 nasksys = nasksys+1
17610 wasksys(nasksys) = wask(iaskb(ivx))
17611 if (wask(iaskb(ivx)) .gt. 0.) then
17612 elasksys(nasksys) = elask(iaskb(ivx))
17613 else
17614 c
17615 c This is a signal to permit negative ask's. Should really have elask>=0.
17616 c
17617 elasksys(nasksys) = -elask(iaskb(ivx))
17618 end if
17619 end if
17620 c
17621 c May have skipped some task's in earlier blocks (due to void voice)
17622 c
17623 iaskb(ivx) = iaskb(ivx)+1
17624 go to 21
17625 end if
17626 if (figbass) then
17627 if (ivx.eq.1 .or. ivx.eq.ivxfig2) then
17628 ivf = 1
17629 if (ivx .gt. 1) ivf = 2
17630 if (figchk(ivf) .and.
17631 * abs(itfig(ivf,ifig(ivf))-tnow).lt.tol) then
17632 c
17633 c Figure on a note. NB: later special check for late figs.
17634 c
17635 call putfig(ivf,ifig(ivf),0.,figchk(ivf),soutq,lsout)
17636 end if
17637 end if
17638 end if
17639 c
17640 c Check for new clef here.
17641 c
17642 if (isclef .and. btest(islur(ivx,ip),11)) then
17643 if (ptclef(iv) .gt. 0.) then
17644 notexq = sq//'off{-'
17645 if (ptclef(iv) .lt. 9.95) then
17646 write(notexq(7:9),'(f3.1)')ptclef(iv)
17647 lnote = 9
17648 else
17649 write(notexq(7:10),'(f4.1)')ptclef(iv)
17650 lnote = 10
17651 end if
17652 notexq = notexq(1:lnote)//'pt}'
17653 lnote = lnote+3
17654 call addstr(notexq,lnote,soutq,lsout)
17655 end if
17656 call clefsym(islur(iv,ip),notexq,lnote,nclef)
17657 c
17658 c 151220 If clef is treblelowoct, change '0' in pos'n 9 to '8'
17659 c
17660 if (btest(ipl(ivx,ip),2)) notexq =
17661 * notexq(1:8)//'8'//notexq(10:10)
17662 call addstr(notexq,lnote,soutq,lsout)
17663 if (ptclef(iv) .gt. 0.) then
17664 notexq = sq//'off{'
17665 if (ptclef(iv) .lt. 9.95) then
17666 write(notexq(6:8),'(f3.1)')ptclef(iv)
17667 lnote = 8
17668 else
17669 write(notexq(6:9),'(f4.1)')ptclef(iv)
17670 lnote = 9
17671 end if
17672 notexq = notexq(1:lnote)//'pt}'
17673 lnote = lnote+3
17674 call addstr(notexq,lnote,soutq,lsout)
17675 end if
17676 end if
17677 c
17678 c Checking for literal TeX string BEFORE starting beams!!
17679 c
17680 if (btest(islur(ivx,ip),16)) then
17681 do 124 il = 1 , nlit
17682 if (iplit(il).eq.ip .and. ivlit(il).eq.ivx) go to 125
17683 124 continue
17684 print*,'Problem finding index for literal string'
17685 call stop1()
17686 125 continue
17687 c
17688 c Write a type 1 tex string.
17689 c
17690 if (lenlit(il) .lt. 71) then
17691 c
17692 c Add normally
17693 c
17694 call addstr(litq(il),lenlit(il),soutq,lsout)
17695 else
17696 c
17697 c Longer than 71. Write souq, Write string, start new soutq.
17698 c
17699 if (islast) write(11,'(a)')soutq(1:lsout)//'%'
17700 if (islast) write(11,'(a)')litq(il)(1:lenlit(il))//'%'
17701 lsout = 0
17702 end if
17703 end if
17704 c
17705 c Arpeggio on a main (non-chordal) note?
17706 c
17707 if (btest(iornq(ivx,ip),27)) then
17708 call putarp(tnow,ivx,ip,nolev(ivx,ip),ncmid(iv,ip),
17709 * soutq,lsout)
17710 end if
17711 c
17712 c See if a beam starts here
17713 c
17714 if ((numbms(ivx).gt.0 .and. ibmcnt(ivx).le.numbms(ivx)
17715 * .and. ibm1(ivx,ibmcnt(ivx)) .eq. ip) .or.
17716 * btest(nacc(ivx,ip),21)) then
17717 if (.not.btest(irest(ivx,ip),24)) then
17718 c
17719 c Not a jump start
17720 c
17721 if (kbdrests .and. btest(irest(ivx,ip),0) .and.
17722 * .not.btest(islur(ivx,ip),29).and. nvmx(iv).eq.2 .and.
17723 * nolev(ivx,ip).le.50)
17724 * call chkkbdrests(ip,iv,ivx,nn,islur,irest,nolev,
17725 * ivmx,nib,nv,ibar,tnow,tol,nodur,2,levtopr,levbotr,
17726 * mult,ipl)
17727 call beamstrt(notexq,lnote,nornb,ihornb,space,squez,ib)
17728 c
17729 c Shift beam start if notehead was shifted
17730 c
17731 if (btest(ipl(ivx,ip),8)) then
17732 call addstr(sq//'loff{',6,soutq,lsout)
17733 else if (btest(ipl(ivx,ip),9)) then
17734 call addstr(sq//'roff{',6,soutq,lsout)
17735 end if
17736 if (lnote .gt. 0) call addstr(notexq,lnote,soutq,lsout)
17737 if (btest(ipl(ivx,ip),8) .or.
17738 * btest(ipl(ivx,ip),9)) call addstr('}',1,soutq,lsout)
17739 else
17740 c
17741 c Jump start. Set marker for second part of a jump beam. Note ivbj2 was set
17742 c to 0 at end of first part of jump beam
17743 c
17744 ivbj2 = ivx
17745 c
17746 c Check for xtup since we bypassed beamstrt wherein vxtup is normally set
17747 c
17748 if (btest(irest(ivx,ip),28) .and. ixrest(ivx).ne.2)
17749 * vxtup(ivx) = .true.
17750 c
17751 c Since beamstrt is not called, and drawbm is normally set there, need to set
17752 c it here. This could cause problems if someone tries a staff-jumping,
17753 c unbarred beam, which I'll deal with when it comes up.
17754 c
17755 drawbm(ivx) = .true.
17756 end if
17757 if (ixrest(ivx) .eq. 0) then
17758 beamon(ivx) = .true.
17759 bspend = .true.
17760 if (.not.btest(irest(ivx,ip),24))bspend = .true.
17761 end if
17762 end if
17763 c
17764 c Setup for chords and possible slurs in chords
17765 c
17766 if (btest(ipl(ivx,ip),10)) then
17767 c
17768 c There is a chord on this note. Just rerun precrd. Klunky, but saves
17769 c me from tracking down errors instroduced when I moved 1st call
17770 c forward for accidental spacing analysis.
17771 c
17772 if (beamon(ivx)) then
17773 call precrd(ivx,ip,nolev(ivx,ip),nacc(ivx,ip),
17774 * ipl(ivx,ip),irest(ivx,ip),ulq(ivx,ibmcnt(ivx)),
17775 * .true.,icashft)
17776 else
17777 call precrd(ivx,ip,nolev(ivx,ip),nacc(ivx,ip),
17778 * ipl(ivx,ip),irest(ivx,ip),udqq(nolev(ivx,ip),
17779 * ncmid(iv,ip),islur(ivx,ip),nvmx(iv),ivx,nv),
17780 * .true.,icashft)
17781 end if
17782 end if
17783 c
17784 c Is there slur or grace activity?
17785 c
17786 isgrace = btest(islur(ivx,ip),4)
17787 if (ip .gt. 1) isgrace = isgrace.or.btest(ipl(ivx,ip-1),31)
17788 c
17789 c isgrace if not 1st note in bar and previous note has Way-after grace.
17790 c
17791 if (btest(islur(ivx,ip),0) .or. isgrace) then
17792 if (btest(islur(ivx,ip),0)) then
17793 if (fontslur) then
17794 c
17795 c Call routine for non-postscript slurs
17796 c
17797 call doslur(nolev(ivx,ip),isdat1,isdat2,isdat3,nsdat,
17798 * ip,iv,kv,nv,beamon(ivx),ncmid(iv,ip),soutq,lsout,
17799 * ulq(ivx,ibmcnt(ivx)),islur(ivx,ip),ipl(ivx,ip),
17800 * iornq(ivx,ip),islhgt,tnote(ipl2(ivx,ip)),
17801 * nacc(ivx,ip))
17802 else
17803 c
17804 c Postscript slurs
17805 c
17806 call dopsslur(nolev(ivx,ip),isdat1,isdat2,isdat3,
17807 * isdat4,nsdat,
17808 * ip,iv,kv,nv,beamon(ivx),ncmid(iv,ip),soutq,lsout,
17809 * ulq(ivx,ibmcnt(ivx)),islur(ivx,ip),ipl(ivx,ip),
17810 * iornq(ivx,ip),islhgt,tnote(ipl2(ivx,ip)),
17811 * nacc(ivx,ip))
17812 end if
17813 end if
17814 if (isgrace) then
17815 c
17816 c Grace note.
17817 c
17818 iphold = ip
17819 isgrace = .false.
17820 if (ip .gt. 1) isgrace = btest(ipl(ivx,ip-1),31)
17821 if (isgrace) iphold = iphold-1
17822 isgrace = isgrace .or. (.not.btest(ipl(ivx,ip),31)
17823 * .and..not.btest(ipl(ivx,ip),29))
17824 c
17825 c Place grace now if (a) Way-after from prev note and ip>1 or (b) Pre-grace
17826 c on current note. Do A-grace on current note, and W-grace at barend, later.
17827 c
17828 if (isgrace) then
17829 call dograce(ivx,iphold,ptgr,soutq,lsout,ncmid(iv,ip),
17830 * nacc(ivx,ip),ig,ipl(ivx,iphold),.false.,
17831 * beamon(ivx),nolev(ivx,ip),ncmid(iv,ip),
17832 * islur(ivx,ip),nvmx(iv),nv,ibmcnt(ivx),
17833 c 130324
17834 * tnote(ipl2(ivx,ip)),ulq,instno(iv))
17835 if (slurg(ig)) then
17836 c
17837 c Terminate slur started in dograce. Get direction of main note stem
17838 c
17839 if (.not.beamon(ivx)) then
17840 c
17841 c Separate note. Get stem direction.
17842 c
17843 stemup = udqq(nolev(ivx,ip),ncmid(iv,ip),
17844 * islur(ivx,ip),nvmx(iv),ivx,nv) .eq. 'u'
17845 else
17846 c
17847 c In a beam
17848 c
17849 stemup = ulq(ivx,ibmcnt(ivx)) .eq. 'u'
17850 end if
17851 c
17852 c Stop the shift if whole note
17853 c
17854 stemup = stemup .or.
17855 * tnote(ipl2(ivx,ip)).gt.63
17856 call endslur(stemup,.not.upg(ig),nolev(ivx,ip),0,
17857 * ndxslur,0,ncmid(iv,ip),soutq,lsout,fontslur)
17858 end if
17859 end if
17860 end if
17861 if (btest(iornq(ivx,ip),24)) then
17862 c
17863 c Start slur on main note for After- or Way-after-grace.
17864 c
17865 ndxslur = log2(16777215-listslur)
17866 c
17867 c Get note name
17868 c
17869 call notefq(noteq,lnoten,nolev(ivx,ip),ncmid(iv,ip))
17870 c
17871 c Get slur direction
17872 c
17873 slurudq = 'u'
17874 if (.not.beamon(ivx)) then
17875 if (udqq(nolev(ivx,ip),ncmid(iv,ip),islur(ivx,ip),
17876 * nvmx(iv),ivx,nv) .eq. 'u') slurudq = 'd'
17877 else
17878 if (ulq(ivx,ibmcnt(ivx)) .eq. 'u') slurudq = 'd'
17879 end if
17880 c
17881 c Replace ndxslur by 23-ndxslur when printing only.
17882 c
17883 if (23-ndxslur .lt. 10) then
17884 notexq = sq//'islur'//slurudq//chax(71-ndxslur)
17885 * //noteq(1:lnoten)
17886 call addstr(notexq,8+lnoten,soutq,lsout)
17887 else if (23-ndxslur .lt. 20) then
17888 notexq = sq//'islur'//slurudq//'{1'//chax(61-ndxslur)
17889 * //'}'//noteq(1:lnoten)
17890 call addstr(notexq,11+lnoten,soutq,lsout)
17891 else
17892 notexq = sq//'islur'//slurudq//'{2'//chax(51-ndxslur)
17893 * //'}'//noteq(1:lnoten)
17894 call addstr(notexq,11+lnoten,soutq,lsout)
17895 end if
17896 call setbits(ipl(ivx,ip),5,23,ndxslur)
17897 if (btest(ipl(ivx,ip),31))
17898 c
17899 c Starting slur on W-grace on THIS note. Record ndxslur.
17900 c
17901 * listslur = ibset(listslur,ndxslur)
17902 end if
17903 end if
17904 c
17905 c Process dynamic marks
17906 c
17907 if (btest(irest(ivx,ip),26)) then
17908 call dodyn(ivx,ip,
17909 * nolev(ivx,ip),ncmid(iv,ip),ipl(ivx,ip),islur(ivx,ip),
17910 * irest(ivx,ip),nvmx(iv),nv,beamon(ivx),ihornb,nornb,ulq,
17911 * ibmcnt(ivx),nodur(ivx,ip).ge.64,soutq,lsout)
17912 end if
17913 c
17914 c Check for chord notes. Moved up from below, 10/27/96 so chord orns done 1st.
17915 c
17916 if (btest(ipl(ivx,ip),10)) then
17917 c
17918 c Need a duration to set type of note head
17919 c
17920 c Clumsy test, but vxtup is not set until main note is processed.
17921 c
17922 if (.not.(vxtup(ivx).or.btest(irest(ivx,ip),28))) then
17923 nodu = nodur(ivx,ip)
17924 else if (btest(irest(ivx,ip),2) .or.
17925 * (ip.gt.1.and.btest(irest(ivx,ip-1),2))) then
17926 c
17927 c In a 2-note tremolo
17928 c
17929 if (btest(irest(ivx,ip),2)) then
17930 c
17931 c First note of tremolo, duration is on next note
17932 c
17933 nodu = nodur(ivx,ip+1)
17934 else
17935 nodu = nodur(ivx,ip)
17936 end if
17937 else if (iand(mult(ivx,ip),15)-8 .lt. 0) then
17938 nodu = 32
17939 else
17940 nodu = 16
17941 end if
17942 call docrd(ivx,ip,nodu,ncmid(iv,ip),iv,tnow,soutq,lsout,
17943 * ulq,ibmcnt(ivx),islur(ivx,ip),nvmx(iv),nv,
17944 * beamon(ivx),nolev(ivx,ip),ihornb,nornb,stemlen,
17945 * btest(nacc(ivx,ip),27),nacc(ivx,ip),
17946 * irest)
17947 end if
17948 c
17949 c Now that chords are done, add stuff to midi file
17950 c
17951 if (ismidi) call addmidi(icm,
17952 c 130316
17953 * nolev(ivx,ip)+miditran(instno(iv)),
17954 * iand(nacc(ivx,ip),7),midisig,
17955 * tnote(ipl2(ivx,ip)),
17956 * btest(irest(ivx,ip),0),.false.)
17957 c
17958 c Check for breath or caesura
17959 c
17960 if (btest(iornq(ivx,ip),28)) then
17961 call putcb(ivx,ip,notexq,lnote)
17962 call addstr(notexq,lnote,soutq,lsout)
17963 end if
17964 c
17965 c Check for main-note ornaments. ')' on dotted notes go in with note, not here.
17966 c Bits 0-13: (stmgx+Tupf._) ; 14: Down fermata, was F
17967 c 15: Trill w/o "tr", was U , 16-18 edit. accid., 19-21 TBD
17968 c
17969 isacc = iand(iornq(ivx,ip),1614807023) .gt. 0
17970 c
17971 c isacc=.true. if any ornament except segno
17972 c
17973 if (btest(iornq(ivx,ip),13) .and. nodur(ivx,ip).gt.0) then
17974 c
17975 c If ). is only ornament, bypass. If with others, temporarirly zero the bit.
17976 c
17977 if (2**log2(nodur(ivx,ip)) .ne. nodur(ivx,ip)) then
17978 if (iand(iornq(ivx,ip),516079) .eq. 0) then
17979 c
17980 c ). is the only non-segno ornament
17981 c
17982 isacc = .false.
17983 else
17984 c
17985 c There are other ornaments in addition
17986 c
17987 rpndot = .true.
17988 iornq(ivx,ip) = ibclr(iornq(ivx,ip),13)
17989 end if
17990 end if
17991 end if
17992 if (isacc .and. .not.cwrferm(ivx)) then
17993 c
17994 c Check for centered whole-bar rest with fermata (bits 10 or 14).
17995 c
17996 if (iand(iornq(ivx,ip),17408).gt.0
17997 * .and. btest(irest(ivx,ip),0) .and.
17998 * nodur(ivx,ip).eq.lenbar .and.
17999 * .not.(firstgulp.and.ibar.eq.1.and.lenb0.gt.0)) then
18000 cwrferm(ivx) = .true.
18001 go to 30
18002 end if
18003 call putorn(iornq(ivx,ip),nolev(ivx,ip),nolev(ivx,ip),
18004 * nodur(ivx,ip),nornb,ulq,ibmcnt(ivx),ivx,ncmid(iv,ip),
18005 * islur(ivx,ip),nvmx(iv),nv,ihornb,stemlen,
18006 * notexq,lnote,ip,islhgt,beamon(ivx),
18007 * btest(ipl(ivx,ip),10))
18008 call addstr(notexq,lnote,soutq,lsout)
18009 end if
18010 if (rpndot) then
18011 iornq(ivx,ip) = ibset(iornq(ivx,ip),13)
18012 rpndot = .false.
18013 end if
18014 30 continue
18015 c
18016 c Check for main note accidental
18017 c
18018 if (iand(nacc(ivx,ip),3).gt.0 .and.
18019 * .not.btest(nacc(ivx,ip),17)) then
18020 ihshft = igetbits(nacc(ivx,ip),7,10)
18021 if (ihshft .ne. 0) ihshft=ihshft-107
18022 if (.not.btest(ipl(ivx,ip),10) .and. btest(ipl(ivx,ip),8))
18023 c
18024 c Not a chord, and left-shifted main note, so left-shift accid
18025 c
18026 * ihshft = ihshft-20
18027 call doacc(ihshft,igetbits(nacc(ivx,ip),6,4),
18028 * notexq,lnote,nacc(ivx,ip),nolev(ivx,ip),ncmid(iv,ip),
18029 * btest(irest(ivx,ip),31))
18030 call addstr(notexq,lnote,soutq,lsout)
18031 end if
18032 c
18033 c Lower dot for lower-voice notes. Conditions are:
18034 c 1. Dotted time value
18035 c 2. Lower voice of two
18036 c 3. Note is on a line
18037 c 4. Not a rest
18038 c. 5. Flag (lowdot) is set to true
18039 c 6. Not in an xtuplet
18040 c
18041 if (lowdot .and. nvmx(iv).eq.2 .and. ivx.le.nv
18042 * .and. nodur(ivx,ip).ne.0) then
18043 if (.not.btest(irest(ivx,ip),0) .and.
18044 * 2**log2(nodur(ivx,ip)).ne.nodur(ivx,ip) .and.
18045 * mod(nolev(ivx,ip)-ncmid(ivx,ip),2).eq.0) then
18046 if (btest(irest(ivx,ip),19)) then
18047 c
18048 c Note already in movdot list. Drop by 2.
18049 c
18050 updot(ivx,ndotmv(ivx)+1) =
18051 * updot(ivx,ndotmv(ivx)+1)-2.
18052 else
18053 c
18054 c Not in list so just move it right now
18055 c
18056 call dotmov(-2.,0.,soutq,lsout,
18057 * igetbits(islur(ivx,ip),1,3))
18058 end if
18059 end if
18060 end if
18061 c
18062 c Check for dotted main notes with moved dots. Chord notes done elsewhere.
18063 c Added check rules out special chordal 2nds, but later must check
18064 c substituted chord note for dot shift that now applies to main note.
18065 c
18066 if (btest(irest(ivx,ip),19)) then
18067 ndotmv(ivx) = ndotmv(ivx)+1
18068 call dotmov(updot(ivx,ndotmv(ivx)),rtdot(ivx,ndotmv(ivx)),
18069 * soutq,lsout,igetbits(islur(ivx,ip),1,3))
18070 end if
18071 c
18072 c Stemlength changes
18073 c
18074 if (btest(mult(ivx,ip),27)) then
18075 dstemlen = igetbits(mult(ivx,ip),6,10)*.5-4.
18076 call addstr(sq//'stdstemfalse',13,soutq,lsout)
18077 stemshort = 4.66+.667*dstemlen
18078 call addstr(sq//'stemlength{',12,soutq,lsout)
18079 write(notexq,'(f4.1)')stemshort
18080 call addstr(notexq(1:4)//'}',5,soutq,lsout)
18081 else if (ip .gt. 1) then
18082 if (btest(mult(ivx,ip-1),27))
18083 c
18084 c Cancel shortening. Looks like it gets automatically restored if new inst. or
18085 c new line, so no need to worry about affecting other lines
18086 c
18087 * call addstr(sq//'stemlength{4.66}',17,soutq,lsout)
18088 end if
18089 c
18090 c Zero out slur-height marker for raising ornaments
18091 c
18092 islhgt = 0
18093 c
18094 c Now start with spacing notes. Is a beam start pending?
18095 c
18096 if (bspend .and.
18097 * ibm2(ivx,ibmcnt(ivx)).gt.ibm1(ivx,ibmcnt(ivx))) then
18098 if (ixrest(ivx) .eq. 4) then
18099 c
18100 c Special path for single note at end of otherwise beamed xtup
18101 c
18102 ixrest(ivx) = 0
18103 else
18104 if (kbdrests .and. btest(irest(ivx,ip),0) .and.
18105 * .not.btest(islur(ivx,ip),29).and. nvmx(iv).eq.2 .and.
18106 * nolev(ivx,ip).le.50)
18107 * call chkkbdrests(ip,iv,ivx,nn,islur,irest,nolev,
18108 * ivmx,nib,nv,ibar,tnow,tol,nodur,2,levtopr,levbotr,
18109 * mult,ipl)
18110 if (btest(islur(ivx,ip),29)
18111 * .and.btest(irest(ivx,ip),24)) then
18112 notexq = chax(92)//'sk'
18113 lnote = 3
18114 else
18115 call beamn1(notexq,lnote)
18116 c if (isbjmp .and.
18117 if (isbjmp .and. ivbj2.ne.0 .and.
18118 * iand(mult(ivx,ip),15)-8 .gt. multbj1) then
18119 c
18120 c Need to increase multiplicity at the beam jump
18121 c
18122 c ibmcnt was increased by 1 at the end of first seg of jump beam!?
18123 c Try adding e.g. \nbbu1 if needed to increase multiplicity. Add
18124 c character in reverse order to start of notexq.
18125 c
18126 if (ivbj1 .lt. 9) then
18127 notexq = char(48+ivbj1)//notexq(1:lnote)
18128 lnote = lnote+1
18129 else
18130 notexq = '{1'//char(38+ivbj1)//'}'
18131 * //notexq(1:lnote)
18132 lnote = lnote+4
18133 end if
18134 notexq = 'bb'//ulq(ivbj1,ibmcnt(ivbj1)-1)
18135 * //notexq(1:lnote)
18136 lnote = lnote+3
18137 if (iand(15,mult(ivx,ip))-8 .eq. 3) then
18138 notexq = 'b'//notexq(1:lnote)
18139 lnote = lnote+1
18140 end if
18141 notexq = sq//'n'//notexq(1:lnote)
18142 lnote = lnote+2
18143 end if
18144 end if
18145 end if
18146 bspend = .false.
18147 c
18148 c Is a beam ending?
18149 c
18150 else if (numbms(ivx).gt.0 .and. ibmcnt(ivx).le.numbms(ivx)
18151 * .and. (ibm2(ivx,ibmcnt(ivx)).eq.ip .or.
18152 * btest(nacc(ivx,ip),20))) then
18153 if (bspend) then
18154 c
18155 c Must be a single-note ending of a jump-beam
18156 c
18157 bspend = .false.
18158 end if
18159 call beamend(notexq,lnote)
18160 if (isbjmp .and. ivx.eq.ivbj1) then
18161 c
18162 c Jump beam segment is ending, check if multiplicity DECREASES
18163 c
18164 if (space(ib+1) .gt. space(ib)) then
18165 c
18166 c Decrease multiplicity 3-1, 3-2, or 2-1. Spaces are 2,4, or 8.
18167 c
18168 if (ivx .lt. 10) then
18169 ivxq = char(ivx+48)
18170 livx = 1
18171 else
18172 ivxq = '{1'//char(ivx-10)//'}'
18173 livx = 4
18174 end if
18175 if (space(ib+1).eq.8..and.space(ib).eq.2.) then
18176 notexq = sq//'tbbb'//ulq(ivx,ibmcnt(ivx))//
18177 * ivxq(1:livx)//sq//'tbb'//
18178 * ulq(ivx,ibmcnt(ivx))//ivxq(1:livx)//notexq(1:lnote)
18179 lnote = lnote+11+2*livx
18180 else if (space(ib+1).eq.8..and.space(ib).eq.4.) then
18181 notexq = sq//'tbb'//ulq(ivx,ibmcnt(ivx))//
18182 * ivxq(1:livx)//notexq(1:lnote)
18183 lnote = lnote+5+livx
18184 else if (space(ib+1).eq.4..and.space(ib).eq.2.) then
18185 notexq = sq//'tbbb'//ulq(ivx,ibmcnt(ivx))//
18186 * ivxq(1:livx)//notexq(1:lnote)
18187 lnote = lnote+6+livx
18188 end if
18189 end if
18190 end if
18191 if (.not.btest(nacc(ivx,ip),20)) then
18192 vxtup(ivx) = .false.
18193 nornb(ivx) = 0
18194 ibmcnt(ivx) = ibmcnt(ivx)+1
18195 beamon(ivx) = .false.
18196 end if
18197 c
18198 c Or if we're in the middle of a beam
18199 c
18200 else if (numbms(ivx).gt.0 .and. beamon(ivx)) then
18201 c
18202 c Added 130127
18203 c
18204 if (kbdrests .and. btest(irest(ivx,ip),0) .and.
18205 * .not.btest(islur(ivx,ip),29).and. nvmx(iv).eq.2 .and.
18206 * nolev(ivx,ip).le.50)
18207 * call chkkbdrests(ip,iv,ivx,nn,islur,irest,nolev,
18208 * ivmx,nib,nv,ibar,tnow,tol,nodur,2,levtopr,levbotr,
18209 * mult,ipl)
18210 call beamid(notexq,lnote)
18211 c
18212 c Or whole-bar rest
18213 c
18214 else if (btest(irest(ivx,ip),0)
18215 * .and. nodur(ivx,ip).eq.lenbar
18216 * .and..not.(firstgulp.and.ibar.eq.1.and.lenb0.gt.0)
18217 * .and..not.btest(irest(ivx,ip),25)
18218 * .and..not.btest(islur(ivx,ip),29)) then
18219 c
18220 c Rule out pickup bar, blank rests, non-centered. Remember islur b19=> rp
18221 c
18222 cwrest(ivx) = .true.
18223 iscwr = .true.
18224 call notex(cwrq(ivx),lcwr(ivx))
18225 tnow = tnow+lenbar
18226 go to 10
18227 else if (ixrest(ivx) .eq. 0) then
18228 c
18229 c Before writing note or rest, check for keyboard rest height adjustment.
18230 c Conditions are 0. This is a non-blank rest
18231 c 1. kbdrests = .true.
18232 c 2. There are two voices on the staff
18233 c 3. No user-def height adjustments have been applied (nolev<50)
18234 c
18235 if (kbdrests .and. btest(irest(ivx,ip),0) .and.
18236 * .not.btest(islur(ivx,ip),29).and. nvmx(iv).eq.2 .and.
18237 * nolev(ivx,ip).le.50) then
18238 call chkkbdrests(ip,iv,ivx,nn,islur,irest,nolev,
18239 * ivmx,nib,nv,ibar,tnow,tol,nodur,1,levtopr,levbotr,
18240 * mult,ipl)
18241 end if
18242 if (btest(ipl(ivx,ip),4)) then
18243 c
18244 c Deal with single stem tremolo
18245 c Get up-downness, borrowed from notex
18246 c
18247 if (udqq(nolev(ivx,ip),ncmid(iv,ip),islur(ivx,ip),
18248 * nvmx(iv),ivx,nv).eq.'u') then
18249 udq = 'u'
18250 else
18251 udq = 'l'
18252 end if
18253 multtrem = igetbits(ipl(ivx,ip),2,5)+1
18254 if (nodur(ivx,ip) .lt. 64) then
18255 notexq = sq//'tr'
18256 else
18257 notexq = sq//'Tr'
18258 end if
18259 lnote = 3
18260 if (multtrem .eq. 2) then
18261 notexq = notexq(1:3)//'r'
18262 lnote = 4
18263 else if (multtrem .eq.3) then
18264 notexq = notexq(1:3)//'rr'
18265 lnote = 5
18266 end if
18267 c
18268 c Get a numerical pitch argument
18269 c
18270 lineno = nolev(ivx,ip)-ncmid(iv,ip)+4
18271 if (lineno .lt.0 .or. lineno .gt.9) then
18272 write(noteq,'(a1,i2,a1)')'{',lineno,'}'
18273 lnoten = 4
18274 else
18275 noteq = char(lineno+48)
18276 lnoten = 1
18277 end if
18278 notexq = notexq(1:lnote)//'m'//udq//noteq(1:lnoten)
18279 lnote = lnote+2+lnoten
18280 call addstr(notexq,lnote,soutq,lsout)
18281 end if
18282 c
18283 c Get code for a separate note or rest
18284 c If nacc(ivx,ip)(30-31)=1 (dotted chordal 2nd including main note),
18285 c pitch will be shifted +/-1 inside notex.
18286 c
18287 call notex(notexq,lnote)
18288 end if
18289 c
18290 c Right offset? This may cause trouble
18291 c
18292 if (btest(ipl(ivx,ip),8)) then
18293 call addstr(sq//'loff{',6,soutq,lsout)
18294 else if (btest(ipl(ivx,ip),9)) then
18295 call addstr(sq//'roff{',6,soutq,lsout)
18296 end if
18297 if (ixrest(ivx).eq.0 .and. lnote.gt. 0) then
18298 call addstr(notexq,lnote,soutq,lsout)
18299 end if
18300 if (btest(ipl(ivx,ip),8) .or.
18301 * btest(ipl(ivx,ip),9)) call addstr('}',1,soutq,lsout)
18302 c
18303 c Terminate user-defined offsets. Fix format
18304 c
18305 if (btest(irest(ivx,ip),15) .or. btest(irest(ivx,ip),17))
18306 * call putshft(ivx,.false.,soutq,lsout)
18307 c
18308 c Deal with After- and Way-after-graces. First, if end of bar, compute space
18309 c needed since it wasn't done during general ask-checks. If extra space is
18310 c rq'd, convert GW to GA. Therefore GW at end of bar never needs extra sp.
18311 c But will still need to add extra space as hardspace.
18312 c
18313 if (ip.eq.nn(ivx) .and. (btest(ipl(ivx,ip),31).or.
18314 * btest(ipl(ivx,ip),29))) then
18315 do 77 ig = 1 , ngrace
18316 if (ipg(ig).eq.ip .and. ivg(ig).eq.ivx) go to 78
18317 77 continue
18318 print*,'Problem finding grace index at "do 77"'
18319 call stop1()
18320 78 continue
18321 c
18322 c Get elemskip to end of bar. WON'T WORK IF XTUPS !!
18323 c
18324 esk = 0.
18325 do 40 iib = ib , nb
18326 if (iib .eq. ib) then
18327 itleft = nint(to(ipl2(ivx,ip)))
18328 else
18329 itleft = nint(tstart(ib))
18330 end if
18331 if (iib .lt. nb) then
18332 itright = nint(tstart(iib+1))
18333 else
18334 itright = lenbar
18335 end if
18336 esk = esk+feon(space(ib))*
18337 * (itright-itleft)/space(ib)
18338 40 continue
18339 ptsavail = poenom*esk-wheadpt
18340 if (nng(ig) .eq. 1) then
18341 wgr = grafac
18342 else
18343 wgr = nng(ig)*emgfac
18344 do 41 ing = 1 , nng(ig)
18345 if (naccg(ngstrt(ig)-1+ing) .gt. 0) wgr = wgr+acgfac
18346 41 continue
18347 end if
18348 ptgr(ig) = wgr*wheadpt
18349 ptsneed = (wgr+0.5)*wheadpt
18350 ptsndg(ivx) = 0.
18351 if (ptsavail .lt. ptsneed) then
18352 ptsndg(ivx) = ptsneed
18353 eskndg(ivx) = esk
18354 if (btest(ipl(ivx,ip),31)) then
18355 c
18356 c Convert GW to GA
18357 c
18358 ipl(ivx,ip) = ibset(ibclr(ipl(ivx,ip),31),29)
18359 end if
18360 end if
18361 end if
18362 c
18363 c Check for GA
18364 c
18365 if (btest(ipl(ivx,ip),29))
18366 * call dograce(ivx,ip,ptgr,soutq,lsout,ncmid(iv,ip),
18367 * nacc(ivx,ip),ig,ipl(ivx,ip),.false.,
18368 * .false.,0,0,0,0,0,0,0.,ulq,instno(iv))
18369 c
18370 c Update running time
18371 c
18372 tnow = tnow+space(ib)
18373 10 continue
18374 c
18375 c Have finished last note in this voice and block
18376 c
18377 itendb = nint(to(istop(ib))+space(ib))
18378 if (figbass .and. ivx.eq.1 .or. ivx.eq.ivxfig2) then
18379 ivf = 1
18380 if (ivx .gt. 1) ivf = 2
18381 17 if (figchk(ivf) .and. itfig(ivf,ifig(ivf)).lt.itendb) then
18382 c
18383 c There's at least one figure left. offnsk could be <0
18384 c
18385 offnsk = (tnow-itfig(ivf,ifig(ivf)))/space(ib)
18386 call putfig(ivf,ifig(ivf),offnsk,figchk(ivf),soutq,lsout)
18387 go to 17
18388 end if
18389 end if
18390 c
18391 c Check for flag, dot, or upstem on last note of bar.
18392 c
18393 if (ib .eq. nb) then
18394 ip = ipo(ipl2(ivx,nn(ivx)))
18395 flgndv(ivx) = 0.
18396 if (abs(tnote(ipl2(ivx,ip))-space(ib)).lt.tol) then
18397 if (space(ib) .lt. 16.-tol) then
18398 c
18399 c Note in last space, smaller than a quarter note.
18400 c
18401 if ((.not.btest(irest(ivx,ip),0) .and.
18402 * udqq(nolev(ivx,ip),ncmid(iv,ip),islur(ivx,ip),
18403 * nvmx(iv),ivx,nv).eq.'u')
18404 * .or. isdotted(nodur,ivx,ip)) then
18405 c
18406 c Upstem non-rest, or dotted
18407 c
18408 if (numbms(ivx).gt.0
18409 * .and. ip.eq.ibm2(ivx,max(1,numbms(ivx)))
18410 * .and. .not.isdotted(nodur,ivx,ip))
18411 * then
18412 c
18413 c In beam and not dotted, so use smaller space
18414 c
18415 flgndv(ivx) = upstmfac
18416 else
18417 flgndv(ivx) = flagfac
18418 end if
18419 end if
18420 else
18421 c
18422 c Last space, nonflagged (no beam) only worry dot or up
18423 c
18424 if (isdotted(nodur,ivx,ip)) then
18425 flgndv(ivx) = flagfac
18426 else if (tnote(ipl2(ivx,ip)).lt.64 .and.
18427 * udqq(nolev(ivx,ip),ncmid(iv,ip),islur(ivx,ip),
18428 * nvmx(iv),ivx,nv).eq.'u') then
18429 c
18430 c Upstem on last note , non-flagged
18431 c
18432 flgndv(ivx) = upstmfac
18433 end if
18434 end if
18435 end if
18436 c
18437 c Check for right-shifted chordal note
18438 c
18439 if (btest(irest(ivx,ip),20)) flgndv(ivx) = rtshfac
18440 flgndb = flgndb .or. flgndv(ivx).gt.0.
18441 if (ismidi) then
18442 c
18443 c For midi, set flags for accidentals on last note of bar. Assume they affect
18444 c first note of next bar whether or not tied.
18445 c Note has already been done, so next entry into addmidi is 1st in new bar.
18446 c First do main note, then chord notes
18447 c
18448 c Gyrations needed to account for multi-bar tied full-bar notes?
18449 cc Old old lbacc(icm) = iand(nacc(ivx,ip),7)
18450 c New old if (lbacc(icm).eq.0) lbacc(icm) = iand(nacc(ivx,ip),7)
18451 c
18452 if (iand(nacc(ivx,ip),7) .gt. 0) then
18453 c
18454 c Explicit accidental on last main note in bar
18455 c
18456 do 55 kacc = 1 , naccbl(icm)
18457 if (laccbl(icm,kacc) .eq. nolev(ivx,ip)) go to 56
18458 55 continue
18459 naccbl(icm) = naccbl(icm)+1
18460 laccbl(icm,naccbl(icm)) = nolev(ivx,ip)
18461 jaccbl(icm,naccbl(icm)) = iashft(iand(nacc(ivx,ip),7))
18462 end if
18463 56 continue
18464 if (btest(ipl(ivx,ip),10) .and. crdacc) then
18465 do 57 icrd = icrd1 , icrd2
18466 iacc = igetbits(icrdat(icrd),3,20)
18467 if (iacc .gt. 0) then
18468 c
18469 c Explicit accidental on chord note at end of bar
18470 c
18471 nolevc = igetbits(icrdat(icrd),7,12)
18472 do 58 kacc = 1 , naccbl(icm)
18473 if (laccbl(icm,kacc) .eq. nolevc) go to 59
18474 58 continue
18475 naccbl(icm) = naccbl(icm)+1
18476 laccbl(icm,naccbl(icm)) = nolevc
18477 jaccbl(icm,naccbl(icm)) = iashft(iacc)
18478 end if
18479 59 continue
18480 57 continue
18481 end if
18482 c if (lbacc(icm).eq.0 .and. accb4(icm)) then
18483 do 65 kacc = 1 , naccim(icm)
18484 c
18485 c If naccim(icm)>0,
18486 c possible implicit accidental from earlier in the bar. Check for prior accid
18487 c in this bar at relevant note levels, main and chord notes. Only act if no
18488 c explicit action from just above. Assuming any accid on last note in bar,
18489 c either explicit or implicit, has same effect on 1st note of next bar.
18490 c
18491 if (nolev(ivx,ip) .eq. laccim(icm,kacc)) go to 66
18492 if (btest(ipl(ivx,ip),10)) then
18493 do 67 icrd = icrd1 , icrd2
18494 if (iand(ishft(icrdat(icrd),-12),127) .eq.
18495 * laccim(icm,kacc)) go to 66
18496 67 continue
18497 end if
18498 go to 65
18499 66 continue
18500 c
18501 c So far we know there is a main or chord note at level laccim(icm,kacc). So
18502 c it will get a bl-accid if it didn't just already get one.
18503 c
18504 do 68 macc = 1 , naccbl(icm)
18505 if (laccbl(icm,macc) .eq. laccim(icm,kacc)) go to 65
18506 68 continue
18507 naccbl(icm) = naccbl(icm)+1
18508 laccbl(icm,naccbl(icm)) = laccim(icm,kacc)
18509 jaccbl(icm,naccbl(icm)) = jaccim(icm,kacc)
18510 65 continue
18511 end if
18512 end if
18513 1199 continue
18514 11 continue
18515 c
18516 c Close out the notes group
18517 c
18518 call addstr(sq//'en',3,soutq,lsout)
18519 if (islast.and.lsout .gt. 0) write(11,'(a)')soutq(1:lsout)//'%'
18520 16 continue
18521 c
18522 c Check for way-after graces at end of bar. We could not link these to notes
18523 c as in midbar since there is no note following grace! Also, set flag if
18524 c hardspace is needed. Also, save nvmx, ivmx for use in space checks on reloop.
18525 c
18526 isgrace = .false.
18527 do 75 iv = 1 , nv
18528 nvmxsav(iv) = nvmx(iv)
18529 do 7599 kv = 1 , nvmx(iv)
18530 ivmxsav(iv,kv) = ivmx(iv,kv)
18531 ivx = ivmx(iv,kv)
18532 ptsgnd = 0.
18533 if ((btest(ipl(ivx,nn(ivx)),29).or.btest(ipl(ivx,nn(ivx)),31))
18534 * .and. ptsndg(ivx).gt.0.) then
18535 flgndb = .true.
18536 if (ptsndg(ivx) .gt. ptsgnd) then
18537 ptsgnd = ptsndg(ivx)
18538 eskgnd = eskndg(ivx)
18539 end if
18540 end if
18541 if (btest(ipl(ivx,nn(ivx)),31)) then
18542 c
18543 c This voice has a way-after grace here at end of bar
18544 c
18545 if (.not.isgrace) then
18546 c
18547 c This is the first one, so set up the string
18548 c
18549 isgrace = .true.
18550 ivlast = 1
18551 soutq = sq//'znotes'
18552 lsout = 7
18553 end if
18554 do 76 iiv = ivlast , iv-1
18555 call addstr(sepsymq(iiv),1,soutq,lsout)
18556 76 continue
18557 ivlast = iv
18558 c
18559 c No need to put in 'nextvoice', even if 2 lines/staff
18560 c
18561 call dograce(ivx,nn(ivx),ptgr,soutq,lsout,ncmid(iv,nn(ivx)),
18562 * nacc(ivx,nn(ivx)),ig,ipl(ivx,nn(ivx)),.true.,
18563 * .false.,0,0,0,0,0,0,0.,ulq,instno(iv))
18564 end if
18565 7599 continue
18566 75 continue
18567 if (isgrace) then
18568 call addstr(sq//'en%',4,soutq,lsout)
18569 if (islast .and. lsout .gt. 0) write(11,'(a)')soutq(1:lsout)
18570 end if
18571 lsout = 0
18572 c
18573 c Write multibar rest. Assuming nv = 1 and do not worry about cwbrest
18574 c This has to be the only use of atnextbar
18575 c
18576 if (ibar.eq.ibarmbr .and. islast) then
18577 if (newmbrhgt) then
18578 soutq = sq//'def'//sq//'mbrhgt{'
18579 if (mbrhgt .le. -10) then
18580 write(soutq(13:15),'(i3)')mbrhgt
18581 lsout = 15
18582 else if (mbrhgt.ge.10.or.mbrhgt.le.-1) then
18583 write(soutq(13:14),'(i2)')mbrhgt
18584 lsout = 14
18585 else
18586 soutq = soutq(1:12)//char(48+mbrhgt)
18587 lsout = 13
18588 end if
18589 soutq = soutq(1:lsout)//'}%'
18590 write(11,'(a)')soutq(1:lsout+2)
18591 newmbrhgt = .false.
18592 end if
18593 soutq = sq//'def'//sq//'atnextbar{'//sq//'znotes'
18594 lsout = 22
18595 notexq = sq//'mbrest'
18596 lnote = 7
18597 call istring(mbrest,noteq,len)
18598 notexq = notexq(1:lnote)//noteq(1:len)
18599 lnote = lnote+len
18600 mtrspc = nint(xb4mbr)
18601 xb4mbr = 0.
18602 call istring(mtrspc,noteq,len)
18603 notexq = notexq(1:lnote)//noteq(1:len)//'0'
18604 lnote = lnote+len+1
18605 do 62 iv = 1 , nv
18606 call addstr(notexq,lnote,soutq,lsout)
18607 if (iv .lt. nv) call addstr(sepsymq(iv),1,soutq,lsout)
18608 62 continue
18609 call addstr(sq//'en}%',5,soutq,lsout)
18610 write(11,'(a)')soutq(1:lsout)
18611 lsout = 0
18612 if (ishort .gt. 0) then
18613 mbrsum = mbrsum+mbrest
18614 nmbr = nmbr+1
18615 end if
18616 if (mbrest .gt. 1) then
18617 ndig = int(alog10(mbrest-1+.01))+1
18618 write(11,'(a14,i'//chax(48+ndig)//',a1)')
18619 * sq//'advance'//sq//'barno',mbrest-1,'%'
18620 end if
18621 else if (iscwr) then
18622 c
18623 c Centered whole-bar rests. Set flag to pass to pmxb at start of NEXT bar
18624 c to check for new clef and add space by redefining \CenterBar
18625 c
18626 centrests = .true.
18627 call addstr(sq//'def'//sq//'value{0}',13,soutq,lsout)
18628 call addstr(sq//'def'//sq//'atnextbar{'//sq//'znotes',22,
18629 * soutq,lsout)
18630 do 60 iv = 1 , nv
18631 c added
18632 lnote = 0
18633 c
18634 do 61 kv = 1 , nvmx(iv)
18635 ivx = ivmx(iv,kv)
18636 if (cwrest(ivx)) then
18637 call addstr(sq//'CenterBar{',11,soutq,lsout)
18638 if (.not.cwrferm(ivx)) then
18639 if (lcwr(ivx).ge.11 .and. cwrq(ivx)(11:11).ne.'p') then
18640 c
18641 c Kluge to use new definitions for centered, stacked rests
18642 c
18643 if (cwrq(ivx)(2:10).eq.'liftpause' .or.
18644 * cwrq(ivx)(2:10).eq.'liftPAuse')
18645 * cwrq(ivx)(10:10) = 'c'
18646 end if
18647 call addstr(cwrq(ivx)(1:lcwr(ivx)),lcwr(ivx),soutq,
18648 * lsout)
18649 call addstr('}{-2}{'//sq//'value}',13,soutq,lsout)
18650 else
18651 c
18652 c Fermata on centered rest. Will need to fix up level.
18653 c 12/6/07 shift it left so it's centered over rest
18654 c
18655 notexq = notexq(1:lnote)//sq//'loffset{.33}{'
18656 * //sq//'fermataup7}'//cwrq(ivx)(1:lcwr(ivx))
18657 * //'}{-2}{'//sq//'value}'
18658 lnote = lnote+26+lcwr(ivx)+13
18659 call addstr(notexq,lnote,soutq,lsout)
18660 cwrferm(ivx) = .false.
18661 end if
18662 end if
18663 61 continue
18664 if (iv .ne. nv) call addstr(sepsymq(iv),1,soutq,lsout)
18665 60 continue
18666 if (islast) then
18667 call addstr(sq//'en}%',5,soutq,lsout)
18668 if (lsout.gt.0)write(11,'(a)')soutq(1:lsout)
18669 end if
18670 end if
18671 c
18672 c End of block for centered whole-bar rests and multi-bar rests
18673 c
18674 c If at end of block, save durations of last notes in bar, for possible use
18675 c if clef changes at start of next bar
18676 c
18677 if (ibar .eq. nbars) then
18678 do 63 iv = 1 , nv
18679 do 6399 kv = 1 , nvmx(iv)
18680 ivx = ivmx(iv,kv)
18681 prevtn(ivx) = tnote(ipl2(ivx,nn(ivx)))
18682 6399 continue
18683 63 continue
18684 end if
18685 c
18686 c Update time for midi. This is only used for the event track
18687 c
18688 if (ismidi) then
18689 miditime = miditime+15*lenbar
18690 c
18691 c If pickup, write the real time signature to the event track. Cannot use
18692 c mtrnuml since it was reset to 0, have to recompute it
18693 c
18694 if (lenb0 .eq. lenbar)
18695 * call midievent('m',mtrdenl*lenb1/64,mtrdenl)
18696 end if
18697 return
18698 end
18699 subroutine makeabar()
18700 c
18701 c On input, have pseudo-durations in nodur(ivx,ip). Not real durations for
18702 c xtups, since only last note of xtup gets non-zero nodur, which
18703 c corresponds to single note of full length of xtup.
18704 c In this subroutine we make an ordered list of all notes in all voices.
18705 c ilnc = list note counter
18706 c ivxo(ilnc), ipo(ilnc) = voice# and position in voice of ilnc-th note.
18707 c to(ilnc) = real start time of note in PMX-units (64=whole note)
18708 c tno(ilnc) = time to next event in the bar.
18709 c tnote(ilnc) = actual duration of note
18710 c Then run thru list, grouping consecutive notes into \notes groups ib.
18711 c space(ib) = real time unit for the \notes group
18712 c squez(ib) = factor on space to get effective space. This will be 1 if
18713 c there is a note exactly spanning each interval of space, and
18714 c <1 if not.
18715 c Details: let eon = elemskips per noteskip (like length). Basic formula is
18716 c eon = sqrt(space/2.)
18717 c If tgovern >= space, then
18718 c eon = sqrt(tgovern/2)*(space/tgovern) = space/sqrt(2*tgovern).
18719 c Time needed to give this eon using basic formula is
18720 c teq = space**2/tgovern
18721 c Factor on space to get teq is
18722 c squez(ib) = space/tgovern
18723 c The eon for each ib can then be computed based on time of space*squez.
18724 c Iff squez = 1, there is a note spanning every increment in the \notes group.
18725 c
18726 c tnminb = minimum time span in the bar for increments spanned by notes,
18727 c i.e., with squez=1. Use after parsing into line to decide if
18728 c spacing needs to be "flattened" among notes groups.
18729 c
18730 common /comtol/ tol
18731 parameter (nm=24,nkb=3999,maxblks=9600)
18732 common /a1ll/ iv,ivxo(600),ipo(600),to(600),tno(600),nnl(nm),
18733 * nv,ibar,mtrnuml,nodur(nm,200),lenbar,iccount,
18734 * nbars,itsofar(nm),nib(nm,15),nn(nm),
18735 * rest(nm,200),lenbr0,lenbr1,firstline,newmeter
18736 common /linecom/ elskb,tnminb(nkb)
18737 common /c1omnotes/ nnodur,wminnh(nkb),nnpd(maxblks),durb(maxblks),
18738 * iddot,nptr(nkb),ibarcnt,mbrest,ibarmbr,
18739 * ibaroff,udsp(nkb),wheadpt,sqzb(maxblks)
18740 common /c1ommvl/ nvmx(nm),ivmx(nm,2),ivx,fbar,nacc(nm,200)
18741 logical rest,firstline,newmeter
18742 integer cnn(nm),istart(80),istop(80)
18743 real*4 xit(nm),space(80),tstart(80),squez(80),tnote(600)
18744 elskb = 0.
18745 tnminb(ibarcnt) = 1000.
18746 do 1 iv = 1 , nv
18747 do 1999 kv = 1 , nvmx(iv)
18748 ivx = ivmx(iv,kv)
18749 if (ibar .gt. 1) then
18750 nn(ivx) = nib(ivx,ibar)-nib(ivx,ibar-1)
18751 else
18752 nn(ivx) = nib(ivx,ibar)
18753 end if
18754 1999 continue
18755 1 continue
18756 c
18757 c initialize list note counter, time(iv), curr. note(iv)
18758 c
18759 ilnc = 1
18760 do 4 iv = 1 , nv
18761 do 4999 kv = 1 , nvmx(iv)
18762 ivx = ivmx(iv,kv)
18763 cnn(ivx) = 1
18764 ivxo(ilnc) = ivx
18765 ipo(ilnc) = 1
18766 to(ilnc) = 0.
18767 tnote(ilnc) = fnote(nodur,ivx,1,nacc)
18768 xit(ivx) = tnote(ilnc)
18769 if (abs(xit(ivx)-lenbar).lt.tol) xit(ivx) = 1000.
18770 ilnc = ilnc+1
18771 4999 continue
18772 4 continue
18773 c
18774 c Build the list
18775 c
18776 5 continue
18777 c
18778 c Determine which voice comes next from end of notes done so far.
18779 c tmin is the earliest ending time of notes done so far
18780 c
18781 tmin = 1000.
18782 do 6 iv = 1 , nv
18783 do 6999 kv = 1 , nvmx(iv)
18784 ivx = ivmx(iv,kv)
18785 tminn = min(tmin,xit(ivx))
18786 if(tminn .lt. tmin) then
18787 tmin = tminn
18788 ivnext = ivx
18789 end if
18790 6999 continue
18791 6 continue
18792 if (tmin .gt. 999.) go to 7
18793 ivxo(ilnc) = ivnext
18794 cnn(ivnext) = cnn(ivnext)+1
18795 ipo(ilnc) = cnn(ivnext)
18796 to(ilnc) = tmin
18797 c
18798 c Check if this voice is done
18799 c
18800 tnote(ilnc) = fnote(nodur,ivnext,cnn(ivnext),nacc)
18801 if (cnn(ivnext) .eq. nn(ivnext)) then
18802 xit(ivnext) = 1000.
18803 else
18804 xit(ivnext) = xit(ivnext)+tnote(ilnc)
18805 end if
18806 ilnc = ilnc+1
18807 go to 5
18808 7 continue
18809 ntot = ilnc-1
18810 if (ntot .gt. 600) then
18811 call printl(' ')
18812 call printl('Cannot have more than 600 notes per bar, stopping')
18813 call stop1()
18814 end if
18815 do 8 in = 1 , ntot-1
18816 tno(in) = to(in+1)-to(in)
18817 8 continue
18818 tno(ntot) = fnote(nodur,ivxo(ntot),ipo(ntot),nacc)
18819 tnote(ntot) = tno(ntot)
18820 c
18821 c Done w/ list. Initialize loop for building note blocks:
18822 c
18823 ib = 1
18824 istart(1) = 1
18825 space(1) = 0.
18826 in = 1
18827 c
18828 c Start the loop
18829 c
18830 9 continue
18831 if (in .eq. ntot) then
18832 if (space(ib) .lt. tol) then
18833 space(ib) = tno(in)
18834 c
18835 c Last gap in bar is spanned by a note, so cannot need a squeeze.
18836 c
18837 squez(ib) = 1.
18838 end if
18839 istop(ib) = ntot
18840 c
18841 c From here flow out of this if block and into block-setup
18842 c
18843 else if (space(ib) .lt. tol) then
18844 c
18845 c space hasn't been set yet, so tentatively set:
18846 c
18847 space(ib) = tno(in)
18848 if (space(ib) .lt. tol) then
18849 in=in+1
18850 else
18851 c
18852 c Tentative space tno(in) is non-zero. Set squez, which will be kept (since
18853 c it is a unique property of the particular increment starting here) :
18854 c
18855 squez(ib) = getsquez(in,ntot,space(ib),tnote,to)
18856 istop(ib) = in
18857 end if
18858 go to 9
18859 else if (tno(in+1) .lt. tol) then
18860 c
18861 c This is not the last note in the space, so
18862 c
18863 in = in+1
18864 go to 9
18865 else if (abs(tno(in+1)-space(ib)) .lt. tol) then
18866 c
18867 c Next increment has same space. Does it have same squez?
18868 c
18869 xsquez = getsquez(in+1,ntot,space(ib),tnote,to)
18870 c
18871 c If it does have the same squez, loop, otherwise flow out
18872 c
18873 if (abs(xsquez-squez(ib)) .lt. tol) then
18874 c
18875 c Keep spacing the same, update tentative stop point
18876 c
18877 in = in+1
18878 istop(ib) = in
18879 go to 9
18880 end if
18881 end if
18882 c
18883 c At this point istart, istop, space, and squez are good, so close out block
18884 c
18885 tstart(ib) = to(istart(ib))
18886 c
18887 c Compute elemskips assuming no flattening to increase min space. The formula
18888 c is only correct if f1eon(t) = sqrt(t/2); more generally (after possible
18889 c flattening in pmxb), elsperns = squez*feon(space/squez)
18890 c
18891 elsperns = f1eon(space(ib)*squez(ib))
18892 if (istop(ib) .eq. ntot) then
18893 nnsk = nint((lenbar-tstart(ib))/space(ib))
18894 else
18895 nnsk = nint((to(istop(ib)+1)-tstart(ib))/space(ib))
18896 end if
18897 elskb = elskb+elsperns*nnsk
18898 if (nptr(ibarcnt+1) .gt. nptr(ibarcnt)) then
18899 call catspace(space(ib),squez(ib),nnsk)
18900 else
18901 c
18902 c This is the first entry for this bar
18903 c
18904 nnpd(nptr(ibarcnt)) = nnsk
18905 durb(nptr(ibarcnt)) = space(ib)
18906 sqzb(nptr(ibarcnt)) = squez(ib)
18907 nptr(ibarcnt+1) = nptr(ibarcnt+1)+1
18908 end if
18909 c
18910 c Update minimum space spanned by a note
18911 c
18912 if (abs(squez(ib)-1) .lt. tol)
18913 * tnminb(ibarcnt) = min(tnminb(ibarcnt),space(ib))
18914 if (istop(ib) .eq. ntot) go to 15
18915 c
18916 c End of spatial accounting for now
18917 c
18918 ib = ib+1
18919 istart(ib) = istop(ib-1)+1
18920 in = istart(ib)
18921 c
18922 c Set tentative block space for new block
18923 c
18924 space(ib) = tno(in)
18925 if (space(ib).gt.tol)
18926 * squez(ib)= getsquez(in,ntot,space(ib),tnote,to)
18927 istop(ib) = in
18928 go to 9
18929 15 continue
18930 return
18931 end
18932 subroutine midievent(typeq,in1,in2)
18933 c
18934 c We now store "conductor" events in mmidi(numchan,.), and count bytes
18935 c with imidi(numchan)
18936 c
18937 parameter (nm=24,mv=24576)
18938 integer*2 mmidi
18939 logical restpend,relacc,notmain,twoline,ismidi,crdacc
18940 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
18941 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
18942 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
18943 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
18944 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
18945 * debugmidi
18946 logical debugmidi
18947 common /comevent/ miditime,lasttime
18948 character*1 typeq
18949 idur = isetvarlen(miditime-lasttime,nbytes)
18950 imidi(numchan) = imidi(numchan)+nbytes+1
18951 do 1 i = 1 , nbytes
18952 mmidi(numchan,imidi(numchan)-i) = mod(idur,256)
18953 idur = ishft(idur,-8)
18954 1 continue
18955 mmidi(numchan,imidi(numchan)) = 255
18956 if (typeq .eq. 't') then
18957 c
18958 c Tempo event. in1 = quarters per minute (integer)
18959 c
18960 mmidi(numchan,imidi(numchan)+1) = 5*16+1
18961 mmidi(numchan,imidi(numchan)+2) = 3
18962 misperq = nint(60000000./in1)
18963 do 2 i = 1 , 3
18964 mmidi(numchan,imidi(numchan)+6-i) = mod(misperq,256)
18965 misperq = ishft(misperq,-8)
18966 2 continue
18967 imidi(numchan) = imidi(numchan)+5
18968 else if (typeq .eq. 'm') then
18969 c
18970 c Meter event. in1=numerator, in2=denom (power of 2)
18971 c
18972 mmidi(numchan,imidi(numchan)+1) = 5*16+8
18973 mmidi(numchan,imidi(numchan)+2) = 4
18974 mmidi(numchan,imidi(numchan)+3) = in1
18975 if (in2 .gt. 0) then
18976 mmidi(numchan,imidi(numchan)+4) = log2(in2)
18977 else
18978 mmidi(numchan,imidi(numchan)+4) = 0
18979 end if
18980 mmidi(numchan,imidi(numchan)+5) = 24
18981 mmidi(numchan,imidi(numchan)+6) = 8
18982 imidi(numchan) = imidi(numchan)+6
18983 else if (typeq .eq. 'k') then
18984 c
18985 c Keychange event. in1 = isig
18986 c
18987 mmidi(numchan,imidi(numchan)+1) = 5*16+9
18988 mmidi(numchan,imidi(numchan)+2) = 2
18989 mmidi(numchan,imidi(numchan)+3) = mod(256+in1,256)
18990 mmidi(numchan,imidi(numchan)+4) = 0
18991 imidi(numchan) = imidi(numchan)+4
18992 else
18993 print*,'Program flameout in midievent'
18994 call stop1()
18995 end if
18996 lasttime = miditime
18997 return
18998 end
18999 subroutine moveln(iuin,iuout,done)
19000 logical done
19001 character*129 outq
19002 done = .false.
19003 read(iuin,'(a)',end=1) outq
19004 lenout = llen(outq,129)
19005 write(iuout,'(a)') outq(1:lenout)
19006 return
19007 1 done = .true.
19008 return
19009 end
19010 subroutine mrec1(lineq,iccount,ndxm)
19011 c
19012 c This is called when (a) macro recording is just starting and
19013 c (b) at the start of a new line, if recording is on
19014 c
19015 parameter (maxblks=9600)
19016 character*128 lineq,lnholdq
19017 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
19018 logical mrecord,mplay,endmac
19019 common /c1ommac/ ip1mac(20),il1mac(20),ip2mac(20),il2mac(20),
19020 * ic1mac(20),ilmac,iplmac
19021 character*131072 bufq
19022 integer*2 lbuf(maxblks)
19023 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
19024 if (.not.mrecord) then
19025 c
19026 c Starting the macro
19027 c
19028 ip1mac(macnum) = ipbuf-lbuf(ilbuf-1)+iccount
19029 il1mac(macnum) = ilbuf-1
19030 ic1mac(macnum) = iccount
19031 mrecord = .true.
19032 end if
19033 if (iccount .lt. 128) then
19034 ndxm = index(lineq(iccount+1:128),'M')
19035 if (ndxm .gt. 0) ndxm = ntindex(lineq(iccount+1:128),'M',
19036 * 128-iccount)
19037 if (ndxm .gt. 0) then
19038 c
19039 c This line ends the macro.
19040 c
19041 ip2mac(macnum) = ipbuf-lbuf(ilbuf-1)+iccount+ndxm
19042 il2mac(macnum) = ilbuf-1
19043 mrecord = .false.
19044 end if
19045 end if
19046 return
19047 end
19048 function ncmid(iv,ip)
19049 parameter (nm=24)
19050 common /all/ mult(nm,200),jv,nnl(nm),nv,ibar,
19051 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
19052 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
19053 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
19054 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
19055 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
19056 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
19057 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
19058 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
19059 common /comipl2/ ipl2(nm,200)
19060 character*1 ulq,sepsymq,sq
19061 logical beamon,firstgulp,figbass,figchk,isfig
19062 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
19063 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
19064 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
19065 common /comtol/ tol
19066 if (ncc(iv) .eq. 1) then
19067 ncmid = ncmidcc(iv,1)
19068 else
19069 xtime = to(ipl2(ivx,ip))
19070 do 1 icc = ncc(iv) , 1 , -1
19071 if (xtime .gt. tcc(iv,icc)-tol) then
19072 ncmid = ncmidcc(iv,icc)
19073 return
19074 end if
19075 1 continue
19076 print*,'Problem in ncmid()'
19077 stop
19078 end if
19079 end
19080 function ncmidf(clefq)
19081 c
19082 c Return middle line of a clef
19083 c
19084 character*1 clefq
19085 if (clefq .eq. '8') then
19086 c
19087 c treblelowoct; will treat as treble for this purpose
19088 c
19089 ncmidf = 35
19090 else
19091 ncmidf = 21+index(' b6r5n4a3m2s1t0f7',clefq)/2*2
19092 end if
19093 return
19094 end
19095 subroutine newvoice(jv,clefq,change)
19096 parameter (nm=24)
19097 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
19098 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
19099 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
19100 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
19101 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
19102 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
19103 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
19104 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
19105 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
19106 character*1 ulq,sepsymq,sq
19107 logical beamon,firstgulp,figbass,figchk,isfig
19108 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
19109 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
19110 * tautofb,autofbon,t1autofb
19111 character*1 ulfbq,clefq
19112 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
19113 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
19114 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
19115 logical change,autofbon
19116 nvmx(jv) = 1
19117 ivmx(jv,1) = jv
19118 itsofar(jv) = 0
19119 nnl(jv) = 0
19120 nfb(jv) = 0
19121 if (firstgulp .or. change) then
19122 ncmidcc(jv,1) = ncmidf(clefq)
19123 else
19124 ncmidcc(jv,1) = ncmidcc(jv,ncc(jv))
19125 end if
19126 tcc(jv,1) = 0.
19127 ncc(jv) = 1
19128 nudoff(jv) = 0
19129 ndotmv(jv) = 0
19130 do 5 j = 1 , 200
19131 irest(jv,j) = 0
19132 islur(jv,j) = 0
19133 ipl(jv,j) = 0
19134 nacc(jv,j) = 0
19135 iornq(jv,j) = 0
19136 mult(jv,j) = 0
19137 if (jv.le.2) isfig(jv,j) = .false.
19138 5 continue
19139 return
19140 end
19141 subroutine notefq(noteq,lnote,nolev,ncmid)
19142 c
19143 c Returns name of note level with octave transpositions, updates noctup.
19144 c
19145 common /comoct/ noctup
19146 character*8 noteq
19147 character*1 upcaseq,noteqt,chax
19148 nupfroma = mod(nolev+1,7)
19149 iname = 97+nupfroma
19150 ioctup = (nolev+1)/7-4
19151 noteqt = chax(iname)
19152 if (ncmid .eq. 23) noteqt = upcaseq(noteqt)
19153 if (ioctup .eq. noctup) then
19154 noteq = noteqt
19155 lnote = 1
19156 c
19157 c Must ALWAYS check if lnote=1 for use with functions requiring a blank
19158 c
19159 else if (ioctup .gt. noctup) then
19160 c
19161 c Raise octave. Encase in {}
19162 c
19163 write(noteq,'(8a1)')'{',(chax(39),i=noctup,ioctup-1),
19164 * noteqt,'}'
19165 lnote = 3+ioctup-noctup
19166 noctup = ioctup
19167 else
19168 c
19169 c Lower octave
19170 c
19171 write(noteq,'(8a1)')'{',(chax(96),i=ioctup,noctup-1),
19172 * noteqt,'}'
19173 lnote = 3+noctup-ioctup
19174 noctup = ioctup
19175 end if
19176 return
19177 end
19178 subroutine notex(notexq,lnote)
19179 c
19180 c Returns non-beamed full note name
19181 c
19182 parameter (nm=24)
19183 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
19184 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
19185 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
19186 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
19187 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
19188 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
19189 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
19190 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
19191 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
19192 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
19193 character*1 ulq,sepsymq,sq
19194 logical beamon,firstgulp,figbass,figchk,
19195 * isfig,ispoi,btest,even
19196 character*1 udq,udqq,chax
19197 character*4 dotq
19198 character*2 numq
19199 character*79 notexq
19200 character*8 noteq
19201 character*40 restq
19202 common /compoi/ ispoi
19203 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
19204 * fullsize(nm),ivxfig2,ivvfig(2,74)
19205 character*10 figq
19206 ip = ipo(jn)
19207 nole = nolev(ivx,ip)
19208 c
19209 c Check for special situations with 2nds (see precrd)
19210 c
19211 if (btest(nacc(ivx,ip),30)) then
19212 nole = nole - 1
19213 else if (btest(nacc(ivx,ip),31)) then
19214 nole = nole + 1
19215 end if
19216 nodu = nodur(ivx,ip)
19217 if (.not.btest(irest(ivx,ip),0)) then
19218 udq = udqq(nole,ncmid(iv,ip),
19219 * islur(ivx,ip),nvmx(iv),ivx,nv)
19220 end if
19221 c
19222 c Check figure level
19223 c
19224 if (figbass .and. .not.btest(irest(ivx,ip),0) .and.
19225 * ((ivx.eq.1.and.isfig(1,ip))
19226 * .or.(ivx.eq.ivxfig2.and.isfig(2,ip)))) then
19227 if (udq .eq. 'u' .or. nodu.ge.64) then
19228 c
19229 c Upper or no stem, fnole (in noleunits) set by notehead
19230 c
19231 fnole = nole
19232 else
19233 c
19234 c Lower stem, fnole set by bottom of stem
19235 c
19236 fnole = nole-stemlen
19237 end if
19238 zmin = fnole-ncmid(ivx,ip)+4
19239 if (ivx .eq. 1) then
19240 ifigdr(1,iline) = max(ifigdr(1,iline),nint(4-zmin))
19241 else
19242 ifigdr(2,iline) = max(ifigdr(2,iline),nint(4-zmin))
19243 end if
19244 end if
19245 if (.not.btest(irest(ivx,ip),0)) then
19246 call notefq(noteq,lnoten,nole,ncmid(iv,ip))
19247 if (lnoten .eq. 1) call addblank(noteq,lnoten)
19248 if (nodu .eq. 1) then
19249 notexq =sq//'cccc'//udq//noteq(1:lnoten)
19250 lnote = lnoten+6
19251 else if (nodu .eq. 2) then
19252 notexq =sq//'ccc'//udq//noteq(1:lnoten)
19253 lnote = lnoten+5
19254 else if (nodu .eq. 4) then
19255 notexq =sq//'cc'//udq//noteq(1:lnoten)
19256 lnote = lnoten+4
19257 else if (nodu .eq. 8) then
19258 notexq =sq//'c'//udq//noteq(1:lnoten)
19259 lnote = lnoten+3
19260 else if (nodu .eq. 16) then
19261 notexq =sq//'q'//udq//noteq(1:lnoten)
19262 lnote = lnoten+3
19263 else if (nodu .eq. 32) then
19264 notexq =sq//'h'//udq//noteq(1:lnoten)
19265 lnote = lnoten+3
19266 else if (nodu .eq. 64) then
19267 notexq =sq//'wh'//noteq(1:lnoten)
19268 lnote = lnoten+3
19269 else if (nodu .eq. 128) then
19270 notexq =sq//'breve'//noteq(1:lnoten)
19271 lnote = lnoten+6
19272 else
19273 dotq = 'p'
19274 ldot = 1
19275 if (btest(iornq(ivx,ip),13)) then
19276 c
19277 c Dotted note with ')' ornament
19278 c
19279 dotq='m'
19280 else if (btest(islur(ivx,ip),3)) then
19281 c
19282 c Double dot
19283 c
19284 dotq = 'pp'
19285 ldot = 2
19286 end if
19287 if (nodu .ge. 192) then
19288 notexq =sq//'breve'//dotq(1:ldot)//noteq(1:lnoten)
19289 lnote = lnoten+6+ldot
19290 else if (nodu .ge. 96) then
19291 notexq =sq//'wh'//dotq(1:ldot)//noteq(1:lnoten)
19292 lnote = lnoten+3+ldot
19293 else if (nodu .ge. 48) then
19294 notexq =sq//'h'//udq//dotq(1:ldot)//noteq(1:lnoten)
19295 lnote = lnoten+3+ldot
19296 else if (nodu .ge. 24) then
19297 notexq =sq//'q'//udq//dotq(1:ldot)//noteq(1:lnoten)
19298 lnote = lnoten+3+ldot
19299 else if (nodu .ge. 12) then
19300 notexq =sq//'c'//udq//dotq(1:ldot)//noteq(1:lnoten)
19301 lnote = lnoten+3+ldot
19302 else if (nodu .ge. 6) then
19303 notexq =sq//'cc'//udq//dotq(1:ldot)//noteq(1:lnoten)
19304 lnote = lnoten+4+ldot
19305 ispoi = .true.
19306 else
19307 notexq =sq//'ccc'//udq//dotq(1:ldot)//noteq(1:lnoten)
19308 lnote = lnoten+5+ldot
19309 ispoi = .true.
19310 end if
19311 if (dotq(1:1) .eq. 'm') then
19312 c
19313 c Need another call to the note, in case the first one has octave shifts
19314 c
19315 if (lnoten .eq. 2) then
19316 notexq = notexq(1:lnote)//'{'//noteq(2:2)//'}'
19317 lnote = lnote+3
19318 else
19319 notexq = notexq(1:lnote)//noteq(lnoten-1:lnoten-1)
19320 lnote = lnote+1
19321 end if
19322 end if
19323 end if
19324 else if (btest(islur(ivx,ip),29)) then
19325 c
19326 c Blank rest
19327 c
19328 notexq = sq//'sk'
19329 lnote = 3
19330 else
19331 c
19332 c Non-blank rest
19333 c
19334 lnote = 0
19335 nole = mod(nole+20,100)-20
19336 c
19337 c Kluge to get pause symbol for rp:
19338 c
19339 if (btest(islur(ivx,ip),19)) nodu = 64
19340 if (nodu .le. 28) then
19341 c
19342 c Normal rest < or = double-dotted quarter
19343 c
19344 lrest = 3
19345 if (nodu .gt. 14) then
19346 restq =sq//'qp'
19347 else if (nodu .gt. 7) then
19348 restq =sq//'ds'
19349 else if (nodu .gt. 3) then
19350 restq =sq//'qs'
19351 else if (nodu .gt. 1) then
19352 restq =sq//'hs'
19353 else
19354 restq =sq//'qqs'
19355 lrest = 4
19356 end if
19357 c
19358 c Special case for rest at start of F-tuplet inside a forced beam
19359 c
19360 if (btest(nacc(ivx,ip),18) .and.
19361 * btest(nacc(ivx,ip),19)) then
19362 restq = sq//'pt4'//restq(1:lrest)
19363 lrest = lrest+4
19364 end if
19365 notexq = restq
19366 lnote = lrest
19367 c
19368 c At this point notexq=restq,lnote=lrest are name of rest. Now raise if necc.
19369 c
19370 if (nole .ne. 0) then
19371 if (abs(nole) .lt. 10) then
19372 noteq = chax(48+abs(nole))
19373 lnoten = 1
19374 else
19375 write(noteq(1:2),'(i2)')abs(nole)
19376 lnoten = 2
19377 end if
19378 if (nole .gt. 0) then
19379 notexq = sq//'raise'//noteq(1:lnoten)//sq//'internote'
19380 else
19381 notexq = sq//'lower'//noteq(1:lnoten)//sq//'internote'
19382 end if
19383 lnote = 16+lnoten
19384 notexq = notexq(1:lnote)//restq(1:lrest)
19385 lnote = lnote+lrest
19386 end if
19387 if (2**log2(nodu) .ne. nodu) then
19388 c
19389 c Deal with dots (on rests shorter than half rest)
19390 c
19391 restq = sq//'pt'
19392 lrest = 3
19393 if (2*nodu .gt. 3*2**log2(nodu)) then
19394 restq = sq//'ppt'
19395 lrest = 4
19396 end if
19397 nole = nole+4
19398 raisedot = 0
19399 c
19400 c Tweak dot positions for special cases
19401 c
19402 even = (mod(100+nole,2).eq.0)
19403 if (.not.even .and. (nole.lt.0.or.nole.gt.8)) then
19404 raisedot = 1
19405 end if
19406 if (nole.ge.10 .or. nole.le.-1) then
19407 write(numq,'(i2)')nole
19408 restq = restq(1:lrest)//'{'//numq//'}'
19409 lrest = lrest+4
19410 else
19411 restq = restq(1:lrest)//chax(nole+48)
19412 lrest = lrest+1
19413 end if
19414 if (raisedot.gt.0) then
19415 restq = sq//'raise'//sq//'internote'//
19416 * sq//'hbox{'//restq(1:lrest)//'}'
19417 lrest = lrest+23
19418 end if
19419 notexq = restq(1:lrest)//notexq(1:lnote)
19420 lnote = lnote+lrest
19421 end if
19422 else
19423 c
19424 c Half rest or longer
19425 c
19426 if (nole .eq. 0) then
19427 c
19428 c Half or longer rest is not raised or lowered
19429 c
19430 if (nodu .le. 56) then
19431 notexq =sq//'hpause'
19432 lnote = 7
19433 else if (nodu .le. 112) then
19434 if (.not.btest(islur(ivx,ip),19) .or.
19435 * btest(irest(ivx,ip),25)) then
19436 notexq = sq//'pause'
19437 else
19438 notexq = sq//'pausc'
19439 end if
19440 lnote = 6
19441 else
19442 notexq =sq//'PAuse'
19443 lnote = 6
19444 end if
19445 if (2**log2(nodu) .ne. nodu) then
19446 c
19447 c Dotted rest, hpause or longer
19448 c
19449 notexq = notexq(1:lnote)//'p'
19450 lnote = lnote+1
19451 if (2*nodu .gt. 3*2**log2(nodu)) then
19452 c
19453 c Double dotted long rest
19454 c
19455 notexq = notexq(1:lnote)//'p'
19456 lnote = lnote+1
19457 end if
19458 end if
19459 else
19460 c
19461 c Raised or lowered half or whole rest
19462 c
19463 if (nodu .eq. 32) then
19464 notexq = sq//'lifthpause'
19465 lnote = 11
19466 else if (nodu .eq. 48) then
19467 notexq = sq//'lifthpausep'
19468 lnote = 12
19469 else if (nodu .eq. 56) then
19470 notexq = sq//'lifthpausepp'
19471 lnote = 13
19472 else if (nodu .eq. 64) then
19473 notexq = sq//'liftpause'
19474 lnote = 10
19475 else if (nodu .eq. 96) then
19476 notexq = sq//'liftpausep'
19477 lnote = 11
19478 else if (nodu .eq. 112) then
19479 notexq = sq//'liftpausepp'
19480 lnote = 12
19481 else if (nodu .eq. 128) then
19482 notexq = sq//'liftPAuse'
19483 lnote = 10
19484 else
19485 c
19486 c Assume dotted double whole rest
19487 c
19488 notexq = sq//'liftPAusep'
19489 lnote = 11
19490 end if
19491 c
19492 c Set up height spec
19493 c
19494 nole = sign(abs(nole)/2,nole)
19495 if (nole.le.9 .and. nole.ge.0) then
19496 noteq = chax(48+nole)
19497 lnoten = 1
19498 else
19499 noteq = '{'
19500 if (nole .ge. -9) then
19501 write(noteq(2:3),'(i2)')nole
19502 lnoten = 3
19503 else
19504 write(noteq(2:4),'(i3)')nole
19505 lnoten = 4
19506 end if
19507 noteq = noteq(1:lnoten)//'}'
19508 lnoten = lnoten+1
19509 end if
19510 notexq = notexq(1:lnote)//noteq(1:lnoten)
19511 lnote = lnote+lnoten
19512 end if
19513 end if
19514 end if
19515 return
19516 end
19517 function ntindex(line,s2q,lenline)
19518 c
19519 c Returns index(line,s2q) if NOT in TeX string, 0 otherwise
19520 c
19521 character*(*) s2q,line
19522 character*1 chax
19523 logical intex
19524 ndxs2 = index(line,s2q)
19525 ndxbs = index(line,chax(92))
19526 if (ndxbs.eq.0 .or. ndxs2.lt.ndxbs) then
19527 ntindex = ndxs2
19528 else
19529 c
19530 c There are both bs and s2q, and bs is to the left of sq2. So check bs's to
19531 c right of first: End is '\ ', start is ' \'
19532 c
19533 len = lenstr(line,lenline)
19534 intex = .true.
19535 do 1 ic = ndxbs+1 , len
19536 if (ic .eq. ndxs2) then
19537 if (intex) then
19538 ntindex = 0
19539 ndxs2 = index(line(ic+1:len),s2q)+ic
19540 else
19541 ntindex = ndxs2
19542 return
19543 end if
19544 else if (intex .and. line(ic+1:ic+2).eq.chax(92)//' ') then
19545 intex = .false.
19546 else if (.not.intex .and. line(ic+1:ic+2).eq.' '//chax(92))
19547 * then
19548 intex = .true.
19549 end if
19550 1 continue
19551 end if
19552 return
19553 end
19554 subroutine ntrbbb(n,char1q,ulqq,iv,notexq,lnote)
19555 c
19556 c This appends to notexq e.g. '\ibbbu1'
19557 c
19558 common /combbm/ isbbm
19559 logical isbbm
19560 character*79 notexq
19561 character*1 char1q,ulqq,chax
19562 character*4 tempq
19563 if (n .ge. 5) isbbm = .true.
19564 if (lnote .gt. 0) then
19565 notexq = notexq(1:lnote)//chax(92)//char1q
19566 else
19567 notexq = chax(92)//char1q
19568 end if
19569 lnote = lnote+2
19570 do 3 im = 1 , n
19571 notexq = notexq(1:lnote)//'b'
19572 lnote = lnote+1
19573 3 continue
19574 c
19575 c add the number, 0 if 12
19576 c
19577 c 5/25/08 Allow >12
19578 c
19579 if (iv .lt. 24) then
19580 call istring(iv,tempq,len)
19581 else if (iv .eq. 24) then
19582 tempq(1:1) = '0'
19583 len = 1
19584 else
19585 call printl('Sorry, too man open beams')
19586 call stop1()
19587 end if
19588 notexq = notexq(1:lnote)//ulqq//tempq(1:len)
19589 lnote = lnote+1+len
19590 return
19591 end
19592 function numclef(clefq)
19593 c
19594 c Returns the number to be used as argument of \setclef for MusiXTeX
19595 c For input 0-6 or tsmanrb return 0-7
19596 c 7 f 9
19597 c 8 0
19598 c
19599 character*1 clefq
19600 if (ichar(clefq) .lt. 55) then
19601 numclef = ichar(clefq)-48
19602 else if (clefq .eq. '7') then
19603 numclef = 9
19604 else if (clefq .eq. '8') then
19605 numclef = 0
19606 else
19607 numclef = index('tsmanrbxxf',clefq)-1
19608 end if
19609 return
19610 end
19611 subroutine outbar(i,jlast)
19612 character*1 chax
19613 nfmt = log10(i+.5)+2
19614 if (jlast+5+nfmt .lt. 80) then
19615 write(*,'(a5,i'//chax(48+nfmt)//',$)')' Bar',i
19616 write(15,'(a5,i'//chax(48+nfmt)//',$)')' Bar',i
19617 jlast = jlast+5+nfmt
19618 else
19619 write(*,'(/,a5,i'//chax(48+nfmt)//',$)')' Bar',i
19620 write(15,'(/,a5,i'//chax(48+nfmt)//',$)')' Bar',i
19621 jlast = 5+nfmt
19622 end if
19623 return
19624 end
19625 subroutine pmxa(basenameq,lbase,isfirst,nsyout,nbarss,optimize)
19626 cccccccccccccccccccccccccccccccccccccccccccccccc
19627 cc cc
19628 cc Subroutine, combine with pmxb.for
19629 cc
19630 cccccccccccccccccccccccccccccccccccccccccccccccc
19631 cc
19632 cc Need to consider X spaces in xtuplets when getting poenom, and
19633 cc maybe fbar?
19634 cc mx06a
19635 cc ID numbers for voices when number of voices is reduced.
19636 cc
19637 cc mx03a
19638 cc account for new fracindent for new movements.
19639 cc
19640 cc Known changes since pmxa. Version 1.1b (see pmxb for longer list)
19641 cc
19642 cc Check ID codes for slurs.
19643 cc Version 1.24 still does not have details for spacing/positioning
19644 cc arpeggios if there are accidentals or shifted notes or crowded scores.
19645 cc Fix problem in 1.22 with arpeggios across multi-line staves
19646 cc Fix problem in 1.22 with flat key signatures
19647 cc Read setup data as strings
19648 cc Warning for octave designation plus +/-
19649 cc Don't pause for volta warning,
19650 cc Macros
19651 cc Correct fsyst to account for transposition and key changes.
19652 cc Check for nbars > nsyst
19653 cc
19654 ccccccccccccccccccccccccccccccccccc
19655 parameter (nm=24,nkb=3999,nks=125,maxblks=9600)
19656 logical loop,usefig,isfirst,optimize
19657 character*131072 bufq
19658 integer*2 lbuf(maxblks)
19659 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
19660 integer nn(nm),nodur(nm,200),ivxo(600),ipo(600),
19661 * nnl(nm),itsofar(nm),nib(nm,15),lastbar(0:nks),nbarss(nks)
19662 common /c1omnotes/ nnodur,wminnh(nkb),nnpd(maxblks),durb(maxblks),
19663 * iddot,nptr(nkb),ibarcnt,mbrest,ibarmbr,
19664 * ibaroff,udsp(nkb),wheadpt,sqzb(maxblks)
19665 common /compage/ widthpt,ptheight,hoffpt,voffpt,
19666 * nsyst,nflb,ibarflb(0:40),
19667 * isysflb(0:40),npages,nfpb,ipagfpb(0:18),isysfpb(0:18),
19668 * usefig,fintstf,gintstf,fracsys(30),nmovbrk,isysmb(0:30),
19669 * nistaff(0:40)
19670 common /comkeys/ nkeys,ibrkch(18),newkey(18),iskchb,idsig,isig1,
19671 * mbrestsav,kchmid(18),ornrpt,shifton,barend,noinst,stickyS
19672 real*4 elsk(nkb),celsk(0:nkb),elss(nks),to(600),tno(600)
19673 character*128 lnholdq
19674 character*44 basenameq
19675 logical rest(nm,200),firstline,fbon,isvolt,iskchb,kchmid,ornrpt,
19676 * stickyS
19677 common /c1omget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
19678 * fracindent,nsperi(nm),linesinpmxmod,line1pmxmod,lenbuf0
19679 logical lastchar,newmeter,newmb(nkb),issegno,bottreb,isheadr,
19680 * shifton,barend
19681 common /a1ll/ iv,ivxo,ipo,to,tno,nnl,nv,ibar,mtrnuml,
19682 * nodur,lenbar,iccount,nbars,itsofar,nib,nn,
19683 * rest,lenbr0,lenbr1,firstline,newmeter
19684 common /linecom/ elskb,tnminb(nkb)
19685 common /cblock/
19686 * etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
19687 * xilbn,xilbtc,xilhdr,xilfig,a,b,inhnoh
19688 common /cominbot/ inbothd
19689 common /c1ommvl/ nvmx(nm),ivmx(nm,2),ivx,fbar,nacc(nm,200)
19690 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
19691 common /commus/ musize,whead20
19692 common /comeon/ eonk,ewmxk
19693 logical mrecord,mplay,endmac,cstuplet
19694 logical novshrinktop,upslur,fontslur,WrotePsslurDefaults
19695 common /comnvst/ novshrinktop,cstuplte
19696 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
19697 * ,WrotePsslurDefaults,SlurCurve
19698 common /comligfont/ isligfont
19699 logical isligfont
19700 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
19701 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
19702 logical EarlyTransOn,LaterInstTrans
19703 logical fulltrans
19704 common /comis4bignv/ is4bignv,AIset
19705 logical is4bignv,AIset
19706 common /comshort/ shortfrac,codafrac,ishort,mbrsum,nmbr,nocodabn,
19707 * poefa
19708 real*4 poefa(125)
19709 logical nocodabn
19710 data wtimesig,wclef,wkeysig
19711 * / 0.72 , 0.8 , 0.28 /
19712 do 97 i = 1 , 125
19713 poefa(i) = 1.
19714 97 continue
19715 is4bignv = .false.
19716 AIset = .false.
19717 whead20 = 0.3
19718 ishort = 0
19719 if (.not.optimize) then
19720 print*
19721 print*,'Starting first PMX pass'
19722 write(15,'(a)') ' Starting first PMX pass'
19723 end if
19724 if (isfirst) then
19725 open(19,file='pmxaerr.dat')
19726 write(19,'(i6)') 0
19727 close(19)
19728 end if
19729 if (.not.optimize) jprntb = 81
19730 macuse = 0
19731 ornrpt = .false.
19732 stickyS = .false.
19733 mrecord = .false.
19734 mplay = .false.
19735 lastchar = .false.
19736 novshrinktop = .false.
19737 cstuplet = .false.
19738 fontslur = .true.
19739 isligfont = .false.
19740 fulltrans = .false.
19741 do 42 ibarcnt = 1 , nkb
19742 udsp(ibarcnt) = 0.
19743 wminnh(ibarcnt) = -1.
19744 42 continue
19745 c
19746 c Initialize input buffer
19747 c
19748 lenbuf0 = ipbuf
19749 ipbuf = 0
19750 ilbuf = 1
19751 call g1etset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,
19752 * xmtrnum0,newkey(1),npages,nsyst,musize,bottreb)
19753 c
19754 c Set up list of instrument numbers (iv)
19755 c
19756 ivnow = 0
19757 do 13 instnow = 1 , noinst
19758 do 14 iscount = 1 , nsperi(instnow)
19759 ivnow = ivnow+1
19760 instno(ivnow) = instnow
19761 14 continue
19762 13 continue
19763 c
19764 c Save initial meter for midi
19765 c
19766 if (.not.isfirst .and. npages.eq.0) then
19767 print*,'Sorry, must have npages>0 for optimization.'
19768 call stop1()
19769 end if
19770 nsyout = nsyst
19771 c
19772 c isig1 will be changed in getnote if there is a transposition
19773 c
19774 isig1 = newkey(1)
19775 if (npages .gt. nsyst) then
19776 call printl('npages > nsyst in input. Please fix the input.')
19777 call stop1()
19778 end if
19779 c
19780 c fbar = afterruleskip/elemskip
19781 c apt = width of small accidental + space in points (= 6 at 20pt) =wheadpt
19782 c
19783 fbar = 1.
19784 wheadpt = whead20*musize
19785 ifig = 0
19786 usefig = .true.
19787 lenbeat = i1fnodur(mtrdenl,'x')
19788 lenmult = 1
19789 if (mtrdenl .eq. 2) then
19790 lenbeat = 16
19791 lenmult = 2
19792 end if
19793 lenbr1 = lenmult*mtrnuml*lenbeat
19794 lenbr0 = nint(lenmult*xmtrnum0*lenbeat)
19795 mtrnuml = 0
19796 if (lenbr0 .ne. 0) then
19797 ibaroff = 1
19798 lenbar = lenbr0
19799 else
19800 ibaroff = 0
19801 lenbar = lenbr1
19802 end if
19803 ibarcnt = 0
19804 nptr(1) = 1
19805 iccount = 128
19806 nmovbrk = 0
19807 nflb = 0
19808 nfpb = 0
19809 ipagfpb(0) = 1
19810 isysfpb(0) = 1
19811 ibarflb(0) = 1
19812 isysflb(0) = 1
19813 nistaff(0) = nv-1
19814 c
19815 c Check for pmx.mod
19816 c
19817 linesinpmxmod = 0
19818 call getpmxmod(.true.,' ')
19819 if (.not.isfirst .and. linesinpmxmod .gt. 0) then
19820 print*,'Sorry, cannot optimize if there is a pmx.mod file'
19821 call stop1()
19822 end if
19823 c
19824 c Initialize for loop over lines
19825 c
19826 nkeys = 1
19827 ibrkch(1) = 1
19828 mbrestsav = 0
19829 shifton = .false.
19830 firstline = .true.
19831 newmeter = .false.
19832 ihead = 0
19833 isheadr = .false.
19834 idsig = 0
19835 iddot = 0
19836 fintstf = -1.
19837 gintstf = 1.0
19838 listcresc = 0
19839 listdecresc = 0
19840 30 loop = .true.
19841 iskchb = .false.
19842 issegno = .false.
19843 nbars = 0
19844 ibarmbr = 0
19845 do 4 iv = 1 , nv
19846 nvmx(iv) = 1
19847 ivmx(iv,1) = iv
19848 itsofar(iv) = 0
19849 nnl(iv) = 0
19850 do 5 j = 1 , 200
19851 rest(iv,j) = .false.
19852 nacc(iv,j) = 0.
19853 5 continue
19854 4 continue
19855 iv = 1
19856 ivx = 1
19857 fbon = .false.
19858 barend = .false.
19859 isvolt = .false.
19860 2 if (loop) then
19861 c
19862 c Within this short loop, nv voices are filled up for the duration of a block.
19863 c On exit (loop=.false.) the following are set: nnl(nv),itsofar(nv)
19864 c nodur(..),rest(..). nnl will later be
19865 c increased and things slid around as accidental skips are added.
19866 c
19867 call g1etnote(loop,ifig,optimize,fulltrans)
19868 if (lastchar) go to 20
19869 go to 2
19870 end if
19871 if (mbrestsav .gt. 0) then
19872 call printl(' ')
19873 call printl(
19874 * 'You must enter the same multibar rest in ALL parts')
19875 call stop1()
19876 end if
19877 do 10 ibar = 1 , nbars
19878 ibarcnt = ibarcnt+1
19879 c
19880 c The following is just a signal to start a new bar when cataloging spaces
19881 c for catspace(...)
19882 c
19883 nptr(ibarcnt+1) = nptr(ibarcnt)
19884 newmb(ibarcnt) = .false.
19885 if (newmeter.and.ibar.eq.1) newmb(ibarcnt) = .true.
19886 c
19887 c Above is only for spacing calcs later on. Remember new meter can only occur
19888 c at START of a new input line (ibar = 1)
19889 c
19890 if (ibar .ne. ibarmbr) then
19891 if (.not.optimize) call outbar(ibarcnt-ibaroff,jprntb)
19892 else
19893 if (.not.optimize) then
19894 write(15,'(/,a20,i4,a1,i4)')' Multibar rest, bars',
19895 * ibarcnt-ibaroff,'-',ibarcnt-ibaroff+mbrest-1
19896 write(*,'(/,a20,i4,a1,i4)')' Multibar rest, bars',
19897 * ibarcnt-ibaroff,'-',ibarcnt-ibaroff+mbrest-1
19898 jprntb = 0
19899 end if
19900 ibaroff = ibaroff-mbrest+1
19901 end if
19902 if (firstline .and. lenbr0.ne.0) then
19903 if (ibar .eq. 1) then
19904 lenbar = lenbr0
19905 else
19906 lenbar = lenbr1
19907 end if
19908 end if
19909 if (ibar .gt. 1) then
19910 c
19911 c For bars after first, slide all stuff down to beginning of arrays
19912 c
19913 do 11 iv = 1 , nv
19914 do 1199 kv = 1 , nvmx(iv)
19915 ivx = ivmx(iv,kv)
19916 ioff = nib(ivx,ibar-1)
19917 do 12 ip = 1 , nib(ivx,ibar)-ioff
19918 nodur(ivx,ip) = nodur(ivx,ip+ioff)
19919 rest(ivx,ip) = rest(ivx,ip+ioff)
19920 nacc(ivx,ip) = nacc(ivx,ip+ioff)
19921 12 continue
19922 1199 continue
19923 11 continue
19924 end if
19925 do 67 iv = 1 , nv
19926 do 6799 kv = 1 , nvmx(iv)
19927 ioff= 0
19928 if(ibar.gt.1)ioff = nib(ivmx(iv,kv),ibar-1)
19929 6799 continue
19930 67 continue
19931 call makeabar()
19932 elsk(ibarcnt) = elskb+fbar
19933 10 continue
19934 newmeter = .false.
19935 firstline = .false.
19936 go to 30
19937 20 continue
19938 c
19939 c Vertical analysis.
19940 c
19941 if (npages .eq. 0) then
19942 if (nsyst .eq. 0) then
19943 print*,'When npages=0, must set nsyst=bars/syst, not 0'
19944 call stop1()
19945 end if
19946 nsyst = (ibarcnt-1)/nsyst+1
19947 if (nv .eq. 1) then
19948 nsystpp = 12
19949 else if (nv .eq. 2) then
19950 nsystpp = 7
19951 else if (nv .eq. 3) then
19952 nsystpp = 5
19953 else if (nv .eq. 4) then
19954 nsystpp = 3
19955 else if (nv .le. 7) then
19956 nsystpp = 2
19957 else
19958 nsystpp = 1
19959 end if
19960 npages = (nsyst-1)/nsystpp+1
19961 end if
19962 c
19963 c Check nsyst vs ibarcnt
19964 c
19965 if (nsyst .gt. ibarcnt) then
19966 print*
19967 print*,'nsyst,ibarcnt:',nsyst,ibarcnt
19968 print*,'There are more systems than bars.'
19969 write(15,'(a,2i5)')' nsyst,ibarcnt:',nsyst,ibarcnt
19970 write(15,'(a)')' There are more systems than bars.'
19971 call stop1()
19972 end if
19973 c
19974 c Set up dummy forced line & page breaks after last real one
19975 c
19976 nflb = nflb+1
19977 ibarflb(nflb) = ibarcnt+1
19978 isysflb(nflb) = nsyst+1
19979 nfpb = nfpb+1
19980 ipagfpb(nfpb) = npages+1
19981 isysfpb(nfpb) = nsyst+1
19982 heightil = ptheight*4./musize
19983 open(12,status='SCRATCH')
19984 write(12,'(a)')basenameq(1:lbase)
19985 write(12,*)lbase
19986 c
19987 c Pass to pmxb the initial signature, including effect of transposition.
19988 c
19989 write(12,'(6f10.5/f10.5,3i5)')fbar,wheadpt,etait,
19990 * etatc,etacs1,etatop,etabot,inbothd,inhnoh,isig1
19991 write(12,*)npages,widthpt,ptheight,hoffpt,voffpt,nsyst
19992 iflbnow = -1
19993 isysb4 = 0
19994 do 8 ifpb = 1 , nfpb
19995 c
19996 c Each time thru this loop is like a single score with several pages
19997 c
19998 npages = ipagfpb(ifpb)-ipagfpb(ifpb-1)
19999 nsyst = isysfpb(ifpb)-isysfpb(ifpb-1)
20000 nomnsystp = (nsyst-1)/npages+1
20001 nshort = nomnsystp*npages-nsyst
20002 do 7 ipage = 1 , npages
20003 nsystp = nomnsystp
20004 if (ipage .le. nshort) nsystp = nsystp-1
20005 c
20006 c Last system number on this page:
20007 isysendpg = isysb4+nsystp
20008 nintpg = 0
20009 do 15 isy = isysb4+1, isysendpg
20010 if (isysflb(iflbnow+1) .eq. isy) iflbnow = iflbnow+1
20011 nintpg = nintpg+nistaff(iflbnow)
20012 15 continue
20013 xilfrac = 0.
20014 xiltxt = 0.
20015 if (ipage.eq.1 .and. ihead.gt.0) then
20016 c
20017 c Needn't zero out ihead after printing titles if we only allow titles at top?
20018 c
20019 if (iand(ihead,1) .eq. 1) then
20020 xiltxt = xiltxt+hgtin*4/musize
20021 xilfrac = xilfrac+etait
20022 end if
20023 if (iand(ihead,2) .eq. 2) then
20024 xiltxt = xiltxt+hgtti*4/musize
20025 xilfrac = xilfrac+etatc
20026 end if
20027 if (iand(ihead,4) .eq. 4) then
20028 xiltxt = xiltxt+hgtco*4/musize
20029 xilfrac = xilfrac+etacs1
20030 else
20031 c
20032 c Use double the title-composer space if there is no composer
20033 c
20034 xilfrac = xilfrac+etatc
20035 end if
20036 end if
20037 D = xilfrac+nsystp-1+etatop+etabot
20038 C = nintpg
20039 xN = heightil - xiltxt - 4*(nintpg+nsystp) - (nsystp-1)*xilbn
20040 if (bottreb) xN = xN-(nsystp-1)*xilbtc
20041 if (ihead.eq.0 .and. isheadr) xN = xN - xilhdr
20042 if (ifig .eq. 1) then
20043 xN = xN - nsystp*xilfig
20044 end if
20045 glueil = (xN-b*C)/(D+a*C)
20046 omegaG = (b*D+a*xN)/(D+a*C)
20047 c
20048 c G = \interlines between systems
20049 c omega*G = \interlines between staves of the same system
20050 c \interstaff = 4+omega*G
20051 c C = total number of interstaff spaces in the page
20052 c D = omega-indep factors for scalable height = nsy-1 (intersystem glue)
20053 c + etatop + etabot + etatxt +
20054 c N = scaleable height (\interlignes) = height - htext - staff heights - xil
20055 c xil = extra interliges = (nsy-1)*xilbn + 10 if header and no titles
20056 c + (nsy-1)*xiltcb for treble clef bottoms
20057 c + nsy*xilfig for figures
20058 c G = N/(D + omega * C) = glueil, (1)
20059 c But (empirically) omega*G = a*G + b (2)
20060 c with a=1.071 and b=2.714
20061 c Solving (1) and (2) gives
20062 c G = (N-b*C)/(D+a*C) , omega*G = (b*D+a*N)/(D+a*C)
20063 c Pass to pmxb omega*G (=\interstaff-4)
20064 c (etatop,bot,it,tc,cx)*G as inputs to \titles
20065 c
20066 c glueil = (heightil-xiltxt-nsystp*(xil+4*nv))
20067 c * /(nsystp*(1+gfact*(nv-1))-1+etatop+etabot+xilfrac)
20068 c xnsttop = glueil*etatop
20069 c xintstaff = 4+gfact*glueil
20070 c
20071 c Only the first page will get local adjustment now if needed, others in pmxb
20072 c
20073 if (ifpb.eq.1 .and. ipage.eq.1 .and. fintstf.gt.0.) then
20074 facins = fintstf
20075 fintstf = -1.
20076 else
20077 c
20078 c gintstf = 1.0 by default, but may be changed with AI<x>
20079 c
20080 facins = gintstf
20081 end if
20082 write(12,*)nsystp,max(0.,etatop*glueil),facins*(omegaG+4)
20083 ihead = 0
20084 isheadr = .false.
20085 isysb4 = isysendpg
20086 7 continue
20087 8 continue
20088 c
20089 c Done with vertical, now do horizontals
20090 c
20091 celsk(1) = elsk(1)
20092 do 21 ibar = 2 , ibarcnt
20093 celsk(ibar) = celsk(ibar-1)+elsk(ibar)
20094 21 continue
20095 lastbar(0) = 0
20096 ibar1 = 1
20097 wmins = -1.
20098 iflb = 1
20099 imovbrk = 0
20100 ikey = 1
20101 c
20102 c Return nsyst to its *total* value
20103 c
20104 nsyst = isysfpb(nfpb)-1
20105 do 22 isyst = 1 , nsyst
20106 if (isyst .eq. isysflb(iflb)) iflb = iflb+1
20107 if (nmovbrk.gt.0 .and. imovbrk.lt.nmovbrk) then
20108 if (isyst .eq. isysmb(imovbrk+1)) imovbrk = imovbrk+1
20109 end if
20110 ibarb4 = lastbar(isyst-1)
20111 if (isyst .eq. 1) then
20112 if (isfirst) elsstarg = celsk(ibarflb(1)-1)/
20113 * (isysflb(1)-1-fracindent)*(1-fracindent)
20114 celskb4 = 0.
20115 else
20116 celskb4 = celsk(ibarb4)
20117 c
20118 c Must dimension isysmb(0:*) just so I can execute this test!
20119 c
20120 if (isfirst) then
20121 if (nmovbrk.gt.0 .and. isyst.eq.isysmb(imovbrk)) then
20122 c
20123 c First syst after forced line break. There may be indentation.
20124 c
20125 elsstarg = (celsk(ibarflb(iflb)-1)-celskb4)
20126 * /(isysflb(iflb)-isyst-fracsys(imovbrk))
20127 * *(1-fracsys(imovbrk))
20128 else
20129 c
20130 c There is no indentation to deal with
20131 c
20132 elsstarg = (celsk(ibarflb(iflb)-1)-celskb4)
20133 * /(isysflb(iflb)-isyst)
20134 end if
20135 end if
20136 end if
20137 if (isfirst) then
20138 diff1 = abs(elsstarg-elsk(ibarb4+1))
20139 do 23 ibar = ibarb4+2 , ibarcnt
20140 diff = elsstarg-(celsk(ibar)-celskb4)
20141 if (abs(diff) .ge. diff1) go to 24
20142 diff1 = abs(diff)
20143 23 continue
20144 24 ibar = ibar-1
20145 lastbar(isyst) = ibar
20146 nbarss(isyst) = ibar-ibarb4
20147 else
20148 c
20149 c nbarss is given as an input, must compute lastbar and ibar
20150 c
20151 lastbar(isyst) = nbarss(isyst)+ibarb4
20152 ibar = lastbar(isyst)
20153 end if
20154 c
20155 c elss is # of elemskip in the syst. from notes & ars's, not ruleskips, ask's.
20156 c
20157 elss(isyst) = celsk(ibar)-celskb4
20158 write(12,'(i5)')lastbar(isyst-1)+1
20159 c
20160 c Transposed sigs are isig1, newkey(2,3,...).
20161 c
20162 if (ikey .eq. 1) then
20163 key1 = isig1
20164 else
20165 key1 = newkey(ikey)
20166 end if
20167 fsyst = wclef+abs(key1)*wkeysig+2./musize
20168 xelsk = 0.
20169 1 if (ikey.lt.nkeys) then
20170 if (ibrkch(ikey+1).le.lastbar(isyst)) then
20171 c
20172 c Add space for all key changes
20173 c
20174 ikey = ikey+1
20175 key2 = newkey(ikey)
20176 naccs = max(abs(key2-key1),max(abs(key1),abs(key2)))
20177 fsyst = fsyst+naccs*wkeysig
20178 c
20179 c Account for afterruleskips (fbar)
20180 c
20181 xelsk = xelsk+fbar/2
20182 if (ibrkch(ikey).lt.lastbar(isyst) .and. .not.kchmid(ikey))
20183 * xelsk = xelsk-1.
20184 key1 = key2
20185 go to 1
20186 end if
20187 end if
20188 c
20189 c Add extra fixed space for double bar
20190 c
20191 if (isyst .eq. nsyst) then
20192 fsyst = fsyst+4.5/musize
20193 end if
20194 c
20195 c Add extra fixed space for initial time signature
20196 c
20197 if (isyst .eq. 1) then
20198 fsyst = fsyst+wtimesig
20199 end if
20200 c
20201 c Add extra fixed space for time signature changes & user-defined spaces
20202 c
20203 do 26 ibars = ibarb4+1 , lastbar(isyst)
20204 if (newmb(ibars)) fsyst = fsyst+wtimesig
20205 fsyst = fsyst+udsp(ibars)/musize
20206 26 continue
20207 if (isyst .eq. 1) then
20208 wdpt = widthpt*(1-fracindent)
20209 else
20210 if (nmovbrk.gt.0 .and. imovbrk.gt.0 .and.
20211 * isyst.eq.isysmb(imovbrk)) then
20212 wdpt = widthpt*(1-fracsys(imovbrk))
20213 else
20214 wdpt = widthpt
20215 end if
20216 end if
20217 wsyspt = wdpt-fsyst*musize-0.4*nbarss(isyst)
20218 c
20219 c Checks for min spacing
20220 c Get min allowable space
20221 c
20222 dtmin = 1000.
20223 do 45 ibar = ibar1 , ibar1+nbarss(isyst)-1
20224 dtmin = min(dtmin,tnminb(ibar))
20225 if (wminnh(ibar).ge.0.) wmins = wminnh(ibar)
20226 45 continue
20227 if (wmins .lt. 0) wmins = 0.3
20228 wminpt = (1+wmins)*0.3*musize
20229 c
20230 c Find max duration & # of notes for this system
20231 c
20232 dtmax = 0.
20233 nns = 0
20234 do 43 iptr = nptr(ibar1) , nptr(ibar1+nbarss(isyst))-1
20235 dtmax = max(dtmax,durb(iptr))
20236 nns = nns + nnpd(iptr)
20237 43 continue
20238 elmin0 = wsyspt*f1eon(dtmin)/(elss(isyst)+xelsk)
20239 if (elmin0 .ge. wminpt) then
20240 c
20241 c Subtract out fbar stuff to keep old way of passing sumelsk to pmxb;
20242 c there is no need to "flatten"
20243 c
20244 sumelsk = elss(isyst)-fbar*nbarss(isyst)
20245 eonk = 0.
20246 ewmxk = 1.
20247 else
20248 elmin1 = wsyspt/((fbar*nbarss(isyst)+xelsk)/f1eon(dtmax)+nns)
20249 if (elmin1 .le. wminpt) then
20250 eonk = 0.9
20251 else
20252 c
20253 c Find eonk by Newton method
20254 c
20255 call findeonk(nptr(ibar1),nptr(ibar1+nbarss(isyst))-1,
20256 * wsyspt/wminpt,fbar*nbarss(isyst)+xelsk,dtmin,dtmax,
20257 * (wminpt-elmin0)/(elmin1-elmin0))
20258 eonk = min(.9,eonk)
20259 end if
20260 ewmxk = f1eon(dtmax)**eonk
20261 c
20262 c Recompute poenom!
20263 c
20264 sumelsk = 0
20265 do 44 iptr = nptr(ibar1) , nptr(ibar1+nbarss(isyst))-1
20266 sumelsk = sumelsk
20267 * + nnpd(iptr)*sqzb(iptr)*feon(durb(iptr)/sqzb(iptr))
20268 44 continue
20269 end if
20270 poenom = wsyspt/(sumelsk+fbar*nbarss(isyst)+xelsk)
20271 c
20272 c Set fracindent for output: orig if isyst=1, fracsys(imovbrk) if movbrk, else 0
20273 c
20274 if (isyst .gt. 0) then
20275 if (nmovbrk.gt.0 .and. imovbrk.gt.0 .and.
20276 * isyst.eq.isysmb(imovbrk)) then
20277 fracindent = fracsys(imovbrk)
20278 else
20279 fracindent = 0.
20280 end if
20281 end if
20282 write(12,'(1pe12.5/i5,5e12.3)') poenom,nbarss(isyst),
20283 * sumelsk,fsyst,fracindent,eonk,ewmxk
20284 ibar1 = ibar1+nbarss(isyst)
20285 22 continue
20286 rewind(12)
20287 open(13,status='SCRATCH')
20288 write(13,'(i5)')ifig
20289 rewind(13)
20290 ilbuf = 1
20291 ipbuf = 0
20292 if (.not.optimize) then
20293 write(*,'(/,a)')' Done with first pass'
20294 print*
20295 write(15,'(/,a)')' Done with first pass'
20296 write(15,'()')
20297 end if
20298 c
20299 c Following syntax is needed since pmxa is called with literal argument .false.
20300 c
20301 if (isfirst) isfirst = .false.
20302 return
20303 end
20304 subroutine pmxb(inlast,poevec,ncalls,optimize)
20305 cccccccccccccccccccccccccc
20306 cc
20307 cc To Do
20308 cc
20309 cc Resolve disagreement in final poe for 1st system, compared with *.mx2
20310 cc Shift slurs on right- or left-shifted main notes (2/7/99)
20311 cc Various end-of-input-block repeat problems (ick142.pmx).
20312 cc Force multiplicity for un-beamed xtups.
20313 cc Clef change at end of piece
20314 cc Global "A" option to maximize "X" at a given time tick.
20315 cc Tighten test for end-of-bar hardspace, flgndv(ivx) due to right-shifted
20316 cc note. See trubl18.pmx
20317 cc Tab character as space.
20318 cc Clef interference with second line of music.
20319 cc Add space for interferences between *different* lines of music?
20320 cc Shift arpeggios, both automatic and manual.
20321 cc Different musicsize for different instruments.
20322 cc Spacing checks for accid's on left-shifted chord notes
20323 cc Spacing checks for double dots
20324 cc Allow forced line breaks w/o setting nsyst.
20325 cc Cresc-Decresc. (Enhance MusiXTeX first?)
20326 cc Dynamic Marks.
20327 cc Bug with Voltas at line end (MusiXTeX problem?).
20328 cc Subtle bug w/ slur hgt over line brk, see trubl15.pmx
20329 cc Stem-end slurs.
20330 cc Allow units in indentation.
20331 cc Make inline TeX more context sensitive.
20332 cc Werner's 4/2/98 problem with "o?"
20333 cc Scor2prt converts e.g. "r0+0" into "r0 0", which seems to be wrong.
20334 cc converts e.g. "r2db" into "r2d", which might be wrong.
20335 cc Werner's generalsignature problem with Key change and new transposition.
20336 cc (wibug8.pmx)
20337 cc Unequal xtuplets
20338 cc Print both sets of bar #'s in tex file.
20339 cc Make barlines invisible \def\xbar{\empty} , fix fbar.
20340 cc Auto-tie slurs 'At'
20341 cc Forced line break anywhere (e.g. at a mid-bar repeat).
20342 cc Clef change at very start of file.
20343 cc Tighten test for M as macro terminator.
20344 cc Fix title so not separate limit on author length + composer length.
20345 cc Arpeggios in xtups.
20346 cc
20347 cc mx10b
20348 cc Option for instrument name at top center. Last item in P command:
20349 cc P[n]c text is instrument name (use in parts)
20350 cc P[n]cstuff text is stuff (up to 1st blank)
20351 cc P[n]c"stuff with spaces" text is stuff with spaces
20352 cc
20353 cc Post version 1.43
20354 cc Reduced space rqmt for multiplicity-0 graces (no flag)
20355 cc Removed last sepsym in centered whole-bar rests, fixes volta height bug.
20356 cc
20357 cc Version 1.43
20358 cc Fix spacing for end-of-line signature change.
20359 cc Adjust left-shift of grace group for shifted accidentals.
20360 cc Put in extra space for left-shifted accidentals.
20361 cc Fix bug with dot-shift before accid-shift on chord note.
20362 cc Space-check for right-shifted main notes.
20363 cc Enable forcing stem direction of single notes in non-beamed xtups.
20364 cc Disallow clef change after last note before end of input block (pmxa)
20365 cc Print meter change before page break
20366 cc increase length of strings for \titles macro
20367 cc version 1.42
20368 cc Loosen up input syntax for "X" commands. Subroutine getx()
20369 cc "B" and "P" in "X" commands
20370 cc mx09b
20371 cc Allow multiple rests at start of xtup
20372 cc Add 64th rest
20373 cc Fix xtup numbers over rests. (subroutine levrn)
20374 cc Initialize notcrd=.false. every gulp. Avoids undefined state with e.g.
20375 cc c za / ( c a ...
20376 cc Allow double dots to be shifted.
20377 cc Fix spacing with double dotted notes; permit splitting small note.
20378 cc Fix \dotted printout so it works with old compiler
20379 cc mx08b
20380 cc Automatic spaces if needed for shifted accidentals.
20381 cc Some Dynamics
20382 cc Increase accid. horiz. shift resolution to .o5 (use one more bit in nacc)
20383 cc version 1.41
20384 cc Allow ":" as last char of path name
20385 cc Dotted slurs "sb"
20386 cc Continue bar numbering at movement break "L[integer]Mc"
20387 cc mx07b
20388 cc Whole-bar rests with double lines of music. Fixed all options ?
20389 cc Shift accidentals, either [+|-][integer][+|-][number] or [<|>][number].
20390 cc Option to suppress centering full-bar rests. "o"
20391 cc mx06b
20392 cc Shift accid on left-shifted chord note.
20393 cc Rest as first note of xtup.
20394 cc Wrong slopes with small widths. Scale slfac1 by widthpt_default/widthpt
20395 cc Allow Rb for single bar at movemnet break or end of piece. (islur(25))
20396 cc Change # of inst at a movement break. noinst is total # and must be used
20397 cc in 1st movement. ninow is current. nspern(1,...,ninow) is current
20398 cc staves/inst, nsperi(1,...,noinst) is original. rename tells whether to
20399 cc reprint names in parindent at a movement break. Default is .false.
20400 cc unless ninow changes, then .true. But can force either with r+/- as
20401 cc option in 'M'
20402 cc mx04b
20403 cc Double-dotted notes, separate+beamed, main+chord, still no extra space.
20404 cc ??? Don't shift slur ends on whole notes.
20405 cc (pmxa) Write line number of error in pmxaerr.dat
20406 cc mx02b
20407 cc Admit "RD" before "/" (search for "rptfq2:" )
20408 cc In doslur, for multi-line staves, single notes, check forced stem dir'n
20409 cc before setting stemup (used to set horiz offset).
20410 ccccccccccccccccccccccccccccccc
20411 parameter (nm=24,nks=125,mv=24576,maxblks=9600)
20412 c
20413 c FYI /all/ differs in appearance in function ncmid
20414 c
20415 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
20416 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
20417 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
20418 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
20419 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
20420 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
20421 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
20422 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
20423 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
20424 common /comipl2/ ipl2(nm,200)
20425 ccccccccccccc
20426 cc islur cc
20427 ccccccccccccc
20428 c bit meaning
20429 c 0 slur activity on this note
20430 c 1 t-slur here.
20431 c 2 force 0-slope beam starting on this note
20432 c 3 Double dotted note!
20433 c 4 grace before main note
20434 c 5 left repeat
20435 c 6 right repeat
20436 c 7 start Volta
20437 c 8 doublebar
20438 c 9 end Volta
20439 c 10 on=>endvoltabox
20440 c 11 on=>clefchange
20441 c 12-14 0=>treble, ... , 6=>bass
20442 c 15 on=> start new block for clef change (maybe diff. voice)
20443 c 16 literal TeX string
20444 c 17 1=up, 0=down stem for single note (override) See bit 30!
20445 c 18 if on, prohibit beaming
20446 c 19 if on, full bar rest as pause
20447 c 20 Beam multiplicity down-up
20448 c 21 Forced multiplicity for any beam including xtups
20449 c 22-24 Value of forced multiplicity
20450 c 25 single barline at movement break
20451 c 26 doubleBAR (see bits 5,6,8)
20452 c 27-28 Forced beam fine-tune height (1 to 3)
20453 c 29 Blank rest
20454 c 30 If on, get stem dir'n from bit 17
20455 c 31 If on, suppress printing number with xtuplet starting here
20456 ccccccccccccc
20457 cc ipl cc
20458 ccccccccccccc
20459 c 0 blank barline (must be iv=1) (would have used islur but no room)
20460 c 1 look left for K rests, moved here from iornq(30)
20461 c 2 treblelowoct
20462 c 3 Open notehead in forced beam xtup
20463 c 4 Set if single stem tremolo
20464 c 5-6 termulo multiplicity - 1
20465 c 7 unused
20466 c 8 left offset main note one headwidth
20467 c 9 right offset main note one headwidth
20468 c 10 chord present?
20469 c 11-16 Forced beam height adjustment (-30 to +30)
20470 c 17-22 Forced beam slope adjustment (-30 to +30)
20471 c 23-26 Slur index for Way-after grace. Inserted when slur is started.
20472 c 27 5th bit for slur index for Way-after grace (100712)
20473 c 28 key change: only in voice 1
20474 c 29 Grace after main note. (Type A)
20475 c 30 In forced beam. Signals need to check beam heights
20476 c 31 Grace way after main note. (stretch to next note, type W)
20477 ccccccccccccc
20478 cc iornq cc
20479 ccccccccccccc
20480 c 0 Ornament "(". Was user-defined horizontal slur shift on this note
20481 c until 9/24/97; changed that to irest(21)
20482 c 1-13 stmgx+Tupf._)
20483 c 14 Down fermata, was F
20484 c 15 Trill w/o "tr", was U
20485 c 16-18 Editorial s,f,n
20486 c 19-20 >^
20487 c 21 "?" for editorial accid, w/ or w/o s,f,n
20488 c 22 Set if ihornb governs ornament height. Same in icrdorn.
20489 c 23 Set in getorn if ANY note at time of this main note has ornament.
20490 c This is ONLY used in beamstrt to signal whether to do more
20491 c tests for whether ihornb is needed. (ihornb is only needed
20492 c if nonchord+upbm, chord+upbm+top_note, chord+dnbm+bot_note)
20493 c (7/1/00)Also set if any dynamic, as ihornb will be needed when dnbm.
20494 c 24 Slur on after or way-after grace. Use as signal to START slur.
20495 c 25 Tweak orn ht. Same in icrdorn for chord note
20496 c 26 Insert user-defined space before this note (was 22)
20497 c 27 Arpeggio stop or start (if 2 at same time), or all-in-this-chord
20498 c 28 caesura or breath
20499 cc 29 blank barline (must be iv=1) (would have used islur but no room)
20500 c 29 coda
20501 cc 30 "Look-left" option for keyboard rest
20502 c 30 Part-by-part segno oG
20503 c 31 Set if any note (main or chord) has cautionary accid, for space checks
20504 ccccccccccccc
20505 cc irest cc
20506 ccccccccccccc
20507 c 0 rest=1, no rest = 0
20508 c 1 There will be a vertical shift for number of this xtup
20509 c 2 Set if 2-note tremolo starts here
20510 c 3-4 nsolid, # of solid beams in 2-note tremolo
20511 c 5-6 nindent, # of indented beams in 2-note tremolo
20512 c 7 There is a horizontal shift for xtup number
20513 c 9-13 Horiz shift, 1=>-1.5, ... , 31=>+1.5
20514 c 14 Flip up/down-ness of xtup number
20515 c 15 Single-voice, single note shift X(...)[p]S
20516 c 16 Start single-voice, multinote shift with this note X(...)[p]:
20517 c 17 End single-voice, multinote shift after this note. Enter symbol
20518 c after note. X:
20519 c 18 User-defined hardspace after last note of bar, *after* this note.
20520 c Value still stored in udoff(ivx,nudoff(ivx)), not with other
20521 c hardspaces in udsp, to avoid confusion with time checks.
20522 c 19 Move the dot. Data stored in ndotmv,updot,rtdot
20523 c 20 Set if right-shifted main or chord note here. Use for space checks.
20524 c 21 User-defined hardspace in xtup
20525 c 22 User-defined slur shift horizontal slur shift.
20526 c 23 Set on last note before staff-jumping a beam.
20527 c 24 Set on first note after staff-jumping a beam
20528 c 25 Suppress rest centering. "ro"
20529 c 26 Dynamic on this note
20530 c 27 Set if left-shifted main or chord note here. Use for space checks.
20531 c 28 Set if xtup starts on this note.
20532 c 29 Set on lowest-voice note at same time as 1st note after jump-beam.
20533 c 30 Set on note after end of jump-beam segment, to force new note group
20534 c 31 Flag for cautionary accidental
20535 ccccccccccccc
20536 cc nacc cc
20537 ccccccccccccc
20538 c 0-1 0=no accid, 1=fl, 2=sh, 3=na
20539 c 2 double
20540 c 3 big
20541 c 4-9 vertshift-32
20542 c 10-16 20*(horiz. shift + 5.35) (Recentered ver 2.32)
20543 c 17 Midi-only accidental
20544 c 18 2:1 xtup
20545 c 19 Together with nacc(18), increase multiplicity by 1 and dot 1st note.
20546 c 20 Set on last note of each seg except last seg of single-slope beam.
20547 c 21 Set on 1st note of each seg except 1st seg of single-slope beam.
20548 c 22-26 If .ne.0, printed xtup number for xtup starting on this note.
20549 c 27 Set for dotted xtup note. Mult dur by 1.5, mult next by .5 & increase
20550 c multiplicity by 1
20551 c 28 Set on main note of chord if accidentals are ordered.
20552 c 29 Tag for chordal accidental shift...means add to autoshifts.
20553 c 30-31 Set 30|31 if main note in a chord is part of a 2nd and needs to be shifted.
20554 c If upstem|downstem, main is upper|lower member of 2nd
20555 c Action is to interchange pitches only when notes are placed.
20556 ccccccccccccc
20557 cc mult cc
20558 ccccccccccccc
20559 c 0-3 Multiplicity+8 (mult= # of flags)
20560 c 4 Set if slope adjustment for xtup bracket
20561 c 5-9 16+slope adjustment
20562 c 10-15 New stem length, [0-63] => (-4,0,+27.5)
20563 c 16-22 64+Vertical offset of xtup #
20564 c 27 Stemlength override
20565 cc 28-30 New stem length.
20566 ccccccccccccc
20567 cc isdat1 cc
20568 ccccccccccccc
20569 c 13-17 iv
20570 c 3-10 ip
20571 c 11 start/stop switch
20572 c 12 kv-1
20573 c 19-25 ichar(code$)
20574 c 26 force direction?
20575 c 27 forced dir'n = up if on, set in sslur; also
20576 c final direction, set in doslur when beam is started, used on term.
20577 c 28-31 ndxslur, set in doslur when beam is started, used on term.
20578 ccccccccccccc
20579 cc isdat2 cc
20580 ccccccccccccc
20581 c 0 Chord switch. Not set on main note.
20582 c 1-2 left/right notehead shift. Set only for chord note.
20583 c 3 tie positioning
20584 c 4 dotted slur
20585 c 6-11 voff1 1-63 => -31...+31
20586 c 12-18 hoff1 1-127 => -6.3...+6.3
20587 c 19-25 nolev
20588 c 26 \sluradjust (p+s)
20589 c 27 \nosluradjust (p-s)
20590 c 28 \tieadjust (p+t)
20591 c 29 \notieadjust (p-t)
20592 ccccccccccccc
20593 cc isdat3 cc
20594 ccccccccccccc
20595 c 0 set if midslur (at least one argument)
20596 c 1 set if curve (2 more args)
20597 c 2-7 32+first arg (height correction) (1st arg may be negative)
20598 c 8-10 second arg (initial slope)
20599 c 11-13 third arg (closing slope)
20600 c 14-21 tie level for use in LineBreakTies
20601 c 22-29 ncm for use in LineBreakTies
20602 ccccccccccccc
20603 cc isdat4 cc Set these all at turn-on using s option
20604 ccccccccccccc
20605 c 0-5 Linebreak seg 1 voff 1-63 => -31...+31
20606 c 6-12 Linebreak seg 1 hoff 1-127 => -6.3...+6.3
20607 c 16-21 Linebreak seg 2 voff 1-63 => -31...+31
20608 c 22-28 Linebreak seg 2 hoff 1-127 => -6.3...+6.3
20609 ccccccccccccc
20610 c icrdat c
20611 ccccccccccccc
20612 c 0-7 ip within voice
20613 c 8-11 ivx (together with 28th bit)
20614 c 12-18 note level
20615 c 19 accidental?
20616 c 20-22 accidental value (1=natural, 2=flat, 3=sharp, 6=dflat, 7=dsharp)
20617 c 23 shift left
20618 c 24 shift right
20619 c 25 arpeggio start or stop
20620 c 26 flag for moved dot (here, not icrdot, since this is always reset!)
20621 c 27 Midi-only accidental
20622 c 28 (6/27/10) 5th bit for ivx, to allow up to 24 voices
20623 c 29 Tag for accidental shift...means add to autoshifts.
20624 c 31 Flag for cautionary accidental on chord note
20625 ccccccccccccc
20626 c icrdot c:
20627 ccccccccccccc
20628 c 0-6 10*abs(vertical dot shift in \internote) + 64
20629 c 7-13 10*abs(horizontal dot shift in \internote) + 64
20630 c 14-19 vert accidental shift-32
20631 c 20-26 20*(horiz accidental shift+3.2)
20632 c 27-29 top-down level rank of chord note w/accid. Set in crdaccs.
20633 c
20634 c Bits in icrdorn are same as in iornq, even tho most orns won't go in crds.
20635 c
20636 cccccccccccccccccccccccccccccccc
20637 character*131072 bufq
20638 integer*2 lbuf(maxblks)
20639 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
20640 character*10 figq
20641 common /comignorenats/ mbrhgt,newmbrhgt,ignorenats
20642 logical ignorenats,newmbrhgt
20643 character*1 ulq,sepsymq,sq,chax
20644 logical beamon,firstgulp,figbass,figchk,
20645 * isfig,rptnd1,rptprev
20646 logical loop,lastchar,slint,svolta,evolta,onvolt,
20647 * cwrest(nm),islast,inlast,optimize
20648 integer istop(80),numbms(nm),istart(80)
20649 real*4 xnsttop(75),xintstaff(75),hesk(23),hpts(23),poevec(nks),
20650 * tstart(80),squez(80)
20651 character*1 clefq(nm),ulfbq,rptfq1,rptfq2,charq
20652 character*79 notexq,inameq
20653 character*40 pathnameq
20654 character*44 basenameq
20655 character*24 fmtq
20656 character*20 voltxtq
20657 character*120 instrq,titleq,compoq
20658 common /comlast/ islast,usevshrink
20659 logical usevshrink,stickyS,OptLineBreakTies,autofbon
20660 common /combjmp/ ivbj1,ivbj2,isbjmp,isbj2,multbj1
20661 common /comtitl/ instrq,titleq,compoq,headlog,inskip,ncskip,
20662 * inhead
20663 common /cominbot/ inbothd
20664 common /comfig/ itfig(2,74),figq(2,74),ivupfig(2,74),nfigs(2),
20665 * fullsize(nm),ivxfig2,ivvfig(2,74)
20666 common /comnsp/ space(80),nb,prevtn(nm),
20667 * flgndv(nm),flgndb,eskgnd,ptsgnd,ivmxsav(nm,2),nvmxsav(nm)
20668 common /comstart/ facmtr
20669 common /comfb/ nfb(nm),t1fb(nm,40),t2fb(nm,40),ulfbq(nm,40),ifb,
20670 * tautofb,autofbon,t1autofb
20671 common /comget/ lastchar,rptnd1,sluron(nm,2),fbon,ornrpt,stickyS,
20672 * movbrk,movnmp,movdnp,movgap,parmov,fintstf,gintstf,
20673 * rptprev,equalize,rptfq1,rptfq2
20674 common /combeam/ ibmtyp
20675 common /comnotes/ nnodur,lastlev,ndlev(nm,2),shifton,setis,notcrd,
20676 * npreslur,was2(nm),ninow,nobar1,nsystp(75),ipage,
20677 * OptLineBreakTies,HeaderSpecial
20678 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
20679 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
20680 * lnam(nm),inameq(nm)
20681 common /comas1/ naskb,task(40),wask(40),elask(40)
20682 common /comas2/ nasksys,wasksys(800),elasksys(800)
20683 common /comas3/ ask(2500),iask,topmods
20684 common /comask/ bar1syst,fixednew,scaldold,
20685 * wheadpt,fbar,poenom
20686 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
20687 * ,WrotePsslurDefaults,SlurCurve
20688 common /comsln/ is1n1,is2n1,irzbnd,isnx
20689 common /comgrace/ ivg(37),ipg(37),nolevg(74),itoff(2,74),aftshft,
20690 * nng(37),ngstrt(37),ibarmbr,mbrest,xb4mbr,
20691 * noffseg,ngrace,nvolt,ivlit(83),iplit(83),nlit,
20692 * graspace(37),
20693 * lenlit(83),multg(37),upg(37),slurg(37),slashg(37),
20694 * naccg(74),voltxtq(6),litq(83)
20695 logical upg,slurg,slashg,fbon,ornrpt,shifton,isbjmp,notcrd,was2,
20696 * isbj2,fontslur,WrotePsslurDefaults,HeaderSpecial
20697 common /comivxudorn/ivxudorn(63)
20698 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
20699 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
20700 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
20701 character*128 litq,lnholdq
20702 logical upslur,bar1syst,vshrink,lrpt,rrpt,lrptpend,
20703 * ispoi,bcspec,topmods,headlog,clchb,clchv(nm),flgndb,
20704 * btest,sluron,setis,nobar1
20705 common /comcc/ ncc(nm),tcc(nm,10),ncmidcc(nm,10),
20706 * maxdotmv(nm),ndotmv(nm),updot(nm,20),rtdot(nm,20)
20707 common /compoi/ ispoi
20708 common /combc/ bcspec
20709 common /comeon/ eonk,ewmxk
20710 common /spfacs/ grafac,acgfac,accfac,xspfac,xb4fac,clefac,emgfac,
20711 * flagfac,dotfac,bacfac,agc1fac,gslfac,arpfac,
20712 * rptfac,lrrptfac,dbarfac,ddbarfac,dotsfac,upstmfac,
20713 * rtshfac
20714 common /comhsp/ hpttot(176)
20715 common /combmh/ bmhgt,clefend
20716 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
20717 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
20718 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
20719 common /strtmid/ ihnum3,flipend(nm),ixrest(nm)
20720 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
20721 * xinsnow,lowdot
20722 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
20723 common /commus/ musize,whead20
20724 common /comtol/ tol
20725 common /comdyn/ ndyn,idyndat(99),levdsav(nm),ivowg(12),hoh1(12),
20726 * hoh2(12),hoh2h1(2),ntxtdyn,ivxiptxt(41),txtdynq(41),
20727 * idynda2(99),levhssav(nm),listcresc,listdecresc
20728 character*128 txtdynq
20729 logical mrecord,mplay,endmac,flipend,istype0,lowdot,rename,ispstie
20730 integer*2 mmidi
20731 logical restpend,relacc,notmain,twoline,ismidi,crdacc,equalize,
20732 * ismbr,putmbr
20733 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
20734 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
20735 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
20736 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
20737 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
20738 * debugmidi
20739 logical debugmidi
20740 common /comcb/ nbc,ibcdata(36)
20741 common /comclefq/ clefq
20742 common /comArpShift/NumArpShift,IvArpShift(20),IpArpShift(20),
20743 * ArpShift(20)
20744 common /comligfont/ isligfont
20745 logical isligfont
20746 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
20747 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
20748 logical EarlyTransOn,LaterInstTrans
20749 common /combibarcnt/ ibarcnt
20750 character*40 nmq
20751 common /commidisig/ midisig
20752 common /comclefrests/ centrests
20753 logical newclef, centrests
20754 common /comlyr/ inputmlyr
20755 logical inputmlyr
20756 common /combottop/ botamt,topamt,bottopgap
20757 logical bottopgap
20758 common /comis4bignv/ is4bignv,AIset
20759 logical is4bignv,AIset
20760 common /comhair/ idhairuse,idhair(nm)
20761 common /comc8flag/ c8flag(nm)
20762 logical c8flag
20763 common /comshort/ shortfrac,codafrac,ishort,mbrsum,nmbr,nocodabn,
20764 * poefa
20765 real*4 poefa(125)
20766 logical nocodabn
20767 character*3 shortfraq,rendq
20768 common /comslope/ bigslope,novbm
20769 logical bigslope,novbm
20770 bigslope = .false.
20771 novbm = .false.
20772 bottopgap = .false.
20773 inputmlyr = .false.
20774 idhairuse = 0
20775 if (.not.optimize) then
20776 print*
20777 print*,'Starting second PMX pass'
20778 print*
20779 write(15,'(a)')'Starting second PMX pass'
20780 end if
20781 newclef = .false.
20782 centrests = .false.
20783 ncalls = ncalls+1
20784 islast = inlast
20785 macuse = 0
20786 isyscnt = 0
20787 stemmax = 8.2
20788 stemmin = 3.9
20789 stemlen = 6.0
20790 sq = chax(92)
20791 ignorenats = .false.
20792 newmbrhgt = .false.
20793 bcspec = .true.
20794 topmods = .false.
20795 ismbr = .false.
20796 read(12,'(a)')basenameq
20797 read(12,*)lbase
20798 read(12,*)fbar,wheadpt,etait,etatc,etacs1,etatop,
20799 * etabot,inbothd,inhnoh,isig
20800 ilbuf = 1
20801 ipbuf = 0
20802 call getset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,xmtrnum0,
20803 * npages,nsyst,musicsize,fracindent,istype0,inameq,
20804 * clefq,sepsymq,pathnameq,lpath,isig0)
20805 if (ismidi) then
20806 if (xmtrnum0 .gt. tol) then
20807 c
20808 c We have a pickup. Some tricky stuff to get a meter:
20809 c
20810 xntrial = xmtrnum0
20811 do 5 ip2 = 0 , 5
20812 if (abs(mod(xntrial,1.)) .lt. tol) go to 6
20813 xntrial = xntrial*2
20814 5 continue
20815 print*,'Problem finding meter for pickup bar'
20816 xntrial = 1.
20817 ip2 = 0
20818 6 continue
20819 call midievent('m',nint(xntrial),2**ip2*mtrdenl)
20820 else
20821 c
20822 c No pickup, enter the starting meter
20823 c
20824 call midievent('m',mtrnuml,mtrdenl)
20825 end if
20826 end if
20827 c
20828 c Set musicsize from value passed in common, due to possible reset by S[n]m16
20829 c
20830 musicsize = musize
20831 read(12,*)npages,widthpt,height,hoffpt,voffpt,nsyst,
20832 * (nsystp(ipa),xnsttop(ipa),xintstaff(ipa),ipa=1,npages),iauto
20833 c
20834 c If default width ever changes, must adjust this stmt.
20835 c
20836 slfac1 = 0.00569*524./widthpt
20837 figbass = .false.
20838 read(13,*)ifig
20839 if (ifig .eq. 1) then
20840 figbass = .true.
20841 open(14,status='SCRATCH')
20842 write(14,'(a)')sq//'def'//sq//'fixdrop{'//sq//'advance'//sq//
20843 * 'sysno by 1'//sq//'ifcase'//sq//'sysno%'
20844 end if
20845 lastchar = .false.
20846 ibcoff = 0
20847 if (xmtrnum0 .gt. 0.) ibcoff = -1
20848 open(11,status='SCRATCH')
20849 c
20850 c vshrink for the first page is calculated in topfile,
20851 c and if true set interstaff=10. vshrink affects Titles.
20852 c Must also save vshrink for page ending.
20853 c
20854 call topfile(basenameq,lbase,nv,clefq,noinst,musicsize,
20855 * xintstaff(1),mtrnmp,mtrdnp,vshrink,fbar,fontslur)
20856 c
20857 c ninow is working value of # of instruments. noinst is max #, and # at start.
20858 c
20859 ninow = noinst
20860 c
20861 c Save original printed meter in case movement breaks
20862 c
20863 movnmp = mtrnmp
20864 movdnp = mtrdnp
20865 c
20866 if (islast .and. figbass .and. musicsize.eq.16)
20867 * write(11,'(a)')sq//'def'//sq//'figfont{'//sq//'eightrm}%'
20868 c
20869 if (islast .and. isligfont) then
20870 if (musicsize .eq. 16) then
20871 write(11,'(a)')sq//'font'//sq//'ligfont=cmrj at 8pt%'
20872 else
20873 write(11,'(a)')sq//'font'//sq//'ligfont=cmrj at 10pt%'
20874 end if
20875 end if
20876 lenbeat = ifnodur(mtrdenl,'x')
20877 if (mtrdenl .eq. 2) lenbeat = 16
20878 lenb1 = mtrnuml*lenbeat
20879 if (mtrdenl .eq. 2) lenb1 = lenb1*2
20880 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
20881 lenb0 = nint(xmtrnum0*lenbeat)
20882 if (mtrdenl .eq. 2) lenb0 = lenb0*2
20883 if (lenb0 .ne. 0) then
20884 if (islast) write(11,'(a)')sq//'advance'//sq//'barno by -1'
20885 lenbar = lenb0
20886 else
20887 lenbar = lenb1
20888 end if
20889 c
20890 c Initialize full-program variables
20891 c
20892 fixednew = 0.
20893 scaldold = 0.
20894 fintstf = -1.
20895 gintstf = 1.
20896 nasksys = 0
20897 ibarcnt = 0
20898 iline = 0
20899 movbrk = 0
20900 isystpg = 0
20901 ipage = 1
20902 iccount = 128
20903 iask = 0
20904 nhstot = 0
20905 nb = 1
20906 if (.not.optimize) jprntb = 81
20907 idsig = 0
20908 iflagbot = 0
20909 c
20910 c Next 5 are raise-barno parameters. irzbnd is integer part of default level.
20911 c
20912 irzbnd = 3
20913 if (isig.eq.3 .and. clefq(nv).eq.'t') irzbnd = 4
20914 is1n1 = 0
20915 isnx = 0
20916 SlurCurve = 0.
20917 ishort = 0
20918 nocodabn = .false.
20919 mbrsum = 0
20920 nmbr = 0
20921 c
20922 c 111109 Made global rather than per gulp
20923 c
20924 ndyn = 0
20925 ispoi = .false.
20926 slint = .false.
20927 lrptpend = .false.
20928 rptnd1 = .false.
20929 rptfq2 = 'E'
20930 rptprev = .false.
20931 onvolt = .false.
20932 flgndb = .false.
20933 fbon = .false.
20934 shifton = .false.
20935 ornrpt = .false.
20936 setis = .false.
20937 lowdot = .false.
20938 rename = .false.
20939 nobar1 = .false.
20940 equalize = .false.
20941 usevshrink = .true.
20942 WrotePsslurDefaults = .false.
20943 OptLineBreakTies = .false.
20944 HeaderSpecial = .false.
20945 c
20946 c vshrink is initialized in topfile
20947 c
20948 stickyS = .false.
20949 c
20950 c ixrest = 1 or 2 if xtup has started with a rest
20951 c
20952 do 1 ivx = 1 , nm
20953 ixrest(ivx) = 0
20954 fullsize(ivx) = 1.
20955 c
20956 c Set legacy note level to middle c as default
20957 c
20958 ndlev(ivx,1) = 29
20959 ndlev(ivx,2) = 29
20960 1 continue
20961 npreslur = 0
20962 nhssys = 0
20963 listslur = 0
20964 do 31 i = 1 , 202
20965 isdat1(i) = 0
20966 isdat2(i) = 0
20967 31 continue
20968 nsdat = 0
20969 c
20970 c Initialize flag for figures in any other voice than 1
20971 c
20972 ivxfig2 = 0
20973 c
20974 c Initialize for loop over gulps
20975 c
20976 firstgulp = .true.
20977 c
20978 c Start a gulp
20979 c
20980 30 loop = .true.
20981 notcrd = .true.
20982 isbjmp = .false.
20983 isbj2 = .false.
20984 autofbon = .false.
20985 tautofb = 0.
20986 nbars = 0
20987 nfigs(1) = 0
20988 nfigs(2) = 0
20989 ngrace = 0
20990 ntrill = 0
20991 ncrd = 0
20992 nudorn = 0
20993 nlit = 0
20994 nvolt = 0
20995 ibarmbr = 0
20996 nudsp = 0
20997 ntxtdyn = 0
20998 nbc = 0
20999 NumArpShift = 0
21000 do 3 i = 1 , 37
21001 graspace(i) = 0.
21002 3 continue
21003 c
21004 c Now initialize up to nv. Do it in getnote as r'qd for 2nd voices per syst.
21005 c and also if nv increases in an 'M' directive.
21006 c
21007 do 4 iv = 1 , nv
21008 call newvoice(iv,clefq(iv),.false.)
21009 4 continue
21010 c
21011 c Check if endsymbol was set earlier
21012 c
21013 if (rptnd1) then
21014 rptnd1 = .false.
21015 rptfq2 = rptfq1
21016 else
21017 c
21018 c Only use if movbrk>0, to signal default ('RD')
21019 c
21020 rptfq2 = 'E'
21021 end if
21022 iv = 1
21023 ivx = 1
21024 2 if (loop) then
21025 c
21026 c Within this loop, nv voices are filled up for the duration of the block.
21027 c On exit (loop=.false.) the following are set: nnl(nv),itsofar(nv)
21028 c nolev(nv,nnl(nv)),nodur(..),accq(..),irest(..).
21029 c nbars is for this input block.
21030 c Only at the beginning of an input block will there be a possible mtr change,
21031 c signalled by a nonzero mtrnuml. (which will be re-zeroed right after change)
21032 c
21033 call getnote(loop)
21034 if (lastchar) go to 40
21035 go to 2
21036 end if
21037 c
21038 c Finished an input block (gulp).
21039 c
21040 if (ismidi) then
21041 c
21042 c Put rests into midi array for 2nd lines that were not used in this gulp.
21043 c
21044 do 60 iv = 1 , nv
21045 if (twoline(iv) .and. nvmx(iv).eq.1) then
21046 if (firstgulp .and. lenb0.ne.0) then
21047 call addmidi(midchan(iv,2),0,0,0,
21048 * (nbars-1.)*lenbar+lenb0,.true.,.false.)
21049 else
21050 call addmidi(midchan(iv,2),0,0,0,1.*nbars*lenbar,.true.,
21051 * .false.)
21052 end if
21053 end if
21054 60 continue
21055 end if
21056 nvolt = 0
21057 do 28 iv = 1 , nm
21058 nudoff(iv) = 0
21059 maxdotmv(iv) = ndotmv(iv)
21060 ndotmv(iv) = 0
21061 28 continue
21062 c
21063 c Put stuff at top of p.1. Must wait until now to have read title info.
21064 c
21065 if (ibarcnt .eq. 0) then
21066 call puttitle(inhnoh,xnsttop(ipage),
21067 * etatop,sq,etait,etatc,etacs1,nv,vshrink,sepsymq)
21068 if (HeaderSpecial)
21069 c
21070 c Write special header for first page
21071 c
21072 * write(11,'(a)')chax(92)//'special{header=psslurs.pro}%'
21073 end if
21074 do 10 ibar = 1 , nbars
21075 ibarcnt = ibarcnt+1
21076 bar1syst = ibarcnt .eq. iauto
21077 ndig = max(0,int(log10(.001+ibarcnt+ibcoff)))
21078 if (islast)
21079 * write(11,'(a11,i'//chax(50+ndig)//')')
21080 * '% Bar count',ibarcnt+ibcoff
21081 if (ibar .ne. ibarmbr) then
21082 if (.not.optimize) call outbar(ibarcnt+ibcoff,jprntb)
21083 else
21084 if (.not.optimize) then
21085 write(*,'(/,a20,i4,a1,i4)')' Multibar rest, bars',
21086 * ibarcnt+ibcoff,'-',ibarcnt+ibcoff+mbrest-1
21087 write(15,'(/,a20,i4,a1,i4)')' Multibar rest, bars',
21088 * ibarcnt+ibcoff,'-',ibarcnt+ibcoff+mbrest-1
21089 jprntb = 0
21090 end if
21091 ibcoff = ibcoff+mbrest-1
21092 c if (ibar.eq.1 .and. firstgulp .and.
21093 c * .not.btest(islur(1,1),5)) xb4mbr = facmtr*musicsize
21094 if (ibar.eq.1 .and. firstgulp .and.
21095 * .not.btest(islur(1,1),5)) xb4mbr = -.2*musicsize
21096 end if
21097 c
21098 c Move the read to after end-of-bar hardspace checks, so we get right poenom
21099 c at end of a line.
21100 c if (bar1syst) read(12,*) poenom
21101 c
21102 c Check for clef at start of bar. No slide yet. Also flags at end of prev.
21103 c bar. This block is run at the start of every bar. May fail for flag at
21104 c end of last bar. To account for necc. hardspaces, compute and store
21105 c nhssys = # of hard spaces for this system
21106 c hesk(nhssys) = elemskips avialable
21107 c hpts(nhssys) = hard points needed, including notehead
21108 c Here, merely insert placeholder into output. Later, when poe is computed,
21109 c compute additional pts and store them in hpttot(1...nhstot). Finally in
21110 c subroutine askfig, write true pts where placeholders are.
21111 c
21112 ioff = 0
21113 if (ibar .gt. 1) ioff = nib(1,ibar-1)
21114 clchb = btest(islur(1,ioff+1),15)
21115 putmbr = .false.
21116 if (ismbr) then
21117 if (clchb) then
21118 ccc
21119 ccc Clef change and multi-bar rest coming up. Kluge to get space at end of rest.
21120 ccc
21121 write(11,'(a)')sq//'let'//sq//'mbrt'//sq//'mbrest'
21122 * //sq//'def'//sq//'mbrest#1#2#3{%'
21123 write(11,'(a14,f4.1,a)')sq//'mbrt{#1}{#2}{',musicsize*.55,
21124 * '}'//sq//'global'//sq//'let'//sq//'mbrest'//sq//'mbrt}%'
21125 end if
21126 ismbr = .false.
21127 putmbr = .true.
21128 end if
21129 if (ibar .eq. ibarmbr) ismbr = .true.
21130 c
21131 c Set flag here so at start of next bar, if there's a clef change, can add space
21132 c after the mbr with the above kluge
21133 c
21134 if (.not.(clchb .or. flgndb)) go to 23
21135 c
21136 c Must check available space
21137 c
21138 ptsndb = 0.
21139 c
21140 c Zero out block signal
21141 c
21142 if (clchb) islur(1,ioff+1) = ibclr(islur(1,ioff+1),15)
21143 c
21144 c In this loop, we determine how much hardspace is needed (if any)
21145 c 9/7/97 Note that for last bar in input block, if number of lines of
21146 c music decreases in new block, highest numbered ones won't be checked
21147 c since the loop below covers the new nvmx(iv), not necessarily the old
21148 c one.
21149 c 4/18/98 Apparently nmxsav was a solution to the above problem
21150 c
21151 do 16 iv = 1 , nv
21152 do 1699 kv = 1 , nvmxsav(iv)
21153 ivx = ivmxsav(iv,kv)
21154 ptsndv = flgndv(ivx)*wheadpt
21155 ioff = 0
21156 if (ibar .gt. 1) then
21157 ioff = nib(ivx,ibar-1)
21158 ip = ioff
21159 if (ibar.gt.2) ip = ioff-nib(ivx,ibar-2)
21160 c prevtn(ivx) = tnote(iand(ipl(ivx,ip),255))
21161 prevtn(ivx) = tnote(ipl2(ivx,ip))
21162 c
21163 c If ibar=1 (1st bar in input block), prevtn(ivx) was set at end of makeabar.
21164 c
21165 end if
21166 c
21167 c Only allow clef changes when ivx <= nv
21168 c
21169 if (ivx .le. nv) then
21170 clchv(iv) = clchb .and. btest(islur(iv,ioff+1),11)
21171 if (clchv(iv)) then
21172 c
21173 c Clef change in this voice. Turn off signal. Get space avail.
21174 c
21175 islur(iv,ioff+1) = ibclr(islur(iv,ioff+1),11)
21176 if (abs(prevtn(iv)-space(nb)).lt.tol) ptsndv =
21177 * ptsndv+clefend*wheadpt
21178 end if
21179 end if
21180 ptsndb = max(ptsndb,ptsndv+wheadpt*xspfac)
21181 1699 continue
21182 16 continue
21183 c
21184 c ???? where is nb set??? nb probably in left over from makeabar
21185 c
21186 esk = feon(space(nb)*squez(nb))
21187 ptsdflt = esk*poenom-wheadpt
21188 if ((ptsndb.gt.ptsdflt.or.ptsgnd.gt.0.) .and. movbrk.eq.0
21189 * .and. .not.putmbr) then
21190 c
21191 c Must ADD hardspace! So put in a placeholder, and store params for later.
21192 c
21193 if (islast) write(11,'(a)')sq//'xardspace{ pt}%'
21194 nhssys = nhssys+1
21195 if (ptsndb-ptsdflt .gt. ptsgnd-poenom*eskgnd) then
21196 hesk(nhssys) = esk
21197 hpts(nhssys) = ptsndb+wheadpt
21198 else
21199 hesk(nhssys) = eskgnd
21200 hpts(nhssys) = ptsgnd+wheadpt
21201 end if
21202 fixednew = fixednew+hpts(nhssys)
21203 scaldold = scaldold+hesk(nhssys)
21204 end if
21205 if (clchb) then
21206 do 17 iv = 1 , nv
21207 if (clchv(iv)) then
21208 notexq = sq//'znotes'
21209 lnote = 7
21210 do 24 iiv = 2 , iv
21211 notexq = notexq(1:lnote)//sepsymq(iiv-1)
21212 lnote = lnote+1
21213 24 continue
21214 c
21215 c Recompute ioff since it will vary from voice to voice
21216 c
21217 if (ibar .eq. 1) then
21218 ioff = 0
21219 else
21220 ioff = nib(iv,ibar-1)
21221 end if
21222 c
21223 c Must call clefsym to get nclef, even if there is a movement break
21224 c
21225 call clefsym(islur(iv,ioff+1),fmtq,lclef,nclef)
21226 c
21227 c If clefq = '8', must change '0' in pos'n 9 to '8'
21228 c
21229 if (btest(ipl(iv,ioff+1),2)) fmtq =
21230 * fmtq(1:8)//'8'//fmtq(10:10)
21231 if (movbrk.eq.0 .and.
21232 * islast)
21233 * write(11,'(a)')notexq(1:lnote)//fmtq(1:lclef)//sq//'en%'
21234 call wsclef(iv,ninow,nclef)
21235 c
21236 c Set new flag to be used just outside this loop, to kluge
21237 c any calls to \CenterBar for full-bar rests, to make room for clef.
21238 c
21239 newclef = .true.
21240 c
21241 if (btest(ipl(iv,ioff+1),2)) then
21242 c
21243 c Find instrument number for voice iv
21244 c
21245 iv1 = 1
21246 do 1111 iinst = 1 , ninow
21247 if (iv .lt. iv1+nspern(iinst)) go to 2222
21248 iv1 = iv1+nspern(iinst)
21249 1111 continue
21250 print*
21251 print*,'Should not be here in pmxb!'
21252 call stop1()
21253 2222 continue
21254 if (iinst .le. 9) then
21255 write(11,'(a20,i1,a)')sq//'settrebleclefsymbol',iinst,
21256 * sq//'treblelowoct%'
21257 else
21258 write(11,'(a20,i2,a)')sq//'settrebleclefsymbol',iinst,
21259 * sq//'treblelowoct%'
21260 end if
21261 c8flag(iv) = .true.
21262 else
21263 if (clefq(iv) .eq. '8') then
21264 write(11,'(a20)')sq//'resetclefsymbols'
21265 end if
21266 end if
21267 end if
21268 17 continue
21269 if (islast) write(11,'(a)')sq//'pmxnewclefs'
21270 end if
21271 23 continue
21272 c
21273 c Kluge \CenterBar for whole bar rests if necessary
21274 c
21275 if (newclef .and. centrests) then
21276 nvalue = nint(.55*musicsize)
21277 if (nvalue .gt. 10) then
21278 write(11,'(a11,i2,a2)')
21279 * sq//'def'//sq//'value{',nvalue,'}%'
21280 else
21281 write(11,'(a11,i1,a2)')
21282 * sq//'def'//sq//'value{',nvalue,'}%'
21283 end if
21284 end if
21285 newclef = .false.
21286 centrests = .false.
21287 c
21288 c End of loop for end-of-bar hardspaces and non-movbrk clef symbol.
21289 c
21290 if (bar1syst) then
21291 read(12,*) poenom
21292 end if
21293 c
21294 c Repeat symbols. Haven't slid down yet, so use islur(1,nib(1,ibar-1)+1)
21295 c
21296 if (ibar .eq. 1) then
21297 islnow = islur(1,1)
21298 iplnow = ipl(1,1)
21299 else
21300 islnow = islur(1,nib(1,ibar-1)+1)
21301 iplnow = ipl(1,nib(1,ibar-1)+1)
21302 end if
21303 c
21304 c Check for R-symbols set at end of prior input block
21305 c
21306 if (movbrk.eq.0 .and. rptfq2.ne.'E') then
21307 if (rptfq2 .eq. 'D') then
21308 islnow = ibset(islnow,26)
21309 else if (rptfq2 .eq. 'r') then
21310 islnow = ibset(islnow,6)
21311 else if (rptfq2 .eq. 'd') then
21312 islnow = ibset(islnow,8)
21313 else if (rptfq2 .eq. 'b') then
21314 islnow = ibset(islnow,25)
21315 else
21316 print*
21317 print*,'Illegal symbol with "R" at end of input block:',
21318 * rptfq2
21319 call stop1()
21320 end if
21321 rptfq2 = 'E'
21322 end if
21323 if (iand(islnow,352) .ne. 0) then
21324 c
21325 c Bit 5(lrpt), 6(rrpt), or 8(doublebar) has been set
21326 c
21327 lrpt = btest(islnow,5)
21328 rrpt = btest(islnow,6)
21329 lrptpend = lrpt.and.bar1syst
21330 if (lrpt .and. .not.lrptpend) then
21331 if (rrpt) then
21332 if (islast) write(11,'(a)')sq//'setleftrightrepeat'
21333 fixednew = fixednew+wheadpt*lrrptfac-0.4
21334 else
21335 if (islast) write(11,'(a)')sq//'setleftrepeat'
21336 fixednew = fixednew+wheadpt*rptfac-0.4
21337 end if
21338 else if (rrpt) then
21339 if (islast) write(11,'(a)')sq//'setrightrepeat'
21340 fixednew = fixednew+wheadpt*rptfac-0.4
21341 else if (btest(islnow,8)) then
21342 if (islast) write(11,'(a)')sq//'setdoublebar'
21343 fixednew = fixednew+wheadpt*dbarfac-0.4
21344 end if
21345 else if (btest(islnow,26)) then
21346 c
21347 c doubleBAR
21348 c
21349 if (islast) write(11,'(a)')sq//'setdoubleBAR'
21350 fixednew = fixednew+wheadpt*ddbarfac-0.4
21351 else if (btest(iplnow,0)) then
21352 c
21353 c no bar line
21354 c
21355 if (islast) then
21356 if (movbrk .eq. 0) then
21357 write(11,'(a)')sq//'setzalaligne'
21358 else
21359 c
21360 c Encountered "Rz" at start of input block at start of new movement, Must
21361 c use newmovement macro with arg 4 rather than setzalaligne, since former
21362 c already redefines stoppiece.
21363 c
21364 rptfq2 = 'z'
21365 end if
21366 end if
21367 fixednew = fixednew-0.4
21368 end if
21369 c
21370 c 1st and 2nd endings
21371 c
21372 svolta = btest(islnow,7)
21373 evolta = btest(islnow,9)
21374 if (evolta) then
21375 if (btest(islnow,10)) then
21376 if (islast) write(11,'(a)')sq//'endvoltabox'
21377 else
21378 if (islast) write(11,'(a)')sq//'endvolta'
21379 end if
21380 onvolt = .false.
21381 end if
21382 if (svolta) then
21383 nvolt = nvolt+1
21384 lvoltxt = index(voltxtq(nvolt),' ')-1
21385 if (lvoltxt .eq. 1) then
21386 if (islast) write(11,'(a)')sq//'Setvolta'
21387 * //voltxtq(nvolt)(1:1)//'%'
21388 else
21389 if (islast) write(11,'(a)')sq//'Setvolta'//'{'//
21390 * voltxtq(nvolt)(1:lvoltxt)//'}%'
21391 end if
21392 onvolt = .true.
21393 end if
21394 if (ibar .gt. 1) then
21395 ipnow = nib(1,ibar-1)+1
21396 else
21397 ipnow = 1
21398 end if
21399 iplnow = ipl(1,ipnow)
21400 if (bar1syst) then
21401 c
21402 c If listslur>0, then there is at least one slur or tie carried over the break
21403 c
21404 ispstie = .false.
21405 if (OptLineBreakTies .and. .not.fontslur .and. listslur.ne.0
21406 * .and. islast)
21407 * call LineBreakTies(isdat1,isdat2,isdat3,isdat4, nsdat,
21408 * ispstie,sepsymq)
21409 iline = iline+1
21410 c
21411 c End an old system, Start a new system
21412 c
21413 c Reduce space before mbrest at start of system
21414 c Need this even if no accidentals in key signature
21415 c
21416 if (ibar.eq.ibarmbr) xb4mbr = -.2*musicsize
21417 c
21418 if (iline .ne. 1) then
21419 c
21420 c Not first line.
21421 c Get corrected poe = points/elemskip for *previous* system
21422 c
21423 wdpt = widthpt*(1-fracindent)
21424 poe = (wdpt-fsyst*musicsize-0.4*nbarss-fixednew)/
21425 * (elsktot+fbar*nbarss-scaldold)
21426 isyscnt = isyscnt+1
21427 poevec(isyscnt) = poe
21428 c
21429 c Transfer data for system into global arrays to hold until very end
21430 c
21431 do 9 ia = 1 , nasksys
21432 iask = iask+1
21433 ask(iask) = (wasksys(ia)/poe-abs(elasksys(ia)))
21434 * /poefa(iline-1)
21435 c
21436 c Only admit negative ask if it was user-defined space, signalled by elask<=0.
21437 c
21438 if (elasksys(ia).gt.0) ask(iask)=dim(ask(iask),0.)
21439 9 continue
21440 do 25 ia = 1 , nhssys
21441 nhstot = nhstot+1
21442 hpttot(nhstot) = max(hpts(ia)-hesk(ia)*poe,0.)
21443 25 continue
21444 c
21445 c Reset counters for new system
21446 c
21447 scaldold = 0.
21448 fixednew = 0.
21449 nasksys = 0
21450 nhssys = 0
21451 end if
21452 c
21453 c End of if block for first bar of non-first system. Still 1st bar, any system
21454 c
21455 if (islast.and.figbass) write(11,'(a)')sq//'fixdrop%'
21456 isystpg = isystpg+1
21457 c
21458 c Try moving the next stmt way down, to fix a bug and get \eject printed at
21459 c end of single-system page.
21460 c if (isystpg .eq. nsystp(ipage)) isystpg = 0
21461 read(12,*)nbarss,elsktot,fsyst,frac,eonk,ewmxk
21462 if (iline .gt. 1) fracindent=frac
21463 if (figbass) then
21464 ifigdr(1,iline) = 4
21465 ifigdr(2,iline) = 4
21466 end if
21467 slfac = slfac1*musicsize*elsktot
21468 if (iline .ne. 1) then
21469 c
21470 c For the line just _finished_, put figdrop in separate file.
21471 c
21472 if (figbass) write(14,'(a9,i2,a10,i2,1x,a4)')
21473 * sq//'figdrop=',ifigdr(1,iline-1),
21474 * ' '//sq//'figdtwo=',ifigdr(2,iline-1),sq//'or%'
21475 c
21476 c Check slurs in top staff for interference w/ barno. Only check when
21477 c # if digits in barno >= |isig| But to keep on/off phasing, must ALWAYS
21478 c keep track of ons and offs when |isig|<=3.
21479 c
21480 ndigbn = int(alog10(ibarcnt+ibcoff+.01))+1
21481 isnx = 0
21482 if (ndigbn.ge.iabs(isig) .and. is1n1.gt.0) then
21483 c
21484 c There's a slur in top voice over the line break, hgt=is1n1, idcode=is2n1
21485 c Look for termination in remainder of this input block. If not found,
21486 c just use is1n1. Remember, haven't slid down yet.
21487 c
21488 ioff = 0
21489 if (ibar .gt. 1) ioff = nib(ivmx(nv,nvmx(nv)),ibar-1)
21490 do 50 isdat = 1 , nsdat
21491 if (igetbits(isdat1(isdat),5,13).eq.ivmx(nv,nvmx(nv))
21492 * .and. .not.btest(isdat1(isdat),11)
21493 * .and. igetbits(isdat1(isdat),7,19).eq.is2n1) then
21494 c
21495 c Found slur ending. Just check note height, can't do fine adjustments.
21496 c
21497 is1n1 = max(is1n1,igetbits(isdat2(isdat),7,19))
21498 go to 51
21499 end if
21500 50 continue
21501 c
21502 c If exiting loop normally, did not find end of slur. c'est la vie.
21503 c
21504 51 continue
21505 isnx = idim(is1n1,ncmid(nv,1)+1+irzbnd)
21506 if (isnx .gt. 0) then
21507 c
21508 c AHA! Slur likely to interfere with barno.
21509 c
21510 c Modified 090525 to use \bnrs
21511 c
21512 slint = .true.
21513 fmtq = '(a16,i1,a14)'
21514 if (irzbnd+isnx .gt. 9) fmtq = '(a16,i2,a14)'
21515 if (islast) write(11,fmtq)sq//'def'//sq//'raisebarno{',
21516 * irzbnd+isnx,'.5'//sq//'internote}%'
21517 end if
21518 end if
21519 if (movbrk .gt. 0) then
21520 c
21521 c movbrk = 0
21522 c Move the reset down, so can use movbrk>0 to stop extra meter prints.
21523 c
21524 c New movement. Redefine stoppiece, contpiece. These will be called either
21525 c explicitly or as part of alaligne.
21526 c indsym = 0,1,2 for doubleBAR , doublebar, rightrepeat.
21527 c This is passed to \newmovement.
21528 c
21529 if (rptfq2 .eq. 'E') rptfq2 = 'D'
21530 indsym = index('Ddrbz',rptfq2)-1
21531 rptfq2 = 'E'
21532 c
21533 c Also check for Rd or Rr set the normal way
21534 c
21535 if (btest(islnow,8)) then
21536 indsym = 1
21537 else if (btest(islnow,6)) then
21538 indsym = 2
21539 end if
21540 if (indsym .lt. 0) then
21541 print*
21542 print*,'Illegal end symbol before "/"'
21543 call stop1()
21544 end if
21545 c
21546 c Check for continuation (no bar number reset)
21547 c
21548 if (islast.and.nobar1) then
21549 write(11,'(a)')sq//'advance'//sq//'barno1'
21550 * //sq//'global'//sq//'startbarno'//sq//'barno%'
21551 c
21552 c Need above for shortening case mcm with Mc
21553 c
21554 end if
21555 c
21556 c Per Rainer's suggestion, changing \nbinstruments via 3rd arg of \newmovement
21557 c
21558 if (islast) then
21559 nmq = sq//'newmovement'
21560 lnmq = 12
21561 if (movgap .lt. 10) then
21562 lnmq = 14
21563 write(nmq(13:14),'(2i1)')movgap,indsym
21564 else
21565 lnmq = 17
21566 write(nmq(13:17),'(a1,i2,a1,i1)')'{',movgap,'}',indsym
21567 end if
21568 if (ninow .lt. 10) then
21569 lnmq = lnmq+1
21570 write(nmq(lnmq:lnmq),'(i1)')ninow
21571 else
21572 lnmq = lnmq+4
21573 write(nmq(lnmq-3:lnmq),'(a1,i2,a1)')'{',ninow,'}'
21574 end if
21575 lnmq = lnmq+1
21576 write(nmq(lnmq:lnmq),'(a1)')'%'
21577 if (ishort .eq. 4) then
21578 c
21579 c Ending Short-blank-coda
21580 c
21581 write(11,'(a)')sq//'Endpiece}}%'
21582 end if
21583 write(11,'(a)')nmq(1:lnmq)
21584 if (ishort .eq. 2) then
21585 write(11,'(a)')sq//'stoppiece}}%'
21586 ishort = 5
21587 else if (ishort .eq. 4) then
21588 write(11,'(a)')sq//'let'//sq//'stoppiece'//sq//
21589 * 'holdstop%'
21590 c
21591 c Since we bypass newmovement, need to set the vertical gap.
21592 c
21593 if (movgap .gt. 10) then
21594 write(11,'(a6,i2,a11)')
21595 * sq//'vskip',movgap,sq//'internote%'
21596 else if (movgap .gt. 0) then
21597 write(11,'(a6,i1,a11)')
21598 * sq//'vskip',movgap,sq//'internote%'
21599 end if
21600 ishort = 6
21601 end if
21602 if ((ishort.eq.5.or.ishort.eq.6).and..not.rename) then
21603 do 62 iinst = 1 , ninow
21604 if (islast) then
21605 if (iinst .lt. 10) then
21606 write(11,'(a8,i1,a3)')sq//'setname',iinst,'{}%'
21607 else
21608 write(11,'(a9,i2,a4)')sq//'setname{',iinst,
21609 * '}{}%'
21610 end if
21611 end if
21612 62 continue
21613 end if
21614 rename = .false.
21615 end if
21616 c
21617 c Change generalmeter if necessary
21618 c
21619 if (islast) then
21620 call wgmeter(mtrnmp,mtrdnp)
21621 end if
21622 c Removed next line 211207 to fix beaming problem at new movement+meter change.
21623 c mtrnuml = 0
21624 c
21625 c (Moved all name-writing to getnote, right when 'M' is detected)
21626 c
21627 if (btest(iplnow,28)) then
21628 c
21629 c Key signature at movement break
21630 c
21631 iplnow = ibclr(iplnow,28)
21632 if (isig .gt. 0) then
21633 if (islast) write(11,'(a18,i1,a2)')
21634 * sq//'generalsignature{',isig,'}%'
21635 else
21636 if (islast) write(11,'(a18,i2,a2)')
21637 * sq//'generalsignature{',isig,'}%'
21638 end if
21639 if (islast .and. LaterInstTrans) then
21640 call Writesetsign(nInstTrans,iInstTrans,iTransKey,
21641 * LaterInstTrans)
21642 end if
21643 end if
21644 if (parmov .ge. -.1) then
21645 c
21646 c Resent paragraph indentation
21647 c
21648 ipi = parmov*widthpt+.1
21649 if (ipi .lt. 10) then
21650 if (islast) write(11,'(a11,i1,a2)')
21651 * sq//'parindent ',ipi,'pt'
21652 else if (ipi .lt. 100) then
21653 if (islast)
21654 * write(11,'(a11,i2,a2)')sq//'parindent ',ipi,'pt'
21655 else
21656 if (islast)
21657 * write(11,'(a11,i3,a2)')sq//'parindent ',ipi,'pt'
21658 end if
21659 end if
21660 if (ishort .eq. 6) then
21661 if (iflagbot .eq. 1) then
21662 write(11,'(a)')sq//'vfill'//sq//'eject'
21663 c iflagbot = 0
21664 c ishort = 0
21665 else
21666 write(11,'(a)')sq//'contpiece'
21667 end if
21668 c
21669 c Zero ishort later trying to write alaligne
21670 c
21671 end if
21672 end if ! End of movement break stuff
21673 if (isystpg .eq. 1) then
21674 c
21675 c First line on a page (not 1st page, still first bar). Tidy up old page
21676 c then eject.
21677 c
21678 c Check for meter change at start of a new PAGE
21679 c
21680 if (mtrnuml .gt. 0) then
21681 c
21682 c Meter change at start of a new page. Ugly repeated coding here.
21683 c
21684 mtrnms = mtrnuml
21685 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
21686 mtrnuml = mtrnms
21687 if (movbrk .eq. 0 .and. islast) then
21688 call wgmeter(mtrnmp,mtrdnp)
21689 end if
21690 end if
21691 c
21692 c Key signature change?
21693 c
21694 if (btest(iplnow,28) .and. movbrk.eq.0) then
21695 notexq = sq//'xbar'//sq//'addspace{-'//sq//
21696 * 'afterruleskip}'//sq//'generalsignature{'
21697 lnote = 49
21698 if (isig .lt. 0) then
21699 notexq = notexq(1:49)//'-'
21700 lnote = 50
21701 end if
21702 if (islast) write(11,'(a)')
21703 * notexq(1:lnote)//chax(48+abs(isig))//'}%'
21704 if (islast .and. LaterInstTrans) then
21705 call Writesetsign(nInstTrans,iInstTrans,iTransKey,
21706 * LaterInstTrans)
21707 end if
21708 if (islast .and. ignorenats)
21709 * write(11,'(a)')sq//'ignorenats%'
21710 if (islast) write(11,'(a)')sq//'zchangecontext'//sq
21711 * //'addspace{-'//sq//'afterruleskip}'
21712 * //sq//'zstoppiece'//sq//'PMXbarnotrue%'
21713 else if (mtrnuml.gt.0 .and. movbrk.eq.0) then
21714 c
21715 c Meter change but no signature change
21716 c
21717 if (islast)
21718 * write(11,'(a)')sq//'xchangecontext'//sq//'addspace{-'//
21719 * sq//'afterruleskip}'//sq//'let'//sq//'bnat'//sq//
21720 * 'barnoadd%'
21721 if (islast)
21722 * write(11,'(a)')sq//'def'//sq//'barnoadd{'//sq//'let'//
21723 * sq//'barnoadd'//sq//'bnat}'//sq//'zstoppiece%'
21724 else
21725 if (islast) then
21726 if ((ishort.eq.4.or.ishort.eq.2)
21727 * .and. iflagbot.eq.1) then
21728 ntmp = ibarcnt-ibarcnt0-nmbr+mbrsum
21729 if (ntmp .le. 9) then
21730 shortfraq(1:1) = char(48+ntmp)
21731 lntmp = 1
21732 else
21733 write(shortfraq(1:2),'(i2)')ntmp
21734 lntmp = 2
21735 end if
21736 write(11,'(a)')sq//'endpiece}}'//sq//'advance'//sq
21737 * //'barno'//shortfraq(1:lntmp)
21738 else if ((ishort.ne.6.and.ishort.ne.2) .or.
21739 * iflagbot.ne.1) then
21740 write(11,'(a)')sq//'stoppiece%'
21741 end if
21742 end if
21743 end if
21744 c
21745 c This is the key spot when vshrink is used. Value of vshrink here comes from
21746 c just after the prior pagebreak, i.e., it is not affected by "Av"
21747 c that may have been entered at this pagebreak, since that only affects usevshrink.
21748 c So choose page *ending* (with or without \vfill) depending on old vshrink. Then
21749 c check value of usevshrink to reset vshrink if necessary for the new page, where
21750 c we have to set \interstaff and later call puttitle.
21751 c Top of first page needs special treatment. For this we use
21752 c novshrinktop, which was set in g1etnote on the first pass, since on
21753 c second pass, vshrink at top of page one is dealt with in topfile, which is called
21754 c *before* any reading in any "Av" at the top of the first input block.
21755 c
21756 if (.not.vshrink) then
21757 if (islast .and. bottopgap) then
21758 if (abs(botamt) .gt. 1.e-6) then
21759 if (botamt .gt. 9.95) then
21760 fmtq = '(a,f4.1,a)'
21761 else if (botamt .gt. 0.) then
21762 fmtq = '(a,f3.1,a)'
21763 else if (botamt .gt. -9.95) then
21764 fmtq = '(a,f4.1,a)'
21765 else
21766 fmtq = '(a,f5.1,a)'
21767 end if
21768 write(11,fmtq)sq//'null'//sq//'vskip',botamt,
21769 * sq//'Internote%'
21770 end if
21771 end if
21772 xnstbot = xnsttop(ipage)*etabot/etatop
21773 if (xnstbot .lt. 9.95) then
21774 fmtq = '(a,f3.1,a)'
21775 else
21776 fmtq = '(a,f4.1,a)'
21777 end if
21778 if (islast) write(11,fmtq)sq//'vskip',xnstbot,
21779 * sq//'Interligne'//sq//'eject%'
21780 if (islast .and. bottopgap) then
21781 if (abs(topamt) .gt. 1.e-6) then
21782 if (topamt .gt. 9.95) then
21783 fmtq = '(a,f4.1,a)'
21784 else if (topamt .gt. 0.) then
21785 fmtq = '(a,f3.1,a)'
21786 else if (topamt .gt. -9.95) then
21787 fmtq = '(a,f4.1,a)'
21788 else
21789 fmtq = '(a,f5.1,a)'
21790 end if
21791 write(11,fmtq)sq//'null'//sq//'vskip',topamt,
21792 * sq//'Internote%'
21793 end if
21794 bottopgap = .false.
21795 end if
21796 else
21797 if (islast) then
21798 if (iflagbot.eq.1.and.ishort.eq.6)then
21799 c
21800 c cleanup for case bcm only
21801 c
21802 iflagbot = 0
21803 ishort = 0
21804 else
21805 write(11,'(a)') sq//'vfill'//sq//'eject%'
21806 if (iflagbot.eq.1.and.ishort.eq.2) then
21807 c Clean up case bsl only
21808 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
21809 * //sq//'makeatother'
21810 iflagbot = 0
21811 ishort = 0
21812 end if
21813 end if
21814 end if
21815 end if
21816 ipage = ipage+1
21817 c
21818 c Now that page is ejected, compute new vshrink
21819 c
21820 vshrink = xintstaff(ipage).gt.20 .and. usevshrink
21821 if (vshrink) then
21822 xinsnow = 10
21823 else
21824 xinsnow = xintstaff(ipage)
21825 end if
21826 if (fintstf.gt.0 .and. ipage.gt.1) then
21827 xinsnow = xinsnow*fintstf/gintstf
21828 fintstf = -1.
21829 end if
21830 if (xinsnow .lt. 9.95) then
21831 fmtq = '(a,f3.1,a)'
21832 else if (xinsnow .lt. 99.95) then
21833 fmtq = '(a,f4.1,a)'
21834 else
21835 fmtq = '(a,f5.1,a)'
21836 end if
21837 c
21838 c Vertical spacing parameters, then restart
21839 c
21840 if (is4bignv) xinsnow = .95*xinsnow
21841 if (islast) then
21842 write(11,fmtq)sq//'interstaff{',xinsnow,
21843 * '}'//sq//'contpiece'
21844 end if
21845 c
21846 c Check for meter change at start of a new PAGE
21847 c
21848 if (mtrnuml .gt. 0) then
21849 c
21850 c Meter change at start of a new page
21851 c
21852 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
21853 if (movbrk .eq. 0) then
21854 if (islast) then
21855 call wgmeter(mtrnmp,mtrdnp)
21856 end if
21857 if (mtrdnp .gt. 0) then
21858 if (islast) write(11,'(a)')sq//'newtimes2%'
21859 if (ibar .eq. ibarmbr) xb4mbr = -.2*musicsize
21860 end if
21861 end if
21862 end if
21863 c
21864 c If no real titles here, which there probably will never be, make vertical
21865 c space at page top with \titles{...}. headlog=.false.<=>no real titles
21866 c
21867 if (ishort.eq.4 .and. iflagbot.eq.1) then
21868 ishort = 0
21869 iflagbot = 0
21870 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'//sq//
21871 * 'makeatother'
21872 end if
21873 call puttitle(inhnoh,xnsttop(ipage),etatop,
21874 * sq,etait,etatc,etacs1,nv,vshrink,sepsymq)
21875 if (HeaderSpecial)
21876 c
21877 c Write special header for first page
21878 c
21879 * write(11,'(a)')chax(92)//'special{header=psslurs.pro}%'
21880 else
21881 c
21882 c First bar of system, not a new page, force line break
21883 c
21884 if (btest(iplnow,28)) then
21885 c
21886 c Signature change
21887 c
21888 notexq = sq//'xbar'//sq//'addspace{-'//sq//
21889 * 'afterruleskip}'//sq//'generalsignature{'
21890 lnote = 49
21891 if (isig .lt. 0) then
21892 notexq = notexq(1:49)//'-'
21893 lnote = 50
21894 end if
21895 if (islast) write(11,'(a)')notexq(1:lnote)
21896 * //chax(48+abs(isig))//'}%'
21897 if (islast .and. LaterInstTrans) then
21898 call Writesetsign(nInstTrans,iInstTrans,iTransKey,
21899 * LaterInstTrans)
21900 end if
21901 if (islast) write(11,'(a)')sq//'advance'//sq//'barno-1%'
21902 if (mtrnuml .ne. 0) then
21903 c
21904 c Meter+sig change, new line, may need mods if movement break here.
21905 c
21906 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
21907 if (islast) then
21908 call wgmeter(mtrnmp,mtrdnp)
21909 if (ignorenats) write(11,'(a)')sq//'ignorenats%'
21910 write(11,'(a)')sq//'xchangecontext'//sq//
21911 * 'addspace{-'//sq//'afterruleskip}'
21912 * //sq//'zstoppiece'//sq//'PMXbarnotrue'//sq//'contpiece%'
21913 write(11,'(a)')sq//'addspace{-'//sq
21914 * //'afterruleskip}%'
21915 call wgmeter(mtrnmp,mtrdnp)
21916 if (ignorenats) write(11,'(a)')sq//'ignorenats%'
21917 write(11,'(a)')sq//'zchangecontext'
21918 end if
21919 else
21920 if (islast .and. ignorenats)
21921 * write(11,'(a)')sq//'ignorenats%'
21922 if (islast) write(11,'(a)')sq//'xchangecontext'//sq//
21923 * 'addspace{-'//sq//'afterruleskip}'
21924 * //sq//'zstoppiece'//sq//'PMXbarnotrue'//sq//'contpiece%'
21925 end if
21926 else if (mtrnuml.eq.0.and.(ishort.eq.0.or.ishort.eq.6))
21927 * then
21928 c
21929 c No meter change
21930 c
21931 if (islast) then
21932 if (ishort .ne. 6) then
21933 write(11,'(a)')sq//'alaligne'
21934 else
21935 ishort = 0
21936 end if
21937 end if
21938 else if (ishort .ne. 0) then
21939 if (ishort .eq. 1) then ! Start short line
21940 write(shortfraq,'(f3.2)')shortfrac
21941 write(11,'(a)')sq//'stoppiece'//sq//'parindent 0pt'
21942 write(11,'(a)')sq//'vskip'//sq//'parskip'
21943 write(11,'(a)')sq//'hbox to'//sq//
21944 * 'hsize{'//sq//'vbox{'//
21945 * sq//'hsize='//shortfraq//sq//'hsize%'
21946 write(11,'(a)')sq//'contpiece'
21947 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
21948 * //sq//'makeatother'
21949 ibarcnt0 = ibarcnt
21950 mbrsum = 0
21951 ishort = 2
21952 nmbr = 0
21953 else if (ishort .eq. 2) then ! End short line, no new mvt
21954 ntmp = ibarcnt-ibarcnt0-nmbr+mbrsum
21955 if (ntmp .le. 9) then
21956 shortfraq(1:1) = char(48+ntmp)
21957 lntmp = 1
21958 else
21959 write(shortfraq(1:2),'(i2)')ntmp
21960 lntmp = 2
21961 end if
21962 write(11,'(a)')sq//'stoppiece}}'//sq//'advance'//sq
21963 * //'barno'//shortfraq(1:lntmp)
21964 c
21965 c Not clear why we needed this
21966 c //sq//'startbarno'//sq//'barno%'
21967 write(11,'(a)')sq//'contpiece'
21968 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
21969 * //sq//'makeatother'
21970 ishort = 0
21971 else if (ishort .eq. 5) then ! End short line, new mvt
21972 if (nobar1) then ! Continue bar numbering
21973 write(11,'(a)')sq//'advance'//sq
21974 * //'barno'//char(ibarcnt-ibarcnt0+48)
21975 * //sq//'startbarno'//sq//'barno%'
21976 c
21977 c Must leave in \startbarno to get msm with LMc to work.
21978 c
21979 end if
21980 write(11,'(a)')sq//'startpiece'//sq//'addspace'//sq
21981 * //'afterruleskip%'
21982 ishort = 0
21983 else if (ishort .eq. 3) then ! Mid line gap, start coda
21984 c May never come thru here. Stuff is done later at least for mcl.pmx
21985 write(shortfraq,'(f3.2)')codafrac
21986 write(11,'(a)')sq//'endpiece}'//sq//'advance'//sq
21987 * //'barno'//char(ibarcnt-ibarcnt0+48)//sq//
21988 * 'startbarno'//sq//'barno%'
21989 write(11,'(a)')sq//'hfill'//sq//
21990 * 'vbox{'//sq//'hsize='//shortfraq//'%'
21991 write(11,'(a)')sq//'contpiece'
21992 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
21993 * //sq//'makeatother'
21994 ishort = 4
21995 else if (ishort .eq. 4) then ! End coda
21996 ntmp = ibarcnt-ibarcnt0-nmbr+mbrsum
21997 if (ntmp .le. 9) then
21998 shortfraq(1:1) = char(48+ntmp)
21999 lntmp = 1
22000 else
22001 write(shortfraq(1:2),'(i2)')ntmp
22002 lntmp = 2
22003 end if
22004 write(11,'(a)')sq//'endpiece}}'//sq//'advance'//sq
22005 * //'barno'//shortfraq(1:lntmp)
22006 write(11,'(a)')sq//'contpiece'
22007 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
22008 * //sq//'makeatother'
22009 ishort = 0
22010 mbrsum = 0
22011 nmbr = 0
22012 end if
22013 else if (mtrnuml .ne. 0) then
22014
22015 c
22016 c New meter, no new sig, end of line, not new page.
22017 c
22018 c \generalmeter{\meterfrac{3}{4}}%
22019 c \xchangecontext\addspace{-\afterruleskip}%
22020 c \zalaligne\generalmeter{\meterfrac{3}{4}}\addspace{-\afterruleskip}%
22021 c \zchangecontext
22022 c
22023 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
22024 if (movbrk .eq. 0) then
22025 if (islast) then
22026 call wgmeter(mtrnmp,mtrdnp)
22027 end if
22028 if (mtrdnp .gt. 0) then
22029 if (islast) then
22030 write(11,'(a)')
22031 * sq//'let'//sq//'bnat'//sq//'barnoadd'
22032 * //sq//'def'//sq//'barnoadd{'//sq//'empty}%'
22033 write(11,'(a)')sq//'xchangecontext'//sq//
22034 * 'addspace{-'//sq//'afterruleskip}'//sq//
22035 * 'zalaligne'//sq//'let'//sq//'barnoadd'//sq//'bnat'
22036 call wgmeter(mtrnmp,mtrdnp)
22037 write(11,'(a)')sq//'addspace{-'//sq//
22038 * 'afterruleskip}'//sq//'zchangecontext'
22039 end if
22040 if (ibar .eq. ibarmbr) xb4mbr = -.2*musicsize
22041 else
22042 if (islast) write(11,'(a)')sq//'alaligne'
22043 end if
22044 else
22045 if (islast) write(11,'(a)')sq//'alaligne'
22046 end if
22047 end if
22048 end if
22049 c
22050 c Modified 090525 to use \bnrs
22051 c
22052 if (slint) then
22053 slint = .false.
22054 if (islast) write(11,'(a16,i1,a14)')sq//'def'//sq//
22055 * 'raisebarno{',irzbnd,'.5'//sq//'internote}%'
22056 end if
22057 movbrk = 0
22058 end if
22059 c
22060 c Clean up if we squelched bar number reset at movement break
22061 c
22062 if (nobar1) then
22063 if (islast) write(11,'(a)')sq//'startbarno1'
22064 nobar1 = .false.
22065 end if
22066 read(12,*,end=14)iauto
22067 14 continue
22068 c
22069 c We come thru here for the 1st bar of every system, so initialize is1n1
22070 c
22071 is1n1 = 0
22072 c
22073 c Brought down from above
22074 c
22075 if (isystpg .eq. nsystp(ipage)) then
22076 isystpg = 0
22077 c
22078 c The following is to avoid moving this reset of isystpg, but still send a signal
22079 c down below for last system shortening events
22080 c
22081 if (ishort.eq.2) iflagbot = 1
22082 end if
22083 c
22084 c Check for linebreak ties
22085 c
22086 if (ispstie)
22087 * call LineBreakTies(isdat1,isdat2,isdat3,isdat4,nsdat,
22088 * ispstie,sepsymq)
22089 else
22090 c
22091 c Not first bar of system
22092 c
22093 if (btest(iplnow,28)) then
22094 c
22095 c Signature change
22096 c
22097 if (mtrnuml .ne. 0) then
22098 c
22099 c Meter+signature change mid line, assume no movement break
22100 c
22101 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
22102 if (islast) call wgmeter(mtrnmp,mtrdnp)
22103 notexq = sq//'generalsignature{'
22104 lnote = 18
22105 if (isig .lt. 0) then
22106 notexq = notexq(1:18)//'-'
22107 lnote = 19
22108 end if
22109 if (islast) then
22110 iptemp = 48+abs(isig)
22111 charq = chax(iptemp)
22112 notexq = notexq(1:lnote)//charq//'}%'
22113 lnote = lnote+3
22114 write(11,'(a)')notexq(1:lnote)
22115 if (islast .and. LaterInstTrans) then
22116 call Writesetsign(nInstTrans,iInstTrans,iTransKey,
22117 * LaterInstTrans)
22118 end if
22119 if (ignorenats) write(11,'(a)')sq//'ignorenats%'
22120 write(11,'(a)')sq//'xchangecontext%'
22121 end if
22122 if (ibar .eq. ibarmbr) then
22123 c
22124 c Compute space for multibar rest
22125 c
22126 if (lastisig*isig .ge. 0) then
22127 naccs = max(abs(lastisig),abs(isig))
22128 else
22129 naccs = abs(lastisig-isig)
22130 end if
22131 xb4mbr = -.2*musicsize
22132 end if
22133 else
22134 c
22135 c Signature change only
22136 c
22137 notexq = sq//'xbar'//sq//'addspace{-'//sq//
22138 * 'afterruleskip}'//sq//'generalsignature{'
22139 lnote = 49
22140 if (isig .lt. 0) then
22141 notexq = notexq(1:49)//'-'
22142 lnote = 50
22143 end if
22144 if (islast)
22145 * write(11,'(a)')notexq(1:lnote)//chax(48+abs(isig))//'}%'
22146 if (islast .and. LaterInstTrans) then
22147 call Writesetsign(nInstTrans,iInstTrans,iTransKey,
22148 * LaterInstTrans)
22149 end if
22150 if (islast .and. ignorenats)
22151 * write(11,'(a)')sq//'ignorenats%'
22152 if (islast) write(11,'(a)')sq//'zchangecontext'//sq
22153 * //'addspace{-.5'// sq//'afterruleskip}%'
22154 if (ibar .eq. ibarmbr) then
22155 c
22156 c Compute space for multibar rest
22157 c
22158 if (lastisig*isig .ge. 0) then
22159 naccs = max(abs(lastisig),abs(isig))
22160 else
22161 naccs = abs(lastisig-isig)
22162 end if
22163 xb4mbr = -.2*musicsize
22164 end if
22165 end if
22166 else if (ishort .eq. 3) then
22167 c
22168 c Gap before coda, assumed no signature change!
22169 c
22170 ntmp = ibarcnt-ibarcnt0-nmbr+mbrsum
22171 if (ntmp .le. 9) then
22172 shortfraq(1:1) = char(48+ntmp)
22173 lntmp = 1
22174 else
22175 write(shortfraq(1:2),'(i2)')ntmp
22176 lntmp = 2
22177 end if
22178 write(11,'(a)')sq//'endpiece}'//sq//'advance'//sq
22179 * //'barno'//shortfraq(1:lntmp)
22180 if (nocodabn) then
22181 write(11,'(a)')sq//'nobarno'
22182 nocodabn = .false.
22183 end if
22184 write(shortfraq,'(f3.2)')codafrac
22185 write(11,'(a)')sq//'hfill'//sq//
22186 * 'vbox{'//sq//'hsize='//shortfraq//sq//'hsize%'
22187 write(11,'(a)')sq//'contpiece'
22188 write(11,'(a)')sq//'makeatletter'//sq//'fil@begin'
22189 * //sq//'makeatother'
22190 ishort = 4
22191 else if (mtrnuml .eq. 0) then
22192 c
22193 c No meter change
22194 c
22195 if (islast) write(11,'(a)')sq//'xbar'
22196 else
22197 c
22198 c Change meter midline
22199 c
22200 call setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
22201 if (movbrk .eq. 0) then
22202 if (islast) then
22203 call wgmeter(mtrnmp,mtrdnp)
22204 end if
22205 if (mtrdnp .gt. 0) then
22206 if (islast) then
22207 write(11,'(a,2i1,a)')sq//'newtimes0%'
22208 end if
22209 if (ibar .eq. ibarmbr) xb4mbr = -.2*musicsize
22210 else
22211 if (islast) write(11,'(a)')sq//'xbar'
22212 end if
22213 end if
22214 end if
22215 end if
22216 c
22217 c Now that xbar's are written, can put in left-repeats at line beginnings
22218 c
22219 if (lrptpend) then
22220 if (islast) write(11,'(a)')sq//'advance'//sq//'barno-1'
22221 * //sq//'leftrepeat'
22222 lrptpend = .false.
22223 end if
22224 if (ibar .gt. 1) then
22225 c
22226 c For bars after first, slide all stuff down to beginning of arrays
22227 c
22228 do 11 iv = 1 , nv
22229 do 1199 kv = 1 , nvmx(iv)
22230 ivx = ivmx(iv,kv)
22231 ioff = nib(ivx,ibar-1)
22232 do 12 ip = 1 , nib(ivx,ibar)-ioff
22233 nolev(ivx,ip) = nolev(ivx,ip+ioff)
22234 nodur(ivx,ip) = nodur(ivx,ip+ioff)
22235 nacc(ivx,ip) = nacc(ivx,ip+ioff)
22236 irest(ivx,ip) = irest(ivx,ip+ioff)
22237 islur(ivx,ip) = islur(ivx,ip+ioff)
22238 ipl(ivx,ip) = ipl(ivx,ip+ioff)
22239 iornq(ivx,ip) = iornq(ivx,ip+ioff)
22240 mult(ivx,ip) = mult(ivx,ip+ioff)
22241 if (figbass .and. ivx.eq.1 .or. ivx.eq.ivxfig2) then
22242 if (ivx.eq.1) then
22243 isfig(1,ip) = isfig(1,ip+ioff)
22244 else
22245 isfig(2,ip) = isfig(2,ip+ioff)
22246 end if
22247 end if
22248 12 continue
22249 if (ivx.le.nv .and. ncc(iv).gt.1) then
22250 islide = 0
22251 do 13 icc = 1 , ncc(iv)
22252 if (tcc(iv,icc) .le. lenbar) then
22253 c
22254 c This time will drop <=0 when slid.
22255 c
22256 islide = icc-1
22257 ncmidcc(iv,1) = ncmidcc(iv,icc)
22258 else
22259 tcc(iv,icc-islide) = tcc(iv,icc)-lenbar
22260 ncmidcc(iv,icc-islide) = ncmidcc(iv,icc)
22261 end if
22262 13 continue
22263 ncc(iv) = ncc(iv)-islide
22264 tcc(iv,1) = 0.
22265 end if
22266 1199 continue
22267 11 continue
22268 do 15 ig = 1 , ngrace
22269 ipg(ig) = ipg(ig)-nib(ivg(ig),ibar-1)
22270 if (ibar .gt. 2) ipg(ig) = ipg(ig)+nib(ivg(ig),ibar-2)
22271 15 continue
22272 do 21 il = 1 , nlit
22273 iplit(il) = iplit(il)-nib(ivlit(il),ibar-1)
22274 if (ibar .gt. 2) iplit(il) = iplit(il)+nib(ivlit(il),ibar-2)
22275 21 continue
22276 do 22 it = 1 , ntrill
22277 iptrill(it) = iptrill(it)-nib(ivtrill(it),ibar-1)
22278 if (ibar .gt. 2) iptrill(it) =
22279 * iptrill(it)+nib(ivtrill(it),ibar-2)
22280 22 continue
22281 do 27 icrd = 1 , ncrd
22282 ivx = iand(15,ishft(icrdat(icrd),-8))
22283 * +16*igetbits(icrdat(icrd),1,28)
22284 ipnew = iand(255,icrdat(icrd))-nib(ivx,ibar-1)
22285 if (ibar .gt. 2) ipnew = ipnew+nib(ivx,ibar-2)
22286 icrdat(icrd) = iand(not(255),icrdat(icrd))
22287 icrdat(icrd) = ior(max(0,ipnew),icrdat(icrd))
22288 27 continue
22289 do 29 iudorn = 1 , nudorn
22290 ivx = ivxudorn(iudorn)
22291 ipnew = iand(255,kudorn(iudorn))-nib(ivx,ibar-1)
22292 if (ibar .gt. 2) ipnew = ipnew+nib(ivx,ibar-2)
22293 kudorn(iudorn) = iand(not(255),kudorn(iudorn))
22294 kudorn(iudorn) = ior(max(0,ipnew),kudorn(iudorn))
22295 29 continue
22296 do 42 idyn = 1 , ndyn
22297 idynd = idyndat(idyn)
22298 ivx = iand(15,idynd)+16*igetbits(idynda2(idyn),1,10)
22299 ipnew = igetbits(idynd,8,4)-nib(ivx,ibar-1)
22300 c
22301 c The following construction avoids array bound errors in some compilers
22302 c
22303 if (ibar .gt. 2) then
22304 ipnew = ipnew+nib(ivx,ibar-2)
22305 end if
22306 ipnew = dim(ipnew,0)
22307 call setbits(idynd,8,4,ipnew)
22308 idyndat(idyn) = idynd
22309 42 continue
22310 do 43 itxtdyn = 1 , ntxtdyn
22311 idynd = ivxiptxt(itxtdyn)
22312 ivx = iand(31,idynd)
22313 ipnew = igetbits(idynd,8,5)-nib(ivx,ibar-1)
22314 if (ibar .gt. 2) then
22315 ipnew = ipnew+nib(ivx,ibar-2)
22316 end if
22317 ipnew = dim(ipnew,0)
22318 c call setbits(idynd,8,4,ipnew)
22319 call setbits(idynd,8,5,ipnew)
22320 ivxiptxt(itxtdyn) = idynd
22321 43 continue
22322 do 41 isdat = 1 , nsdat
22323 isdata = isdat1(isdat)
22324 ivx = ivmx(igetbits(isdata,5,13),igetbits(isdata,1,12)+1)
22325 ipnew = igetbits(isdata,8,3)-nib(ivx,ibar-1)
22326 if (ibar .gt. 2) then
22327 ipnew = ipnew+nib(ivx,ibar-2)
22328 end if
22329 ipnew = dim(ipnew,0)
22330 call setbits(isdata,8,3,ipnew)
22331 isdat1(isdat) = isdata
22332 41 continue
22333 do 44 ibc = 1 , nbc
22334 ivx = iand(15,ibcdata(ibc))+16*igetbits(ibcdata(ibc),1,28)
22335 ipnew = igetbits(ibcdata(ibc),8,4)-nib(ivx,ibar-1)
22336 if (ibar .gt. 2) then
22337 ipnew = ipnew+nib(ivx,ibar-2)
22338 end if
22339 ipnew = dim(ipnew,0)
22340 call setbits(ibcdata(ibc),8,4,ipnew)
22341 44 continue
22342 do 45 iarps = 1 , NumArpShift
22343 IpArpShift(iarps) =
22344 * IpArpShift(iarps)-nib(IvArpShift(iarps),ibar-1)
22345 if (ibar .gt. 2) then
22346 IpArpShift(iarps) =
22347 * IpArpShift(iarps)+nib(IvArpShift(iarps),ibar-2)
22348 end if
22349 45 continue
22350 c
22351 c Bookkeeping for figures. This will set nfigs = 0 if there are no figs left.
22352 c If there are figs left, it will reset all times relative to start of
22353 c current bar.
22354 c
22355 do 46 ivx = 1 , 2
22356 if (figbass) then
22357 islide = 0
22358 do 20 jfig = 1 , nfigs(ivx)
22359 if (itfig(ivx,jfig) .lt. lenbar) then
22360 c
22361 c This figure was already used
22362 c
22363 islide = jfig
22364 else
22365 itfig(ivx,jfig-islide) = itfig(ivx,jfig)-lenbar
22366 figq(ivx,jfig-islide) = figq(ivx,jfig)
22367 itoff(ivx,jfig-islide) = itoff(ivx,jfig)
22368 ivupfig(ivx,jfig-islide) = ivupfig(ivx,jfig)
22369 ivvfig(ivx,jfig-islide) = ivvfig(ivx,jfig)
22370 end if
22371 20 continue
22372 nfigs(ivx) = nfigs(ivx)-islide
22373 end if
22374 if (nfigs(2) .eq. 0) go to 47
22375 46 continue
22376 47 continue
22377 end if
22378 c
22379 c End of sliding down for bars after first in gulp.
22380 c
22381 c The following may not be needed by makeabar, but just in case...
22382 c
22383 if (firstgulp .and. lenb0.ne.0) then
22384 if (ibar .eq. 1) then
22385 lenbar = lenb0
22386 else
22387 lenbar = lenb1
22388 end if
22389 end if
22390 c
22391 c Equal line spacing stuff
22392 c
22393 if (equalize .and. bar1syst) then
22394 if (isystpg .eq. 1) then
22395 write(11,'(a)')sq//'starteq%'
22396 else if (isystpg .eq. nsystp(ipage)-1) then
22397 write(11,'(a)')sq//'endeq%'
22398 end if
22399 end if
22400 call make1bar(ibmrep,tglp1,tstart,cwrest,squez,
22401 * istop,numbms,istart)
22402 call make2bar(ninow,tglp1,tstart,cwrest,squez,
22403 * istop,numbms,istart,clefq)
22404 c
22405 c Hardspace before barline?
22406 c
22407 hardb4 = 0.
22408 do 35 iv = 1 , nv
22409 do 3599 kv = 1 , nvmx(iv)
22410 ivx = ivmx(iv,kv)
22411 if (btest(irest(ivx,nn(ivx)),18)) then
22412 nudoff(ivx) = nudoff(ivx)+1
22413 hardb4 = max(hardb4,udoff(ivx,nudoff(ivx)))
22414 end if
22415 3599 continue
22416 35 continue
22417 if (hardb4 .gt. 0.) then
22418 if (islast) write(11,'(a11,f5.1,a4)')sq
22419 * //'hardspace{',hardb4,'pt}%'
22420 c
22421 c This was causing an incorrect poe in an example, which did not affect main
22422 c spacing, but did cause an extra accidental space to be too small
22423 c
22424 fixednew = fixednew-hardb4
22425 end if
22426 10 continue
22427 firstgulp = .false.
22428 lenb0 = 0
22429 go to 30
22430 40 close(12)
22431 close(13)
22432 ilbuf = 1
22433 ipbuf = 0
22434 wdpt = widthpt
22435 if (iline .eq. 1) wdpt = widthpt*(1-fracindent)
22436 poe = (wdpt-fsyst*musicsize-0.4*nbarss-fixednew)/
22437 * (elsktot+fbar*nbarss-scaldold)
22438 poevec(nsyst) = poe
22439 if (.not.islast) then
22440 close(11)
22441 close(16)
22442 if (figbass) close(14)
22443 return
22444 end if
22445 do 19 ia = 1 , nasksys
22446 iask = iask+1
22447 ask(iask) = (wasksys(ia)/poe-abs(elasksys(ia)))/poefa(iline)
22448 if (elasksys(ia).gt.0) ask(iask)=dim(ask(iask),0.)
22449 19 continue
22450 do 26 ia = 1 , nhssys
22451 nhstot = nhstot+1
22452 hpttot(nhstot) = max(hpts(ia)-hesk(ia)*poe,0.)
22453 26 continue
22454 if (islast .and.
22455 * onvolt) write(11,'(a)')sq//'endvoltabox'
22456 rendq = '% '
22457 if (ishort .ne. 0) rendq = '}}%'
22458 if (rptfq2 .ne. 'E') then
22459 c
22460 c Terminal repeat. Right or double?
22461 c
22462 if (rptfq2 .eq. 'r') then
22463 if (islast) write(11,'(a)')sq//'setrightrepeat'
22464 * //sq//'endpiece'//rendq
22465 else if (rptfq2 .eq. 'd') then
22466 if (islast) write(11,'(a)')sq//'setdoublebar'//sq//'endpiece'
22467 * //rendq
22468 else if (rptfq2 .eq. 'b') then
22469 if (islast) write(11,'(a)')sq//'endpiece'//rendq
22470 else if (rptfq2 .eq. 'z') then
22471 if (islast) write(11,'(a)')sq//'setzalaligne'//sq//'Endpiece'
22472 * //rendq
22473 else
22474 print*
22475 print*,'R? , ? not "d","r",or"b","z"; rptfq2:',rptfq2
22476 write(15,*)'R? , ? not "d","r",or"b","z"; rptfq2:',rptfq2
22477 if (islast) write(11,'(a)')sq//'Endpiece'
22478 end if
22479 else
22480 write(11,'(a)')sq//'Endpiece'//rendq
22481 end if
22482 if (.not.vshrink) then
22483 if (islast .and. bottopgap) then
22484 if (abs(botamt) .gt. 1.e-6) then
22485 if (botamt .gt. 9.95) then
22486 fmtq = '(a,f4.1,a)'
22487 else if (botamt .gt. 0.) then
22488 fmtq = '(a,f3.1,a)'
22489 else if (botamt .gt. -9.95) then
22490 fmtq = '(a,f4.1,a)'
22491 else
22492 fmtq = '(a,f5.1,a)'
22493 end if
22494 write(11,fmtq)sq//'null'//sq//'vskip',botamt,
22495 * sq//'Internote%'
22496 end if
22497 end if
22498 xnstbot = xnsttop(ipage)*etabot/etatop
22499 if (xnstbot .lt. 9.95) then
22500 fmtq = '(a,f3.1,a)'
22501 else
22502 fmtq = '(a,f4.1,a)'
22503 end if
22504 if (islast) write(11,fmtq)sq//'vskip',xnstbot,
22505 * sq//'Interligne'//sq//'eject'//sq//'endmuflex'
22506 if (islast) write(11,'(a)')sq//'bye'
22507 else
22508 if (islast) write(11,'(a)')
22509 * sq//'vfill'//sq//'eject'//sq//'endmuflex'
22510 if (islast) write(11,'(a)')sq//'bye'
22511 end if
22512 rewind(11)
22513 if (figbass) then
22514 write(14,'(a9,i2,a10,i2,1x,a5)')
22515 * sq//'figdrop=',ifigdr(1,iline),
22516 * ' '//sq//'figdtwo=',ifigdr(2,iline),sq//'fi}%'
22517 rewind(14)
22518 end if
22519 call askfig(pathnameq,lpath,basenameq,lbase,figbass,istype0)
22520 if (.not.optimize) then
22521 print*
22522 print*,'Writing '
22523 * //pathnameq(1:lpath)//basenameq(1:lbase)//'.tex'
22524 print*,'Done with second PMX pass.'
22525 write(15,'(/,a)')'Writing '
22526 * //pathnameq(1:lpath)//basenameq(1:lbase)//'.tex'
22527 write(15,'(a)')' Done with second PMX pass. Now run TeX'
22528 end if
22529 return
22530 end
22531 subroutine poestats(nsyst,poe,poebar,devnorm)
22532 parameter (nks=125)
22533 c
22534 c Compute avg. & norm. std. dev. of poe.
22535 c
22536 real*4 poe(nks)
22537 sumx = 0.
22538 sumxx = 0.
22539 do 1 isyst = 1 , nsyst
22540 sumx = sumx+poe(isyst)
22541 sumxx = sumxx+poe(isyst)**2
22542 1 continue
22543 devnorm = sqrt(nsyst*sumxx/sumx**2-1)
22544 poebar = sumx/nsyst
22545 return
22546 end
22547 subroutine precrd(ivx,ip,nolevm,nacc,ipl,irest,udq,
22548 * twooftwo,icashft)
22549 c
22550 c Analyzes chords, data to be used with slurs on chords and plain chords.
22551 c Check for 2nds, shift notes if neccesary.
22552 c ipl(10) chord present
22553 c irest(20) set if any note is right shifted
22554 c irest(27) set if any note is left shifted
22555 c ipl(8|9) left|right shift main note
22556 c icrdat(23|24) ditto chord note
22557 c udq is updown-ness, needed to analyze 2nds.
22558 c levtabl(i)=0 if no note at this level, -1 if main note, icrd if chord note.
22559 c icrdot(icrd)(27-29) sequence order of chord note if accid, top down
22560 c
22561 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
22562 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
22563 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
22564 logical btest,is2nd,twooftwo
22565 integer*4 kicrd(10),levtabl(88)
22566 character*1 udq
22567 do 11 i = 1 , 88
22568 levtabl(i) = 0
22569 11 continue
22570 do 1 icrd1 = 1 , ncrd
22571 ivx1 = iand(15,ishft(icrdat(icrd1),-8))
22572 * +16*igetbits(icrdat(icrd1),1,28)
22573 ip1 = iand(255,icrdat(icrd1))
22574 if (ip1.eq.ip .and. ivx1.eq.ivx) go to 2
22575 1 continue
22576 print*
22577 print*,
22578 * 'Cannot find first chord note in precrd. Send source to Dr. Don!'
22579 call stop1()
22580 2 continue
22581 maxlev = nolevm
22582 minlev = nolevm
22583 levtabl(nolevm) = -1
22584 is2nd = .false.
22585 naccid = 0
22586 levmaxacc = -100
22587 levminacc = 1000
22588 c
22589 c Check 1st 3 bits of nacc for accid on main note of chord.
22590 c
22591 if (iand(7,nacc) .gt. 0) then
22592 naccid = 1
22593 c
22594 c Start list of notes with accid's. There will be naccid of them. kicrd=0 if main,
22595 c otherwise icrd value for note with accidental.
22596 c
22597 kicrd(1) = 0
22598 levmaxacc = nolevm
22599 levminacc = nolevm
22600 c
22601 c Start the level-ranking
22602 c
22603 icrdot0 = 1
22604 end if
22605 do 3 icrd2 = icrd1 , ncrd
22606 nolev = igetbits(icrdat(icrd2),7,12)
22607 levtabl(nolev) = icrd2
22608 maxlev = max(maxlev,nolev)
22609 minlev = min(minlev,nolev)
22610 c
22611 c Check for accidental
22612 c
22613 if (btest(icrdat(icrd2),19)) then
22614 naccid = naccid+1
22615 levmaxacc = max(levmaxacc,nolev)
22616 levminacc = min(levminacc,nolev)
22617 c
22618 c Add this icrd to list of values for notes with accid's.
22619 c
22620 kicrd(naccid) = icrd2
22621 if (.not.btest(nacc,28)) then
22622 c
22623 c Order not forced, so get the level-ranking, top down
22624 c
22625 iorder = 1
22626 do 12 iaccid = 1 , naccid-1
22627 if (kicrd(iaccid) .eq. 0) then
22628 if (nolevm .gt. nolev) then
22629 iorder = iorder+1
22630 else
22631 icrdot0 = icrdot0+1
22632 end if
22633 else
22634 if (igetbits(icrdat(kicrd(iaccid)),7,12)
22635 * .gt. nolev) then
22636 iorder = iorder+1
22637 else
22638 iold = igetbits(icrdot(kicrd(iaccid)),3,27)
22639 call setbits(icrdot(kicrd(iaccid)),3,27,iold+1)
22640 end if
22641 end if
22642 12 continue
22643 call setbits(icrdot(icrd2),3,27,iorder)
22644 end if
22645 end if
22646 c
22647 c Exit loop if last note in this chord
22648 c
22649 if (icrd2 .eq. ncrd) go to 4
22650 if (igetbits(icrdat(icrd2+1),8,0) .ne. ip .or.
22651 c * igetbits(icrdat(icrd2+1),4,8) .ne. ivx) go to 4
22652 * igetbits(icrdat(icrd2+1),4,8)
22653 * +16*igetbits(icrdat(icrd2+1),1,28) .ne. ivx) go to 4
22654 3 continue
22655 print*
22656 print*,'Failed to find last chord note. Send source to Dr. Don!'
22657 call stop1()
22658 4 continue
22659 c
22660 c Now icrd1, icrd2 define range of icrd for this chord.
22661 c
22662 c Bypass autos-shifting if any manual shifts are present
22663 c
22664 if (btest(irest,20) .or. btest(irest,27)) go to 10
22665 c
22666 c Check for 2nds
22667 c
22668 do 5 ilev = 1 , 87
22669 if (levtabl(ilev).ne.0 .and. levtabl(ilev+1).ne.0) then
22670 c
22671 c There is at least one 2nd..
22672 c
22673 if (udq .eq. 'u') then
22674 c
22675 c Upstem. Start with 2nd just found and go up, rt-shifting upper
22676 c member of each pair
22677 c
22678 ile = ilev
22679 c
22680 c Set main-note flag for ANY right-shift
22681 c
22682 irest = ibset(irest,20)
22683 7 continue
22684 if (levtabl(ile+1) .lt. 0) then
22685 c
22686 c Upstem, & upper member is main so must be rt-shifted. This would move
22687 c stem too, so we rt-shift the OTHER note, and set flag that signals
22688 c to interchange pitches just when these two notes are placed.
22689 c
22690 nacc = ibset(nacc,30)
22691 icrdat(levtabl(ile)) = ibset(icrdat(levtabl(ile)),24)
22692 else
22693 c
22694 c Upper member is chord note, must be rt-shifted
22695 c
22696 icrdat(levtabl(ile+1)) = ibset(icrdat(levtabl(ile+1)),24)
22697 end if
22698 ile = ile+1
22699 8 continue
22700 ile = ile+1
22701 if (ile .lt. 87) then
22702 if (levtabl(ile).ne.0 .and. levtabl(ile+1).ne.0) then
22703 go to 7
22704 else
22705 go to 8
22706 end if
22707 end if
22708 go to 10
22709 else
22710 c
22711 c Downstem. Start at top and work down, left-shifting lower member of each pair.
22712 c We know that lowest pair is at (ilev,ilev+1).
22713 c
22714 ile = 88
22715 c
22716 c Set main-note flag for ANY right-shift
22717 c
22718 irest = ibset(irest,27)
22719 9 continue
22720 if (levtabl(ile).ne.0 .and. levtabl(ile-1).ne.0) then
22721 if (levtabl(ile-1) .lt. 0) then
22722 c
22723 c Dnstem, & lower member is main so must be left-shifted. This would move
22724 c stem too, so we left-shift the OTHER note, and set flag that signals
22725 c to interchange pitches just when these two notes are placed.
22726 c
22727 nacc = ibset(nacc,31)
22728 icrdat(levtabl(ile)) = ibset(icrdat(levtabl(ile)),23)
22729 else
22730 c
22731 c Lower member is chord note, must be shifted
22732 c
22733 icrdat(levtabl(ile-1)) =
22734 * ibset(icrdat(levtabl(ile-1)),23)
22735 end if
22736 ile = ile-1
22737 end if
22738 ile = ile-1
22739 if (ile .ge. ilev+1) go to 9
22740 go to 10
22741 end if
22742 end if
22743 5 continue
22744 10 continue
22745 c
22746 c Done with 2nds, now do accid's. Call even if just one, in case left shifts.
22747 c
22748 if (naccid .ge. 1) call crdaccs(nacc,ipl,irest,naccid,
22749 * kicrd,nolevm,levmaxacc,levminacc,icrdot0,twooftwo,icashft)
22750 return
22751 end
22752 subroutine printl(string)
22753 character*(*) string
22754 c
22755 c Send string to console and to log file
22756 c
22757 print*,string
22758 write(15,'(a)')string
22759 return
22760 end
22761 subroutine putarp(tnow,iv,ip,nolev,ncm,soutq,lsout)
22762 parameter (nm=24)
22763 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
22764 * xinsnow,lowdot
22765 common /comtol/ tol
22766 common /comArpShift/NumArpShift,IvArpShift(20),IpArpShift(20),
22767 * ArpShift(20)
22768 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
22769 logical lowdot,IsArpShift
22770 character*80 soutq
22771 character*79 notexq
22772 character*8 symq(2)
22773 character*1 chax
22774 data symq /'raisearp','arpeggio'/
22775 c
22776 c NOTE iv in arg list is really ivx, referring to voice rather than staff.
22777 c
22778 c Find which iarp, if any
22779 c
22780 do 1 iarp = 1 , narp
22781 if (abs(tnow-tar(iarp)).lt.tol) go to 2
22782 1 continue
22783 c
22784 c If here, this is the *first* call for this arp.
22785 c
22786 narp = narp+1
22787 tar(narp) = tnow+tol*.5
22788 ivar1(narp) = iv
22789 ipar1(narp) = ip
22790 levar1(narp) = nolev
22791 ncmar1(narp) = ncm
22792 return
22793 2 continue
22794 c
22795 c If here, this is *second* call at this time, narp points to values from 1st.
22796 c
22797 c Check for shift. Set IsArpShift and iarps
22798 c
22799 do 3 iarps = 1 , NumArpShift
22800 if (IvArpShift(iarps) .eq. ivar1(iarp) .and.
22801 * IpArpShift(iarps) .eq. ipar1(iarp)) then
22802 IsArpShift = .true.
22803 notexq = chax(92)//'loffset{'
22804 write(notexq(10:14),'(f3.1,a2)') Arpshift(iarps),'}{'
22805 lnote = 14
22806 go to 4
22807 end if
22808 3 continue
22809 IsArpShift = .false.
22810 lnote = 0
22811 4 continue
22812 if (iv .eq. ivar1(iarp)) then
22813 c
22814 c Arp is in a single voice.
22815 c
22816 levbot = min(levar1(iarp),nolev)-ncm+3
22817 invert = abs(levar1(iarp)-nolev)+1
22818 else
22819 c
22820 c Arp covers >1 voice. Lower voice has to be the first, upper is current and
22821 c is where the symbol will be written.
22822 c Check whether ivx's ivar1(iarp) & iv are in same staff
22823 c
22824 do 5 iiv = 1 , nm
22825 if (ivmx(iiv,1).eq.ivar1(iarp) .or. (nvmx(iiv).eq.2.and.
22826 * ivmx(iiv,2).eq.ivar1(iarp))) then
22827 iivivx1 = iiv
22828 go to 6
22829 end if
22830 5 continue
22831 print*,'Screwup#1 in putarp'
22832 stop
22833 6 continue
22834 do 7 iiv = 1 , nm
22835 if (ivmx(iiv,1).eq.iv .or. (nvmx(iiv).eq.2.and.
22836 * ivmx(iiv,2).eq.iv)) go to 8
22837 c
22838 c Found iv for both voices (iivivx1, iiv), done looking
22839 c
22840 7 continue
22841 print*,'Screwup#2 in putarp'
22842 stop
22843 8 continue
22844 if (iivivx1 .eq. iiv) then
22845 nstaffshift = 0
22846 else
22847 nstaffshift = -nint(2*xinsnow)
22848 end if
22849 levbot = nstaffshift+3+levar1(iarp)-ncmar1(iarp)
22850 invert = -levbot+4+nolev-ncm
22851 end if
22852 c
22853 c isym will be (1,2) if invert is (even,odd). If even, raise .5\internote
22854 c
22855 isym = mod(invert,2)+1
22856 ilvert = (invert+1)/2
22857 if (levbot .ge. 0 .and. levbot .le. 9) then
22858 c
22859 c Single digit
22860 c
22861 if (.not.IsArpShift) then
22862 notexq = chax(92)//symq(isym)//chax(48+levbot)
22863 else
22864 notexq = notexq(1:lnote)//
22865 * chax(92)//symq(isym)//chax(48+levbot)
22866 end if
22867 lnote = lnote+10
22868 else
22869 if (.not.IsArpShift) then
22870 notexq = chax(92)//symq(isym)//'{'
22871 else
22872 notexq = notexq(1:lnote)//chax(92)//symq(isym)//'{'
22873 end if
22874 lnote = lnote+10
22875 if (levbot .ge. -9) then
22876 c
22877 c Need two spaces for number
22878 c
22879 write(notexq(lnote+1:lnote+3),'(i2,a1)')levbot,'}'
22880 lnote = lnote+3
22881 else
22882 write(notexq(lnote+1:lnote+4),'(i3,a1)')levbot,'}'
22883 lnote = lnote+4
22884 end if
22885 end if
22886 if (ilvert .gt. 9) then
22887 write(notexq(lnote+1:lnote+4),'(a1,i2,a1)')'{',ilvert,'}'
22888 lnote = lnote+4
22889 else
22890 notexq = notexq(1:lnote)//chax(48+ilvert)
22891 lnote = lnote+1
22892 end if
22893 if (IsArpShift) then
22894 notexq = notexq(1:lnote)//'}'
22895 lnote = lnote+1
22896 end if
22897 call addstr(notexq(1:lnote),lnote,soutq,lsout)
22898 c
22899 c cancel out the stored time, to permit two arps at same time!
22900 c
22901 tar(iarp) = -1.
22902 return
22903 end
22904 subroutine putast(elask,indxask,outq)
22905 character*129 outq,tag
22906 character*9 fmtq
22907 if (elask .ge. 0.) then
22908 if (elask.lt.0.995) then
22909 lp = 3
22910 else if (elask .lt. 9.995) then
22911 lp = 4
22912 else
22913 lp = 5
22914 end if
22915 write(fmtq,'(a5,i1,a3)')'(a2,f',lp,'.2)'
22916 else
22917 lp = 5
22918 fmtq = '(a2,f5.1)'
22919 end if
22920 c
22921 c Overwrite as follows: ...xyz*ask *lmnop... ->
22922 c ...xyz*ast{.nn}*lmnop...
22923 c ...xyz*ast{n.nn}*lmnop...
22924 c ...xyz*ast{nn.nn}*lmnop...
22925 c or for negative, ...xyz*ast{-nn.n}*lmnop...
22926 tag = outq(indxask+9:)
22927 write(outq(indxask+3:),fmtq)'t{',elask
22928 outq = outq(1:indxask+4+lp)//'}'//tag
22929 return
22930 end
22931 subroutine putcb(ivx,ip,notexq,lnote)
22932 common /comcb/ nbc,ibcdata(36)
22933 character*79 notexq
22934 logical btest
22935 do 1 ibc = 1 , nbc
22936 ivxbc = iand(15,ibcdata(ibc))+16*igetbits(ibcdata(ibc),1,28)
22937 ipbc = igetbits(ibcdata(ibc),8,4)
22938 if (ivx .eq. ivxbc .and. ip .eq.ipbc) go to 2
22939 1 continue
22940 call printl('Error in putbc, Call Dr. Don')
22941 stop
22942 2 continue
22943 if (btest(ibcdata(ibc),27)) then
22944 lnote = 8
22945 notexq = char(92)//'pbreath'
22946 else
22947 lnote = 9
22948 notexq = char(92)//'pcaesura'
22949 end if
22950 ivshft = igetbits(ibcdata(ibc),6,13)
22951 if (ivshft .gt. 0) ivshft = ivshft-32
22952 if (ivshft.lt.0 .or. ivshft.gt.9) then
22953 notexq = notexq(1:lnote)//'{'
22954 lnote = lnote+1
22955 if (ivshft .lt. -9) then
22956 write(notexq(lnote+1:lnote+3),'(i3)')ivshft
22957 lnote = lnote+3
22958 else
22959 write(notexq(lnote+1:lnote+2),'(i2)')ivshft
22960 lnote = lnote+2
22961 end if
22962 notexq = notexq(1:lnote)//'}'
22963 lnote = lnote+1
22964 else
22965 notexq = notexq(1:lnote)//char(48+ivshft)
22966 lnote = lnote+1
22967 end if
22968 ihshft = igetbits(ibcdata(ibc),8,19)
22969 if (ihshft .eq. 0) then
22970 notexq = notexq(1:lnote)//'0'
22971 lnote = lnote+1
22972 else
22973 hshft = .1*(ihshft-128)
22974 c
22975 c -12.8<hshft<12.8
22976 c
22977 notexq = notexq(1:lnote)//'{'
22978 lnote = lnote+1
22979 if (hshft .lt. -9.95) then
22980 write(notexq(lnote+1:lnote+5),'(f5.1)')hshft
22981 lnote = lnote+5
22982 else if (hshft.lt.-0.05 .or. hshft.gt.9.95) then
22983 write(notexq(lnote+1:lnote+4),'(f4.1)')hshft
22984 lnote = lnote+4
22985 else
22986 write(notexq(lnote+1:lnote+3),'(f3.1)')hshft
22987 lnote = lnote+3
22988 end if
22989 notexq = notexq(1:lnote)//'}'
22990 lnote = lnote+1
22991 end if
22992 return
22993 end
22994 subroutine putfig(ivx,ifig,offnsk,figcheck,soutq,lsout)
22995 parameter (nm=24)
22996 common /comfig/ itfig(2,74),figqq(2,74),ivupfig(2,74),nfigs(2),
22997 * fullsize(nm),ivxfig2,ivvfig(2,74)
22998 character*10 figqq,figq
22999 character*80 soutq,notexq
23000 character*1 ch1q,ch2q,sq,chax
23001 character*5 nofq,nofaq
23002 character*4 Figutq,Conttq
23003 logical figcheck
23004 if (ivx .eq. 1) then
23005 Figutq = 'Figu'
23006 Conttq = 'Cont'
23007 else
23008 Figutq = 'Figt'
23009 Conttq = 'Cott'
23010 end if
23011 sq = chax(92)
23012 if (ivvfig(ivx,ifig) .ne. 0) then
23013 c
23014 c Alter figdrop
23015 c
23016 notexq = sq//'global'//sq//'advance'//sq//'figdrop'
23017 lnote = 23
23018 if (ivvfig(ivx,ifig) .lt. 0) then
23019 notexq = notexq(1:lnote)//'-'
23020 lnote = lnote+1
23021 endif
23022 notexq = notexq(1:lnote)//char(48+abs(ivvfig(ivx,ifig)))
23023 lnote = lnote+1
23024 call addstr(notexq,lnote,soutq,lsout)
23025 end if
23026 if (abs(offnsk) .gt. .0001) then
23027 c
23028 c Write offset for floating figure, to two decimal places
23029 c
23030 notexq = sq//'off{'
23031 if (-offnsk .lt. -9.995) then
23032 write(notexq(6:11),'(f6.2)')-offnsk
23033 lnote = 11
23034 else if (-offnsk.lt.-.995 .or. -offnsk.gt.9.995) then
23035 write(notexq(6:10),'(f5.2)')-offnsk
23036 lnote = 10
23037 else if (-offnsk.lt.-.0001 .or. -offnsk.gt..995) then
23038 write(notexq(6:9),'(f4.2)')-offnsk
23039 lnote = 9
23040 else
23041 write(notexq(6:8),'(f3.2)')-offnsk
23042 lnote = 8
23043 end if
23044 notexq = notexq(1:lnote)//sq//'noteskip}'
23045 call addstr(notexq,lnote+10,soutq,lsout)
23046 end if
23047 figq = figqq(ivx,ifig)
23048 ic = 1
23049 nof = -ivupfig(ivx,ifig)
23050 nofa = -ivupfig(ivx,ifig)-1
23051 c
23052 c Beginning of manual loop
23053 c
23054 1 ch1q = figq(ic:ic)
23055 c
23056 c Exit when first blank is encountered
23057 c
23058 if (ch1q .eq. ' ') go to 2
23059 c
23060 c Starting a level. Set up vertical offset.
23061 c
23062 call istring(nof,nofq,lnof)
23063 call istring(nofa,nofaq,lnofa)
23064 if (ch1q .eq. '0') then
23065 c
23066 c Continuation figure. Next number is length (in noteskips). The number will
23067 c end at the first blank or char that is not digit or decimal point. If
23068 c colon, it is a separator and must be skipped
23069 c
23070 icnum = ic+1
23071 3 continue
23072 ic = ic+1
23073 if (index('0123456789.',figq(ic:ic)) .gt. 0) go to 3
23074 lnum = ic-icnum
23075 call addstr(sq//Conttq//nofq(1:lnof)//'{'
23076 * //figq(icnum:ic-1)//'}',7+ic-icnum+lnof,soutq,lsout)
23077 if (figq(ic:ic) .ne. ':') ic=ic-1
23078 else if (ch1q.eq.'#'.or.ch1q.eq.'-'.or.ch1q.eq.'n') then
23079 ic = ic+1
23080 ch2q = figq(ic:ic)
23081 if (ch2q .eq. ' ') then
23082 c
23083 c Figure is a stand-alone accidental, so must be centered
23084 c
23085 if (ch1q .eq. '#') then
23086 call addstr(sq//Figutq//nofaq(1:lnofa)//
23087 * '{'//sq//'sharpfig}',16+lnofa,soutq,lsout)
23088 else if (ch1q .eq. '-') then
23089 call addstr(sq//Figutq//nofaq(1:lnofa)//
23090 * '{'//sq//'flatfig}',15+lnofa,soutq,lsout)
23091 else if (ch1q .eq. 'n') then
23092 call addstr(sq//Figutq//nofaq(1:lnofa)//
23093 * '{'//sq//'natfig}',14+lnofa,soutq,lsout)
23094 end if
23095 go to 2
23096 else
23097 c
23098 c Figure is an accidental followed by a number
23099 c First put the accidental (offset to the left)
23100 c
23101 if (ch1q .eq. '#') then
23102 call addstr(sq//Figutq//
23103 * nofaq(1:lnofa)//'{'//sq//'fsmsh}',
23104 * 13+lnofa,soutq,lsout)
23105 else if (ch1q .eq. '-') then
23106 call addstr(sq//Figutq//
23107 * nofaq(1:lnofa)//'{'//sq//'fsmfl}',
23108 * 13+lnofa,soutq,lsout)
23109 else if (ch1q .eq. 'n') then
23110 call addstr(sq//Figutq//
23111 * nofaq(1:lnofa)//'{'//sq//'fsmna}',
23112 * 13+lnofa,soutq,lsout)
23113 end if
23114 c
23115 c Now put the number
23116 c
23117 call addstr(sq//Figutq//nofq(1:lnof)//'{'//ch2q//'}',
23118 * 8+lnof,soutq,lsout)
23119 c
23120 c Mods for 2-digit fig with accidental.
23121 c
23122 if (ch2q.eq.'1') then
23123 ic = ic+1
23124 lsout = lsout-1
23125 call addstr(figq(ic:ic)//'}',2,soutq,lsout)
23126 end if
23127 endif
23128 else if (ch1q .eq. '_') then
23129 c
23130 c Placeholder only (for lowering a figure). Don't do anything!
23131 c
23132 continue
23133 else if (ch1q .eq. '1') then
23134 c
23135 c Mods for 2-digit fig with no accidental.
23136 c
23137 ic = ic+1
23138 ch2q = figq(ic:ic)
23139 call addstr(sq//'off{-2pt}'//sq//Figutq//nofq(1:lnof)//'{'
23140 * //'1'//ch2q//'}'//sq//'off{2pt}',28+lnof,soutq,lsout)
23141 else
23142 c
23143 c Figure is a single number, maybe with s after
23144 c
23145 call addstr(sq//Figutq//nofq(1:lnof)//'{',
23146 * 6+lnof,soutq,lsout)
23147 ch2q = figq(ic+1:ic+1)
23148 if (ch2q .eq. 's') then
23149 c
23150 c Use a special character. Insert font call
23151 c
23152 ic = ic+1
23153 call addstr(sq//'ligfont',8,soutq,lsout)
23154 end if
23155 call addstr(ch1q//'}',2,soutq,lsout)
23156 end if
23157 if (ic .ge. 10) go to 2
23158 ic = ic+1
23159 nof = nof+4
23160 nofa = nofa+4
23161 go to 1
23162 2 continue
23163 if (abs(offnsk) .gt. .0001) then
23164 notexq = sq//'off{'
23165 if (offnsk .lt. -9.995) then
23166 write(notexq(6:11),'(f6.2)')offnsk
23167 lnote = 11
23168 else if (offnsk.lt.-.995 .or. offnsk.gt.9.995) then
23169 write(notexq(6:10),'(f5.2)')offnsk
23170 lnote = 10
23171 else if (offnsk.lt.-.0001 .or. offnsk.gt..995) then
23172 write(notexq(6:9),'(f4.2)')offnsk
23173 lnote = 9
23174 else
23175 write(notexq(6:8),'(f3.2)')offnsk
23176 lnote = 8
23177 end if
23178 notexq = notexq(1:lnote)//sq//'noteskip}'
23179 call addstr(notexq,lnote+10,soutq,lsout)
23180 end if
23181 if (ifig .lt. nfigs(ivx)) then
23182 ifig = ifig+1
23183 else
23184 nfigs(ivx) = 0
23185 figcheck = .false.
23186 end if
23187 return
23188 end
23189 subroutine putorn(iornq,nolev,nolevm,nodur,nornb,ulq,ibmcnt,ivx,
23190 * ncm,islur,nvmx,nv,ihornb,stemlin,outq,lout,ip,islhgt,
23191 * beamon,iscrd)
23192 c
23193 c All args are individual array element *values* except nornb,ihornb,ulq.
23194 c notcrd = .true. if ornament is on main note.
23195 c nolevm is level of main note (for chords)
23196 c
23197 parameter (nm=24)
23198 character*1 ulpzq,ulq(nm,9),udqq,sq,chax
23199 character*8 noteq
23200 character*79 notexq,outq
23201 integer*4 ihornb(nm,24),nornb(nm)
23202 logical btest,iscrd,usehornb,beamon
23203 common /comivxudorn/ivxudorn(63)
23204 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
23205 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
23206 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
23207 sq = chax(92)
23208 lout = 0
23209 usehornb = .false.
23210 if (nodur .lt. 64) then
23211 stemlen = stemlin
23212 else
23213 stemlen = 0.
23214 end if
23215 c
23216 c Get up-downness. ulpzq is opposite from stem direction for both beams and
23217 c non beams. Can use in name of ornament [ . or _ ]
23218 c
23219 if (beamon) then
23220 if (ulq(ivx,ibmcnt) .eq. 'u') then
23221 ulpzq = 'l'
23222 else
23223 ulpzq = 'u'
23224 end if
23225 else
23226 if (udqq(nolevm,ncm,islur,nvmx,ivx,nv).eq.'l' ) then
23227 ulpzq = 'u'
23228 else
23229 ulpzq = 'l'
23230 end if
23231 end if
23232 c
23233 c To enable >1 ornament on a note, next line is top of manual loop.
23234 c
23235 2 continue
23236 if (btest(iornq,29)) then
23237 ibit = 29
23238 else if (btest(iornq,30)) then
23239 ibit = 30
23240 else
23241 ibit = log2(iand(iornq,4194303))
23242 end if
23243 iornt = 2**ibit
23244 c
23245 c Begin routine to set height. Bits 0-13: (stmgx+Tupf._)
23246 c 14: Down fermata, was F 15: Trill w/o "tr", was U, 16-18: edit. s,f,n
23247 c 19-20: >^, 21: ? (with or w/o 16-18)
23248 c and 29-30: C (coda), G (new segno)
23249 c
23250 c Do not use beam height for . or _
23251 c
23252 if (btest(iornq,22) .and. iand(iornt,6144).eq.0) then
23253 c
23254 c Height is set by special beam stuff.
23255 c Do not leave ihorn set, do separately for every ornament
23256 c
23257 ihorn = ihornb(ivx,nornb(ivx))
23258 if (ulpzq .eq. 'u') ihorn = ihorn-2
23259 c
23260 c Following flag tells whether to increment nornb when exiting the subroutine.
23261 c
23262 usehornb = .true.
23263 else if (ibit .eq. 14) then
23264 c
23265 c Down fermata. Don't worry about upper chord notes.
23266 c
23267 if (ulpzq .eq. 'l') then
23268 ihorn = min(nolev,ncm-3)
23269 else
23270 ihorn = min(nolev-stemlen,ncm-3.)
23271 end if
23272 else if (btest(iornt,13) .or. btest(iornt,0)) then
23273 c
23274 c ( or )
23275 c
23276 ihorn = nolev
23277 else if (iand(iornt,6144) .gt. 0) then
23278 c
23279 cc Staccato . or tenuto _ , but not special beam stuff. Need up-down info
23280 c NOTE: removed .&_ from special beam treatment.
23281 c Staccato . or tenuto _ Need up-down info
23282 c
23283 if (.not.iscrd .or. (maxlev.ne.nolev.and.ulpzq.eq.'l') .or.
23284 * (minlev.ne.nolev.and.ulpzq.eq.'u')) then
23285 ihorn = nolev
23286 else if (maxlev .eq. nolev) then
23287 ulpzq = 'u'
23288 ihorn = max(nolev+stemlen,ncm+3.)
23289 else
23290 ulpzq = 'l'
23291 ihorn = min(nolev-stemlen,ncm-3.)
23292 end if
23293 else if (iscrd .and. nolev .eq. minlev) then
23294 if (ulpzq .eq. 'l') then
23295 ihorn = min(nolev-3,ncm-6)
23296 else
23297 ihorn = min(nolev-nint(stemlen)-3,ncm-6)
23298 end if
23299 else if (ibit.eq.10 .and. nolev.gt.90) then
23300 c
23301 c Special treatment for fermata on a shifted rest
23302 c
23303 ihorn = ncm+5
23304 else if (ulpzq.eq.'l') then
23305 c
23306 c (iscrd and nolev=maxlev) or (.not.iscrd)
23307 c
23308 ihorn = max(nolev+stemlen+2,ncm+5.)
23309 else if (ibit.eq.29 .or. ibit.eq.30) then
23310 c
23311 c coda or new segno, no height tweak
23312 c
23313 ihorn = ncm+5
23314 else
23315 ihorn = max(nolev+2,ncm+5)
23316 end if
23317 ioff = 0
23318 iclracc = 0
23319 c
23320 c Begin routine to set name. Bits 0-13: (stmgx+Tupf._)
23321 c 14: Down fermata, was F 15: Trill w/o "tr", was U, 16-18: edit. s,f,n
23322 c
23323 if (btest(iornt,2)) then
23324 notexq = sq//'shake'
23325 lnote = 6
23326 else if (btest(iornt,3)) then
23327 notexq = sq//'mordent'
23328 lnote = 8
23329 else if (btest(iornt,1)) then
23330 notexq = sq//'mtr'
23331 lnote = 4
23332 else if (btest(iornt,5)) then
23333 notexq = sq//'xtr'
23334 lnote = 4
23335 else if (btest(iornt,6)) then
23336 notexq = sq//'ptr'
23337 lnote = 4
23338 else if (btest(iornt,13)) then
23339 notexq = sq//'rpn'
23340 lnote = 4
23341 else if (btest(iornt,0)) then
23342 notexq = sq//'lpn'
23343 lnote = 4
23344 else if (btest(iornt,12)) then
23345 notexq = sq//ulpzq//'st'
23346 lnote = 4
23347 else if (btest(iornt,11)) then
23348 notexq = sq//ulpzq//'pz'
23349 lnote = 4
23350 else if (btest(iornt,8)) then
23351 notexq = sq//'upz'
23352 lnote = 4
23353 ioff = -2
23354 else if (btest(iornt,9)) then
23355 notexq = sq//'uppz'
23356 lnote = 5
23357 ioff = -2
23358 else if (btest(iornt,10)) then
23359 if (nodur .lt. 48) then
23360 notexq = sq//'fermataup'
23361 else
23362 notexq = sq//'Fermataup'
23363 end if
23364 lnote = 10
23365 ioff = -2
23366 else if (btest(iornt,14)) then
23367 if (nodur .lt. 48) then
23368 notexq = sq//'fermatadown'
23369 else
23370 notexq = sq//'Fermatadown'
23371 end if
23372 lnote = 12
23373 else if (btest(iornt,21)) then
23374 c
23375 c "?" in editorial ornament. Clear bit 16-18 after use, since ibit=21
23376 c
23377 if (btest(iornq,16)) then
23378 notexq = sq//'qsharp'
23379 lnote = 7
23380 ioff = 2
23381 iornq = ibclr(iornq,16)
23382 iclracc = 16
23383 else if (btest(iornq,17)) then
23384 notexq = sq//'qflat'
23385 lnote = 6
23386 ioff = 1
23387 iornq = ibclr(iornq,17)
23388 iclracc = 17
23389 else if (btest(iornq,18)) then
23390 notexq = sq//'qnat'
23391 lnote = 5
23392 ioff = 2
23393 iornq = ibclr(iornq,18)
23394 iclracc = 18
23395 else
23396 notexq = sq//'qedit'
23397 lnote = 6
23398 ioff = 0
23399 end if
23400 else if (btest(iornt,16)) then
23401 notexq = sq//'esharp'
23402 lnote = 7
23403 ioff = 2
23404 else if (btest(iornt,17)) then
23405 notexq = sq//'eflat'
23406 lnote = 6
23407 ioff = 1
23408 else if (btest(iornt,18)) then
23409 notexq = sq//'enat'
23410 lnote = 5
23411 ioff = 2
23412 else if (btest(iornt,19)) then
23413 notexq = sq//'usf'
23414 lnote = 4
23415 ioff = -2
23416 else if (btest(iornt,20)) then
23417 notexq = sq//'usfz'
23418 lnote = 5
23419 ioff = -2
23420 else if (btest(iornt,29)) then
23421 notexq = sq//'ccoda'
23422 lnote = 6
23423 else if (btest(iornt,30)) then
23424 notexq = sq//'ssegno'
23425 lnote = 7
23426 end if
23427 iudorn = 0
23428 c
23429 c User-defined level shift of ornament from default?
23430 c
23431 if (btest(iornq,25)) then
23432 c
23433 c Find which (if any) element of kudorn has the shift.
23434 c
23435 do 3 iudorn = 1 , nudorn
23436 if (ibit.lt.21 .or. ibit.eq.29 .or. ibit.eq.30) then
23437 ibitt = ibit
23438 c
23439 c Could have oes, but not oe? or oes?
23440 c
23441 else if (iclracc .gt. 0) then
23442 c
23443 c Earlier cleared edit. accid, meaning it was oes?
23444 c
23445 ibitt = iclracc+6
23446 else
23447 ibitt = 21
23448 end if
23449 ibitt=ip+ishft(mod(ivx,16),8)+ishft(nolev,12)+ishft(ibitt,19)
23450 if (ibitt .eq. iand(33554431,kudorn(iudorn))
23451 * .and. ivx.eq.ivxudorn(iudorn)) go to 4
23452 3 continue
23453 c
23454 c Nothing shifted on this note; exit this if block
23455 c
23456 iudorn = 0
23457 go to 5
23458 4 continue
23459 ioffinc = iand(63,ishft(kudorn(iudorn),-25))-32
23460 if (ibit.eq.19 .and. ioffinc .lt. -7) then
23461 c
23462 c Convert usf to lsf. The reason has to do with positioning being impossile
23463 c for some mysterious reason when you drop \usf below the staff
23464 c
23465 notexq = sq//'lsf'
23466 ioffinc = ioffinc+6
23467 end if
23468 ioff = ioff+ioffinc
23469 end if
23470 5 continue
23471 c
23472 c Shift level to avoid slur. Conditions are
23473 c 1. There is a slur
23474 c 2. No user-defined orn height shift (btest(iornq,25))
23475 c 3. upslur (islhgt>0)
23476 c 4. ornament is not segno(4), ._)(11-13), down ferm(14) or "(" (0) Bin=30737
23477 c 5. islhgt+3 >= height already computed.
23478 c
23479 if (.not.btest(iornq,25) .and.
23480 * islhgt.gt.0 .and. iand(iornt,30737).eq.0)
23481 * ioff = ioff+dim(islhgt+3,ihorn )
23482 call notefq(noteq,lnoten,ihorn+ioff,ncm)
23483 if (lnoten.eq.1) call addblank(noteq,lnoten)
23484 if (iand(iornt,32896) .gt. 0) then
23485 c
23486 c T-trill or trill w/o "tr"
23487 c
23488 call dotrill(ivx,ip,iornt,noteq,lnoten,notexq,lnote)
23489 else
23490 notexq = notexq(1:lnote)//noteq(1:lnoten)
23491 lnote = lnote+lnoten
23492 end if
23493 if (iudorn .gt. 0) then
23494 if (btest(kudorn(iudorn),31)) then
23495 c
23496 c Horizontal shift
23497 c
23498 lform = lfmt1(ornhshft(iudorn))
23499 write(noteq(1:lform),'(f'//chax(48+lform)//'.1)')
23500 * ornhshft(iudorn)
23501 notexq = sq//'roffset{'//noteq(1:lform)//'}{'
23502 * //notexq(1:lnote)//'}'
23503 lnote = lnote+lform+12
23504 ornhshft(iudorn) = 0.
23505 kudorn(iudorn) = ibclr(kudorn(iudorn),31)
23506 end if
23507 end if
23508 c
23509 c Zero out the bit for ornament just dealt with.
23510 c
23511 iornq = ibclr(iornq,ibit)
23512 if (lout .eq. 0) then
23513 outq = notexq(1:lnote)
23514 else
23515 outq = outq(1:lout)//notexq(1:lnote)
23516 end if
23517 lout = lout+lnote
23518 c
23519 c Check bits 0-21, go back if any are still set
23520 c If bit 29 or 30 had been set, would have been used first time thru,
23521 c and you wouldn't use both coda and segno on same note
23522 c
23523 if (iand(iornq,4194303) .gt. 0) go to 2
23524 if (usehornb) nornb(ivx) = nornb(ivx)+1
23525 return
23526 end
23527 subroutine putshft(ivx,onoff,soutq,lsout)
23528 parameter (nm=24)
23529 common /comudsp/udsp(50),tudsp(50),nudsp,udoff(nm,20),nudoff(nm)
23530 character*80 soutq,notexq
23531 character*1 sq,chax
23532 logical onoff
23533 sq = chax(92)
23534 c
23535 c Start user-defined offsets X(...): or X(...)S
23536 c
23537 if (onoff) nudoff(ivx) = nudoff(ivx)+1
23538 c
23539 c Xoff is in pts. Round off to nearest .1. Will use at end of shift.
23540 c
23541 xoff = udoff(ivx,nudoff(ivx))
23542 xoff = sign(int(10.*abs(xoff)+.5)/10.,xoff)
23543 if (.not.onoff) xoff = -xoff
23544 if (xoff .lt. -9.95) then
23545 ifmt = 5
23546 else if (xoff.lt.-.95 .or. xoff.gt.9.95) then
23547 ifmt = 4
23548 else
23549 ifmt = 3
23550 end if
23551 write(notexq,'(f'//chax(48+ifmt)//'.1)')xoff
23552 call addstr(sq//'off{'//notexq(1:ifmt)//'pt}',8+ifmt,
23553 * soutq,lsout)
23554 return
23555 end
23556 subroutine puttitle(inhnoh,xnsttop,etatop,sq,etait,etatc,
23557 * etacs1,nv,vshrink,sepsymq)
23558 c
23559 c Called once per page, at top of page! If vshrink, only called for p.1.
23560 c Actual titles only allowed on p.1. (set by headlog).
23561 c 3/18/01: The above comment is probably bogus...can use Tt on later pages.
23562 c
23563 common /comlast/ islast,usevshrink
23564 logical islast,usevshrink
23565 common /comtitl/ instrq,titleq,compoq,headlog,inskip,ncskip,
23566 * inhead
23567 common /cominbot/ inbothd
23568 character*127 notexq
23569 character*120 instrq,titleq,compoq
23570 parameter (nm=24)
23571 character*1 sq,sepsymq(nm),chax
23572 logical headlog,vshrink
23573 notexq = sq//'znotes'
23574 lenline = 7
23575 do 22 iv = 1 , nv-1
23576 notexq = notexq(1:lenline)//sepsymq(iv)
23577 lenline = lenline+1
23578 22 continue
23579 notexq = notexq(1:lenline)//sq//'zcharnote{'
23580 lenline = lenline+11
23581 if (.not.headlog) then
23582 inhead = inhnoh
23583 end if
23584 if (vshrink .and. usevshrink) then
23585 inhead = 16
23586 end if
23587 ndig = int(alog10(inhead+.01))+1
23588 write(notexq(lenline+1:lenline+ndig+10),'(i'//chax(48+ndig)//
23589 * ',a10)')inhead,'}{'//sq//'titles{'
23590 lenline = lenline+ndig+10
23591 c
23592 c Vertical skip at top of page (\Il) = etatop*glueil. Needed whether
23593 c headers are present or not.
23594 c
23595 glueil = xnsttop/etatop
23596 vskil = etatop*glueil
23597 if (vshrink .and. usevshrink) vskil = 2
23598 call writflot(vskil,notexq,lenline)
23599 if (.not.headlog) then
23600 if (islast) write(11,'(a)')notexq(1:lenline)
23601 * //'}{}{0}{}{0}{}{0}}'//sq//'en%'
23602 else
23603 notexq = notexq(1:lenline)//'}{'
23604 lenline = lenline+2
23605 lcq = lenstr(instrq,120)
23606 if (lcq .gt. 0) then
23607 xitil = etait*glueil
23608 if (vshrink .and. usevshrink) xitil = 2
23609 notexq = notexq(1:lenline)//instrq(1:lcq)//'}{'
23610 c
23611 c Null out instrument once used
23612 c
23613 instrq = ' '
23614 lenline = lenline+lcq+2
23615 call writflot(xitil,notexq,lenline)
23616 else
23617 notexq = notexq(1:lenline)//'}{0'
23618 lenline = lenline+3
23619 end if
23620 if (islast) write(11,'(a)')notexq(1:lenline)//'}%'
23621 notexq = '{'
23622 lenline = 1
23623 lcq = lenstr(titleq,120)
23624 if (lcq .gt. 0) then
23625 notexq = notexq(1:lenline)//titleq(1:lcq)
23626 lenline = lenline+lcq
23627 else
23628 call printl(' ')
23629 call printl('WARNING')
23630 call printl(
23631 * ' In a title block, you have specified instrument and/or')
23632 call printl(
23633 * ' composer but no title for the piece.')
23634 end if
23635 notexq = notexq(1:lenline)//'}{'
23636 lenline = lenline+2
23637 xtcil = etatc*glueil
23638 lcq = lenstr(compoq,120)
23639 if (lcq .eq. 0) xtcil = 2*xtcil
23640 if (vshrink .and. usevshrink) xtcil = 2
23641 call writflot(xtcil,notexq,lenline)
23642 notexq = notexq(1:lenline)//'}{'
23643 lenline = lenline+2
23644 if (lcq .gt. 0) then
23645 notexq = notexq(1:lenline)//compoq(1:lcq)//'}{'
23646 lenline = lenline+2+lcq
23647 c
23648 c Null out compoq so it does not get written later
23649 c
23650 compoq = ' '
23651 xcsil = etacs1*glueil
23652 if (vshrink .and. usevshrink) xcsil = 2
23653 call writflot(xcsil,notexq,lenline)
23654 else
23655 notexq = notexq(1:lenline)//'}{0'
23656 lenline = lenline+3
23657 end if
23658 if (islast) write(11,'(a)')notexq(1:lenline)//'}}'//sq//'en%'
23659 headlog = .false.
23660 end if
23661 return
23662 end
23663 subroutine putxtn(ntupv,iflop,multb,iud,wheadpt,poenom,
23664 * nolev1,islope,slfac,xnlmid,islur,lnote,notexq,ncmid,nlnum,
23665 * eloff,iup,irest,mult,usexnumt)
23666 c
23667 c Places digit for xtuplet.
23668 c
23669 character*1 chax
23670 character*8 noteq
23671 character*79 notexq
23672 logical btest,usexnumt
23673 if (iflop.ne.0 .and. multb.gt.0) then
23674 c
23675 c Number goes on beam side, move R/L by .5 wheadpt for upper/lower
23676 c
23677 eloff = eloff-0.5*iud*wheadpt/poenom
23678 c
23679 c Number goes on beam side, must use beam parameters to set pos'n
23680 c
23681 nlnum = nolev1+islope/slfac*eloff+iup*(multb+8)
23682 if (multb .ge. 2) nlnum = nlnum+iup
23683 else
23684 nlnum = nint(xnlmid-1+3*iud+iflop*11)
23685 end if
23686 if (.not.btest(islur,31)) then
23687 c
23688 c Only print number when wanted. First check vert, horiz offset
23689 c
23690 if (btest(irest,1)) nlnum = nlnum+igetbits(mult,8,16)-64
23691 if (btest(irest,7)) eloff = eloff+
23692 * (.1*iand(31,ishft(irest,-9))-1.6)*wheadpt/poenom
23693 if (.not.usexnumt) then
23694 notexq = chax(92)//'xnum{'
23695 lnote = 10
23696 istrtn = 7
23697 else
23698 notexq = chax(92)//'xnumt{'
23699 lnote = 11
23700 istrtn = 8
23701 end if
23702 if (eloff .lt. 0.995) then
23703 write(notexq(istrtn:istrtn+3),'(i1,f3.2)')0,eloff
23704 else if (eloff .lt. 9.995) then
23705 write(notexq(istrtn:istrtn+3),'(f4.2)')eloff
23706 else
23707 write(notexq(istrtn:istrtn+4),'(f5.2)')eloff
23708 lnote = lnote+1
23709 end if
23710 call notefq(noteq,lnoten,nlnum,ncmid)
23711 notexq = notexq(1:lnote)//'}'//noteq(1:lnoten)
23712 lnote = lnote+1+lnoten
23713 if (ntupv .lt. 10) then
23714 write(notexq(lnote+1:lnote+1),'(i1)')ntupv
23715 lnote = lnote+1
23716 else
23717 notexq = notexq(1:lnote)//'{'
23718 write(notexq(lnote+2:lnote+3),'(i2)')ntupv
23719 notexq = notexq(1:lnote+3)//'}'
23720 lnote = lnote+4
23721 end if
23722 end if
23723 return
23724 end
23725 subroutine read10(string,lastchar)
23726 parameter (maxblks=9600)
23727 character*131072 bufq
23728 integer*2 lbuf(maxblks)
23729 common /inbuff/ ipbuf,ilbuf,nlbuf,lbuf,bufq
23730 character*(*) string
23731 character*128 lnholdq
23732 logical lastchar
23733 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
23734 logical mrecord,mplay,endmac
23735 common /c1ommac/ ip1mac(20),il1mac(20),ip2mac(20),il2mac(20),
23736 * ic1mac(20),ilmac,iplmac
23737 if (.not.mplay) then
23738 if (ilbuf .gt. nlbuf) go to 999
23739 call getbuf(string)
23740 return
23741 999 lastchar = .true.
23742 return
23743 else
23744 c
23745 c Play a macro. Set pointer to first character needed in buffer
23746 c
23747 if (ilmac .eq. il1mac(macnum)) then
23748 c
23749 c Getting first line of macro
23750 c
23751 ip1 = ip1mac(macnum)
23752 iplmac = ip1-ic1mac(macnum)
23753 else if (ilmac .le. il2mac(macnum)) then
23754 c
23755 c Beyond first line of macro. Advance line-start pointer.
23756 c
23757 iplmac = iplmac+lbuf(ilmac-1)
23758 ip1 = iplmac+1
23759 else
23760 c
23761 c Beyond last line of macro. Terminate it!
23762 c
23763 mplay = .false.
23764 endmac = .true.
23765 return
23766 end if
23767 if (ilmac .eq. il2mac(macnum)) then
23768 c
23769 c Getting last line of macro.
23770 c
23771 ip2 = ip2mac(macnum)
23772 else
23773 c
23774 c Getting line before last line of macro.
23775 c
23776 ip2 = iplmac+lbuf(ilmac)
23777 end if
23778 if (ip2 .ge. ip1) then
23779 string = bufq(ip1:ip2)
23780 else
23781 c
23782 c Kluge for when macro start is on a line by itself
23783 c
23784 string = ' '
23785 end if
23786 ilmac = ilmac+1
23787 return
23788 end if
23789 end
23790 function readin(lineq,iccount,nline)
23791 c
23792 c Reads a piece of setup data from file lineq, gets a new lineq from
23793 c file 10 (jobname.pmx) and increments nline if needed, passes over
23794 c comment lines
23795 c
23796 character*128 lineq
23797 character*1 durq,chax
23798 4 if (iccount .eq. 128) then
23799 1 call getbuf(lineq)
23800 nline = nline+1
23801 if (lineq(1:1) .eq. '%') go to 1
23802 iccount = 0
23803 end if
23804 iccount = iccount+1
23805 c
23806 c Find next non-blank or end of line
23807 c
23808 do 2 iccount = iccount , 127
23809 if (lineq(iccount:iccount) .ne. ' ') go to 3
23810 2 continue
23811 c
23812 c If here, need to get a new line
23813 c
23814 iccount = 128
23815 go to 4
23816 3 continue
23817 c
23818 c iccount now points to start of number to read
23819 c
23820 i1 = iccount
23821 5 call getchar(lineq,iccount,durq)
23822 c
23823 c Remember that getchar increments iccount, then reads a character.
23824 c
23825 if (index('0123456789.-',durq) .gt. 0) go to 5
23826 i2 = iccount-1
23827 if (i2 .lt. i1) then
23828 print*,'Found "'//durq//'" instead of number'
23829 call stop1()
23830 end if
23831 icf = i2-i1+49
23832 read(lineq(i1:i2),'(f'//chax(icf)//'.0)')readin
23833 return
23834 end
23835 subroutine readmeter(lineq,iccount,mtrnum,mtrden)
23836 character*128 lineq
23837 character*1 durq,chax
23838 if (index(lineq(iccount+1:iccount+3),chax(47)) .eq. 0) then
23839 c
23840 c No slashes, so use old method
23841 c
23842 call getchar(lineq,iccount,durq)
23843 if (durq .eq. '-') then
23844 c
23845 c Negative numerator is used only to printed; signals vertical slash
23846 c
23847 call getchar(lineq,iccount,durq)
23848 mtrnum = -(ichar(durq)-48)
23849 else if (durq .eq. 'o') then
23850 c
23851 c Numerator is EXACTLY 1
23852 c
23853 mtrnum = 1
23854 else
23855 mtrnum = ichar(durq)-48
23856 if (mtrnum .eq. 1) then
23857 c
23858 c Numerator is >9
23859 c
23860 call getchar(lineq,iccount,durq)
23861 mtrnum = 10+ichar(durq)-48
23862 end if
23863 end if
23864 call getchar(lineq,iccount,durq)
23865 if (durq .eq. 'o') then
23866 mtrden = 1
23867 else
23868 mtrden = ichar(durq)-48
23869 if (mtrden .eq. 1) then
23870 call getchar(lineq,iccount,durq)
23871 mtrden = 10+ichar(durq)-48
23872 end if
23873 end if
23874 else
23875 c
23876 c Expect the form m[n1]/[n2]/[n3]/[n4] . Advance iccount by one from '/' or 'm'
23877 c
23878 iccount = iccount+1
23879 ns = index(lineq(iccount:128),chax(47))
23880 read(lineq(iccount:iccount+ns-2),'(i'//chax(47+ns)//')')mtrnum
23881 c
23882 c Reset iccount to start of second integer
23883 c
23884 iccount = iccount+ns
23885 c
23886 c There must be either a slash or a blank at pos'n 2 or 3
23887 c
23888 ns = index(lineq(iccount:iccount+2),chax(47))
23889 if (ns .eq. 0) ns = index(lineq(iccount:iccount+2),' ')
23890 read(lineq(iccount:iccount+ns-2),'(i'//chax(47+ns)//')')mtrden
23891 c
23892 c Set iccount to last character used
23893 c
23894 iccount = iccount+ns-1
23895 end if
23896 return
23897 end
23898 subroutine readnum(lineq,iccount,durq,fnum)
23899 c
23900 c This reads a number starting at position iccount. Remember that on exit,
23901 c getchar leaves iccount at the last character retrieved. So must only
23902 c call this routine *after* detecting a number or decimal.
23903 c On exit, durq is next character after end of number.
23904 c
23905 character*128 lineq
23906 character*1 durq,chax
23907 i1 = iccount
23908 1 call getchar(lineq,iccount,durq)
23909 if (index('0123456789.',durq) .gt. 0) go to 1
23910 i2 = iccount-1
23911 if (i2 .lt. i1) then
23912 print*,'Found "'//durq//'" instead of number'
23913 call stop1()
23914 else if (lineq(i1:i1).eq.'.'.and.lineq(i2:i2).eq.'.') then
23915 i2 = i2-1
23916 iccount = iccount-1
23917 end if
23918 icf = i2-i1+49
23919 read(lineq(i1:i2),'(f'//chax(icf)//'.0)')fnum
23920 return
23921 end
23922 subroutine setbits(isdata,iwidbit,ishift,ivalue)
23923 c
23924 c Sets iwidbits of isdata, shifted by ishift, to ivalue
23925 c
23926 ibase = 2**iwidbit-1
23927 isdata = iand(not(ishft(ibase,ishift)),isdata)
23928 isdata = ior(isdata,ishft(ivalue,ishift))
23929 return
23930 end
23931 subroutine setbm2(xelsk,nnb,sumx,sumy,ipb,islope,nolev1)
23932 c
23933 c The MEAN SQUARE slope algorithm
23934 c
23935 parameter (nm=24)
23936 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
23937 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
23938 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
23939 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
23940 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
23941 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
23942 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
23943 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
23944 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
23945 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
23946 character*1 ulq,sepsymq,sq
23947 logical beamon,firstgulp,figbass,figchk,
23948 * isfig
23949 real*4 xelsk(24)
23950 integer ipb(24)
23951 ibc = ibmcnt(ivx)
23952 sumxx = 0.
23953 sumxy = 0.
23954 do 2 inb = 1 , nnb
23955 sumxx = sumxx+xelsk(inb)**2
23956 sumxy = sumxy+xelsk(inb)*nolev(ivx,ipb(inb))
23957 2 continue
23958 delta = nnb*sumxx-sumx*sumx
23959 em = (nnb*sumxy-sumx*sumy)/delta
23960 islope = nint(0.5*em*slfac)
23961 if (iabs(islope) .gt. 9) islope = isign(9,islope)
23962 beta = (sumy-islope/slfac*sumx)/nnb
23963 nolev1 = nint(beta)
23964 c
23965 c Check if any stems are too short
23966 c
23967 smin = 100.
23968 iul = -1
23969 if (ulq(ivx,ibc) .eq. 'u') iul = 1
23970 do 4 inb = 1 , nnb
23971 ybeam = nolev1+iul*stemlen+islope*xelsk(inb)/slfac
23972 ynote = nolev(ivx,ipb(inb))
23973 smin = min(smin,iul*(ybeam-ynote))
23974 4 continue
23975 if (smin .lt. stemmin) then
23976 deficit = stemmin-smin
23977 nolev1 = nint(nolev1+iul*deficit)
23978 end if
23979 return
23980 end
23981 subroutine setmac(lineq,iccount,ibarcnt,ibaroff,nbars,charq,durq,
23982 * ivx,nline)
23983 character*1 charq,durq
23984 common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
23985 logical mrecord,mplay,endmac,btest
23986 character*128 lnholdq,lineq
23987 common /c1ommac/ ip1mac(20),il1mac(20),ip2mac(20),il2mac(20),
23988 * ic1mac(20),ilmac,iplmac
23989 c
23990 c Macro action
23991 c
23992 call g1etchar(lineq,iccount,charq)
23993 if (charq.eq.'S' .and. ivx.ne.1) then
23994 print*
23995 print*
23996 print*,'*********WARNING*********'
23997 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
23998 * '"MS..." only put in parts by scor2prt if in voice #1!')
23999 end if
24000 if (index('RSP ',charq) .eq. 0) then
24001 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
24002 * 'Illegal character after "M" (macro)!')
24003 call stop1()
24004 else if (charq .ne. ' ') then
24005 c
24006 c Record or playback a macro. Get the number of the macro.
24007 c
24008 call g1etchar(lineq,iccount,durq)
24009 if (index('123456789',durq) .eq. 0) then
24010 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
24011 * 'Must input number after "MR","MP", or "MS"!')
24012 call stop1()
24013 end if
24014 call readnum(lineq,iccount,durq,fnum)
24015 macnum = nint(fnum)
24016 if (durq .ne. ' ') then
24017 call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
24018 * 'Macro number must be followed by a blank!')
24019 call stop1()
24020 end if
24021 if (index('RS',charq ).gt. 0) then
24022 c
24023 c Record or save a macro
24024 c
24025 if (macnum.lt.1 .or. macnum.gt.20) then
24026 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
24027 * 'Macro number not in range 1-20!')
24028 call stop1()
24029 end if
24030 macuse = ibset(macuse,macnum)
24031 if (charq .eq. 'R') then
24032 call m1rec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
24033 else if (charq .eq. 'S') then
24034 c
24035 c Save (Record but don't activate)
24036 c
24037 1 call m1rec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
24038 if (mrecord) then
24039 call getbuf(lineq)
24040 nline = nline+1
24041 iccount = 0
24042 go to 1
24043 end if
24044 iccount = iccount+ndxm+1
24045 end if
24046 else
24047 c
24048 c Playback the macro
24049 c
24050 if (.not.btest(macuse,macnum)) then
24051 call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
24052 * 'Cannot play a macro that has not been recorded!')
24053 call stop1()
24054 end if
24055 icchold = iccount
24056 lnholdq = lineq
24057 iccount = 128
24058 mplay = .true.
24059 ilmac = il1mac(macnum)
24060 end if
24061 end if
24062 return
24063 end
24064 subroutine setmeter(mtrnuml,mtrdenl,ibmtyp,ibmrep)
24065 c
24066 c Sets last 2 args depending on 1st 2, (logical) num, denom.
24067 c ibmtyp = 1, 2, or 3 defines set of masks for beam groupings.
24068 c 1: all duple meters
24069 c 2: triple w/ denom=4, subdivide in groups of 2 8ths
24070 c 3: triple w/ denom=8, subdivide in groups of 3 8ths
24071 c Note that lenbar is set at top or when 'm' symbol is read in getnote
24072 c
24073 if (mtrdenl .eq. 4) then
24074 if (mod(mtrnuml,3) .eq. 0) then
24075 ibmtyp = 2
24076 ibmrep = mtrnuml/3
24077 else
24078 ibmtyp = 1
24079 ibmrep = mtrnuml/2
24080 end if
24081 else if (mtrdenl .eq. 2) then
24082 ibmtyp = 1
24083 if (mtrnuml .eq. 3) then
24084 ibmrep = 3
24085 else
24086 ibmrep = 2*mtrnuml/mtrdenl
24087 end if
24088 else if (mtrdenl.eq.8 .and. (mtrnuml.eq.8.or.mtrnuml.eq.4)) then
24089 c
24090 c Added 170726
24091 c
24092 ibmtyp = 1
24093 ibmrep = mtrnuml/4
24094 else
24095 c
24096 c Assumes mtrdenl=8 and 3/8, 6/8, 9/8, or 12/8
24097 c
24098 ibmtyp = 3
24099 ibmrep = mtrnuml/3
24100 end if
24101 c
24102 c Reset so we don't keep writing new meters
24103 c
24104 mtrnuml = 0
24105 c
24106 c Prevent ibmrep=0. Needed for odd bars, e.g. 1/8, where beams don't matter
24107 c
24108 ibmrep = max(ibmrep,1)
24109 return
24110 end
24111 subroutine SetupB(xelsk,nnb,sumx,sumy,ipb,smed,ixrest)
24112 c
24113 c The outer combo algorithm
24114 c
24115 parameter (nm=24)
24116 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
24117 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
24118 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
24119 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
24120 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
24121 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
24122 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
24123 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
24124 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
24125 common /comipl2/ ipl2(nm,200)
24126 character*1 ulq,sepsymq,sq
24127 logical beamon,firstgulp,figbass,figchk,btest,
24128 * isfig,vxtup,l1ng,l2ng,bar1syst,drawbm
24129 common /comeskz2/ eskz2(nm,200)
24130 real*4 slope(800),xelsk(24)
24131 integer ipb(24)
24132 common /comask/ bar1syst,fixednew,scaldold,
24133 * wheadpt,fbar,poenom
24134 common /comas1/ naskb,task(40),wask(40),elask(40)
24135 common /comxtup/ ixtup,vxtup(nm),ntupv(nm,9),nolev1(nm),
24136 * mtupv(nm,9),nxtinbm(nm),
24137 * islope(nm),xels11(24),eloff(nm,9),
24138 * nssb(nm),issb(nm),lev1ssb(nm,20)
24139 common /comdraw/ drawbm(nm)
24140 common /combmh/ bmhgt,clefend
24141 common /commvl/ nvmx(nm),ivmx(nm,2),ivx
24142 common /comtol/ tol
24143 ibc = ibmcnt(ivx)
24144 nxtinbm(ivx) = 0
24145 n1 = ipl2(ivx,ibm1(ivx,ibc))
24146 c
24147 c Initialize counters used in this subroutine, and then later during actual
24148 c beam drawing, to count later segments of single-slope beam groups
24149 c
24150 nssb(ivx) = 0
24151 issb(ivx) = 0
24152 c
24153 c Set flag for xtup beam starting with rest (no others can start with rest)
24154 c
24155 if (btest(irest(ivx,ipo(n1)),0)) ixrest = 1
24156 c
24157 c Figure how many elemskips to each note. Use the list, counting only non-rests.
24158 c
24159 eskz0 = eskz(ivx,ibm1(ivx,ibc))
24160 nnb = 0
24161 sumx = 0.
24162 sumy = 0.
24163 ipxt1 = 0
24164 iplast = ibm2(ivx,ibc)
24165 do 2 ip = ibm1(ivx,ibc) , iplast
24166 if (.not.btest(irest(ivx,ip),0)) then
24167 nnb = nnb+1
24168 ipb(nnb) = ip
24169 xelsk(nnb) = eskz(ivx,ip)-eskz0
24170 sumx = sumx+xelsk(nnb)
24171 sumy = sumy+nolev(ivx,ipb(nnb))
24172 if (btest(nacc(ivx,ip),21)) then
24173 c
24174 c This is the starting note of later segment of single-slope beam group
24175 c Temporarily store ip here.
24176 c
24177 nssb(ivx) = nssb(ivx)+1
24178 lev1ssb(ivx,nssb(ivx)) = nnb
24179 end if
24180 end if
24181 c
24182 c New xtup stuff here. Final object is to get distance from start of xtup
24183 c to number. xtinbm counts xtups in this beam only. mtupv is the printed
24184 c number. ntupv is number of notes in xtup, and is only used to get
24185 c eloff, the distance from start of xtup to the number.
24186 c
24187 if (btest(nacc(ivx,ip),18)) ndoub = ndoub+1
24188 if (ipxt1.eq.0 .and. nodur(ivx,ip).eq.0) then
24189 c
24190 c Xtup is starting here
24191 c
24192 nxtinbm(ivx) = nxtinbm(ivx)+1
24193 ipxt1 = ip
24194 if (btest(nacc(ivx,ip),18)) then
24195 ndoub = 1
24196 else
24197 ndoub = 0
24198 end if
24199 else if (ipxt1.gt.0 .and. nodur(ivx,ip).gt.0) then
24200 c
24201 c Xtup ends here. Set total number of notes in xtup.
24202 c
24203 ntupv(ivx,nxtinbm(ivx)) = ip+1-ipxt1
24204 c
24205 c Set printed number for embedded xtup.
24206 c
24207 mtupv(ivx,nxtinbm(ivx)) = ntupv(ivx,nxtinbm(ivx))+ndoub
24208 c
24209 c Middle note of xtup if ntupv odd, note to left of gap if even.
24210 c
24211 ipxtmid = (ip+ipxt1)/2
24212 eloff(ivx,nxtinbm(ivx)) = eskz2(ivx,ipxtmid)-eskz2(ivx,ipxt1)
24213 if (mod(ntupv(ivx,nxtinbm(ivx)),2) .eq. 0)
24214 * eloff(ivx,nxtinbm(ivx)) = eloff(ivx,nxtinbm(ivx))+
24215 * .5*(eskz2(ivx,ipxtmid+1)-eskz2(ivx,ipxtmid))
24216 ipxt1 = 0
24217 end if
24218 2 continue
24219 c
24220 c Reset nxtinbm for use as counter as #'s are posted by putxtn(..)
24221 c
24222 nxtinbm(ivx) = 0
24223 smed = 0.
24224 c if (.not.btest(islur(ivx,ipb(1)),2)) then
24225 if (.not.btest(islur(ivx,ipb(1)),2) .and. nnb.gt.1) then
24226 c
24227 c No forced 0 slope
24228 c
24229 c if (nnb .eq. 1) go to 6
24230 nsc = 0
24231 do 5 inb = 1 , nnb-1
24232 do 5999 jnb = inb+1 , nnb
24233 nsc = nsc+1
24234 slope(nsc) = (nolev(ivx,ipb(jnb))-nolev(ivx,ipb(inb)))/
24235 * (xelsk(jnb)-xelsk(inb))
24236 if (abs(slope(nsc)) .lt. 1.e-4) then
24237 nsc = nsc+1
24238 slope(nsc) = slope(nsc-1)
24239 nsc = nsc+1
24240 slope(nsc) = slope(nsc-1)
24241 end if
24242 5999 continue
24243 5 continue
24244 if (nsc .eq. 1) then
24245 smed = slope(1)
24246 go to 6
24247 end if
24248 nscmid = nsc/2+1
24249 do 7 i = 1 , nscmid
24250 do 7999 j = i+1 , nsc
24251 if (slope(j) .lt. slope(i)) then
24252 t = slope(j)
24253 slope(j) = slope(i)
24254 slope(i) = t
24255 end if
24256 7999 continue
24257 7 continue
24258 smed = slope(nscmid)
24259 if (nsc .eq. 2*(nsc/2)) then
24260 c
24261 c Even number of slopes in the list, so median is ambiguous
24262 c
24263 if (abs(slope(nscmid-1)) .lt. abs(slope(nscmid))-tol) then
24264 c
24265 c Lower-numbered one is truly less in absolute value, so use it
24266 c
24267 smed=slope(nscmid-1)
24268 else if (abs(slope(nscmid-1)+slope(nscmid)) .lt. tol) then
24269 c
24270 c Two slopes are effectively equal. Take the one with sign of the average
24271 c
24272 sum = 0.
24273 do 1 i = 1 , nsc
24274 sum = sum+slope(i)
24275 1 continue
24276 smed = sign(smed,sum)
24277 end if
24278 end if
24279 6 continue
24280 islope(ivx) = nint(0.5*smed*slfac)
24281 if (iabs(islope(ivx)) .gt. 9)
24282 * islope(ivx) = isign(9,islope(ivx))
24283 else
24284 c
24285 c Forced horizontal beam
24286 c
24287 islope(ivx) = 0
24288 end if
24289 beta = (sumy-islope(ivx)/slfac*sumx)/nnb
24290 c
24291 c If ixrest>0, this is a virtual nolev1 at location of rest. Will first use
24292 c as is for placing xtup number and/or bracket, then reset it for start of
24293 c actual beam
24294 c
24295 nolev1(ivx) = nint(beta)
24296 c
24297 c Check if any stems are too short
24298 c
24299 smin = 100.
24300 iul = -1
24301 if (ulq(ivx,ibc) .eq. 'u') iul = 1
24302 ssq = 0.
24303 syb = 0.
24304 yb1 = nolev1(ivx)
24305 * +iul*(stemlen+bmhgt*(iand(15,mult(ivx,ipb(1)))-8-1))
24306 do 4 inb = 1 , nnb
24307 ybeam = yb1+islope(ivx)*xelsk(inb)/slfac
24308 * -iul*bmhgt*(iand(15,mult(ivx,ipb(inb)))-8-1)
24309 syb = syb+ybeam
24310 ynote = nolev(ivx,ipb(inb))
24311 off = ybeam-ynote
24312 if (inb .eq. 1) then
24313 off1 = off
24314 else if (inb .eq. nnb) then
24315 off2 = off
24316 end if
24317 ssq = ssq+off*off
24318 smin = min(smin,iul*off)
24319 4 continue
24320 dnolev = 0.
24321 if (smin .lt. stemmin) then
24322 deficit = stemmin-smin
24323 nolevo = nolev1(ivx)
24324 nolev1(ivx) = nint(nolev1(ivx)+iul*deficit)
24325 dnolev = nolev1(ivx)-nolevo
24326 off1 = off1+dnolev
24327 off2 = off2+dnolev
24328 end if
24329 ssq = ssq+2*dnolev*(syb-sumy)+dnolev**2
24330 if (.not.vxtup(ivx) .and. sqrt(ssq/nnb) .gt. stemmax .and.
24331 * (abs(off1).lt.stemmax .or. abs(off2).lt.stemmax)
24332 c * .and. .not.btest(islur(ivx,ipb(1)),2)) then
24333 * .and. .not.btest(islur(ivx,ipb(1)),2)
24334 * .and. nnb.ne.1) then
24335 c
24336 c The first check is to save trouble of putting xtup's in setbm2.
24337 c The penultimate check is that first and last stems aren't both excessive.
24338 c The last check is that a 0 slope has not been forced
24339 c
24340 call setbm2(xelsk,nnb,sumx,sumy,ipb,islope(ivx),nolev1(ivx))
24341 end if
24342 c
24343 c Check if beam starts or ends too high or low.
24344 c
24345 xboff = bmhgt*(iand(15,mult(ivx,ipb(1)))-8-1)
24346 l1ng = iul*(nolev1(ivx)-ncmid(iv,ipb(1)))+xboff+7 .lt. 0.
24347 xnolev2 = nolev1(ivx)+islope(ivx)/slfac*xelsk(nnb)
24348 l2ng = iul*(xnolev2-ncmid(iv,ipb(nnb)))+xboff+7 .lt. 0
24349 if (l1ng .or. l2ng) then
24350 c
24351 c Need to correct start or stop, also slope
24352 c
24353 if (l1ng) then
24354 nolev1(ivx) = nint(ncmid(iv,ipb(1))-(7.+xboff)*iul)
24355 end if
24356 if (l2ng) then
24357 xnolev2 = nint(ncmid(iv,ipb(nnb))-(7.+xboff)*iul)
24358 end if
24359 c
24360 c Since one or the other end has changed, need to change slope
24361 c
24362 if (.not.btest(islur(ivx,ipb(1)),2) .and. nnb.ne.1)
24363 * islope(ivx) = nint(slfac*(xnolev2-nolev1(ivx))/xelsk(nnb))
24364 end if
24365 if (nssb(ivx) .gt. 0) then
24366 c
24367 c This is a single-slope beam group. Store start heights for later segs.
24368 c
24369 do 3 issbs = 1 , nssb(ivx)
24370 lev1ssb(ivx,issbs) = nolev1(ivx)+islope(ivx)/slfac*
24371 * xelsk(lev1ssb(ivx,issbs))
24372 3 continue
24373 end if
24374 return
24375 end
24376 subroutine sortpoe(nsyst,poe,ipoe)
24377 parameter (nks=125)
24378 real*4 poe(nks)
24379 integer*4 ipoe(nks)
24380 c
24381 c Initialize ipoe:
24382 c
24383 do 3 iord = 1 , nsyst
24384 ipoe(iord) = iord
24385 3 continue
24386 c
24387 c Construct ipoe vector with pairwise interchanges. When done, ipoe(1) will
24388 c be index of smallest poe, and ipoe(nsyst) will be index of biggest poe.
24389 c
24390 do 4 io1 = 1 , nsyst-1
24391 do 5 io2 = io1+1 , nsyst
24392 if (poe(ipoe(io1)) .gt. poe(ipoe(io2))) then
24393 c
24394 c Interchange the indices
24395 c
24396 itemp = ipoe(io1)
24397 ipoe(io1) = ipoe(io2)
24398 ipoe(io2) = itemp
24399 end if
24400 5 continue
24401 4 continue
24402 return
24403 end
24404 subroutine spsslur(lineq,iccount,iv,kv,ip,isdat1,isdat2,isdat3,
24405 * isdat4,nsdat,notcrd,nolev,starter)
24406 parameter (nm=24)
24407 c
24408 c Reads in slur data. Record all h/v-shifts for non-chords, user-specified
24409 c ones for chords.
24410 c 5/26/02 This subr is called ONLY for postscript slurs.
24411 c
24412 c See subroutine doslur for bit values in isdat1,2,3
24413 c
24414 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
24415 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
24416 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
24417 integer*4 isdat1(202),isdat2(202),isdat3(202),isdat4(202)
24418 logical notcrd,btest
24419 character*128 lineq
24420 character*1 durq,dumq,starter
24421 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
24422 * ,WrotePsslurDefaults,SlurCurve
24423 logical upslur,fontslur,WrotePsslurDefaults
24424 c
24425 c Counter for signed integers. 1st is height, 2nd is horiz, 3rd is curve
24426 c
24427 numint = 0
24428 ivoff = 0
24429 ihoff = 0
24430 nsdat = nsdat+1
24431 if (starter.eq.'{' .or. starter.eq.'}')
24432 * isdat2(nsdat)=ibset(isdat2(nsdat),3)
24433 call setbits(isdat1(nsdat),5,13,iv)
24434 call setbits(isdat1(nsdat),1,12,kv-1)
24435 call setbits(isdat1(nsdat),8,3,ip)
24436 isdat3(nsdat) = 0
24437 isdat4(nsdat) = 0
24438 ilb12 = 0 ! flag for tweaks of 1st or 2nd (0|1) seg of linebreak slur
24439 c
24440 c Get ID code
24441 c
24442 call getchar(lineq,iccount,durq)
24443 if (index('uldtb+-hfnHpsv ',durq) .gt. 0) then
24444 c
24445 c Null id. Note for ps slurs, 'H' cannot be an ID
24446 c
24447 iccount = iccount-1
24448 if (lineq(iccount:iccount) .eq. 't') then
24449 idcode = 1
24450 else
24451 idcode = 32
24452 end if
24453 else
24454 c
24455 c Set explicit idcode
24456 c
24457 idcode = ichar(durq)
24458 if (lineq(iccount-1:iccount-1) .eq. 't') then
24459 c
24460 c Make t[ID] look like s[ID]t
24461 c
24462 isdat2(nsdat) = ibset(isdat2(nsdat),3)
24463 end if
24464 if (lineq(iccount+1:iccount+1).eq.'x') then
24465 c
24466 c Flag for 2-voice, indexed slurs
24467 c
24468 iccount = iccount+1
24469 call setbits(isdat1(nsdat),1,1,1)
24470 end if
24471 end if
24472 call setbits(isdat1(nsdat),7,19,idcode)
24473 c
24474 c Set start/stop: look thru list from end for same idcode,iv,kv
24475 c
24476 do 2 isdat = nsdat-1 , 1 , -1
24477 if (idcode .eq. igetbits(isdat1(isdat),7,19) .and.
24478 * iv .eq. igetbits(isdat1(isdat),5,13) .and.
24479 * (kv-1 .eq. igetbits(isdat1(isdat),1,12)
24480 * .or. btest(isdat1(isdat),1))) then
24481 c
24482 c Matched idcode & ivx. On/off?. If on, new is turnoff, leave bit 11 at 0.
24483 c
24484 if (btest(isdat1(isdat),11)) go to 3
24485 c
24486 c Found slur is a turnoff, so new one is a turnon. Jump down to set bit
24487 c
24488 go to 4
24489 end if
24490 2 continue
24491 c
24492 c If here, this is turnon.
24493 c
24494 4 continue
24495 isdat1(nsdat) = ibset(isdat1(nsdat),11)
24496 3 continue
24497 c
24498 c Now done with initial turnon- or turnoff-specifics.
24499 c
24500 if (nint(SlurCurve).ne.0 .and. btest(isdat1(nsdat),11)) then
24501 c
24502 c There's a default curvature tweak
24503 c
24504 icurv1 = nint(SlurCurve)+3
24505 if (icurv1 .eq. 2) icurv1 = 1
24506 isdat3(nsdat) = ibset(isdat3(nsdat),0)
24507 call setbits(isdat3(nsdat),6,2,32+icurv1)
24508 end if
24509 c
24510 c Loop for rest of input
24511 c
24512 1 call getchar(lineq,iccount,durq)
24513 if (index('uld',durq) .gt. 0) then
24514 c
24515 c Force direction
24516 c
24517 isdat1(nsdat) = ibset(isdat1(nsdat),26)
24518 if (durq .eq. 'u') isdat1(nsdat) = ibset(isdat1(nsdat),27)
24519 go to 1
24520 else if (index('+-',durq) .gt. 0) then
24521 numint = numint+1
24522 if (numint .eq. 1) then
24523 c
24524 c Vertical offset
24525 c
24526 iccount = iccount+1
24527 call readnum(lineq,iccount,dumq,fnum)
24528 iccount = iccount-1
24529 ivoff = nint(fnum)
24530 if (durq .eq. '-') ivoff = -ivoff
24531 else if (numint .eq. 2) then
24532 c
24533 c Horizontal offset
24534 c
24535 iccount = iccount+1
24536 call readnum(lineq,iccount,dumq,fnum)
24537 iccount = iccount-1
24538 c
24539 c fnum is abs(hshift), must be 0 to 6.3
24540 c
24541 ihoff = fnum*10 + .5
24542 if (durq .eq. '-') ihoff = -ihoff
24543 c
24544 c Later will set bits to 1...127 to represent -6.3,...+6.3
24545 c
24546 else
24547 c
24548 c Must be the 3rd signed integer, so it's a curve specification
24549 c
24550 isdat3(nsdat) = ibset(isdat3(nsdat),0)
24551 iccount = iccount+1
24552 call readnum(lineq,iccount,dumq,fnum)
24553 icurv1 = nint(fnum)
24554 if (durq .eq. '-') icurv1 = -icurv1
24555 call setbits(isdat3(nsdat),6,2,32+icurv1)
24556 if (dumq .ne. ':') then
24557 c
24558 c Back up the pointer and loop for more input
24559 c
24560 iccount = iccount-1
24561 else
24562 c
24563 c Expect two single digits as parameters for curve
24564 c
24565 isdat3(nsdat) = ibset(isdat3(nsdat),1)
24566 call setbits(isdat3(nsdat),3,8,
24567 * ichar(lineq(iccount+1:iccount+1))-48)
24568 call setbits(isdat3(nsdat),3,11,
24569 * ichar(lineq(iccount+2:iccount+2))-48)
24570 iccount = iccount+2
24571 end if
24572 end if
24573 go to 1
24574 else if (durq .eq. 't') then
24575 isdat2(nsdat) = ibset(isdat2(nsdat),3)
24576 go to 1
24577 else if (durq .eq. 'b') then
24578 isdat2(nsdat) = ibset(isdat2(nsdat),4)
24579 go to 1
24580 else if (durq .eq. 's') then
24581 c
24582 c Endpoint tweaks for linebreak slurs.
24583 c
24584 call getchar(lineq,iccount,durq) ! Must be +|-
24585 c
24586 c Next is vertical offset
24587 c
24588 iccount = iccount+1
24589 call readnum(lineq,iccount,dumq,fnum)
24590 if (durq .eq. '-') fnum=-fnum
24591 call setbits(isdat4(nsdat),6,ilb12*16,nint(fnum)+32)
24592 if (index('+-',dumq) .gt. 0) then
24593 c
24594 c Also a horizontal offset
24595 c
24596 iccount = iccount+1
24597 call readnum(lineq,iccount,durq,fnum)
24598 if (dumq .eq. '-') fnum=-fnum
24599 call setbits(isdat4(nsdat),7,ilb12*16+6,nint(10*fnum)+64)
24600 end if
24601 iccount = iccount-1
24602 ilb12 = 1
24603 go to 1
24604 else if (index('fnhH',durq).gt.0) then
24605 c
24606 c Special ps slur curvatures.
24607 c Translate to old \midslur args (1,4,5,6)
24608 c
24609 icurv1 = index('fnxhH',durq)
24610 if (icurv1 .eq. 5) then
24611 c
24612 c check for 2nd H
24613 c
24614 if (lineq(iccount+1:iccount+1) .eq. 'H') then
24615 iccount = iccount+1
24616 icurv1 = 6
24617 end if
24618 end if
24619 isdat3(nsdat) = ibset(isdat3(nsdat),0)
24620 call setbits(isdat3(nsdat),6,2,32+icurv1)
24621 go to 1
24622 else if (durq .eq. 'p') then ! Local adjustment
24623 call getchar(lineq,iccount,durq) ! +|-
24624 call getchar(lineq,iccount,dumq) ! s|t
24625 c 26 \sluradjust (p+s)
24626 c 27 \nosluradjust (p-s)
24627 c 28 \tieadjust (p+t)
24628 c 29 \notieadjust (p-t)
24629 if (durq .eq. '+') then
24630 if (dumq .eq. 's') then
24631 isdat2(nsdat) = ibset(isdat2(nsdat),26)
24632 else
24633 isdat2(nsdat) = ibset(isdat2(nsdat),28)
24634 end if
24635 else
24636 if (dumq .eq. 's') then
24637 isdat2(nsdat) = ibset(isdat2(nsdat),27)
24638 else
24639 isdat2(nsdat) = ibset(isdat2(nsdat),29)
24640 end if
24641 end if
24642 go to 1
24643 else if (durq .eq. 'v') then ! Stem slur
24644 isdat1(nsdat) = ibset(isdat1(nsdat),2)
24645 go to 1
24646 end if
24647 c
24648 c Record shifts
24649 c
24650 call setbits(isdat2(nsdat),6, 6,ivoff+32)
24651 call setbits(isdat2(nsdat),7,12,ihoff+64)
24652 c
24653 c Record chord flag, note level, notehead shift
24654 c
24655 if (notcrd) then
24656 call setbits(isdat2(nsdat),7,19,nolev)
24657 else
24658 nolevc = igetbits(icrdat(ncrd),7,12)
24659 call setbits(isdat2(nsdat),7,19,nolevc)
24660 isdat2(nsdat) = ibset(isdat2(nsdat),0)
24661 call setbits(isdat2(nsdat),2,1,igetbits(icrdat(ncrd),2,23))
24662 end if
24663 return
24664 end
24665 subroutine sslur(lineq,iccount,iv,kv,ip,isdat1,isdat2,isdat3,
24666 * nsdat,notcrd,nolev,starter)
24667 parameter (nm=24)
24668 c
24669 c Reads in slur data. Record all h/v-shifts for non-chords, user-specified
24670 c ones for chords.
24671 c 5/26/02 now only for non-postscript slurs, use spsslur() for postscript
24672 c
24673 c See subroutine doslur for bit values in isdat1,2,3
24674 c
24675 common /comtrill/ ntrill,ivtrill(24),iptrill(24),xnsktr(24),
24676 * ncrd,icrdat(193),icrdot(193),icrdorn(193),nudorn,
24677 * kudorn(63),ornhshft(63),minlev,maxlev,icrd1,icrd2
24678 integer*4 isdat1(202),isdat2(202),isdat3(202)
24679 logical notcrd,btest
24680 character*128 lineq
24681 character*1 durq,dumq,starter
24682 common /comslur/ listslur,upslur(nm,2),ndxslur,fontslur
24683 * ,WrotePsslurDefaults,SlurCurve
24684 logical upslur,fontslur,WrotePsslurDefaults
24685 c
24686 c Counter for signed integers. 1st is height, 2nd is horiz, 3rd is curve
24687 c
24688 numint = 0
24689 ivoff = 0
24690 ihoff = 0
24691 nsdat = nsdat+1
24692 if (starter.eq.'{' .or. starter.eq.'}')
24693 * isdat2(nsdat)=ibset(isdat2(nsdat),3)
24694 call setbits(isdat1(nsdat),5,13,iv)
24695 call setbits(isdat1(nsdat),1,12,kv-1)
24696 call setbits(isdat1(nsdat),8,3,ip)
24697 isdat3(nsdat) = 0
24698 c
24699 c Get id letter
24700 c
24701 if (lineq(iccount:iccount) .eq. 't') then
24702 c
24703 c Old-style t-slur. Use special idcode = 1
24704 c
24705 idcode = 1
24706 else
24707 call getchar(lineq,iccount,durq)
24708 if (index('uldtb+-hf ',durq) .gt. 0) then
24709 c
24710 c Null id
24711 c
24712 idcode = 32
24713 iccount = iccount-1
24714 else if (durq.eq.'H') then
24715 c
24716 c Postscript slur, cannot use 'H' as code, must check for 2nd 'H'
24717 c
24718 idcode = 32
24719 iccount = iccount-1
24720 c
24721 c There may be another "H", but no need to deal with it yet
24722 c
24723 else
24724 c
24725 c Set explicit idcode
24726 c
24727 idcode = ichar(durq)
24728 end if
24729 end if
24730 call setbits(isdat1(nsdat),7,19,idcode)
24731 c
24732 c Set start/stop: look thru list from end for same idcode,iv,kv
24733 c
24734 do 2 isdat = nsdat-1 , 1 , -1
24735 if (idcode .eq. igetbits(isdat1(isdat),7,19) .and.
24736 * iv .eq. igetbits(isdat1(isdat),5,13) .and.
24737 * kv-1 .eq. igetbits(isdat1(isdat),1,12)) then
24738 c
24739 c Matched idcode & ivx. On/off?. If on, new is turnoff, leave bit 11 at 0.
24740 c
24741 if (btest(isdat1(isdat),11)) go to 3
24742 c
24743 c Found slur is a turnoff, so new one is a turnon. Jump down to set bit
24744 c
24745 go to 4
24746 end if
24747 2 continue
24748 c
24749 c If here, this is turnon.
24750 c
24751 4 continue
24752 isdat1(nsdat) = ibset(isdat1(nsdat),11)
24753 3 continue
24754 c
24755 c Now done with initial turnon- or turnoff-specifics. Loop for rest of input
24756 c
24757 1 call getchar(lineq,iccount,durq)
24758 if (index('uld',durq) .gt. 0) then
24759 c
24760 c Force direction
24761 c
24762 isdat1(nsdat) = ibset(isdat1(nsdat),26)
24763 if (durq .eq. 'u') isdat1(nsdat) = ibset(isdat1(nsdat),27)
24764 go to 1
24765 else if (index('+-',durq) .gt. 0) then
24766 numint = numint+1
24767 if (numint .eq. 1) then
24768 c
24769 c Vertical offset
24770 c
24771 iccount = iccount+1
24772 call readnum(lineq,iccount,dumq,fnum)
24773 iccount = iccount-1
24774 ivoff = nint(fnum)
24775 if (durq .eq. '-') ivoff = -ivoff
24776 else if (numint .eq. 2) then
24777 c
24778 c Horizontal offset
24779 c
24780 iccount = iccount+1
24781 call readnum(lineq,iccount,dumq,fnum)
24782 iccount = iccount-1
24783 c
24784 c fnum is abs(hshift), must be 0 to 6.3
24785 c
24786 ihoff = fnum*10 + .5
24787 if (durq .eq. '-') ihoff = -ihoff
24788 c
24789 c Later will set bits to 1...127 to represent -6.3,...+6.3
24790 c
24791 else
24792 c
24793 c Must be the 3rd signed integer, so it's a curve specification
24794 c
24795 isdat3(nsdat) = ibset(isdat3(nsdat),0)
24796 iccount = iccount+1
24797 call readnum(lineq,iccount,dumq,fnum)
24798 icurv1 = nint(fnum)
24799 if (durq .eq. '-') icurv1 = -icurv1
24800 call setbits(isdat3(nsdat),6,2,32+icurv1)
24801 if (dumq .ne. ':') then
24802 c
24803 c Back up the pointer and loop for more input
24804 c
24805 iccount = iccount-1
24806 else
24807 c
24808 c Expect two single digits as parameters for curve
24809 c
24810 isdat3(nsdat) = ibset(isdat3(nsdat),1)
24811 call setbits(isdat3(nsdat),3,8,
24812 * ichar(lineq(iccount+1:iccount+1))-48)
24813 call setbits(isdat3(nsdat),3,11,
24814 * ichar(lineq(iccount+2:iccount+2))-48)
24815 iccount = iccount+2
24816 end if
24817 end if
24818 go to 1
24819 else if (durq .eq. 't') then
24820 isdat2(nsdat) = ibset(isdat2(nsdat),3)
24821 go to 1
24822 else if (durq .eq. 'b') then
24823 isdat2(nsdat) = ibset(isdat2(nsdat),4)
24824 go to 1
24825 else if (index('fhH',durq) .gt. 0) then
24826 c
24827 c Special ps slur curvatures. Translate to old \midslur args (1,4,5,6)
24828 c
24829 icurv1 = 2+index('fhH',durq)
24830 if (icurv1 .eq. 3) then
24831 icurv1 = 1
24832 else if (icurv1 .eq. 5) then
24833 c
24834 c check for 2nd H
24835 c
24836 if (lineq(iccount+1:iccount+1) .eq. 'H') then
24837 iccount = iccount+1
24838 icurv1 = 6
24839 end if
24840 end if
24841 isdat3(nsdat) = ibset(isdat3(nsdat),0)
24842 c
24843 c Must change sign if downslur, but cannot do it now since we don't know
24844 c slur direction for sure.
24845 c
24846 call setbits(isdat3(nsdat),6,2,32+icurv1)
24847 go to 1
24848 end if
24849 c
24850 c Record shifts
24851 c
24852 call setbits(isdat2(nsdat),6, 6,ivoff+32)
24853 call setbits(isdat2(nsdat),7,12,ihoff+64)
24854 c
24855 c Record chord flag, note level, notehead shift
24856 c
24857 if (notcrd) then
24858 call setbits(isdat2(nsdat),7,19,nolev)
24859 else
24860 nolevc = igetbits(icrdat(ncrd),7,12)
24861 call setbits(isdat2(nsdat),7,19,nolevc)
24862 isdat2(nsdat) = ibset(isdat2(nsdat),0)
24863 call setbits(isdat2(nsdat),2,1,igetbits(icrdat(ncrd),2,23))
24864 end if
24865 return
24866 end
24867 subroutine stop1()
24868 call exit(1)
24869 end
24870 subroutine topfile(basenameq,lbase,nv,clefq,noinst,musicsize,
24871 * xinstf1,mtrnmp,mtrdnp,vshrink,fbar,fontslur)
24872 parameter (nm=24)
24873 common /comlast/ islast,usevshrink
24874 logical islast,usevshrink,fontslur
24875 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
24876 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
24877 * lnam(nm),inameq(nm)
24878 common /comarp/ narp,tar(8),ivar1(8),ipar1(8),levar1(8),ncmar1(8),
24879 * xinsnow,lowdot
24880 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
24881 character*79 inameq
24882 character*44 basenameq
24883 character*24 fmtq
24884 character*5 fbarq
24885 character*1 clefq(nm),sq,chax,clefqiv
24886 common /comstart/ facmtr
24887 logical vshrink,lowdot,rename
24888 logical novshrinktop,cstuplet
24889 common /comnvst/ novshrinktop,cstuplet
24890 common /comInstTrans/ iInstTrans(nm),iTransKey(nm),iTransAmt(nm),
24891 * instno(nm),nInstTrans,EarlyTransOn,LaterInstTrans
24892 logical EarlyTransOn,LaterInstTrans
24893 common /comsize/ isize(nm)
24894 common /comis4bignv/ is4bignv,AIset
24895 logical is4bignv,AIset
24896 common /comc8flag/ c8flag(nm)
24897 logical c8flag
24898 common /comslope/ bigslope,novbm
24899 logical bigslope,novbm
24900 sq = chax(92)
24901 vshrink = xinstf1.gt.20. .and. .not.novshrinktop
24902 if (vshrink) then
24903 xinsnow = 10.
24904 else
24905 xinsnow = xinstf1
24906 end if
24907 if (.not.islast) return
24908 c
24909 c Initialize octave treble clef tracker
24910 c
24911 do 6 im = 1 , nm
24912 c8flag(im) = .false.
24913 6 continue
24914 write(11,'(a)')'%%%%%%%%%%%%%%%%%'
24915 write(11,'(a)')'%'
24916 write(11,'(a)')'% '//basenameq(1:lbase)//'.tex'
24917 write(11,'(a)')'%'
24918 write(11,'(a)')'%%%%%%%%%%%%%%%%'
24919 write(11,'(a)')sq//'input musixtex'
24920 write(11,'(a)')sq//'input pmx'
24921 write(11,'(a)')
24922 * sq//'setmaxslurs{24}'//sq//'setmaxinstruments{24}%'
24923 if (.not.fontslur) write(11,'(a)')sq//'input musixps'
24924 c
24925 c Need to input musixmad to permit more slurs.
24926 c
24927 if (musicsize .eq. 20) then
24928 write(11,'(a)')sq//'normalmusicsize%'
24929 else if (musicsize .eq. 16) then
24930 write(11,'(a)')sq//'smallmusicsize%'
24931 else if (musicsize .eq. 24) then
24932 write(11,'(a)')sq//'largemusicsize%'
24933 else if (musicsize .eq. 29) then
24934 write(11,'(a)')sq//'Largemusicsize%'
24935 end if
24936 c
24937 c Set sizes. Have sizes per staff in isize(.) and noinst per staff in
24938 c nsperi(.)
24939 c
24940 do 5 iinst = 1 , noinst
24941 if (isize(iinst) .eq. 1) then
24942 if(iinst.le.9) then
24943 write(11,'(a8,i1,a)')
24944 * sq//'setsize',iinst,sq//'smallvalue%'
24945 else
24946 write(11,'(a9,i2,a)')
24947 * sq//'setsize{',iinst,'}'//sq//'smallvalue%'
24948 end if
24949 else if (isize(iinst) .eq. 2) then
24950 if(iinst.le.9) then
24951 write(11,'(a8,i1,a)')
24952 * sq//'setsize',iinst,sq//'tinyvalue%'
24953 else
24954 write(11,'(a9,i2,a)')
24955 * sq//'setsize{',iinst,'}'//sq//'tinyvalue%'
24956 end if
24957 end if
24958 5 continue
24959 write(fbarq,'(f5.3)')fbar
24960 write(11,'(a)')sq//'nopagenumbers'
24961 write(11,'(a)')sq//'tracingstats=2'//sq//'relax'
24962 write(11,'(a7,i3,a2)')sq//'hsize=',nint(widthpt),'pt'
24963 write(11,'(a6,i'//chax(49+int(log10(height+.1)))//',a2)')
24964 * sq//'vsize',int(height+.1),'pt'
24965 if (abs(hoffpt) .gt. 0.1) then
24966 if (hoffpt .le. -10.) then
24967 write(11,'(a8,i3,a2)')sq//'hoffset',nint(hoffpt),'pt'
24968 else if (hoffpt .lt. 0.) then
24969 write(11,'(a8,i2,a2)')sq//'hoffset',nint(hoffpt),'pt'
24970 else if (hoffpt .lt. 10.) then
24971 write(11,'(a8,i1,a2)')sq//'hoffset',nint(hoffpt),'pt'
24972 else
24973 write(11,'(a8,i2,a2)')sq//'hoffset',nint(hoffpt),'pt'
24974 end if
24975 end if
24976 if (abs(voffpt) .gt. 0.1) then
24977 if (voffpt .le. -10.) then
24978 write(11,'(a8,i3,a2)')sq//'voffset',nint(voffpt),'pt'
24979 else if (voffpt .lt. 0.) then
24980 write(11,'(a8,i2,a2)')sq//'voffset',nint(voffpt),'pt'
24981 else if (voffpt .lt. 10.) then
24982 write(11,'(a8,i1,a2)')sq//'voffset',nint(voffpt),'pt'
24983 else
24984 write(11,'(a8,i2,a2)')sq//'voffset',nint(voffpt),'pt'
24985 end if
24986 end if
24987 c
24988 c The default raisebarno=3.5 internote, set in pmx.tex. Increase to 4.5 if
24989 c 3 sharps and treble clef, to avoid vertical clash with top space g#
24990 c
24991 if (isig.eq.3 .and. clefq(nv).eq.'t') write(11,'(a)')
24992 * sq//'def'//sq//'raisebarno{4.5'//sq//'internote}'
24993 if (noinst .lt. 10) then
24994 write(11,'(a19,i1,a1)')sq//'def'//sq//'nbinstruments{',
24995 * noinst,'}'
24996 else
24997 write(11,'(a19,i2,a1)')sq//'def'//sq//'nbinstruments{',
24998 * noinst,'}'
24999 end if
25000 iv = 0
25001 do 1 iinst = 1 , noinst
25002 nstaves = nsperi(iinst)
25003 if (iinst .lt. 10) then
25004 write(11,'(a)')sq//'setstaffs'//chax(48+iinst)
25005 * //chax(48+nstaves)
25006 else
25007 write(11,'(a11,i2,a)')sq//'setstaffs{',iinst,'}'
25008 * //chax(48+nstaves)
25009 end if
25010 iv = iv+1
25011 clefqiv = clefq(iv)
25012 if (clefqiv.eq.'8') then
25013 clefqiv='t'
25014 iTransAmt(instno(iv)) = 7+iTransAmt(instno(iv))
25015 c8flag(iv) = .true.
25016 end if
25017 if (nstaves .eq. 1) then
25018 fmtq = chax(48+numclef(clefq(iv)))
25019 lfmtq = 1
25020 else
25021 fmtq = '{'//chax(48+numclef(clefq(iv)))
25022 lfmtq = 2
25023 do 2 k = 2 , nstaves
25024 iv = iv+1
25025 fmtq = fmtq(1:lfmtq)//chax(48+numclef(clefq(iv)))
25026 lfmtq = lfmtq+1
25027 2 continue
25028 fmtq = fmtq(1:lfmtq)//'}'
25029 lfmtq = lfmtq+1
25030 end if
25031 if (iinst .lt. 10) then
25032 write(11,'(a)')sq//'setclef'//chax(48+iinst)//fmtq(1:lfmtq)
25033 else
25034 write(11,'(a9,i2,a)')sq//'setclef{',iinst,'}'//fmtq(1:lfmtq)
25035 end if
25036 if (clefq(iv) .eq. '8') then
25037 if (iinst .lt. 10) then
25038 write(11,'(a)')sq//'settrebleclefsymbol'//chax(48+iinst)//
25039 * sq//'treblelowoct%'
25040 else
25041 write(11,'(a21,i2,a)')sq//'settrebleclefsymbol{',iinst,'}'//
25042 * sq//'treblelowoct%'
25043 end if
25044 c8flag(iv) = .true.
25045 end if
25046 do 3 lname = 79 , 2 , -1
25047 if (inameq(iinst)(lname:lname) .ne. ' ') go to 4
25048 3 continue
25049 4 continue
25050 lnam(iinst) = lname
25051 if (iinst .lt. 10) then
25052 write(11,'(a8,i1,a)')sq//'setname',iinst,
25053 * '{'//inameq(iinst)(1:lname)//'}'
25054 else
25055 write(11,'(a9,i2,a)')sq//'setname{',iinst,
25056 * '}{'//inameq(iinst)(1:lname)//'}'
25057 end if
25058 1 continue
25059 write(11,'(a18,i2,a2)')sq//'generalsignature{',isig,'}%'
25060 if (EarlyTransOn)
25061 * call Writesetsign(nInstTrans,iInstTrans,iTransKey,EarlyTransOn)
25062 call wgmeter(mtrnmp,mtrdnp)
25063 ipi = nint(fracindent*widthpt)
25064 if (ipi .lt. 10) then
25065 write(11,'(a11,i1,a2)')sq//'parindent ',ipi,'pt'
25066 else if (ipi .lt. 100) then
25067 write(11,'(a11,i2,a2)')sq//'parindent ',ipi,'pt'
25068 else
25069 write(11,'(a11,i3,a2)')sq//'parindent ',ipi,'pt'
25070 end if
25071 write(11,'(a)')sq//'elemskip1pt'//sq//'afterruleskip'
25072 * //fbarq//'pt'//sq//'beforeruleskip0pt'//sq//'relax'
25073 if (.not.vshrink) then
25074 if (xinstf1 .lt. 9.95) then
25075 fmtq = '(a,f3.1,a)'
25076 else
25077 fmtq = '(a,f4.1,a)'
25078 end if
25079 facis = 1.
25080 if (is4bignv) facis = .95
25081 write(11,fmtq)sq//'stafftopmarg0pt'//sq//'staffbotmarg0pt'
25082 * //sq//'interstaff{',xinstf1*facis,'}'//sq//'relax'
25083 else
25084 write(11,'(a)')sq//'stafftopmarg0pt'//
25085 * sq//'staffbotmarg5'//sq//'Interligne'//sq//
25086 * 'interstaff{10}'//sq//'relax'
25087 end if
25088 if (nv.eq.1) write(11,'(a)')sq//'nostartrule'
25089 write(11,'(a)')sq//'readmod{'//basenameq(1:lbase)//'}'
25090 if (cstuplet) then
25091 write(11,'(a)')sq//'input tuplet'
25092 * //sq//'def'//sq//'xnumt#1#2#3{'//sq//'zcharnote{#2}{~}'
25093 * //sq//'def'//sq//'tuplettxt{'//sq//'smalltype'//sq//'it{#3}'
25094 * //sq//chax(47)//sq//'/}}%'
25095 write(11,'(a)')sq//'let'//sq//'ovbkt'//sq//'uptuplet'
25096 * //sq//'let'//sq//'unbkt'//sq//'downtuplet%'
25097 end if
25098 write(11,'(a)')sq//'startmuflex'//sq//'startpiece'//sq//
25099 * 'addspace'//sq//'afterruleskip%'
25100 return
25101 end
25102 character*1 function udfq(nolev,ncm)
25103 c
25104 c Slur directions
25105 c
25106 common /combc/ bcspec
25107 logical bcspec
25108 ntest = nolev-ncm
25109 if (ntest.lt.0 .or.
25110 * (ntest.eq.0 .and. bcspec .and. ncm.eq.23) ) then
25111 udfq = 'd'
25112 else
25113 udfq = 'u'
25114 end if
25115 return
25116 end
25117 character*1 function udqq(nole,ncm,isl,nvmx,ivx,nv)
25118 c
25119 c Stem direction for single notes
25120 c
25121 character*1 ulfq
25122 character*1 udqqq
25123 logical btest
25124 if (btest(isl,30)) then
25125 c
25126 c Absolute override
25127 c
25128 if (btest(isl,17)) then
25129 udqqq = 'u'
25130 else
25131 udqqq = 'l'
25132 end if
25133 else if (nvmx .eq. 1) then
25134 c
25135 c Single voice per staff, default
25136 c
25137 udqqq = ulfq(1.*nole,ncm)
25138 else
25139 c
25140 c Multi-voice per staff, 1st is lower, 2nd upper
25141 c
25142 if (ivx .le. nv) then
25143 udqqq = 'l'
25144 else
25145 udqqq = 'u'
25146 end if
25147 end if
25148 udqq = udqqq
25149 return
25150 end
25151 character*1 function ulfq(xnolev,ncm)
25152 c
25153 c Stem directions
25154 c
25155 common /combc/ bcspec
25156 logical bcspec
25157 test = xnolev-ncm
25158 if (test.lt.-.001 .or.
25159 * (test.lt..001.and.bcspec.and.ncm.eq.23) ) then
25160 ulfq = 'u'
25161 else
25162 ulfq = 'l'
25163 end if
25164 return
25165 end
25166 function upcaseq(chq)
25167 character*1 chq,upcaseq,chax
25168 if (ichar(chq).ge.61.and.ichar(chq).lt.122) then
25169 upcaseq = chax(ichar(chq)-32)
25170 else
25171 upcaseq = chq
25172 print*,'Warning, upcaseq was called with improper argument: '
25173 * //chq
25174 stop
25175 end if
25176 return
25177 end
25178 subroutine wgmeter(mtrnmp,mtrdnp)
25179 c
25180 c Writes meter stuff to file 11, so only called if islast=.true.
25181 c
25182 character*1 sq,chax
25183 if (mtrdnp .eq. 0) return
25184 sq=chax(92)
25185 if (mtrnmp.gt.0 .and. mtrnmp.le.9) then
25186 if (mtrdnp .lt. 10) then
25187 write(11,'(a25,i1,a2,i1,a3)')
25188 * sq//'generalmeter{'//sq//'meterfrac{',
25189 * mtrnmp,'}{',mtrdnp,'}}%'
25190 else
25191 write(11,'(a25,i1,a2,i2,a3)')
25192 * sq//'generalmeter{'//sq//'meterfrac{',
25193 * mtrnmp,'}{',mtrdnp,'}}%'
25194 end if
25195 else if (mtrnmp .ge. 10) then
25196 if (mtrdnp .lt. 10) then
25197 write(11,'(a25,i2,a2,i1,a3)')
25198 * sq//'generalmeter{'//sq//'meterfrac{',
25199 * mtrnmp,'}{',mtrdnp,'}}%'
25200 else
25201 write(11,'(a25,i2,a2,i2,a3)')
25202 * sq//'generalmeter{'//sq//'meterfrac{',
25203 * mtrnmp,'}{',mtrdnp,'}}%'
25204 end if
25205 else if (mtrnmp .lt. 0) then
25206 write(11,'(a26,i1,a2,i1,a3)')
25207 * sq//'generalmeter{'//sq//'meterfracS{',
25208 * -mtrnmp,'}{',mtrdnp,'}}%'
25209 else if (mtrdnp .le. 4) then
25210 write(11,'(a21,i1,a2)')
25211 * sq//'generalmeter{'//sq//'meterN',mtrdnp,'}%'
25212 else if (mtrdnp .eq. 5) then
25213 write(11,'(a)')sq//'generalmeter'//sq//'allabreve%'
25214 else if (mtrdnp .eq. 6) then
25215 write(11,'(a)')sq//'generalmeter'//sq//'meterC%'
25216 else if (mtrdnp .eq. 7) then
25217 write(11,'(a)')sq//'generalmeter'//sq//'meterIIIS%'
25218 end if
25219 return
25220 end
25221 subroutine writemidi(jobname,ljob)
25222 parameter(nm=24,mv=24576)
25223 common /all/ mult(nm,200),iv,nnl(nm),nv,ibar,
25224 * ivxo(600),ipo(600),to(600),tno(600),tnote(600),eskz(nm,200),
25225 * ipl(nm,200),ibm1(nm,9),ibm2(nm,9),nolev(nm,200),ibmcnt(nm),
25226 * nodur(nm,200),jn,lenbar,iccount,nbars,itsofar(nm),nacc(nm,200),
25227 * nib(nm,15),nn(nm),lenb0,lenb1,slfac,musicsize,stemmax,
25228 * stemmin,stemlen,mtrnuml,mtrdenl,mtrnmp,mtrdnp,islur(nm,200),
25229 * ifigdr(2,125),iline,figbass,figchk(2),firstgulp,irest(nm,200),
25230 * iornq(nm,0:200),isdat1(202),isdat2(202),nsdat,isdat3(202),
25231 * isdat4(202),beamon(nm),isfig(2,200),sepsymq(nm),sq,ulq(nm,9)
25232 character*1 ulq,sepsymq,sq
25233 logical beamon,firstgulp,figbass,figchk,isfig
25234 character*1 byteq(4),char,chax
25235 character*10 tempoq,instq
25236 character*44 jobname
25237 integer*2 mmidi
25238 logical restpend,relacc,notmain,twoline,ismidi,crdacc
25239 common /commidi/ imidi(0:nm),trest(0:nm),mcpitch(20),mgap,
25240 * iacclo(0:nm,6),iacchi(0:nm,6),midinst(nm),
25241 * nmidcrd,midchan(nm,2),numchan,naccim(0:nm),
25242 * laccim(0:nm,10),jaccim(0:nm,10),crdacc,notmain,
25243 * restpend(0:nm),relacc,twoline(nm),ismidi,mmidi(0:nm,mv),
25244 * debugmidi
25245 logical debugmidi
25246 common /commvel/ midivel(nm),midvelc(0:nm),midibal(nm),midbc(0:nm)
25247 * ,miditran(nm),midtc(0:nm),noinst,iinsiv(nm)
25248 common /comevent/ miditime,lasttime
25249 logical mmacrec,gottempo
25250 common /commmac/ mmacstrt(0:nm,20),mmacend(0:nm,20),immac,
25251 * mmactime(20),nmidsec,msecstrt(0:nm,60),msecend(0:nm,60),
25252 * mmacrec,gottempo
25253 character*79 inameq
25254 common /comtop / itopfacteur,ibotfacteur,interfacteur,isig0,
25255 * isig,lastisig,fracindent,widthpt,height,hoffpt,voffpt,idsig,
25256 * lnam(nm),inameq(nm)
25257 logical rename
25258 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
25259 c
25260 c Used to be icmm(0:nm); did midi fail when nv>16?
25261 c
25262 integer*2 iinsiv,icmm(0:15)
25263 character*5 versionc
25264 common /comver/ versionc
25265 c
25266 c These are not consecutive because channel 9 is reserved for percussion.
25267 c
25268 data icmm /0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16/
25269 c
25270 c Write Header
25271 c
25272 write(51,'(a,$)')'MThd'//char(0)//char(0)//char(0)//char(6)
25273 * //char(0)//char(1)//char(0)//char(numchan+1)//char(0)//char(240)
25274 if (debugmidi)
25275 * write(52,'(a6,10Z4)')'"MThd"',0,0,0,6,
25276 * 0,1,0,numchan+1,0,240
25277 c
25278 c Write the "conductor" track, for keys, meter, and tempos
25279 c Get the number of bytes in the conductor event stream
25280 c
25281 ndata = 1+imidi(numchan)-msecstrt(numchan,nmidsec)
25282 do 15 isec = 1 , nmidsec-1
25283 ndata = ndata+1+msecend(numchan,isec)-msecstrt(numchan,isec)
25284 15 continue
25285 ib1 = (4+ljob+27+ndata+4)/256
25286 ib0 = 4+ljob+27+ndata+4-256*ib1
25287 write(51,'(a,$)')'MTrk'//char(0)//char(0)//char(ib1)//char(ib0)
25288 c
25289 c Text header
25290 c
25291 * //char(0)//char(255)//char(1)//char(ljob+27)
25292 if (debugmidi)
25293 * write(52,'(a6,8z4)')'"MTrk"',0,0,ib1,ib0,
25294 * 0,255,1,ljob+27
25295 write(51,'(a,$)')jobname(1:ljob)
25296 if (debugmidi) write(52,'(a)')chax(34)//jobname(1:ljob)//chax(34)
25297 c
25298 c (separate writes are needed to defeat compiler BUG!!!)
25299 c
25300 write(51,'(a,$)')'.mid, produced by PMX '//versionc
25301 if (debugmidi) write(52,'(a)')
25302 * chax(34)//'.mid, produced by PMX '//versionc//chax(34)
25303 c
25304 c Conductor event data: Loop over sections.
25305 c
25306 do 16 isec = 1 , nmidsec
25307 if (isec .lt. nmidsec) then
25308 mend = msecend(numchan,isec)
25309 else
25310 mend = imidi(numchan)
25311 end if
25312 do 17 i = msecstrt(numchan,isec) , mend
25313 write(51,'(a,$)')char(mmidi(numchan,i))
25314 if (debugmidi) write(52,'(z4)')mmidi(numchan,i)
25315 17 continue
25316 16 continue
25317 c
25318 c And close out the time sig / tempo track.
25319 c
25320 write(51,'(a,$)')char(0)//char(255)//char(2*16+15)//char(0)
25321 if (debugmidi) write(52,'(4z4)')0,255,2*16+15,0
25322 c
25323 c Loop over track for each voice: The following sets up iv.
25324 c
25325 iv = nv
25326 if (twoline(nv)) then
25327 kv = 2
25328 else
25329 kv = 1
25330 end if
25331 c
25332 do 5 icm = 0 , numchan-1
25333 c
25334 c Get the number of bytes in the data stream
25335 c
25336 ndata = 1+imidi(icm)-msecstrt(icm,nmidsec)
25337 do 11 isec = 1 , nmidsec-1
25338 ndata = ndata+1+msecend(icm,isec)-msecstrt(icm,isec)
25339 11 continue
25340 c
25341 c Add 3 for instrum, 4 for bal, plus 4 (for closing) to byte count,
25342 c
25343 ndata = ndata+11
25344 c
25345 c Add 4+lnam(iinsiv(iv)) if lnam>0 ,
25346 c
25347 if (lnam(iinsiv(iv)).gt.0) ndata = ndata+4+lnam(iinsiv(iv))
25348 c
25349 c Separate total byte counts into 4 bytes
25350 c
25351 do 2 ibyte = 1 , 4
25352 if (ndata .gt. 0) then
25353 byteq(ibyte) = char(mod(ndata,256))
25354 ndata = ishft(ndata,-8)
25355 else
25356 byteq(ibyte) = char(0)
25357 end if
25358 2 continue
25359 c
25360 c Now write front stuff for this track
25361 c
25362 write(51,'(a,$)')'MTrk'//byteq(4)//byteq(3)//byteq(2)//byteq(1)
25363 * //char(0)//char(12*16+icmm(icm))//char(midinst(iinsiv(iv)))
25364 * //char(0)//char(11*16+icmm(icm))//char(10)//char(midbc(icm))
25365 if (debugmidi) write(52,'(a4,z2,a7,11z4)')'icm=',icm,
25366 * ' "MTrk"',ichar(byteq(4)),ichar(byteq(3)),ichar(byteq(2)),
25367 * ichar(byteq(1)),0,12*16+icmm(icm),midinst(iinsiv(iv)),
25368 * 0,11*16+icmm(icm),10,midbc(icm)
25369 if (lnam(iinsiv(iv)) .gt. 0) then
25370 c
25371 c Add instrument name as sequence name
25372 c
25373 write(51,'(a,$)')char(0)//char(255)//char(3)
25374 * //char(lnam(iinsiv(iv)))
25375 if (debugmidi) write(52,'(4z4)')0,255,3,lnam(iinsiv(iv))
25376 write(51,'(a,$)')
25377 * inameq(iinsiv(iv))(1:lnam(iinsiv(iv)))
25378 if (debugmidi) write(52,'(a)')
25379 * chax(34)//inameq(iinsiv(iv))(1:lnam(iinsiv(iv)))//chax(34)
25380 end if
25381 write(tempoq,'(i2)')icm
25382 write(instq,'(i3)')midinst(iinsiv(iv))
25383 call printl('MIDI instrument '//tempoq(1:2)//' is '//instq(1:3))
25384 c
25385 c Notes: Loop over sections.
25386 c
25387 do 9 isec = 1 , nmidsec
25388 if (isec .lt. nmidsec) then
25389 mend = msecend(icm,isec)
25390 else
25391 mend = imidi(icm)
25392 end if
25393 do 10 i = msecstrt(icm,isec) , mend
25394 write(51,'(a,$)')char(mmidi(icm,i))
25395 if (debugmidi) write(52,'(z4)')mmidi(icm,i)
25396 10 continue
25397 9 continue
25398 c
25399 c Closing 4 bytes
25400 c
25401 write(51,'(a,$)')chax(0)//char(255)//char(2*16+15)//char(0)
25402 if (debugmidi) write(52,'(4z4)')0,255,2*16+15,0
25403 if (kv .eq. 2) then
25404 kv = 1
25405 else if (iv .eq. 1) then
25406 go to 5
25407 else
25408 iv = iv-1
25409 if (twoline(iv)) kv=2
25410 end if
25411 5 continue
25412 c write(*,'(1x,a12,(10i6))')'Bytes used:',(imidi(icm),icm=0,numchan)
25413 c write(15,'(1x,a12,(10i6))')
25414 c * 'Bytes used:',(imidi(icm),icm=0,numchan)
25415 close(51)
25416 if (debugmidi) close(52)
25417 return
25418 end
25419 subroutine Writesetsign(nInstTrans,iInstTrans,iTransKey,flag)
25420 parameter(nm=24)
25421 integer*4 iInstTrans(nm),iTransKey(nm)
25422 character*79 notexq
25423 character*1 chax
25424 logical flag
25425 c
25426 c Assumes notexq is blank
25427 c
25428 do 1 i = 1 , nInstTrans
25429 notexq = chax(92)//'setsign'
25430 lnote = 8
25431 if (iInstTrans(i) .lt. 10) then
25432 notexq = notexq(1:lnote)//chax(48+iInstTrans(i))
25433 lnote = lnote+1
25434 else
25435 write(notexq(lnote+1:lnote+4),'(a1,i2,a1)')
25436 * '{',iInstTrans(i),'}'
25437 lnote = lnote+4
25438 end if
25439 if (iTransKey(i) .lt. 0) then
25440 write(notexq(lnote+1:lnote+4),'(a1,i2,a1)')
25441 * '{',iTransKey(i),'}'
25442 lnote = lnote+4
25443 else
25444 notexq = notexq(1:lnote)//chax(48+iTransKey(i))
25445 lnote = lnote+1
25446 end if
25447 write(11,'(a)')notexq(1:lnote)//'%'
25448 1 continue
25449 flag = .false.
25450 return
25451 end
25452 subroutine writflot(x,notexq,lenline)
25453 character*(*) notexq
25454 if (x .lt. 0.95) then
25455 write(notexq(lenline+1:lenline+2),'(f2.1)')x
25456 lenline = lenline+2
25457 else if (x .lt. 9.95) then
25458 write(notexq(lenline+1:lenline+3),'(f3.1)')x
25459 lenline = lenline+3
25460 else
25461 write(notexq(lenline+1:lenline+4),'(f4.1)')x
25462 lenline = lenline+4
25463 end if
25464 return
25465 end
25466 subroutine wsclef(iv,ninow,nclef)
25467 c
25468 c Writes \setclef for instrument containing *staff* iv
25469 c
25470 parameter (nm=24)
25471 common /comlast/ islast,usevshrink
25472 logical islast,usevshrink
25473 common /comnvi/ nsperi(nm),nspern(nm),rename,iiorig(nm)
25474 logical rename
25475 c
25476 c In pmx271, had removed clefq, so with 2 or more staves in
25477 c an instrument, had problems. So replace in 272
25478 c
25479 common /comclefq/ clefq(nm)
25480 character*1 clefq,chax
25481 character*40 temq
25482 common /comc8flag/ c8flag(nm)
25483 logical c8flag
25484 if (nclef .lt. 7) then
25485 clefq(iv) = chax(48+nclef)
25486 else
25487 clefq(iv)='9'
25488 end if
25489 if (.not.islast) return
25490 iv1 = 1
25491 do 1 iinst = 1 , ninow
25492 if (iv .lt. iv1+nspern(iinst)) go to 2
25493 iv1 = iv1+nspern(iinst)
25494 1 continue
25495 print*
25496 print*,'Should not be here in wsclef!'
25497 call stop1()
25498 2 continue
25499 c
25500 c Here, iinst is the instrument number with staff of clef change
25501 c
25502 iv2 = iv1+nspern(iinst)-1
25503 if (iinst .lt. 10) then
25504 temq = chax(92)//'setclef'//chax(48+iinst)
25505 ltem = 9
25506 else
25507 write(temq,'(a9,i2,a1)') chax(92)//'setclef{',iinst,'}'
25508 ltem = 12
25509 end if
25510 if (iv1 .eq. iv2) then
25511 c
25512 c Only one staff (iv) in instrument with clef change
25513 c
25514 write(11,'(a)')temq(1:ltem)//clefq(iv)//'%'
25515 else
25516 temq = temq(1:ltem)//'{'
25517 ltem = ltem+1
25518 c
25519 c Loop over staves, but clefq has only changed for one of them
25520 c
25521 do 3 iiv = iv1 , iv2
25522 temq = temq(1:ltem)//chax(48+numclef(clefq(iiv)))
25523 ltem = ltem+1
25524 3 continue
25525 write(11,'(a)')temq(1:ltem)//'}%'
25526 end if
25527 if (c8flag(iv)) then
25528 c
25529 c If we change FROM octave treble clef to some other, need the following.
25530 c
25531 write(11,'(a)')char(92)//'settrebleclefsymbol'//chax(48+iinst)
25532 * //char(92)//'trebleclef%'
25533 c8flag(iv) = .false.
25534 end if
25535 return
25536 end
25537 subroutine chkpmxlyr(lineq,iccount,lyrerr)
25538 character*128 lineq
25539 character*1 charq,chax
25540 lyrerr = 0
25541 c
25542 c On entry, last char was "
25543 c
25544 18 call g1etchar(lineq,iccount,charq)
25545 if (iccount .eq. 121) then
25546 lyrerr = 2
25547 return
25548 else if (charq.eq.chax(34) .and.
25549 * .not.(lineq(iccount-1:iccount-1).eq.char(92))) then
25550 call g1etchar(lineq,iccount,charq)
25551 c
25552 c Check for raise/lower command
25553 c
25554 if (charq .eq. '@') then
25555 c
25556 c @ positions lyrics vertically for current voice
25557 c [a,b] above or below of the staff
25558 c +/- i offset, \internotes
25559 c
25560 call g1etchar(lineq,iccount,charq)
25561 if (index('ab',charq).eq.0) then
25562 lyrerr = 3
25563 return
25564 end if
25565 call g1etchar(lineq,iccount,charq)
25566 if (index('+-',charq).eq.0) then
25567 lyrerr = 4
25568 return
25569 end if
25570 call g1etchar(lineq,iccount,charq)
25571 if (index('0123456789',charq).eq.0) then
25572 lyrerr = 5
25573 return
25574 end if
25575 else if (charq .ne. ' ') then
25576 c
25577 c 2nd " must be followed by ' '
25578 c
25579 lyrerr = 1
25580 return
25581 end if
25582 return
25583 end if
25584 go to 18
25585 end
25586 subroutine dopmxlyr(lineq,iccount)
25587 c
25588 c lineq has " at iccount. Find end of lyrics string, replace "..."
25589 c with \pmxlyr{...}\, but also look for ~ in lyrics and replace with '\ll ',
25590 c (unless preceded with '\'), check length
25591 c
25592 character*128 lineq,lineqt
25593 character*1 sq,chax
25594 sq = chax(92)
25595 iend = lenstr(lineq,128)
25596 c
25597 c Find position of closing '"'; must bypass any \" which is used for umlaut
25598 c
25599 i2nd = iccount+index(lineq(iccount+1:128),chax(34))
25600 2 continue
25601 if (lineq(i2nd-1:i2nd-1).eq.char(92)) then
25602 i2nd = i2nd+index(lineq(i2nd+1:128),chax(34))
25603 go to 2
25604 end if
25605 istart = iccount
25606 1 itilde = istart+index(lineq(istart+1:i2nd-1),'~')
25607 if (itilde.gt.istart.and.itilde.lt.i2nd) then
25608 c
25609 c Replace tilde if not preceded by \
25610 c
25611 if (iend .ge. 117) then
25612 print*,'Sorry, lyric string is too long, stopping'
25613 call stop1()
25614 else if (lineq(itilde-1:itilde-1) .eq. sq) then
25615 istart = itilde
25616 go to 1
25617 end if
25618 lineqt = lineq(1:itilde-1)//sq//'lk '
25619 * //lineq(itilde+1:iend)
25620 iend = lenstr(lineqt,128)
25621 i2nd = i2nd+3
25622 lineq = lineqt
25623 go to 1
25624 end if
25625 if (iccount .eq. 1) then
25626 lineqt = sq//'pmxlyr{'//lineq(2:i2nd-1)//'}'//sq
25627 * //lineq(i2nd+1:128)
25628 else
25629 lineqt = lineq(1:iccount-1)//sq//'pmxlyr{'
25630 * //lineq(iccount+1:i2nd-1)//'}'//sq
25631 * //lineq(i2nd+1:128)
25632 end if
25633 i2nd = i2nd+8
25634 lineq = lineqt
25635 if (lineq(i2nd+1:i2nd+1) .eq. '@') then
25636 lineqt = lineq(1:i2nd)//'at{'//lineq(i2nd+2:i2nd+4)//'}'//sq
25637 * //lineq(i2nd+5:128)
25638 lineq = lineqt
25639 end if
25640 return
25641 end
25642 subroutine inst2chan(midc,midi,midchan,nv,iinsiv,twoline)
25643 c
25644 c propagate per-instrument quantities to per-channel ones
25645 c
25646 parameter (nm=24)
25647 integer*4 midc(0:nm),midi(nm),midchan(nm,2)
25648 integer*2 iinsiv(nm)
25649 logical twoline(nm)
25650 do iv = nv, 1, -1
25651 if (twoline(iv)) then
25652 midc(midchan(iv,2)) = midi(iinsiv(iv))
25653 end if
25654 midc(midchan(iv,1)) = midi(iinsiv(iv))
25655 end do
25656 end
25657
25658