&dA &d@ &dA &d@ S2ED.Z &dA &d@ ÍÍÍÍÍÍÍÍ &dA &d@ &dI &d@ based on autoset, &dI &dA &d@ &dI &d@ with small additions from mskpage &dI &dA &d@ &dI &d@ and large additions from eskpage. &dI &dA &dA &d@ Graphical Program to Aid in Stage2 Data Entry &dA &d@ ============================================= &dA &dA &d@ Program takes input file from source library file and creates &dA &d@ an output source file &dA &dA &d@ Version 1.00 (rev. 11/21/94) &dA &d@ Version 1.01 (rev. 01/03/95) &dA &dA &d@ Note: With a program a complex as this one, there are necessarily &dA &d@ going to be corner cases that are too difficult or too obscure to &dA &d@ handle properly. To prevent the details of these cases from being &dA &d@ "lost" in the program, there will appear from time to time &dA &d@ paragraphs labled "CORNER", which decribe the situation and any &dA &d@ potential limtations imposed on the program. &dA &dA &d@ Version control &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ &dA01/03/95&d@: Capability to run on 640 x 480 screens (notesize = 6) &dA &dA &d@ &dA04/24/95&d@: Changed the way the zak(.) parameters work (to accomodate &dA &d@ odd notesizes for autoset) &dA &dA &d@ &dA06/28/95&d@: There was an error c. line 17000 in the way the program &dA &d@ search for extra chord tones. A the moment, the fix for &dA &d@ this problem is not rigorous. The problem is caused by &dA &d@ the feature that combines homophonic instrumental parts &dA &d@ into chords. The solution makes the assumption that &dA &d@ only "P" and "S" records can intervene between chord &dA &d@ tones. Obviously, this will not always be true! &dA &dA &d@ 12-24-96 Added capability to handle triple and quadruple dots &dA &dA &d@ 02-02-97 Fix problem of overlapping trill extensions. Added &dA &d@ arrays pre_tsnum, pre_ctrarrf, and pre_try (pre = preliminary) &dA &dA &dA &d@ Program options &dA #define SMALL 1 #define SFZ 0 /* SFZ = 1: print sfortzando as sfz #define DOT_DIFFERENCE 0 /* DOT_DIFFERENCE = 1: don't allow overstrike #define OLD_REPEATERS 1 /* OLD_REPEATERS = 1: use half notes instead of quarters &dA &d@ Actual Characters #define DOT_CHAR 44 &dA &d@ Descriptive Definitions #define TIE_SNUM 1 #define TIE_NTYPE 2 #define TIE_VLOC 3 #define TIE_FHDIS 4 #define TIE_FSTEM 5 #define TIE_NDX 6 #define TIE_STAFF 7 #define TIE_FOUND 8 #define TIE_FORCE 9 #define TIE_ARR_SZ 9 #define FIG_SNUM 1 #define FIG_HOFF1 2 #define FIG_HOFF2 3 #define FIG_READY 4 #define REG 1 #define GRACE 2 #define CUE 3 #define CUEGRACE 4 #define BM_SNUM 1 #define BM_CNT 2 #define BM_READY 3 #define BM_STEM 4 #define BM_TUPLE 5 #define BM_SIZE 6 #define SL_SNUM 1 #define SL_YSHIFT 2 #define SL_XSHIFT 3 #define SL_NEXTSNUM 4 #define SL_BEAMF 5 #define TU_SNUM 1 #define TU_Y1 2 #define TU_Y2 3 #define TU_FSTEM 4 #define TYPE 1 #define DIV 2 #define CLAVE 3 #define AX 4 #define NTYPE 5 #define DOT 6 #define TUPLE 7 #define STAFFLOC 8 #define SPACING 9 #define STEM_FLAGS 10 #define BEAM_FLAG 11 #define BEAM_CODE 12 #define LOCAL_XOFF 13 #define SUPER_FLAG 14 #define SLUR_FLAG 15 #define SUBFLAG_1 16 #define SUBFLAG_2 17 #define VIRT_NOTE 18 #define SORTPAR1 18 #define SORTPAR2 19 #define TEMP2 19 #define GLOBAL_XOFF 19 #define TEXT_INDEX 20 #define PASSNUM 21 #define BACKTIE 22 #define NOTE_DUR 23 #define DINC_FLAG 24 #define VIRT_STEM 25 #define ED_SUBFLAG_1 26 #define ED_SUBFLAG_2 27 #define STAFF_NUM 28 #define NUM_STAVES 28 #define MULTI_TRACK 29 #define TEMP1 30 #define SPN_NUM 30 #define OBY 31 #define SLUR_X 32 #define NODE_SHIFT 33 #define TSR_POINT 34 #define XTABLE_POINT 35 #define TS_SIZE 35 #define NUMBER_OF_FIG 3 #define FIG_SPACE 4 #define FIG_DATA 5 #define MIN_FIG_SPAC 20 #define FIG_DUR 23 #define SIGN_POS 3 #define SIGN_TYPE 4 #define SUPER_TYPE 5 #define FONT_NUM 6 #define WEDGE_OFFSET 7 #define TRACK_NUM 8 #define WEDGE_SPREAD 10 #define POSI_SHIFT1 11 #define ISOLATED 12 #define POSI_SHIFT2 13 #define TIME_NUM 3 #define DIVSPQ 3 #define CLEF_NUM 3 #define CLEF_FONT 4 #define TRANS_FLAG 5 #define CLEF_STAFF_POS 6 #define BAR_NUMBER 3 #define BAR_TYPE 4 #define REPEAT 5 #define BACK_ENDING 6 #define FORW_ENDING 7 #define BAR_FLAGS 8 #define M_NUMBER 10 #define REGULAR 1 #define HEAVY 2 #define DOTTED 3 #define DOUBLE_REG 5 #define REG_HEAVY 6 #define HEAVY_REG 9 #define DOUBLE_HEAVY 10 #define DOUBLE_DOTTED 15 #define WEDGES 1 #define DASHES 2 #define OCT_UP 3 #define OCT_DOWN 4 #define DBL_OCT_UP 5 #define DBL_OCT_DOWN 6 #define NORMAL_TRANS 13 #define NOTE 1 #define XNOTE 2 #define REST 3 #define CUE_NOTE 4 #define XCUE_NOTE 5 #define CUE_REST 6 #define GR_NOTE 7 #define XGR_NOTE 8 #define NOTE_OR_REST 8 #define FIGURES 9 #define BAR_LINE 10 #define SIGN 11 #define WORDS 12 #define MARK 13 #define CLEF_CHG 14 #define DESIGNATION 15 #define METER_CHG 16 #define DIV_CHG 17 #define AX_CHG 18 #define P_SUGGESTION 19 #define MUSICAL_DIR 11 #define IREST 12 #define BACKSPACE 13 #define SEGNO 1 #define PED 2 #define END_PED 3 #define LETTER_DYNAM 4 #define RIGHT_JUST_STR 5 #define CENTER_STR 6 #define LEFT_JUST_STR 7 #define TIE_TERM 8 /* TIE_TERM added &dA10-12-96&d@ #define BELOW 1 #define ABOVE 2 #define HEAD 0 #define TAIL 1 #define FULLSIZE 0 #define CUESIZE 1 #define THIRTY_SECOND 4 #define SIXTEENTH 5 #define EIGHTH 6 #define QUARTER 7 #define HALF 8 #define WHOLE 9 #define BREVE 10 #define SLASH8 0 #define UP 0 #define DOWN 1 #define SINGLE_NOTE 0 #define CHORD 1 #define NO_BEAM 0 #define END_BEAM 1 #define START_BEAM 2 #define CONT_BEAM 3 * Parametric Definitions #define MAX_STAFF 2 #define MAX_TIES 16 #define MAX_FIG 4 #define MAX_PASS 10 #define MAX_OBJECTS 1000 #define MAX_M 400 * Other Definitions #define DUMMY_VALUE 10000 #define INT1000000 1000000 #define INT10000 10000 #define INT9000 9000 #define BHPAR1 30 * More Definitions #define TOP_FLAG 0 #define BOTTOM_FLAG 1000000 #define SUPERSIZE 128 #define SUPERMAX 50 #define MAX_BNOTES 32 #define MAX_S2Z 20000 #define USE_REC 0 #define IGNORE_REC 1 #define LMARG 30 #define RMARG 1200 #define RMARGX 600 #define STRETCH 5/3 #define SOUROW1 25 #define SOUROW2 50 #define SOUROW3 75 #define SOUROW4 100 #define SOUROW5 125 #define SOUROW6 150 #define SOUROW7 175 #define SOUROW8 200 #define SOUROW9 225 #define SOUROW10 250 #define SOUROW11 275 #define SOUROW12 300 #define SOUROW13 325 #define SOUROW14 350 #define SOUROW15 375 #define SOUROW16 400 #define SUPEROW1 30 #define SUPEROW2 55 #define SUPEROL1 30 #define SUPEROL2 330 #define SUPEROL3 630 #define SUPEROL4 930 #define SOURCETAB 40 #define MSGTAB2 24 #define MSGTAB2A 144 #define MSGTAB2B 94 #define HLPHORIZ 600 #define HLPVERT 600 #define HLPTOP 30 #define HLPINC 25 #define SOUROW1X 15 #define SOUROW2X 27 #define SOUROW3X 39 #define SOUROW4X 51 #define SOUROW5X 63 #define SOUROW6X 75 #define SOUROW7X 87 #define SOUROW8X 99 #define SOUROW9X 111 #define SOUROW10X 123 #define SOUROW11X 135 #define SOUROW12X 147 #define SOUROW13X 159 #define SOUROW14X 171 #define SOUROW15X 183 #define SOUROW16X 195 #define SUPEROW1X 12 #define SUPEROW2X 24 #define SUPEROL1X 15 #define SUPEROL2X 165 #define SUPEROL3X 315 #define SUPEROL4X 465 #define SOURCETABX 20 #define MSGTAB2X 12 #define MSGTAB2AX 72 #define MSGTAB2BX 47 #define HLPHORIZX 300 #define HLPVERTX 260 #define HLPTOPX 14 #define HLPINCX 12 #define SUG_CASE 5 #define SUG_CLASS 3 #define SUG_POSI 16 * Include parameters *process D * str infiles.12(100),group.10 str file.100,out.280,line.180,temp.180,lib.30,temp2.160,temp3.160,temp4.160 str line2.180,slurstr.160,slurlet.1,slurover.80,slurunder.80 str inlib.100,outlib.100,outfile.100 str claves.7,numbers.10,accs.3 str note.4,jtype.1,codes.12 str ttext.80,msg.60,xbyte.2 str tcode.4(MAX_M),tdata.80(MAX_M) str sobl.50(30),tsdata.80(MAX_OBJECTS) str mname.60,tname.60,partname.80 str tsr.68(MAX_OBJECTS) int tv1(MAX_M),tv2(MAX_M),tv3(MAX_M),tv4(MAX_M) int tvar1,tvar2,tiecnt int supcnt,supnums(12) int mf(256),beampar(4,MAX_PASS,6),mf2(120) int multichk(3,MAX_PASS,MAX_STAFF) int tiearr(MAX_TIES,TIE_ARR_SZ),slurar(8,5),tuar(4,MAX_PASS,4) int figarr(MAX_FIG,4) int sitf,super_flag,slur_flag,subflag_1,subflag_2 int spc(255),nsp(33),claveax(50),measax(3,50) int zak(2,7),wak(9),hpar(200),vpar(200),bvpar(35),vpar20 int a,d,e,g,h,i,j,k,m,s,x,y,z int kk,prek int @a,@b,@c,@d,@e,@n,old@n int f1,f2,f3,f4,pmode int notesize,mtfont,twfont,beamfont,curfont,mdirfont int olddivspq,divspq int cline(MAX_STAFF),clef(MAX_STAFF),clave,key int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15 int save_a4 int c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15 int t1,t2,t3,t4 int x1,x2,y1,y2,z1,z2,z3 int olda1,unison_flag,sugg_flg int beamdata(4,MAX_PASS,31),beamcode(31) int passpar(MAX_PASS) int firstsp,tfirstsp,emptyspace(MAX_STAFF,45) int ts(MAX_OBJECTS,TS_SIZE) int sct,oldsct,maxsct,divpoint,mrest,measnum,totdiv,cuediv,mdiv,qflag int figdiv,esnum,smusdir(30,4) int tsnum(MAX_PASS),ctrarrf(MAX_PASS),try(MAX_PASS) int pre_tsnum(MAX_PASS),pre_ctrarrf(MAX_PASS),pre_try(MAX_PASS) int ntype,f8,inctype,jcode,pcode,nodtype,passtype,passsize,stem int firstoff,sigflag int oby,sobx,soby,sobcnt,snum int obx1,obx2,oby1,oby2 int c8flag(MAX_STAFF),transflag(MAX_STAFF),ctrflag,tuflag,passnum,chorddur,spn int mindist int tnum,tden,abflg,nstaves int ssize,scnt,debug_point int vflag,mcat,sflag,granddist,outpnt,first_outpnt,tword_height int note_dur int minshort int global_tpflag int tpflag,xposi_shift,yposi_shift int pcontrol,px,py,pyy int putobjpar int repeater_flag,repeater_flag2,repeater_case int chord_spread,mdir_offset bstr outslurs.8 label E(20),T(6),SS(21),PSUG(10),TPF(5),TPFF(5),ADJS(5) label R1(14) table X(MAX_S2Z),Y(30000) &dA &dA &d@ Variables added 6-19-93 for processing slurs &dA int profile(100,2) int sgroup(13,3),nsgroups int curvedata(8,4,8) int curve &dA &dA &d@ Variables added 5-27-93 for pseudo typesetting of simultaneous notes &dA int npasses,thispass,passcnt(MAX_PASS,3) int pitchcnt(10) int ndata(20,11) int pcnt int clashes(10,10) int tgroup(10),ntgroups int printpos(10) int ps_passcount(2) int gl(2,45),gr(2,45),oldgr(2,45) int pseudo_gr(2,45) int pseudo_gl(2,45) real r1,r2,r3,r4 &dA &dA &d@ Variables added 4-27-94 for determining text position &dA int ttextcnt str ttextarr.80(6) str xbytearr.2(6) &dA &dA &d@ Variables added 6-08-94 for working or repeaters &dA str chord_tones.4(10) int chordsize,last_chordsize,chordsize2 int checkoff(10) * int autop,obx,dv1,dv2,dv3,dv4 &dA &dA &d@ Variables added 9-27-96 for controlling position of rests &dA int restplace,restplace2 &dA &dA &d@ Variables added 10-01-94 for editing and display &dA int list_order(MAX_S2Z,3) int scnt_start,tv5(MAX_M),tvar5,pre_scnt int s2_to_ifile(MAX_S2Z) int ifile_to_s2(MAX_S2Z) int s2rec,start_s2rec,start_outpnt &dA &d@ variables added to make music construction work str messages.80(40),sub_def.30(255),obj_def.30(15),super_def.30(12) str tiefile.80(4) str sbeamcode.6(MAX_BNOTES) str cmode.1,newcmode.1 int dhpar(59),dvpar(45),expar(8),mkpvpar41 int fontmap(100),music_con(255) int pos(223),underspc,hyphspc int q(12),beamext(435,12),dtiearr(4,162,12) int backloc,uxstart,uxstop,nuxstop,buxstop,underflag int sp,sq,syslen int tspan,sitflag int stemchar,beamh,beamt,qwid int f9,f5,f11,f12 int tupldata(7),tbflag int superdata(SUPERMAX,SUPERSIZE),supermap(SUPERMAX),superpnt(SUPERMAX) int bthick int aa1,aa2,aa3,aa4,aa5,aa6,aa7,aa8,aa9,aa10,aa11,aa12 int cc1,cc2,cc3,cc4,cc5,cc6,cc7 int dstem,addcurve,con3,con4 int postx,posty int vst,dbeamdata(MAX_BNOTES,2) int bcount,start_beam(2),stop_beam(2) int horiz_shift,firstx,lastx,display_flag int sysy,Y_point,sysx &dA &d@ variables added to make screen display work #if SMALL str gstr.400000 str genmsgstr.2250 str msgstr.10000 str redmsgstr.10000 str bluemsgstr.10000 str msgstr2.3000 str redmsgstr2.3000 str helpmsgstr.12000 str supermsgstr.2500 #else str gstr.1600000 str genmsgstr.9000 str msgstr.40000 str redmsgstr.40000 str bluemsgstr.40000 str msgstr2.12000 str redmsgstr2.12000 str helpmsgstr.42000 str supermsgstr.10000 #endif int FA(97000) int activefont int xco, yco int xze, yze str zline.80 int curdist int altflag int revmap(400) int scx,scy,scf,scb int slur_edit_flag bstr bt.2500(250) bstr dotted.2500 int gapsize bstr cycle.200 str curdata.30(20) int CURSOR(25) bstr tbstr.800 str curstr.200 int xcur, ycur,x2cur,y2cur,acur,bcur int rmarg int source_row(16) str current_line.60(16),new_line.60(16) str gline.360 int start_Y_point,last_Y_point,save_Y_point int save_X_point str current_def.80,new_def.80,current_iline.80,new_iline.80 str notecode.4,supermsg.50(8) int s2marks(1000,4),markcnt,save_markcnt int message_row(4),supermsgrow(2),supermsgcol(4),superignore(8) int addrec,pan_resume,backup_pan_resume int font_changes(10,2),changecnt,ignorecnt,ignoreset int slur_inventory(5000,2),slur_incnt int newk,helpscreen int helpscrnum,helprows int jump_mnum,active_clef,active_clef_change,old_active_clef int vsugg(SUG_CASE,SUG_CLASS,SUG_POSI) &dA &d@ Macros int macros(8,100) int macropnt(8) &dA &d@ help str hlpx.72(30,16) str hlp03a.55(7),hlp03b.55(6),hlp03c.55(6) str hlp10.80(5),hlp12.70(29) int helptop,helpinc int hlpxpos,hlpypos int hlpxz,hlpyz int m_number &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA³ Description of arrays not described elsewhere ³&d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ &dA &dA &d@ Description of tiearr(MAX_TIES,TIE_ARR_SZ) &dA &dA &d@ This is an array for collecting information on ties. The &dA &d@ program allows up to MAX_TIES such simultaneous ties (first &dA &d@ dimension of the array). The second dimension contains the &dA &d@ following attributes: &dA &dA &d@ tiearr(TIE_SNUM) = super-object number for this tie &dA &d@ tiearr(TIE_NTYPE) = note type: 1 = note, 2 = xnote, 4 = cue, 5 = xcue, etc. &dA &d@ tiearr(TIE_VLOC) = location on staff of tied notes &dA &d@ tiearr(TIE_FHDIS) = horizontal displacement of first note &dA &d@ head from its object (chords only) &dA &d@ tiearr(TIE_FSTEM) = stem flag for first note &dA &d@ tiearr(TIE_NDX) = ts() index for first note in tie &dA &d@ tiearr(TIE_STAFF) = staff number (0 or 1) for first note in tie &dA &d@ tiearr(TIE_FOUND) = tie found flag &dA &d@ tiearr(TIE_FORCE) = tie force flag &dA &dA &d@ Note: It can happen that a note is tied in both directions &dA &d@ out of the measure (e.g. pedal points). In this situation, we &dA &d@ will need to use the information in the old tiearr before &dA &d@ constructing a new one. Since we cannot deposit the tie &dA &d@ super-object until we have deposited the terminating note &dA &d@ object, and since we cannot deposit this note object without &dA &d@ knowing the new super-object number for the forward tie, we must &dA &d@ increment snum and store this number somewhere before writing &dA &d@ out the note object. We will use tv4(.) to store this number. &dA &d@ This also has a baring on how ties are handled within the &dA &d@ measure. When a tie flag is encountered, snum is incremented &dA &d@ and stored in tv4(.). tv4(.) is filled with ties from the top &dA &d@ note down. After any backward ties are dealt with, a free slice &dA &d@ of tiearr is identified and filled. The pointer to this slice &dA &d@ of tiearr may be put in ts(22) (after old ties are taken care &dA &d@ of). If the other end of this tie is encountered within the &dA &d@ measure (as determined by ts(22)), then the information in &dA &d@ tiearr is used with current information to construct the &dA &d@ super-object. &dA &dA &dA &d@ Description of figarr(MAX_FIG,4) &dA &dA &d@ This is an array for collecting information on continuation &dA &d@ lines for figures. The program allows up to MAX_FIG figures, and &dA &d@ each of these levels may have a continuation line. The first &dA &d@ dimension is therefore MAX_FIG; the highest level is 1 and the &dA &d@ lowest level is MAX_FIG. (In this version 3.0, MAX_FIG is 4) &dA &d@ The second dimension contines the following attributes: &dA &dA &d@ figarr(FIG_SNUM) = super-object number for this continuation &dA &d@ figarr(FIG_HOFF1) = horizontal off-set from first object &dA &d@ figarr(FIG_HOFF2) = horizontal off-set from second object &dA &d@ figarr(FIG_READY) = completion flag: set = array completed &dA &dA &dA &d@ Description of beamdata(4,MAX_PASS,31) &dA &dA &d@ Note: At the moment, there is a structural reason why the third &dA &d@ dimension of beamdata cannot exceed 31. This is because &dA &d@ beampar(.,.,BM_STEM) stores stem directions as bits. &dA &dA &d@ This is an array for collecting information on the beams that &dA &d@ connect notes together. The first dimension tells whether this &dA &d@ information is for (1) regular notes, (2) grace notes to regular &dA &d@ notes, (3) cue notes, or (4) grace notes to cue notes. The &dA &d@ second dimension tells the pass number for this beam. The &dA &d@ third dimension contains the beamcodes for the various notes &dA &d@ under the beam. &dA &dA &d@ The beamcode is a number between 1 and 666661. It describes the &dA &d@ structure of the beam for this note/chord. This version (3.0) of &dA &d@ the program supports beams up to 256th notes. The ones column of &dA &d@ the beamcode is for eighth notes, the tens column for sixteenth &dA &d@ notes, etc. The digits have the following meaning: &dA &dA &d@ 1 = continued beam &dA &d@ 2 = begin beam &dA &d@ 3 = end beam &dA &d@ 4 = forward hook &dA &d@ 5 = backward hook &dA &d@ 6 = repeater character &dA &d@ 7 = begin repeated beam &dA &d@ 8 = end repeated beam &dA &dA &dA &d@ Description of beampar(4,MAX_PASS,6) &dA &dA &d@ In addition to beamdata, there are six other parameters &dA &d@ related to beams. These parameters are represented in the &dA &d@ array beampar as follows: &dA &dA &d@ beampar(BM_SNUM) = super-object number for the beam &dA &d@ beampar(BM_CNT) = note counter for beam &dA &d@ beampar(BM_READY) = flag that signals that a beam is complete &dA &d@ and should be put out. &dA &d@ beampar(BM_STEM) = stem flags for notes under beam &dA &d@ beampar(BM_TUPLE) = tuplet flag, which relates to the beam &dA &d@ in the following ways: &dA &d@ a. BM_TUPLE is set to (1 + stem) when the first note of &dA &d@ a beam is a tuplet &dA &d@ b. BM_TUPLE must be cleared after a beam is processed &dA &d@ c. if processing a beam, if BM_TUPLE is > 0 and if &dA &d@ end of tuplet bit is set, then process tuplet &dA &d@ with this beam (i.e. use no bracket and put &dA &d@ tuplet number over the beam in the middle. &dA &d@ &dA &d@ beampar(BM_SIZE) = size of beam (full size vs. cue size) &dA &dA &d@ Description of slurar(8,5) &dA &dA &d@ This is an array for collecting information on slurs between &dA &d@ two notes. This program allows up to four simultaneous slurs, &dA &d@ and four dotted slurs (hence the first dimension = 8). The &dA &d@ second dimension contains the following elements: &dA &dA &d@ slurar(SL_SNUM) = super-object number for this slur &dA &d@ slurar(SL_YSHIFT) = shift in y co-ordinate of the first &dA &d@ note of the slur &dA &d@ slurar(SL_XSHIFT) = shift in x co-ordinate of the first &dA &d@ note of the slur &dA &d@ slurar(SL_NEXTSNUM) = super-object number for next slur &dA &d@ (or zero) &dA &d@ slurar(SL_BEAMF) = beam flag: 0 = slur does not start on a beam &dA &d@ 1 = slur starts on a stem-up beam &dA &d@ 2 = slur starts on a stem-down beam &dA &dA &d@ Note: There are some similarities between the handling of &dA &d@ ties and the handling of slurs. It can happen that a note will &dA &d@ have one or more slurs ending and/or starting on it. In this &dA &d@ case, as in the case of ties, the terminating super-objects &dA &d@ cannot be written until the object is written, and the object &dA &d@ cannot be written until the super-object numbers for the new &dA &d@ slurs are known. This means that we must establish these &dA &d@ numbers and save them before destroying the contents of the &dA &d@ slurar for the old slurs. This is the purpose for the NEXTSNUM &dA &d@ element in slurar. It is the super-object number for a forward &dA &d@ slur. After the backward slur is written, and at the time the &dA &d@ new elements of slurar are to be written, this number is moved &dA &d@ from slurar(SL_NEXTSNUM) to slurar(SL_SNUM). &dA &dA &dA &d@ Description of tuar(4,MAX_PASS,4) &dA &dA &d@ This is an array for collecting information on tuplet groups. &dA &d@ The first dimension tells whether this information is for &dA &d@ (1) regular notes, (2) grace notes to regular notes, (3) cue &dA &d@ notes, or (4) grace notes to cue notes. The second dimension &dA &d@ tells the pass number for this tuplet group. The elements of &dA &d@ the third dimension are as follows: &dA &dA &d@ tuar(TU_SNUM) = super-object number &dA &d@ tuar(TU_Y1) = y co-ordinate of the first object &dA &d@ tuar(TU_Y2) = y co-ordinate of the terminating note &dA &d@ head of the first object &dA &d@ tuar(TU_FSTEM) = bits 0-7: stem flag of the first note &dA &d@ bits 8-15: bracket flags (0 = no bracket) &dA &dA &d@ Note: Since it is not possible for a note to belong to two &dA &d@ tuplet groups at once, we do not have the problem present in &dA &d@ ties and slurs. There is a short-cut to processing that has been &dA &d@ mentioned in connection with beams, and which should be mentioned &dA &d@ here also. At processing time (when tuplet process bit is set), &dA &d@ we should check to see if beampar(.,.,BM_TUPLE) for this pass &dA &d@ is set. If it is, then we should do nothing; the tuplet will &dA &d@ be processed along with the beam and without a bracket. If &dA &d@ beampar(.,.,BM_TUPLE) is clear, then we must process the tuplet &dA &d@ using a bracket. &dA &dA &d@ Handling of the long trill &dA &dA &d@ The long trill is a simple super-object. However, there may &dA &d@ be several long trills in a measure-group. Therefore we need to &dA &d@ store this information for each pass. &dA &dA &d@ Let us assume up to MAX_PASS passes. Then each of the parameters &dA &d@ associated with long trills (tsnum, ctrflag, and try) will be a one &dA &d@ dimentional array type variable. &dA &dA &d@ The parameters associated with long trills are as follows: &dA &dA &d@ tsnum(.) = super-object number of long trill (0 = no &dA &d@ long trill present) &dA &d@ &dA &d@ ctrarrf(.) = situation flag 1 = no "tr" before long ~~~ &dA &d@ 2 = "tr" start, no accidental &dA &d@ 3 = "tr" start, with sharp &dA &d@ 4 = "tr" start, with natural &dA &d@ 5 = "tr" start, with flat &dA &dA &d@ try(.) = vertical displacement from associated object &dA &dA &d@ To deal with the case of overlapping trills (one long trill ends &dA &d@ where the next begins), we have introduced the arrays: &dA &dA &d@ pre_tsnum(.) = prelimary storage for tsnum(.) &dA &d@ pre_ctrarrf(.) = prelimary storage for ctrarrf(.) &dA &d@ pre_try(.) = prelimary storage for try(.) &dA &dA &d@ for storing temporarily the associated values of tsnum, ctrarrf &dA &d@ and try. &dA &dA &dA &d@ Description of smusdir(30,4) &dA &dA &d@ There are actually 6 musical direction super-objects: wedges, &dA &d@ dashes, octave-up transposition, octave-down transposition, 15-up &dA &d@ transposition, and 15-down transposition. We may encounter these &dA &d@ in any one of up to 5 passes. Therefore the first dimension is &dA &d@ (super-object type - 1) * 5 + pass-number. If there is no pass &dA &d@ number, then the first available row starting at 1 will be used &dA &d@ (i.e., assume pass 1 first, then pass 2, etc.). If the row for &dA &d@ a particular pass is in use, then use the next higher one, etc. &dA &d@ If no rows are available, this should halt the program. &dA &dA &d@ Desciption of the second element: &dA &dA &d@ smusdir(.,1) = snum (0 = inactive, > 0 = active) &dA &d@ smusdir(.,2) = spread (Wedges) &dA &d@ = word space (Dashes) &dA &d@ = 0 (Oct-up) &dA &d@ = 1 (Oct-down) &dA &d@ = 2 (15-up) &dA &d@ = 3 (15-down) &dA &d@ smusdir(.,3) = offset (Wedges) &dA &d@ = font number (Dashes) &dA &d@ = x-offset (Transpositions) &dA &d@ smusdir(.,4) = vertical offset from top of staff &dA &dA &d@ Vertical Parameters vpar(.) &dA &d@ ------------------- &dA &dA &d@ vpar(1) = one vertical note space &dA &d@ vpar(2) = two " " spaces &dA &d@ vpar(3) = three " " " &dA &d@ vpar(4) = four " " " &dA &d@ vpar(5) = five " " " &dA &d@ vpar(6) = six " " " &dA &d@ vpar(7) = seven " " " &dA &d@ vpar(8) = eight " " " &dA &d@ vpar(9) = nine " " " &dA &d@ vpar(10) = ten " " " &dA &d@ vpar(11) = vertical shift for printing multiple rest ends &dA &d@ vpar(12) = vertical correction of dot position, if on staff line &dA &d@ vpar(13) = height parameter for beams &dA &d@ vpar(14) = shift in height for multiple beams &dA &d@ vpar(15) = cutoff of severe up-down pattern under beam &dA &d@ vpar(16) = vertical space between beams &dA &d@ vpar(17) = fudge factor for two/more slanted beams on staff lines &dA &d@ vpar(18) = fudge factor for one slanted beam on staff lines &dA &d@ vpar(19) = maximum rise allowed for beam on one staff line &dA &d@ vpar(20) = minimum rise allowed for beam crossing two staff lines &dA &d@ vpar(21) = minimum rise allowed for beam crossing 3 staff lines &dA &d@ vpar(22) = vertical shift for printing hooks and beams &dA &d@ vpar(23) = shift down for printing italic 8 under treble clef &dA &d@ vpar(24) = minimum stem length that triggers adding to 16th stem &dA &dA &d@ vpar(31) = vertical shift for printing add-flags &dA &d@ vpar(32) = (un-used) &dA &d@ vpar(33) = first level of time words &dA &d@ vpar(34) = (un-used) &dA &d@ vpar(35) = (un-used) &dA &d@ vpar(36) = vertical shift for printing grace size add-flags &dA &d@ vpar(37) = adjustment f/raising 16th beams because of short stems &dA &d@ vpar(38) = minimum for sum of two stems under 2-note beam &dA &d@ vpar(39) = amount to extend stems under 2-note beam (s. vpar(38)) &dA &d@ vpar(40) = height of horizontal ending lines &dA &dA &d@ vertical parameters (continued) vpar(.) &dA &dA &d@ vpar(41) = length of vertical hooks on ending lines &dA &d@ vpar(43) = height of signet sign above staff lines &dA &d@ vpar(44) = height above staff for words, wedges &dA &d@ vpar(45) = height below staff for words, wedges &dA &d@ vpar(46) = height above staff for 8ve &dA &d@ vpar(47) = height below staff for 8ve &dA &d@ vpar(48) = height of figures &dA &d@ vpar(49) = position of first figure &dA &d@ vpar(50) = height of spiccato character &dA &d@ vpar(51) = height of horizontal ~~~~ &dA &d@ vpar(52) = height of turn &dA &d@ vpar(53) = height of tr. trill character &dA &d@ vpar(54) = height of shake &dA &d@ vpar(55) = height of mordent &dA &d@ vpar(56) = height of accidental over ornament &dA &d@ vpar(57) = height of horizontal accent &dA &d@ vpar(58) = height of vertical accent &dA &d@ vpar(59) = height of harmonic character &dA &d@ vpar(60) = height of thumb position character &dA &d@ vpar(61) = height of down bow &dA &d@ vpar(62) = height of up bow &dA &d@ vpar(63) = height of fermata &dA &d@ vpar(64) = height of tuplet number &dA &d@ vpar(65) = vertical shift for adding sixteenth grace rest flag &dA &d@ vpar(66) = default distance between staves of grand staff &dA &d@ vpar(67) = amount to length flag stem with repeater if note is on a space (stem up) &dA &d@ vpar(68) = amount to length flag stem with repeater if note is on a line (stem up) &dA &d@ vpar(69) = location for first repeater on flag stem if note is on a space (stem up) &dA &d@ vpar(70) = location for first repeater on flag stem if note is on a line (stem up) &dA &d@ vpar(71) = amount to length flag stem with 2 repeaters if note is on a space (stem down) &dA &d@ vpar(72) = amount to length flag stem with >2 repeaters if note is on a space (stem down) &dA &d@ vpar(73) = amount to length flag stem with 2 repeaters if note is on a line (stem down) &dA &d@ vpar(74) = amount to length flag stem with >2 repeaters if note is on a line (stem down) &dA &d@ vpar(75) = location for first repeater on flag stem if note is on a space (stem down) &dA &d@ vpar(76) = location for first repeater on flag stem if note is on a line (stem down) &dA &d@ vpar(77) = maximum absolute stopping point for quarter stem with repeater (stem up) &dA &d@ vpar(78) = mimimum absolute stopping point for quarter stem with repeater (stem down) &dA &d@ vpar(79) = slight lengthening of quarter stem with repeater &dA &d@ vpar(80) = more extra lengthening of quarter stem with one repeater &dA &d@ vpar(81) = location of first repeater on quarter stem &dA &d@ vpar(82) = location of tuple number above note or quarter stem with repeaters &dA &d@ vpar(83) = location of tuple number above eight stem with repeaters &dA &dA &dA &dA &dA &d@ vpar(101) = vertical displacement to first line of text &dA &dA &dA &d@ Horizontal Parameters hpar(.) &dA &d@ --------------------- &dA &dA &d@ hpar(1) = shift following accidental natural &dA &d@ hpar(2) = shift following accidental sharp &dA &d@ hpar(3) = shift following accidental flat &dA &d@ hpar(4) = minimum distance between notes &dA &d@ dotted note to note ratio = 12 / 10 &dA &d@ triplet note to note ratio = 9 / 10 &dA &d@ double note to note ratio = 13 / 10 &dA &d@ (cf. determine spacing) &dA &d@ hpar(5) = distance from beginning of staff lines to 1st character &dA &d@ hpar(6) = shift following accidental natural-sharp &dA &d@ hpar(7) = shift following accidental natural-flat &dA &d@ hpar(8) = shift after big clef sign &dA &d@ hpar(9) = shift following sharp or natural in key signature &dA &d@ hpar(10) = shift following accidental double sharp &dA &d@ hpar(11) = shift following flat in key signature &dA &d@ hpar(12) = shift after key signature &dA &d@ hpar(13) = shift if no key signature or key change &dA &d@ hpar(14) = shift following common or cut time signature &dA &d@ hpar(15) = shift following accidental double flat &dA &d@ hpar(16) = shift to middle of double digit time signature &dA &d@ hpar(17) = shift to middle of single digit time signature &dA &d@ hpar(18) = shift after time signature &dA &d@ hpar(19) = shift for printing staccato and spiccato &dA &d@ hpar(20) = shift for large number &dA &d@ hpar(21) = half shift for large number &dA &d@ hpar(22) = shift before printing multiple rest &dA &d@ hpar(23) = shift after printing multiple rest &dA &d@ hpar(24) = shift before printing whole measure rest &dA &d@ hpar(25) = shift for complete whole measure rest &dA &d@ hpar(26) = space taken up by up flag &dA &d@ hpar(27) = extra shift for dot under flag &dA &d@ hpar(28) = extra shift after note with stem-up flag &dA &d@ hpar(29) = minimum separation between previous object and accidental &dA &d@ hpar(30) = shift for dot after half or whole rest &dA &d@ hpar(31) = shift for dot after quarter or smaller rest &dA &d@ hpar(32) = shift for dot after whole note or larger &dA &d@ hpar(33) = shift for dot after half note or smaller note &dA &d@ hpar(34) = horizontal correction of dot position, if on staff line &dA &d@ hpar(35) = minimum space following projecting flag &dA &d@ hpar(36) = space before bar line &dA &d@ hpar(37) = space after bar line &dA &d@ hpar(38) = length of beam hook character &dA &d@ hpar(39) = placement of movement word &dA &d@ hpar(40) = shift for the first natural/flat of a double accidental &dA &d@ hpar(41) = gap between ending line and measure line &dA &d@ hpar(42) = gap between end of long trill and next object &dA &d@ hpar(43) = distance between repeat sign and bar line &dA &d@ hpar(44) = space between light bar and light bar &dA &d@ hpar(45) = space between heavy bar and light bar, or light bar and heavy bar, or two heavy bars &dA &d@ hpar(46) = space between end of wedge and dynamic &dA &d@ hpar(47) = space between end of 8ve and next object &dA &d@ hpar(48) = space between end of continuation and bar line &dA &d@ hpar(49) = space add to left side of note heads to further separate them &dA &d@ from previous objects (implemented, because the separation &dA &d@ of hpar(29) alone is not enough between note heads) &dA &dA &d@ hpar(51) = width of quarter note (approximately) &dA &d@ hpar(52) = shift of small italic 8 for octave treble clef &dA &d@ hpar(53) = approximate width of grace note &dA &d@ hpar(54) = right shift for adding sixteenth rest flag &dA &d@ hpar(55) = not used &dA &d@ hpar(56) = length of standard beam character &dA &d@ hpar(57) = back shift before concatination character &dA &d@ hpar(58) = (not used) &dA &d@ hpar(59) = back shift before last "__" of continuous underline &dA &d@ hpar(60) = width of dynamic letter p &dA &d@ hpar(61) = width of dynamic letter m &dA &d@ hpar(62) = width of dynamic letter f &dA &d@ hpar(63) = width of dynamic letter s &dA &d@ hpar(64) = width of dynamic letter z &dA &d@ hpar(65) = width of dynamic letter r &dA &d@ hpar(66) = width of number figure &dA &d@ hpar(67) = width of small plus figure &dA &d@ hpar(68) = width of small x figure &dA &d@ hpar(69) = width of two-plus figure &dA &d@ hpar(70) = width of figured sharp &dA &d@ hpar(71) = width of four-plus figure &dA &d@ hpar(72) = width of five-plus figure &dA &d@ hpar(73) = width of six-slash figure &dA &d@ hpar(74) = width of seven-slash figure &dA &d@ hpar(75) = width of figured natural &dA &d@ hpar(76) = width of figured flat &dA &d@ hpar(77) = overlap if figure continuation line &dA &d@ hpar(78) = right shift if slur interferes with stem &dA &d@ hpar(79) = actual thickness of light bar line &dA &d@ hpar(80) = thickness of dot &dA &d@ hpar(81) = actual thickness of heavy bar line &dA &d@ hpar(82) = width of black note (for typesetting) &dA &d@ hpar(83) = width of whole note (for typesetting) &dA &d@ hpar(84) = width of breve note (for typesetting) &dA &d@ hpar(85) = space between stems (for typesetting) &dA &d@ hpar(86) = width of big clef sign (approximate) &dA &d@ hpar(87) = width of whole rest and half rest &dA &d@ hpar(88) = width of quarter rest and eight rest &dA &d@ hpar(89) = right shift for adding sixteenth grace rest flag &dA &d@ hpar(90) = width of stem &dA &d@ hpar(91) = shift to second dot of double dot &dA &d@ hpar(92) = width of common and cut time glyph &dA &d@ hpar(93) = width of bar line &dA &d@ hpar(94) = minimum extra shift, when accidental occurs on note of minimum space &dA &d@ hpar(95) = "chip" off of note shape &dA &d@ hpar(96) = width of heavy bar line &dA &d@ hpar(97) = standard spacing between grace notes &dA &d@ hpar(98) = amount by which repeater protrudes from stem &dA &d@ hpar(99) = offset of repeater for eighth notes (stem up) &dA &d@ hpar(100) = offset of repeater for eighth notes (stem down) &dA &d@ hpar(101) = offset of repeater for quarter notes (stem down) &dA &d@ hpar(102) = offset for printing tuple number above stem with repeater &dA &d@ hpar(103) = offset for printing tuple number above note with repeater &dA &d@ hpar(104) = back shift for printing two tuple numbers &dA &d@ hpar(105) = forward shift for printing second of two tuple numbers &dA &dA &dA &d@ Vertical parameters &dA &d@ ------------------- &dA &dA &d@ loop for i = 1 to 10 &dA &d@ vpar(i) = i * 8 &dA &d@ repeat &dA &d@ vpar(11) = 4 &dA &d@ vpar(12) = 7 &dA &d@ vpar(13) = 42 &dA &d@ vpar(14) = 7 &dA &d@ vpar(15) = 30 &dA &d@ vpar(16) = 13 &dA &d@ vpar(17) = 6 &dA &d@ vpar(18) = 9 &dA &d@ vpar(19) = 7 &dA &d@ vpar(20) = 22 &dA &d@ vpar(21) = 27 &dA &d@ vpar(22) = 4 &dA &d@ vpar(23) = 64 &dA &d@ vpar(24) = 40 &dA &dA &d@ loop for i = 1 to 24 &dA &d@ vpar(i) = vpar(i) * notesize / 16 &dA &d@ repeat &dA &dA &d@ vpar(31) = 14 * notesize + 8 / 16 &dA &d@ vpar(32) = 0 /* was 8 &dA &d@ vpar(33) = 5 * notesize / 3 &dA &d@ vpar(34) = 0 /* was 121 &dA &d@ vpar(35) = 0 /* was 15 &dA &d@ vpar(36) = 12 * notesize + 6 / 16 &dA &d@ vpar(37) = 3 * notesize - 8 / 16 &dA &d@ vpar(38) = 84 * notesize / 16 &dA &d@ vpar(39) = 15 * notesize / 16 &dA &d@ vpar(40) = 3 * notesize &dA &d@ vpar(41) = 3 * notesize / 2 &dA &d@ vpar(43) = 5 * notesize / 2 &dA &d@ vpar(44) = 5 * notesize / 2 &dA &d@ vpar(45) = 8 * notesize &dA &d@ vpar(46) = 4 * notesize &dA &d@ vpar(47) = 10 * notesize &dA &d@ vpar(48) = 3 * notesize / 2 &dA &d@ vpar(49) = 7 * notesize &dA &d@ vpar(50) = notesize &dA &d@ vpar(51) = notesize &dA &d@ vpar(52) = 5 * notesize / 4 &dA &d@ vpar(53) = 2 * notesize &dA &d@ vpar(54) = 5 * notesize / 4 &dA &d@ vpar(55) = 3 * notesize / 2 &dA &d@ vpar(56) = 4 * notesize / 3 &dA &d@ vpar(57) = 3 * notesize / 2 &dA &d@ vpar(58) = 3 * notesize / 2 &dA &d@ vpar(59) = 3 * notesize / 2 &dA &d@ vpar(60) = 3 * notesize / 2 &dA &d@ vpar(61) = 3 * notesize / 2 &dA &d@ vpar(62) = 9 * notesize / 4 &dA &d@ vpar(63) = 2 * notesize &dA &d@ vpar(64) = 3 * notesize / 2 &dA &d@ vpar(65) = 11 (for notesize 14) 4 (for notesize 6) &dA &d@ vpar(66) = 10 * notesize &dA &d@ vpar(67) = 8 (for notesize 14) &dA &d@ vpar(68) = 5 (for notesize 14) &dA &d@ vpar(69) = 21 (for notesize 14) &dA &d@ vpar(70) = 18 (for notesize 14) &dA &d@ vpar(71) = 2 (for notesize 14) &dA &d@ vpar(72) = 1 (for notesize 14) &dA &d@ vpar(73) = 6 (for notesize 14) &dA &d@ vpar(74) = 5 (for notesize 14) &dA &d@ vpar(75) = 21 (for notesize 14) &dA &d@ vpar(76) = 17 (for notesize 14) &dA &d@ vpar(77) = 19 (for notesize 14) &dA &d@ vpar(78) = 24 (for notesize 14) &dA &d@ vpar(79) = 2 (for notesize 14) &dA &d@ vpar(80) = 1 (for notesize 14) &dA &d@ vpar(81) = 19 (for notesize 14) &dA &d@ vpar(82) = 17 (for notesize 14) &dA &d@ vpar(83) = 33 (for notesize 14) &dA &dA &d@ vpar(101) = 101 &dA &dA &d@ Horizontal parameters &dA &d@ --------------------- &dA &dA &d@ hpar(1) = 17 &dA &d@ hpar(2) = 21 &dA &d@ hpar(3) = 18 &dA &d@ hpar(4) = 34 &dA &d@ hpar(5) = 6 &dA &d@ hpar(6) = 38 &dA &d@ hpar(7) = 35 &dA &d@ hpar(8) = 60 &dA &d@ hpar(9) = 18 &dA &d@ hpar(10) = 24 &dA &d@ hpar(11) = 15 &dA &d@ hpar(12) = 19 &dA &d@ hpar(13) = 4 &dA &d@ hpar(14) = 55 &dA &d@ hpar(15) = 35 &dA &d@ hpar(16) = 25 &dA &d@ hpar(17) = 11 &dA &d@ hpar(18) = 33 &dA &d@ hpar(19) = 10 &dA &d@ hpar(20) = 24 &dA &d@ hpar(21) = 12 &dA &d@ hpar(22) = 10 &dA &d@ hpar(23) = 30 &dA &d@ hpar(24) = 30 &dA &d@ hpar(25) = 110 &dA &d@ hpar(26) = 15 &dA &d@ hpar(27) = 12 &dA &d@ hpar(28) = 5 &dA &d@ hpar(29) = 9 &dA &d@ hpar(30) = 36 &dA &d@ hpar(31) = 24 &dA &d@ hpar(32) = 37 &dA &d@ hpar(33) = 29 &dA &d@ hpar(34) = 2 &dA &d@ hpar(35) = 44 &dA &d@ hpar(36) = 5 &dA &d@ hpar(37) = 25 &dA &d@ hpar(38) = 18 &dA &d@ hpar(39) = 80 &dA &d@ hpar(40) = 17 &dA &d@ hpar(41) = 10 &dA &d@ hpar(42) = 32 &dA &d@ hpar(43) = 15 &dA &d@ hpar(46) = 20 &dA &d@ hpar(47) = 14 &dA &d@ hpar(48) = 30 &dA &d@ hpar(49) = 3 &dA &dA &d@ loop for i = 1 to 50 &dA &d@ hpar(i) = hpar(i) * notesize / 16 &dA &d@ repeat &dA &dA &d@ hpar(44) = 6 (for notesize = 14) &dA &d@ hpar(45) = 5 (for notesize = 14) &dA &dA &d@ hpar(51) = 18 * notesize + 8 / 16 &dA &d@ hpar(52) = 7 * notesize + 2 / 7 &dA &d@ hpar(53) = 13 * notesize + 2 / 16 &dA &d@ hpar(54) = 4 &dA &d@ hpar(55) = 0 /* not used, formerly 80 &dA &d@ hpar(56) = 30 &dA &d@ hpar(57) = 3 &dA &d@ hpar(58) = 0 (not used) &dA &d@ hpar(59) = 0 (not used) &dA &d@ hpar(60) = 23 (for notesize 14) &dA &d@ hpar(61) = 25 (for notesize 14) &dA &d@ hpar(62) = 19 (for notesize 14) &dA &d@ hpar(63) = 12 (for notesize 14) &dA &d@ hpar(64) = 18 (for notesize 14) &dA &d@ hpar(65) = 15 (for notesize 14) &dA &d@ hpar(66) = 15 (for notesize 14) &dA &d@ hpar(67) = 13 (for notesize 14) &dA &d@ hpar(68) = 13 (for notesize 14) &dA &d@ hpar(69) = 22 (for notesize 14) &dA &d@ hpar(70) = 11 (for notesize 14) &dA &d@ hpar(71) = 22 (for notesize 14) &dA &d@ hpar(72) = 22 (for notesize 14) &dA &d@ hpar(73) = 20 (for notesize 14) &dA &d@ hpar(74) = 14 (for notesize 14) &dA &d@ hpar(75) = 9 (for notesize 14) &dA &d@ hpar(76) = 11 (for notesize 14) &dA &d@ hpar(77) = 3 * notesize / 2 &dA &d@ hpar(78) = 4 * notesize / 3 &dA &d@ hpar(79) = 2 (for notesize 14) &dA &d@ hpar(80) = 6 (for notesize 14) &dA &d@ hpar(81) = 7 (for notesize 14) &dA &d@ hpar(82) = 19 (for notesize 14) &dA &d@ hpar(83) = 24 (for notesize 14) &dA &d@ hpar(84) = 28 (for notesize 14) &dA &d@ hpar(85) = 6 (for notesize 14) &dA &d@ hpar(86) = 38 (for notesize 14) &dA &d@ hpar(87) = 27 (for notesize 14) &dA &d@ hpar(88) = 15 (for notesize 14) &dA &d@ hpar(89) = 3 (for notesize 14) &dA &d@ hpar(90) = 2 (for notesize 14) &dA &d@ hpar(91) = 13 (for notesize 14) &dA &d@ hpar(92) = 25 (for notesize 14) &dA &d@ hpar(93) = 2 (for notesize 14) &dA &d@ hpar(94) = hpar(2) >> 2 (4 for notesize 14) &dA &d@ hpar(95) = hpar(85) + hpar(90) >> 1 (4 for notesize 14) &dA &d@ hpar(96) = 7 (for notesize 14) &dA &d@ hpar(97) = 21 (for notesize 14) &dA &d@ hpar(98) = 11 (for notesize 14) &dA &d@ hpar(99) = 1 (for notesize 14) &dA &d@ hpar(100) = hpar(82) - hpar(99) &dA &d@ hpar(101) = hpar(82) - hpar(90) &dA &d@ hpar(102) = 10 (for notesize 14) &dA &d@ hpar(103) = 2 (for notesize 14) &dA &d@ hpar(104) = 9 (for notesize 14) &dA &d@ hpar(105) = 17 (for notesize 14) &dA &dA &d@ initialization &dA &d@ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ &dA &dA &d@ Vertical and horizontal parameters &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ #if SMALL notesize = 6 #else notesize = 14 #endif file = "c:\release\progs\proofpar\" // chs(notesize) open [1,1] file loop for i = 1 to 200 getf [1] vpar(i) repeat loop for i = 1 to 200 getf [1] hpar(i) repeat vpar20 = 2 * vpar(10) &dA &dA &d@ Other parameters and variables &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA loop for i = 1 to 9 getf [1] wak(i) repeat loop for i = 1 to 2 loop for j = 1 to 6 getf [1] zak(i,j) repeat repeat close [1] &dA &dA &d@ Description of tsr.68(MAX_OBJECTS) &dA &dA &d@ The purpose of the tsr strings is to store print suggestion data &dA &d@ for the note object and for sub-objects in the note field 32-43. &dA &dA &d@ Note Object &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ byte1: bit 0 = control &dA &dA &d@ 0 = no modification of data (default in &dA &d@ 99.9% of all cases) &dA &d@ 1 = possible modification somewhere &dA &d@ &dA &d@ bits 1-4 = print modification code &dA &dA &d@ 0 = no modification &dA &d@ 1 = turn off all sub-objects &dA &d@ 2 = turn off all sub-objects &dA &d@ but print an extension dot &dA &dA &d@ 3-7 = eliminate tie if there is one &dA &d@ 3 = print object, no extension dot &dA &d@ 4 = print object, include extension dot &dA &d@ 5 = double note length, no extension dot &dA &d@ 6 = double note length, include extension dot &dA &d@ 7 = quadruple note length, no extension dot &dA &d@ &dA &d@ byte2: modification of horizontal position (from default) &dA &dA &d@ if byte2 >= 128, move notation to the right &dA &d@ by the amount (byte2 - 128) &dA &d@ if byte2 < 128, move notation to the left &dA &d@ by the amount (128 - byte2) &dA &d@ i.e. to the right by the &dA &d@ amount (byte2 - 128) &dA &dA &d@ byte3: modification of vertical position (from default) &dA &dA &d@ if byte2 >= 128, move notation down by the &dA &d@ amount (byte2 - 128) &dA &d@ if byte2 < 128, move notation up by the &dA &d@ amount (128 - byte2) &dA &d@ i.e., down by the amount &dA &d@ (byte2 - 128) &dA &dA &d@ byte4: vertical position relative to staff line &dA &dA &d@ if byte2 >= 128, location is below the staff line &dA &d@ by the amount (byte2 - 128) &dA &d@ if byte2 < 128, location is above the staff line &dA &d@ by the amount (128 - byte2) &dA &d@ i.e., down by the amount &dA &d@ (byte2 - 128) &dA &dA &dA &dA &d@ Sub-objects in the Note Field 32-43 &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ At the moment, there are 16 code catagories for which data &dA &d@ can be stored. Each of these catagories requires 3 bytes. &dA &d@ The data stored in each byte is as follows: &dA &dA &d@ byte1: bit 0 = control &dA &dA &d@ 0 = no modification of data (default in &dA &d@ 99.9% of all cases) &dA &d@ 1 = possible modification somewhere &dA &d@ &dA &d@ bit 1 = major location change flag &dA &dA &d@ 0 = no change in position relative &dA &d@ to staff (default) &dA &d@ 1 = determine position relative to staff &dA &d@ from bit 2 &dA &dA &d@ bit 2 = position relative to staff &dA &dA &d@ 0 = place notation above staff &dA &d@ 1 = place notation below staff &dA &dA &d@ bit 3 = print flag for score &dA &dA &d@ 0 = print notation in score (default) &dA &d@ 1 = don't print notation in score &dA &dA &d@ bit 4 = print flag for non-score (parts) &dA &dA &d@ 0 = print notation in non-score (default) &dA &d@ 1 = don't print notation in non-score &dA &dA &d@ bit 5 = parentheses flag for score &dA &dA &d@ 0 = no action (default) &dA &d@ 1 = surround notation with parentheses &dA &d@ in score &dA &dA &d@ bit 6 = parentheses flag for non-score (parts) &dA &dA &d@ 0 = no action (default) &dA &d@ 1 = surround notation with parentheses &dA &d@ in non-score (parts) &dA &dA &dA &d@ byte2: modification of horizontal position (from default) &dA &dA &d@ if byte2 >= 128, move notation to the right &dA &d@ by the amount (byte2 - 128) &dA &d@ if byte2 < 128, move notation to the left &dA &d@ by the amount (128 - byte2) &dA &d@ i.e. to the right by the &dA &d@ amount (byte2 - 128) &dA &dA &d@ byte3: modification of vertical position (from default) &dA &dA &d@ if byte2 >= 128, move notation down by the &dA &d@ amount (byte2 - 128) &dA &d@ if byte2 < 128, move notation up by the &dA &d@ amount (128 - byte2) &dA &d@ i.e., down by the amount &dA &d@ (byte2 - 128) &dA &dA &d@ byte4: vertical position relative to object &dA &dA &d@ if byte2 >= 128, location is below the object &dA &d@ by the amount (byte2 - 128) &dA &d@ if byte2 < 128, location is above the object &dA &d@ by the amount (128 - byte2) &dA &d@ i.e., down by the amount &dA &d@ (byte2 - 128) &dA &dA &d@ The code catagories are as follows: &dA &d@ &dA &d@ 1 = note object &dA &d@ &dA &d@ 2 = note length: legato(_), staccato(.), line with dot(=) &dA &d@ 3 = spiccato: (i) &dA &d@ 4 = accents: horizontal(>), vertical(V), inverted vertical(A) &dA &d@ &dA &d@ 5 = single ornaments: turn(r), trill(t), shake(w), &dA &d@ (and compound-1) mordent(M), delayed turn(k) &dA &d@ 6 = compound-2: none at the moment &dA &dA &d@ 7 = bowing: up-bow(v), down-bow(n) &dA &d@ 8 = harmonic: string harmonic(o) &dA &d@ 9 = thumb-open: thumb(Q), open-string(0) &dA &d@ 10 = finger1: finger code level 1 &dA &d@ 11 = finger2: finger code level 2 &dA &d@ 12 = finger3: finger code level 3 &dA &d@ 13 = finger4: finger code level 4 &dA &d@ 14 = finger5: finger code level 5 &dA &dA &d@ 15 = dynamics: any dynamic string &dA &dA &d@ 16 = upright fermata: (F) &dA &d@ 17 = inverted fermata: (E) &dA &dA &dA &dA &dA &d@ Vertical Parameters for guessing beam positions &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ bvpar(16) = height parameter for beams &dA &d@ bvpar(17) = decrease in bvpar(16) when range of notes exceeds vpar(3) &dA &d@ bvpar(18) = cutoff of wevere up-down pattern under beam &dA &d@ bvpar(20) = amount to add to beam height to get stradle &dA &d@ bvpar(22) = fudge factor for two/more slanted beams on staff lines &dA &d@ bvpar(23) = fudge factor for one slanted beam on staff lines &dA &d@ bvpar(24) = maximum rise allowed for beam on one staff line &dA &d@ bvpar(25) = minimum rise allowed for beam crossing two staff lines &dA &d@ bvpar(26) = minimum rise allowed for beam crossing three staff lines &dA &d@ bvpar(29) = minimum stem length that triggers adding to 16th stem &dA &d@ bvpar(30) = adjustment for raising 16th beams because of short stems &dA &d@ bvpar(31) = beam thickness &dA &d@ bvpar(32) = offset between beams (if two or three) &dA &d@ bvpar(33) = offset between beams (if more than three in staff line) &dA &d@ bvpar(34) = amount by which a hanging beam exceeds line height &dA &d@ bvpar(35) = maximum beam slope for short beams &dA &dA &d@ initialization of these parameters &dA &d@ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ &dA mtfont = 31 mdirfont = 31 tword_height = 6 twfont = 34 abflg = 2 bvpar(16) = 3 * notesize bvpar(17) = notesize / 2 bvpar(18) = 30 * notesize / 16 bvpar(20) = vpar(1) + 1 / 2 bvpar(22) = 6 * notesize / 16 bvpar(23) = 9 * notesize / 16 bvpar(24) = 7 * notesize / 16 bvpar(25) = 22 * notesize / 16 bvpar(26) = 27 * notesize / 16 bvpar(29) = 38 * notesize / 16 bvpar(30) = 3 * notesize - 8 / 16 bvpar(31) = notesize / 2 + 1 bvpar(32) = notesize * 8 + 4 / 10 bvpar(33) = notesize * 12 + 10 / 14 bvpar(34) = notesize - 3 / 9 bvpar(35) = notesize / 3 &dA &dA &d@ initialization of display variables &dA &d@ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ &dA &dA &d@ Vertical parameters &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA #if SMALL sysx = 40 sysy = 75 rmarg = RMARGX dvpar(13) = 4 dvpar(42) = 2 dvpar(43) = 80 #else sysx = 100 sysy = 180 rmarg = RMARG dvpar(13) = 8 dvpar(42) = 4 dvpar(43) = 240 #endif a = notesize / 2 loop for i = 1 to 10 dvpar(i) = a * i repeat dvpar(11) = 200 * notesize / 16 dvpar(12) = 4 * notesize / 16 dvpar(13) = 8 dvpar(14) = 160 * notesize / 16 dvpar(15) = 64 * notesize / 16 dvpar(16) = 3 * notesize dvpar(17) = notesize / 2 dvpar(18) = 30 * notesize / 16 dvpar(19) = 15 dvpar(20) = vpar(1) + 1 / 2 dvpar(21) = notesize - dvpar(20) dvpar(22) = 6 * notesize / 16 dvpar(23) = 9 * notesize / 16 dvpar(24) = 7 * notesize / 16 dvpar(25) = 22 * notesize / 16 dvpar(26) = 27 * notesize / 16 dvpar(27) = 72 * notesize / 16 dvpar(28) = 15 * notesize / 16 dvpar(29) = 38 * notesize / 16 dvpar(30) = 3 * notesize - 8 / 16 dvpar(31) = notesize / 2 + 1 dvpar(32) = notesize * 8 + 4 / 10 dvpar(33) = notesize * 12 + 10 / 14 dvpar(34) = notesize - 3 / 9 dvpar(35) = notesize / 3 dvpar(36) = 7 * notesize dvpar(37) = 5 * notesize / 4 dvpar(38) = 4 * notesize / 3 dvpar(39) = notesize dvpar(40) = 3 * notesize / 5 dvpar(41) = vpar(5) dvpar(45) = 4 * notesize / 3 mkpvpar41 = 1 &dA &dA &d@ Horizontal parameters &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA #if SMALL dhpar(2) = 7 dhpar(4) = 1 dhpar(6) = 34 dhpar(8) = 85 dhpar(9) = 1050 dhpar(12) = 35 dhpar(17) = 7 dhpar(19) = 2 dhpar(20) = 9 dhpar(21) = 130 dhpar(30) = 7 dhpar(43) = 17 dhpar(58) = 10 #else dhpar(2) = 15 dhpar(4) = 3 dhpar(6) = 80 dhpar(8) = 200 dhpar(9) = 2250 dhpar(12) = 80 dhpar(17) = 14 dhpar(19) = 4 dhpar(20) = 20 dhpar(21) = 300 dhpar(30) = 15 dhpar(43) = 40 dhpar(58) = 30 #endif dhpar(1) = 30 &dA &d@ dhpar(2) = 18 * notesize / 16 dhpar(3) = 19 * notesize + 8 / 16 &dA &d@ dhpar(4) = 3 dhpar(5) = 13 * notesize + 2 / 16 &dA &d@ dhpar(6) = 80 dhpar(7) = 4 * notesize &dA &d@ dhpar(8) = 200 &dA &d@ dhpar(9) = 2250 dhpar(10) = 26 * notesize / 16 dhpar(11) = 200 * notesize / 16 &dA &d@ dhpar(12) = 80 dhpar(14) = 40 * notesize / 16 dhpar(16) = 24 * notesize / 16 &dA &d@ dhpar(17) = 14 dhpar(18) = 2 * notesize &dA &d@ dhpar(19) = 4 &dA &d@ dhpar(20) = 20 &dA &d@ dhpar(21) = 300 dhpar(22) = 6 * notesize / 16 dhpar(23) = 60 * notesize / 16 dhpar(24) = 7 * notesize + 2 / 7 &dA &d@ dhpar(25) = 18 * notesize / 16 &dA &d@ dhpar(26) = 15 * notesize / 16 dhpar(27) = 0 dhpar(28) = 0 - 32 * notesize / 16 dhpar(29) = 2 * notesize + 8 / 16 dhpar(30) += dhpar(29) dhpar(31) = 24 * notesize / 16 dhpar(32) = 44 * notesize / 16 dhpar(33) = 6 * notesize / 16 dhpar(34) = 8 * notesize / 16 dhpar(35) = 14 * notesize / 16 dhpar(36) = 8 * notesize / 16 dhpar(37) = 20 * notesize / 16 dhpar(38) = 20 * notesize / 16 dhpar(39) = 50 * notesize / 16 dhpar(40) = 15 * notesize + 4 / 16 dhpar(41) = 5 * notesize / 2 dhpar(42) = notesize * 4 &dA &d@ dhpar(43) = 40 dhpar(44) = notesize dhpar(45) = notesize dhpar(46) = 13 * notesize / 16 dhpar(47) = 3 * notesize / 5 dhpar(48) = 10 * notesize / 16 dhpar(49) = 24 * notesize / 16 dhpar(50) = 12 * notesize / 16 dhpar(51) = 31 * notesize / 16 dhpar(52) = 19 * notesize / 16 dhpar(53) = 4 * notesize / 16 dhpar(54) = 18 * notesize / 16 dhpar(55) = 6 * notesize / 16 dhpar(56) = 12 * notesize / 16 dhpar(57) = 2 * notesize dhpar(59) = 3 * notesize / 5 &dA &dA &d@ Other parameters and variables &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA #if SMALL expar(1) = 102 expar(2) = 139 expar(3) = 106 expar(4) = 146 expar(5) = 107 expar(6) = 144 expar(7) = 109 expar(8) = 148 #else expar(1) = 240 expar(2) = 324 expar(3) = 254 expar(4) = 324 expar(5) = 256 expar(6) = 324 expar(7) = 260 expar(8) = 324 #endif #if SMALL curdata(1) = " " curdata(2) = " " curdata(3) = " " curdata(4) = " " curdata(5) = " x " curdata(6) = " xxx " curdata(7) = " xxxx " curdata(8) = " xxxxx " curdata(9) = "xx xxxxxxx " curdata(10) = "xxxxxxxxxxxxxxx" curdata(11) = "xxxxxxxxxxxxxxx" curdata(12) = "xx xxxxxxxx " curdata(13) = " xxxxx " curdata(14) = " xxxx " curdata(15) = " xxx " curdata(16) = " x " curdata(17) = " " curdata(18) = " " curdata(19) = " " curdata(20) = " " #else curdata(1) = " xxxx " curdata(2) = " xxxxx " curdata(3) = " xxxxxx " curdata(4) = " xxxxxxx " curdata(5) = " xxxxxxxx " curdata(6) = " xxxxxxxxx " curdata(7) = " xxxxxxxxxxx " curdata(8) = " xxxxxxxxxxxxx " curdata(9) = "xxxxxxxxxxxxxxxxxxxxxxxxx " curdata(10) = "xxxxxxxxxxxxxxxxxxxxxxxxxxx" curdata(11) = "xxxxxxxxxxxxxxxxxxxxxxxxxxx" curdata(12) = "xxxxxxxxxxxxxxxxxxxxxxxxx " curdata(13) = " xxxxxxxxxxxxx " curdata(14) = " xxxxxxxxxxx " curdata(15) = " xxxxxxxxx " curdata(16) = " xxxxxxxx " curdata(17) = " xxxxxxx " curdata(18) = " xxxxxx " curdata(19) = " xxxxx " curdata(20) = " xxxx " #endif CURSOR(1) = 2 CURSOR(2) = 0x141c0000 CURSOR(3) = 0 loop for i = 1 to 20 tbstr = pak(curdata(i)) temp = cby(tbstr) temp = temp // zpd(4) CURSOR(i+3) = ors(temp) repeat temp = chr(255) gline = dup(temp,360) obj_def(1) = "Bar line" obj_def(2) = "Clef" obj_def(3) = "Key signature" obj_def(4) = "Time signature" obj_def(5) = "Directive" obj_def(6) = "Symbol" obj_def(7) = "Note" obj_def(8) = "Rest" obj_def(9) = "Grace note" obj_def(10) = "Cue note" obj_def(11) = "Figures" obj_def(12) = "Directive/symbol" obj_def(13) = "Mark (dummy)" super_def(1) = "Beam" super_def(2) = "Tie" super_def(3) = "Slur" super_def(4) = "Tuple/bracket" super_def(5) = "Wedge" super_def(6) = "Dashes" super_def(7) = "Ending" super_def(8) = "Long trill" super_def(9) = "Octave transposition" super_def(10) = "Figure extension" super_def(11) = "Null" sub_def(33) = "Treble clef (top)" sub_def(34) = "Treble clef (bottom)" sub_def(35) = "C-clef" sub_def(36) = "Bass clef" sub_def(37) = "Common time" sub_def(38) = "Alle breve time" sub_def(39) = "Longa note head" sub_def(40) = "Breve note head" sub_def(41) = "Whole note head" sub_def(42) = "White note head" sub_def(43) = "Black note head" sub_def(44) = "time dot" sub_def(45) = "Leger line" sub_def(46) = "Whole rest" sub_def(47) = "Half rest" sub_def(48) = "Quarter rest" sub_def(49) = "Eighth rest" sub_def(50) = "Rest add-on component" sub_def(51) = "Short eighth flag" sub_def(52) = "Short eighth flag" sub_def(53) = "Eighth flag" sub_def(54) = "Eighth flag" sub_def(55) = "Sixteenth flag" sub_def(56) = "Sixteenth flag" sub_def(57) = "Flag add-on component" sub_def(58) = "Flag add-on component" sub_def(59) = "Two space stem unit" sub_def(60) = "Two space stem unit" sub_def(61) = "One space stem unit" sub_def(62) = "One space stem unit" sub_def(63) = "Sharp" sub_def(64) = "Natural" sub_def(65) = "Flat" sub_def(66) = "Double sharp" sub_def(67) = "Square left bracket" sub_def(68) = "Square right bracket" sub_def(69) = "Round left bracket" sub_def(70) = "Round right bracket" sub_def(71) = "Number 0" sub_def(72) = "Number 1" sub_def(73) = "Number 2" sub_def(74) = "Number 3" sub_def(75) = "Number 4" sub_def(76) = "Number 5" sub_def(77) = "Number 6" sub_def(78) = "Number 7" sub_def(79) = "Number 8" sub_def(80) = "Number 9" sub_def(81) = "Staff line character" sub_def(82) = "Four space bar" sub_def(83) = "One space bar" sub_def(84) = "Four space thick bar" sub_def(85) = "One space thick bar" sub_def(86) = "Four space dotted bar" sub_def(87) = "Thick vertical top" sub_def(88) = "Thick vartical bottom" sub_def(89) = "Begin/end hook" sub_def(90) = "Solid horz. line" sub_def(91) = "Dash horz. line" sub_def(92) = "Heavy horz. line" sub_def(93) = "horizontal accent" sub_def(94) = "Accent" sub_def(95) = "Accent" sub_def(96) = "Staccato dot" sub_def(97) = "Stricht" sub_def(98) = "Stricht" sub_def(99) = "- legato" sub_def(100) = ", breath" sub_def(101) = "Fermata" sub_def(102) = "Fermata" sub_def(103) = "./." sub_def(104) = "Solid /" sub_def(105) = "Empty /" sub_def(106) = "Signet sign" sub_def(107) = "Circle + cross" sub_def(108) = "p Piano" sub_def(109) = "m Mezzo" sub_def(110) = "f Forte" sub_def(111) = "s dynamic letter" sub_def(112) = "z dynamic letter" sub_def(113) = "r dynamic letter" sub_def(114) = "Ped." sub_def(115) = "* (end pedal)" sub_def(116) = "Up bow" sub_def(117) = "Down bow" sub_def(118) = "Pedal heel" sub_def(119) = "Pedal toe" sub_def(120) = "Arpegiate" sub_def(121) = "Repeat notes" sub_def(122) = "Harmonic a" sub_def(123) = "Harmonic b" sub_def(124) = "Thumb position" sub_def(125) = "Stem repeater" sub_def(126) = "Stem repeater" sub_def(127) = "Stem repeater" sub_def(161) = "Small treble clef (top)" sub_def(162) = "Small treble clef (bottom)" sub_def(163) = "Small C-clef" sub_def(164) = "Small bass clef" sub_def(165) = "Small common time" sub_def(166) = "Small alle breve time" sub_def(167) = "Small duple time" sub_def(168) = "Small triple time" sub_def(169) = "Small whole note head" sub_def(170) = "Small white note head" sub_def(171) = "Small black note head" sub_def(172) = "Small time dot" sub_def(173) = "Small leger line" sub_def(174) = "Small whole rest" sub_def(175) = "Small half rest" sub_def(176) = "Small quarter rest" sub_def(177) = "Small eighth rest" sub_def(178) = "Small rest add-on component" sub_def(179) = "Small eight + slash" sub_def(180) = "Small eight + slash" sub_def(181) = "Small eighth flag" sub_def(182) = "Small eighth flag" sub_def(183) = "Small sixteenth flag" sub_def(184) = "Small sixteenth flag" sub_def(185) = "Small flag add-on component" sub_def(186) = "Small flag add-on component" sub_def(187) = "Small two space stem unit" sub_def(188) = "Small two space stem unit" sub_def(189) = "Small one space stem unit" sub_def(190) = "Small one space stem unit" sub_def(191) = "Small sharp" sub_def(192) = "Small natural" sub_def(193) = "Small flat" sub_def(194) = "Small double sharp" sub_def(195) = "Small square left bracket" sub_def(196) = "Small square right bracket" sub_def(197) = "Small round left bracket" sub_def(198) = "Small round right bracket" sub_def(199) = "Small number 0" sub_def(200) = "Small number 1" sub_def(201) = "Small number 2" sub_def(202) = "Small number 3" sub_def(203) = "Small number 4" sub_def(204) = "Small number 5" sub_def(205) = "Small number 6" sub_def(206) = "Small number 7" sub_def(207) = "Small number 8" sub_def(208) = "Small number 9" sub_def(209) = "Small staff line character" sub_def(210) = "Plus (+) figure" sub_def(211) = "(x) figure" sub_def(212) = "2+ figure" sub_def(213) = "Sharp figure" sub_def(214) = "4+ figure" sub_def(215) = "5+ figure" sub_def(216) = "6/ figure" sub_def(217) = "7\ figure" sub_def(218) = "Natural figure" sub_def(219) = "Flat figure" sub_def(220) = "(-) figure" sub_def(221) = "Tuple 0" sub_def(222) = "Tuple 1" sub_def(223) = "Tuple 2" sub_def(224) = "Tuple 3" sub_def(225) = "Tuple 4" sub_def(226) = "Tuple 5" sub_def(227) = "Tuple 6" sub_def(228) = "Tuple 7" sub_def(229) = "Tuple 8" sub_def(230) = "Tuple 9" sub_def(231) = "Big upright 8" sub_def(232) = "Little upright 8" sub_def(233) = "Big italic 8" sub_def(234) = "Little italic 8" sub_def(235) = "Big italic 15" sub_def(236) = "tr." sub_def(237) = "~~" sub_def(238) = "Mordent" sub_def(239) = "Shake" sub_def(240) = "Shake from above" sub_def(241) = "Shake from below" sub_def(242) = "Turn" sub_def(243) = "Turn" sub_def(244) = " " sub_def(245) = " " sub_def(246) = " " sub_def(247) = " " sub_def(248) = " " sub_def(249) = " " sub_def(250) = "(blank)" sub_def(251) = "Editorial piano" sub_def(252) = "Editorial mezzo" sub_def(253) = "Editorial forte" sub_def(254) = "Editorial trill" sub_def(255) = " " messages(1) = "j = move by object" messages(2) = "x = move consecutively" messages(3) = "Pointing at:" messages(4) = "Line =" messages(5) = " = redraw music" messages(6) = " = goto measure ..." messages(7) = " = remove all new records beyond cursor" supermsg(1) = chr(34) // "(" // chr(34) // " type SLUR outstanding" supermsg(2) = chr(34) // "[" // chr(34) // " type SLUR outstanding" supermsg(3) = chr(34) // "{" // chr(34) // " type SLUR outstanding" supermsg(4) = "WEDGE outstanding" supermsg(5) = "DASHES outstanding" supermsg(6) = "ENDING outstanding" supermsg(7) = "FIGURE outstanding" supermsg(8) = "TRANSPOSE outstanding" #if SMALL supermsgrow(1) = SUPEROW1X supermsgrow(2) = SUPEROW2X supermsgcol(1) = SUPEROL1X supermsgcol(2) = SUPEROL2X supermsgcol(3) = SUPEROL3X supermsgcol(4) = SUPEROL4X message_row(1) = SOUROW1X message_row(2) = SOUROW2X message_row(3) = SOUROW3X message_row(4) = SOUROW4X source_row(1) = SOUROW1X source_row(2) = SOUROW2X source_row(3) = SOUROW3X source_row(4) = SOUROW4X source_row(5) = SOUROW5X source_row(6) = SOUROW6X source_row(7) = SOUROW7X source_row(8) = SOUROW8X source_row(9) = SOUROW9X source_row(10) = SOUROW10X source_row(11) = SOUROW11X source_row(12) = SOUROW12X source_row(13) = SOUROW13X source_row(14) = SOUROW14X source_row(15) = SOUROW15X source_row(16) = SOUROW16X #else supermsgrow(1) = SUPEROW1 supermsgrow(2) = SUPEROW2 supermsgcol(1) = SUPEROL1 supermsgcol(2) = SUPEROL2 supermsgcol(3) = SUPEROL3 supermsgcol(4) = SUPEROL4 message_row(1) = SOUROW1 message_row(2) = SOUROW2 message_row(3) = SOUROW3 message_row(4) = SOUROW4 source_row(1) = SOUROW1 source_row(2) = SOUROW2 source_row(3) = SOUROW3 source_row(4) = SOUROW4 source_row(5) = SOUROW5 source_row(6) = SOUROW6 source_row(7) = SOUROW7 source_row(8) = SOUROW8 source_row(9) = SOUROW9 source_row(10) = SOUROW10 source_row(11) = SOUROW11 source_row(12) = SOUROW12 source_row(13) = SOUROW13 source_row(14) = SOUROW14 source_row(15) = SOUROW15 source_row(16) = SOUROW16 #endif &dA &dA HELP MESSAGES &dA hlpx(1,1) = "ENTER TWO KEY STROKES ( = start over/cancel)" hlpx(1,2) = " a = segno sign (2/@ = toggle staff num)" hlpx(1,3) = " b = right justified ASCII string" hlpx(1,4) = " c = centered ASCII string" hlpx(1,5) = " d = left justified ASCII string" hlpx(1,6) = " e = begin wedge" hlpx(1,7) = " f = end wedge" hlpx(1,8) = " g = letter dynamics (given in ASCII string)" hlpx(1,9) = " h = begin dashes (after words)" hlpx(1,10) = " j = end dashes" hlpx(1,11) = " p = begin pedal: Ped" hlpx(1,12) = " q = release pedal: *" hlpx(1,13) = " u = shift notes Up (usually by 8ve)" hlpx(1,14) = " v = shift notes Down (usually by 8ve)" hlpx(1,15) = " w = stop shift" hlpx(1,16) = " = no letter" hlpx(2,1) = "ENTER optional forward offset" hlpx(2,2) = " (measured in units of duration)" hlpx(2,3) = " " hlpx(2,4) = " = CONTINUE" hlpx(2,5) = " " hlpx(2,6) = " = enter number again/go back to start" hlpx(4,1) = "ENTER ASCII string (terminate with )" hlpx(4,2) = " " hlpx(4,3) = " Indicate font changes with " // chr(34) // "!" // chr(34) // "--followed" hlpx(4,4) = " directly by a font number" hlpx(4,5) = " For words, a starting font of 33 is assumed." hlpx(4,6) = " For dynamics, a starting font of 1 is assumed." hlpx(4,7) = " = enter data again/go back to start" hlpx(5,1) = "   will move pitch up or down" hlpx(5,2) = "   does it faster" hlpx(5,3) = " " hlpx(5,4) = " = cancel operation" hlpx(5,5) = "ENTER number for type of grace note" hlpx(6,1) = "NO ACTION" hlpx(6,2) = " " hlpx(6,3) = " Specification of a " // chr(34) // "_" // chr(34) // " type slur is still outstanding" hlpx(6,4) = " " hlpx(6,5) = " type any key to continue" hlpx(7,1) = "NO ACTION" hlpx(7,2) = " " hlpx(7,3) = " A " // chr(34) // "_" // chr(34) // " type slur has not been properly started" hlpx(7,4) = " " hlpx(7,5) = " type any key to continue" hlpx(8,1) = "PRINT SUGGESTION -- Enter Column Number " hlpx(8,2) = " " hlpx(8,3) = " 0: general print suggestions" hlpx(8,4) = " 1: modifying the printing of notes, rests and figures" hlpx(8,5) = " 17 or 18: position of musical direction (Enter 16 for 17+18)" hlpx(8,6) = " 26 or 27: repeaters for beams" hlpx(8,7) = " 32 to 40: orientation of ties and slurs" hlpx(8,8) = " location of notations attached to notes" hlpx(8,9) = " " hlpx(8,10) = " NUMBER = " hlpx(8,11) = " type to cancel" hlpx(9,1) = "NO ACTION" hlpx(9,2) = " " hlpx(9,3) = " Unable to generate a print suggestion for for column " hlpx(9,4) = " " hlpx(9,5) = " type any key to continue" hlpx(11,1) = "TYPE one of the following letters" hlpx(11,2) = " " hlpx(11,3) = " p = minimum distance between notes" hlpx(11,4) = " q = duration which is assigned the minimum distance" hlpx(11,5) = " s = space between grand staffs" hlpx(11,6) = " t = global tuplet placement" hlpx(11,7) = " " hlpx(11,8) = " = enter data again/go back to start" hlpx(13,1) = "ENTER desired suggestion for beam repeaters" hlpx(13,2) = " " hlpx(13,3) = " a = use repeater for next beam only." hlpx(13,4) = " A = use repeaters for all beams" hlpx(13,5) = " which follow." hlpx(13,6) = " b = return to normal beaming" hlpx(13,7) = " (used to cancel A)" hlpx(13,8) = " " hlpx(13,9) = " = cancel operation" hlpx(14,1) = "ENTER desired suggestion for slur/tie" hlpx(14,2) = " " hlpx(14,3) = " o = place slur/tie over the note in" hlpx(14,4) = " question" hlpx(14,5) = " u = place slur/tie under the note in" hlpx(14,6) = " question" hlpx(14,7) = " " hlpx(14,8) = " = cancel operation" hlpx(15,1) = "OPTIONS for Pitch records" hlpx(15,2) = " " hlpx(15,3) = " alt (or shft-alt)   = raise/lower pitch" hlpx(15,4) = " 9 0 , [ ] , { } = start/end " // chr(34) // "(, [, {" // chr(34) // " type slur" hlpx(15,5) = " b = alter beaming or stem direction" hlpx(15,6) = " a = add dynamic letter(s), articulations," hlpx(15,7) = " fermatas, ornaments, fingerings and/or bowings" hlpx(15,8) = " p m z R . i _ > A V t M w r k F E +/= accepted directly" hlpx(15,9) = " / = replace current note with two notes (- = toggle tie)" hlpx(15,10) = " | = combine current note with note following" hlpx(15,11) = " % = toggle between note and rest" hlpx(15,12) = " f = add figure record(s)" hlpx(15,13) = " g = add a grace note before this pitch" hlpx(15,14) = " 8 = add a musical direction before this pitch" hlpx(15,15) = " P = add a print suggestion below this pitch" hlpx(16,1) = "OPTIONS for Rest records" hlpx(16,2) = " " hlpx(16,3) = " alt (or shft-alt)   = move rest up/down" hlpx(16,4) = " F,E = add upright/inverted fermata" hlpx(16,5) = " " hlpx(16,6) = " / = replace current rest with two rests" hlpx(16,7) = " | = combine current rest with note/rest following" hlpx(16,8) = " % = toggle between note and rest" hlpx(16,9) = " " hlpx(16,10) = " g = add a grace note before this rest" hlpx(16,11) = " 8 = add a musical direction before this rest" hlpx(16,12) = " P = add a print suggestion below this rest" hlpx(17,1) = "TYPE one or more of the following letters" hlpx(17,2) = " " hlpx(17,3) = " p,f,m,z,R  make up dynamics (< = delete dynamics)" hlpx(17,4) = " .,i,_,D  staccato, spiccato, legato, legato-dot" hlpx(17,5) = " >,A,V  horizontal, vertical accents" hlpx(17,6) = " F,E,~  upright/inverted fermatas" hlpx(17,7) = " t,M,w,r,k  trill, mordent, shake, turn, delayed turn" hlpx(17,8) = " +,=  both are cautionary accidental" hlpx(17,9) = " 1,2,3,4,5  fingerings" hlpx(17,10) = " 0,Q,v,n  open string, thumb, up bow, down bow" hlpx(17,11) = " !, *, ~  start/stop tuple, wavy line" hlpx(17,12) = " " hlpx(17,13) = " = enter data again/go back to start" hlpx(17,14) = " " hlpx(17,15) = ", , or  = data entry complete" hlpx(18,1) = "BEAM and STEM EDIT commands" hlpx(18,2) = " " hlpx(18,3) = " U = stem up for all notes under a beam" hlpx(18,4) = " D = stem down for all notes under a beam" hlpx(18,5) = " u = stem up for this note" hlpx(18,6) = " d = stem down for this note" hlpx(18,7) = " 1,2,3,...,A,B,C = number of notes under this" hlpx(18,8) = " beam, going forward. If breaking up a beam," hlpx(18,9) = " notes going backward will have their own beam." hlpx(18,10) = " If beams are merged, all stems will match" hlpx(18,11) = " current stem direction." hlpx(18,12) = " " hlpx(18,13) = " or  = data entry complete" hlpx(19,1) = "OPTIONS for editing the position of Musical Directions" hlpx(19,2) = " " hlpx(19,3) = " 6 = edit position of directions in both columns 17 and 18" hlpx(19,4) = " 7 = edit position of direction in columns 17" hlpx(19,5) = " 8 = edit position of direction in columns 18" hlpx(19,6) = " " hlpx(19,7) = "P = add/append suggestion to edit other parameters" hlpx(19,8) = " such as fonts" hlpx(20,1) = "OPTIONS for editing Musical Direction Records" hlpx(20,2) = " relating to starting or ending of super-objects" hlpx(20,3) = " " hlpx(20,4) = " alt  = move this end of super-object" hlpx(20,5) = " left,up,right,down by 1/10th of staff distance" hlpx(20,6) = " shft-alt  = move this end of super-object" hlpx(20,7) = " left,up,right,down by 5/10ths of staff distance" hlpx(20,8) = " " hlpx(20,9) = " = cancel operation" hlpx(20,10) = " " hlpx(20,11) = ", , or  = data entry complete" hlpx(21,1) = "OPTIONS for editing Musical Direction Records" hlpx(21,2) = " which result in placement of objects in the i-file" hlpx(21,3) = " " hlpx(21,4) = " alt  = move this object left,up,right,down" hlpx(21,5) = " by 1/10th of staff distance" hlpx(21,6) = " shft-alt  = move this object left,up,right,down" hlpx(21,7) = " by 5/10ths of staff distance" hlpx(21,8) = " " hlpx(21,9) = " = cancel operation" hlpx(21,10) = " " hlpx(21,11) = ", , or  = data entry complete" hlpx(22,1) = "JUMP FORWARD to measure number -- " hlpx(22,2) = " " hlpx(22,3) = " Enter Measere Number " hlpx(22,4) = " " hlpx(22,5) = " NUMBER = " hlpx(22,6) = " " hlpx(22,7) = " type to cancel" hlpx(22,8) = " SEARCHING (i.e., not dead yet!) . . . " hlpx(23,1) = "OPTIONS for editing Musical Direction Records" hlpx(23,2) = " for both column 17 and column 18 simultaneously" hlpx(23,3) = " " hlpx(23,4) = " alt  = move everything" hlpx(23,5) = " left,up,right,down by 1/10th of staff distance" hlpx(23,6) = " shft-alt  = move everything" hlpx(23,7) = " left,up,right,down by 5/10ths of staff distance" hlpx(23,8) = " " hlpx(23,9) = " = cancel operation" hlpx(23,10) = " " hlpx(23,11) = ", , or  = data entry complete" hlpx(24,1) = " " hlpx(24,2) = " " hlpx(24,3) = "REMOVING all ADDED records beyond the current position" hlpx(24,4) = " Records terminating existing wedges, dashes," hlpx(24,5) = " and transpositions are retained." hlpx(25,1) = "NO ACTION" hlpx(25,2) = " " hlpx(25,3) = " You must FIRST remove all beams on this note and on the" hlpx(25,4) = " following note before this command will work. You can" hlpx(25,5) = " add them again AFTER the command has been executed." hlpx(25,6) = " " hlpx(25,7) = " Type and key to continue" hlpx(26,1) = "NO ACTION" hlpx(26,2) = " " hlpx(26,3) = " You must FIRST remove all beams on this note" hlpx(26,4) = " before this command will work. You can add" hlpx(26,5) = " beams AFTER the command has been executed." hlpx(26,6) = " " hlpx(26,7) = " Type and key to continue" hlpx(27,1) = "GRATUITOUS WARNING" hlpx(27,2) = " " hlpx(27,3) = " You started a tuple super-object with the * character." hlpx(27,4) = " It is important that you terminate this tuple with a " // chr(34) // "!" // chr(34) hlpx(27,5) = " before typing either or , because doing" hlpx(27,6) = " otherwise may cause this program indigestion" hlpx(27,7) = " " hlpx(27,8) = " Type and key to continue" hlpx(28,1) = "STEM EDIT commands" hlpx(28,2) = " " hlpx(28,3) = " u = stem up for this note" hlpx(28,4) = " d = stem down for this note" hlpx(29,1) = "OPTIONS for entering figure record" hlpx(29,2) = " " hlpx(29,3) = " If the figure lies directly under the note (no division offset)," hlpx(29,4) = " you may begin entering figure(s) directly:" hlpx(29,5) = " 1,2,3,4,5,6,7,8,9, #,n,f,x,s, -,_,b " hlpx(29,6) = " " hlpx(29,7) = " Otherwise type " // chr(34) // "d" // chr(34) // " to enter division offset." hlpx(29,8) = " " hlpx(29,9) = " = cancel operation" hlpx(30,1) = "OPTIONS for entering figure = operation completed" hlpx(30,2) = " = cancel operation " hlpx(30,3) = " " hlpx(30,4) = " = enter next figure" hlpx(30,5) = " The first figure field is for the top of the figure list." hlpx(30,6) = " " hlpx(30,7) = "Valid figure numbers: 1 to 19 " hlpx(30,8) = "Figure signs and modifiers: #/s , n , f , x , + , \ and / " hlpx(30,9) = " #/s = sharp, n = natural, f = flat, x = double sharp " hlpx(30,10) = " + = augment, / or \ = diminish " hlpx(30,11) = " - = short line, _ = long line from previous figure " hlpx(30,12) = "Valid modifiers in front of number: # , n , f , and x " hlpx(30,13) = " These signs may also stand alone as figures " hlpx(30,14) = "A " // chr(34) // "b" // chr(34) // " indicates a blank figure. This is used as a place holder" hlpx(30,15) = " in a list and also to start a continuation line with no figure." hlp03a(1) = "ENTER numerical parameter and/or unshifted " // chr(34) // "+" // chr(34) // " key" hlp03a(2) = " (parameter measured in 10ths of line space" hlp03a(3) = " For E,F (wedges), number = spread" hlp03a(4) = " unshifted " // chr(34) // "+" // chr(34) // "key shifts directive" hlp03a(5) = " to a position above the staff line" hlp03a(6) = " = entry done" hlp03a(7) = " = enter data again/go back to start" hlp03b(1) = "ENTER numerical parameter" hlp03b(2) = " (parameter measured in 10ths of line space" hlp03b(3) = " For U,V (transpositions), number = transpose" hlp03b(4) = " size, other than octave" hlp03b(5) = " = entry done" hlp03b(6) = " = enter data again/go back to start" hlp03c(1) = "TYPE unshifted " // chr(34) // "+" // chr(34) // " key" hlp03c(2) = " to position directive above the staff line" hlp03c(3) = " " hlp03c(4) = " = NO CHANGE" hlp03c(5) = " " hlp03c(6) = " = enter data again/go back to start" hlp10(1) = "NO ACTION" hlp10(2) = " " hlp10(3) = " Column of this record does not lend itself to a print suggestion" hlp10(4) = " " hlp10(5) = " type any key to continue" hlp12(1) = "ENTER numerical parameter for this suggestion (# )" hlp12(2) = " " hlp12(3) = " p<#> = minimum distance between notes (expressed as" hlp12(4) = " percent of the default)." hlp12(5) = " " hlp12(6) = " " hlp12(7) = " " hlp12(8) = " " hlp12(9) = " q<#> = duration which is assigned the minimum distance" hlp12(10) = " 0 = recompute default (from this point onward)" hlp12(11) = " 1 = whole notes" hlp12(12) = " ... . . . " hlp12(13) = " 8 = eighth notes" hlp12(14) = " 16 = sixteenth notes, etc" hlp12(15) = " s<#> = space between grand staffs measured in multiples" hlp12(16) = " of leger lines times 10; e.g. 100 = 10 leger lines" hlp12(17) = " " hlp12(18) = " " hlp12(19) = " " hlp12(20) = " " hlp12(21) = " t<#> = global tuplet placement" hlp12(22) = " # = 0: use default" hlp12(23) = " # = 1: place tuplet near note heads" hlp12(24) = " # = 2: place tuplet near note stems (beams)" hlp12(25) = " # = 3: place all tuplets above notes" hlp12(26) = " # = 4: place all tuplets below notes" hlp12(27) = " " hlp12(28) = " NUMBER = " hlp12(29) = " = enter data again/go back to start" #if SMALL helptop = HLPTOPX helpinc = HLPINCX hlpxpos = 40 hlpypos = 280 hlpxz = 40 hlpyz = 240 #else helptop = HLPTOP helpinc = HLPINC hlpxpos = 80 hlpypos = 600 hlpxz = 80 hlpyz = 500 #endif &dA &dA &d@ &dA &dA &d@ &dA Initialize array for suggestions for vertical position of dynamics &dA &d@ &dA &dA &dA &d@ &dACASE 1: All stems up without slurs or ties&d@ &dA &dA &d@ &dKdynamic = p,pp,ppp,pppp,mp&d@ 5...10 +5 = 10 to 15 &dA &dA &d@ note position < 6 sugg = 57 &dA &d@ note position = 6 sugg = 57 &dA &d@ note position = 7 sugg = 58 &dA &d@ note position = 8 sugg = 62 &dA &d@ note position = 9 sugg = 66 &dA &d@ note position > 9 sugg = pos * 5 + 21 &dA &dA &d@ &dKdynamic = f,ff,fff,ffff,mf,fp,Zp,Z,R&d@ 5...10 +5 = 10 to 15 &dA &dA &d@ note position < 3 sugg = 61 &dA &d@ note position = 3 sugg = 62 &dA &d@ note position = 4 sugg = 62 &dA &d@ note position = 5 sugg = 62 &dA &d@ note position = 6 sugg = 62 &dA &d@ note position = 7 sugg = 63 &dA &d@ note position = 8 sugg = 66 &dA &d@ note position = 9 sugg = 71 &dA &d@ note position > 9 sugg = pos * 5 + 26 vsugg(1,1,1) = 57 vsugg(1,1,2) = 57 vsugg(1,1,3) = 57 vsugg(1,1,4) = 57 vsugg(1,1,5) = 57 vsugg(1,1,6) = 57 vsugg(1,1,7) = 57 vsugg(1,1,8) = 57 vsugg(1,1,9) = 57 vsugg(1,1,10) = 57 vsugg(1,1,11) = 57 vsugg(1,1,12) = 58 vsugg(1,1,13) = 62 vsugg(1,1,14) = 66 vsugg(1,1,15) = 71 vsugg(1,1,16) = 21 vsugg(1,2,1) = 61 vsugg(1,2,2) = 61 vsugg(1,2,3) = 61 vsugg(1,2,4) = 61 vsugg(1,2,5) = 61 vsugg(1,2,6) = 61 vsugg(1,2,7) = 61 vsugg(1,2,8) = 62 vsugg(1,2,9) = 62 vsugg(1,2,10) = 62 vsugg(1,2,11) = 62 vsugg(1,2,12) = 63 vsugg(1,2,13) = 66 vsugg(1,2,14) = 71 vsugg(1,2,15) = 76 vsugg(1,2,16) = 26 vsugg(1,3,1) = 61 vsugg(1,3,2) = 61 vsugg(1,3,3) = 61 vsugg(1,3,4) = 61 vsugg(1,3,5) = 61 vsugg(1,3,6) = 61 vsugg(1,3,7) = 61 vsugg(1,3,8) = 62 vsugg(1,3,9) = 62 vsugg(1,3,10) = 62 vsugg(1,3,11) = 62 vsugg(1,3,12) = 63 vsugg(1,3,13) = 66 vsugg(1,3,14) = 71 vsugg(1,3,15) = 76 vsugg(1,3,16) = 26 &dA &d@ &dACASE 2: All stems down without beams&d@ &dA &dA &d@ &dKdynamic = p,pp,ppp,pppp,mp&d@ -3...4 +5 = 2 to 9 &dA &dA &d@ note position < -2 sugg = 56 &dA &d@ note position = -2 sugg = 57 &dA &d@ note position = -1 sugg = 57 &dA &d@ note position = 0 sugg = 57 &dA &d@ note position = 1 sugg = 58 &dA &d@ note position = 2 sugg = 60 &dA &d@ note position = 3 sugg = 64 &dA &d@ note position = 4 sugg = 68 &dA &d@ note position = 5 sugg = 70 &dA &d@ note position = 6 sugg = 75 &dA &d@ note position = 7 sugg = 80 &dA &d@ note position = 8 sugg = 85 &dA &d@ note position = 9 sugg = 90 &dA &d@ note position = 10 sugg = 90 &dA &d@ note position > 10 sugg = pos * 5 + 40 &dA &dA &d@ &dKdynamic = f,ff,fff,ffff,fp&d@ -3...4 +5 = 2 to 9 &dA &dA &d@ note position < -2 sugg = 60 &dA &d@ note position = -2 sugg = 61 &dA &d@ note position = -1 sugg = 61 &dA &d@ note position = 0 sugg = 61 &dA &d@ note position = 1 sugg = 61 &dA &d@ note position = 2 sugg = 62 &dA &d@ note position = 3 sugg = 66 &dA &d@ note position = 4 sugg = 69 &dA &d@ note position = 5 sugg = 71 &dA &d@ note position = 6 sugg = 76 &dA &d@ note position = 7 sugg = 81 &dA &d@ note position = 8 sugg = 86 &dA &d@ note position = 9 sugg = 90 &dA &d@ note position = 10 sugg = 91 &dA &d@ note position > 10 sugg = pos * 5 + 41 &dA &dA &d@ &dKdynamic = mf,Z,Zp,R&d@ -3...4 +5 = 2 to 9 &dA &dA &d@ note position < -2 sugg = 60 &dA &d@ note position = -2 sugg = 60 &dA &d@ note position = -1 sugg = 60 &dA &d@ note position = 0 sugg = 60 &dA &d@ note position = 1 sugg = 60 &dA &d@ note position = 2 sugg = 61 &dA &d@ note position = 3 sugg = 65 &dA &d@ note position = 4 sugg = 69 &dA &d@ note position = 5 sugg = 71 &dA &d@ note position = 6 sugg = 76 &dA &d@ note position = 7 sugg = 81 &dA &d@ note position = 8 sugg = 86 &dA &d@ note position = 9 sugg = 91 &dA &d@ note position = 10 sugg = 92 &dA &d@ note position > 10 sugg = pos * 5 + 42 vsugg(2,1,1) = 56 vsugg(2,1,2) = 56 vsugg(2,1,3) = 57 vsugg(2,1,4) = 57 vsugg(2,1,5) = 57 vsugg(2,1,6) = 58 vsugg(2,1,7) = 60 vsugg(2,1,8) = 64 vsugg(2,1,9) = 68 vsugg(2,1,10) = 70 vsugg(2,1,11) = 75 vsugg(2,1,12) = 80 vsugg(2,1,13) = 85 vsugg(2,1,14) = 90 vsugg(2,1,15) = 90 vsugg(2,1,16) = 40 vsugg(2,2,1) = 60 vsugg(2,2,2) = 60 vsugg(2,2,3) = 61 vsugg(2,2,4) = 61 vsugg(2,2,5) = 61 vsugg(2,2,6) = 61 vsugg(2,2,7) = 62 vsugg(2,2,8) = 66 vsugg(2,2,9) = 69 vsugg(2,2,10) = 71 vsugg(2,2,11) = 76 vsugg(2,2,12) = 81 vsugg(2,2,13) = 86 vsugg(2,2,14) = 90 vsugg(2,2,15) = 91 vsugg(2,2,16) = 41 vsugg(2,3,1) = 60 vsugg(2,3,2) = 60 vsugg(2,3,3) = 60 vsugg(2,3,4) = 60 vsugg(2,3,5) = 60 vsugg(2,3,6) = 60 vsugg(2,3,7) = 61 vsugg(2,3,8) = 65 vsugg(2,3,9) = 69 vsugg(2,3,10) = 71 vsugg(2,3,11) = 76 vsugg(2,3,12) = 81 vsugg(2,3,13) = 86 vsugg(2,3,14) = 91 vsugg(2,3,15) = 92 vsugg(2,3,16) = 42 &dACASE 3: All whole notes without slurs or ties&d@ &dA &d@ &dKdynamic = p,pp,ppp,pppp,mp&d@ 2...8 + 5 = 7 to 13 &dA &dA &d@ note position < 3 sugg = 57 &dA &d@ note position = 3 sugg = 57 &dA &d@ note position = 4 sugg = 58 &dA &d@ note position = 5 sugg = 58 &dA &d@ note position = 6 sugg = 59 &dA &d@ note position = 7 sugg = 61 &dA &d@ note position > 7 sugg = pos * 5 + 24 &dA &dA &d@ &dKdynamic = f,ff,fff,ffff,mf,fp,Zp,Z,R&d@ 2...8 + 5 = 7 to 13 &dA &dA &d@ note position < 3 sugg = 61 &dA &d@ note position = 3 sugg = 61 &dA &d@ note position = 4 sugg = 62 &dA &d@ note position = 5 sugg = 63 &dA &d@ note position = 6 sugg = 63 &dA &d@ note position = 7 sugg = 65 &dA &d@ note position > 7 sugg = pos * 5 + 29 vsugg(3,1,1) = 57 vsugg(3,1,2) = 57 vsugg(3,1,3) = 57 vsugg(3,1,4) = 57 vsugg(3,1,5) = 57 vsugg(3,1,6) = 57 vsugg(3,1,7) = 57 vsugg(3,1,8) = 57 vsugg(3,1,9) = 58 vsugg(3,1,10) = 58 vsugg(3,1,11) = 59 vsugg(3,1,12) = 61 vsugg(3,1,13) = 64 vsugg(3,1,14) = 69 vsugg(3,1,15) = 74 vsugg(3,1,16) = 24 vsugg(3,2,1) = 61 vsugg(3,2,2) = 61 vsugg(3,2,3) = 61 vsugg(3,2,4) = 61 vsugg(3,2,5) = 61 vsugg(3,2,6) = 61 vsugg(3,2,7) = 61 vsugg(3,2,8) = 61 vsugg(3,2,9) = 62 vsugg(3,2,10) = 63 vsugg(3,2,11) = 63 vsugg(3,2,12) = 65 vsugg(3,2,13) = 69 vsugg(3,2,14) = 74 vsugg(3,2,15) = 79 vsugg(3,2,16) = 29 vsugg(3,3,1) = 61 vsugg(3,3,2) = 61 vsugg(3,3,3) = 61 vsugg(3,3,4) = 61 vsugg(3,3,5) = 61 vsugg(3,3,6) = 61 vsugg(3,3,7) = 61 vsugg(3,3,8) = 61 vsugg(3,3,9) = 62 vsugg(3,3,10) = 63 vsugg(3,3,11) = 63 vsugg(3,3,12) = 65 vsugg(3,3,13) = 69 vsugg(3,3,14) = 74 vsugg(3,3,15) = 79 vsugg(3,3,16) = 29 &dA &d@ &dACASE 4: Stems up with slurs or ties&d@ &dA &dA &d@ &dKdynamic = p,pp,ppp,pppp,mp&d@ &dA &dA &d@ note position < 4 sugg = 57 5...8 +5 = 10 to 13 &dA &d@ note position = 4 sugg = 58 &dA &d@ note position = 5 sugg = 58 &dA &d@ note position = 6 sugg = 59 &dA &d@ note position = 7 sugg = 63 &dA &d@ note position > 7 sugg = pos * 5 + 27 &dA &dA &d@ &dKdynamic = f,ff,fff,ffff,fp&d@ 4...9 +5 = 9 to 14 &dA &dA &d@ note position < 1 sugg = 61 &dA &d@ note position = 1 sugg = 62 &dA &d@ note position = 2 sugg = 62 &dA &d@ note position = 3 sugg = 62 &dA &d@ note position = 4 sugg = 63 &dA &d@ note position = 5 sugg = 63 &dA &d@ note position = 6 sugg = 66 &dA &d@ note position = 7 sugg = 68 &dA &d@ note position = 8 sugg = 73 &dA &d@ note position > 8 sugg = pos * 5 + 32 &dA &dA &d@ &dKdynamic = mf,Z,Zp,R&d@ 5...9 +5 = 10 to 14 &dA &dA &d@ note position < 1 sugg = 61 &dA &d@ note position = 1 sugg = 62 &dA &d@ note position = 2 sugg = 62 &dA &d@ note position = 3 sugg = 62 &dA &d@ note position = 4 sugg = 62 &dA &d@ note position = 5 sugg = 63 &dA &d@ note position = 6 sugg = 67 &dA &d@ note position = 7 sugg = 70 &dA &d@ note position = 8 sugg = 75 &dA &d@ note position > 8 sugg = pos * 5 + 34 vsugg(4,1,1) = 57 vsugg(4,1,2) = 57 vsugg(4,1,3) = 57 vsugg(4,1,4) = 57 vsugg(4,1,5) = 57 vsugg(4,1,6) = 57 vsugg(4,1,7) = 57 vsugg(4,1,8) = 57 vsugg(4,1,9) = 58 vsugg(4,1,10) = 58 vsugg(4,1,11) = 59 vsugg(4,1,12) = 63 vsugg(4,1,13) = 67 vsugg(4,1,14) = 72 vsugg(4,1,15) = 77 vsugg(4,1,16) = 27 vsugg(4,2,1) = 61 vsugg(4,2,2) = 61 vsugg(4,2,3) = 61 vsugg(4,2,4) = 61 vsugg(4,2,5) = 61 vsugg(4,2,6) = 62 vsugg(4,2,7) = 62 vsugg(4,2,8) = 62 vsugg(4,2,9) = 63 vsugg(4,2,10) = 63 vsugg(4,2,11) = 66 vsugg(4,2,12) = 68 vsugg(4,2,13) = 73 vsugg(4,2,14) = 77 vsugg(4,2,15) = 82 vsugg(4,2,16) = 32 vsugg(4,3,1) = 61 vsugg(4,3,2) = 61 vsugg(4,3,3) = 61 vsugg(4,3,4) = 61 vsugg(4,3,5) = 61 vsugg(4,3,6) = 62 vsugg(4,3,7) = 62 vsugg(4,3,8) = 62 vsugg(4,3,9) = 62 vsugg(4,3,10) = 63 vsugg(4,3,11) = 67 vsugg(4,3,12) = 70 vsugg(4,3,13) = 75 vsugg(4,3,14) = 79 vsugg(4,3,15) = 84 vsugg(4,3,16) = 34 &dA &d@ &dACASE 5: Stems down with beams&d@ &dA &dA &d@ &dKdynamic = p,pp,ppp,pppp,mp&d@ &dA &dA &d@ note position < -2 sugg = 56 -3...6 +5 = 2 to 11 &dA &d@ note position = -2 sugg = 57 &dA &d@ note position = -1 sugg = 57 &dA &d@ note position = 0 sugg = 58 &dA &d@ note position = 1 sugg = 61 &dA &d@ note position = 2 sugg = 63 &dA &d@ note position = 3 sugg = 65 &dA &d@ note position = 4 sugg = 68 &dA &d@ note position = 5 sugg = 72 &dA &d@ note position > 5 sugg = pos * 5 + 46 &dA &dA &d@ if note position > 1 add 3 for each extra beam &dA &dA &d@ &dKdynamic = f,ff,fff,ffff,mf,fp,Zp,Z,R&d@ -1...7 +5 = 4 to 12 &dA &dA &d@ note position < 0 sugg = 61 &dA &d@ note position = 0 sugg = 63 &dA &d@ note position = 1 sugg = 66 &dA &d@ note position = 2 sugg = 68 &dA &d@ note position = 3 sugg = 71 &dA &d@ note position = 4 sugg = 75 &dA &d@ note position = 5 sugg = 79 &dA &d@ note position = 6 sugg = 83 &dA &d@ note position > 6 sugg = pos * 5 + 53 &dA &dA &d@ if note position > 1 add 3 for each extra beam vsugg(5,1,1) = 56 vsugg(5,1,2) = 56 vsugg(5,1,3) = 57 vsugg(5,1,4) = 57 vsugg(5,1,5) = 58 vsugg(5,1,6) = 61 vsugg(5,1,7) = 63 vsugg(5,1,8) = 65 vsugg(5,1,9) = 68 vsugg(5,1,10) = 72 vsugg(5,1,11) = 76 vsugg(5,1,12) = 81 vsugg(5,1,13) = 86 vsugg(5,1,14) = 91 vsugg(5,1,15) = 96 vsugg(5,1,16) = 46 vsugg(5,2,1) = 61 vsugg(5,2,2) = 61 vsugg(5,2,3) = 61 vsugg(5,2,4) = 61 vsugg(5,2,5) = 63 vsugg(5,2,6) = 66 vsugg(5,2,7) = 68 vsugg(5,2,8) = 71 vsugg(5,2,9) = 75 vsugg(5,2,10) = 79 vsugg(5,2,11) = 83 vsugg(5,2,12) = 88 vsugg(5,2,13) = 93 vsugg(5,2,14) = 98 vsugg(5,2,15) = 103 vsugg(5,2,16) = 53 vsugg(5,3,1) = 61 vsugg(5,3,2) = 61 vsugg(5,3,3) = 61 vsugg(5,3,4) = 61 vsugg(5,3,5) = 63 vsugg(5,3,6) = 66 vsugg(5,3,7) = 68 vsugg(5,3,8) = 71 vsugg(5,3,9) = 75 vsugg(5,3,10) = 79 vsugg(5,3,11) = 83 vsugg(5,3,12) = 88 vsugg(5,3,13) = 93 vsugg(5,3,14) = 98 vsugg(5,3,15) = 103 vsugg(5,3,16) = 53 &dA &dA &d@ &dA &dA &d@ &dA End of initialization of vertical suggestion array &dA &d@ &dA &dA loop for i = 1 to 100 fontmap(i) = i repeat fontmap(1) = notesize /* 1 = Ed's choice for music font loop for i = 1 to 255 music_con(i) = i repeat &dA &dA &d@ Dotted mask &dA gapsize = 3 * notesize / 4 cycle = dup("1",gapsize) // dup("0",gapsize) dotted = "" i = 2500 - (2 * gapsize) loop dotted = dotted // cycle repeat while len(dotted) < i music_con(102) = 110 /* forte music_con(109) = 109 /* mezzo music_con(112) = 108 /* piano music_con(114) = 113 /* r music_con(115) = 111 /* s music_con(122) = 112 /* z &dA &dA &d@ Get screen fonts &dA revmap(31) = 1 revmap(32) = 2 revmap(33) = 3 revmap(34) = 4 revmap(37) = 5 revmap(38) = 6 revmap(39) = 7 revmap(44) = 8 revmap(46) = 9 #if SMALL revmap(06) = 10 revmap(102) = 11 revmap(103) = 12 #else revmap(14) = 10 revmap(106) = 11 revmap(108) = 12 #endif revmap(300) = 13 revmap(400) = 14 revmap(131) = 15 revmap(137) = 16 revmap(200) = 17 loop for i = 1 to 8 macros(i,1) = 0 macropnt(i) = 0 repeat putc Stage2 Data Entry and Editing Program putc getting fonts . . . ... #if SMALL open [1,5] "c:\zprogs\apps\scrfts06.fnt" #else open [1,5] "c:\zprogs\apps\scrfonts.fnt" #endif len(gstr) = sze read [1,1] gstr j = 1 loop for i = 1 to len(gstr) step 4 FA(j) = ors(gstr{i,4}) ++j repeat close [1] putc done! &dA &dA &d@ get spacing parameters for hyphon and underline characters (text font) &dA #if SMALL file = "c:\musprint\param06\fontspac" #else file = "c:\musprint\param\fontspac" #endif open [1,1] file h = mtfont - 1 * 10 loop for j = 1 to h getf [1] repeat getf [1] line hyphspc = int(line{40,2}) getf [1] line getf [1] line getf [1] line underspc = int(line{10,2}) close [1] &dA &dA &d@ get shift parameters for music font &dA #if SMALL file = "c:\musprint\param\ex\pos3" #else file = "c:\musprint\param\ex\pos3" #endif open [1,1] file loop for i = 1 to 223 getf [1] .t39 a pos(i) = a * notesize repeat close [1] &dA &dA &d@ get beam generation parameters &dA #if SMALL file = "c:\musprint\param\beamexs" #else file = "c:\musprint\param\beamexs" #endif open [1,1] file loop for i = 1 to 435 getf [1] q(1) q(2) q(3) q(4) q(5) q(6) q(7) q(8) q(9) q(10) q(11) q(12) loop for j = 1 to 12 beamext(i,j) = q(j) repeat repeat close [1] &dA &dA &d@ get tie placement parameters &dA #if SMALL file = "c:\musprint\param06\" #else file = "c:\musprint\param\" #endif tiefile(1) = file // "tpar\td-ns" tiefile(2) = file // "tpar\td-nl" tiefile(3) = file // "tpar\tu-ns" tiefile(4) = file // "tpar\tu-nl" * loop for i = 1 to 4 open [1,1] tiefile(i) loop for j = 1 to 4 getf [1] repeat loop for j = 1 to 162 getf [1] a q(1) q(2) q(3) q(4) q(5) q(6) q(7) q(8) q(9) q(10) q(11) q(12) loop for k = 1 to 12 dtiearr(i,j,k) = q(k) repeat repeat close [1] repeat &dA &dA &d@ &dE &dA &d@ &dE End of Initialization of music construction parameters &dA &d@ &dE &dA curfont = 0 claves = "CDEFGAB" numbers = "0123456789" accs = " #f" slurstr = "FpmFjoiOlpmFooiOphpFokoiffnFggnHFfFFIgGJcceBdddQBaAPEdQQcbeedddM" slurstr = slurstr // "KaNKddNMBaAAECCDlpmFIGGOlpmFOGOOphpFoiGHffnFggNH" slurstr = slurstr // "FfFFIgGJcceBECQQcdeAECQQcbeeddLMKaNKMdNMAaAAECCD" slurunder = "FHHFIGOOFHHFIGOOFNFFINGGFFNFIGNHFFFFIGGJBBBBECCQ" slurunder = slurunder // "BBBBECCQKCKKQNLMKKNKMLNMBKAAECCD" slurover = "lpppjoiolpppjoiophppokoiffnrggngffsngggncceedddd" slurover = slurover // "cceeddddcbeeddddcanaddndcaendddn" &dA &dA &d@ Meaning of curvedata: Curvedata is meant to describe the &dA &d@ approximate shape of slurs for various situations. The slurs &dA &d@ begin described are (flat) tips down. The end points are &dA &d@ assumed to be 0 and are therefore not included. A slur between &dA &d@ two notes need not be described, so that the first relevant &dA &d@ description is a slur between three notes. &dA &dA &d@ The first dimension of curvedata contains the number of notes &dA &d@ under the slur (not counting the end points). The second &dA &d@ dimension contains a number representing the curvature of the &dA &d@ slur (from 1 to 4). The third dimension contains the specific &dA &d@ note number for the height data. This number will range from &dA &d@ 1 to the number of notes under the slur (not counting the end &dA &d@ points). &dA &dA &dA &d@ Curvedata for notesize = 14 &dA curvedata(1,1,1) = 10 curvedata(1,2,1) = 14 curvedata(1,3,1) = 18 curvedata(1,4,1) = 22 curvedata(2,1,1) = 8 curvedata(2,2,1) = 12 curvedata(2,3,1) = 16 curvedata(2,4,1) = 20 curvedata(3,1,1) = 10 /* 8 curvedata(3,1,2) = 12 /* 12 curvedata(3,2,1) = 12 /* 10 curvedata(3,2,2) = 16 /* 16 curvedata(3,3,1) = 14 /* 12 curvedata(3,3,2) = 20 /* 20 curvedata(3,4,1) = 17 /* 15 curvedata(3,4,2) = 24 /* 24 curvedata(4,1,1) = 9 /* 7 curvedata(4,1,2) = 12 /* 12 curvedata(4,2,1) = 11 /* 10 curvedata(4,2,2) = 16 /* 16 curvedata(4,3,1) = 13 /* 12 curvedata(4,3,2) = 20 /* 20 curvedata(4,4,1) = 16 /* 15 curvedata(4,4,2) = 24 /* 24 curvedata(5,1,1) = 8 /* 6 curvedata(5,1,2) = 13 /* 12 curvedata(5,1,3) = 14 /* 13 curvedata(5,2,1) = 11 /* 9 curvedata(5,2,2) = 16 /* 15 curvedata(5,2,3) = 18 /* 17 curvedata(5,3,1) = 13 /* 11 curvedata(5,3,2) = 19 /* 19 curvedata(5,3,3) = 21 /* 21 curvedata(5,4,1) = 16 /* 14 curvedata(5,4,2) = 24 /* 23 curvedata(5,4,3) = 25 /* 25 curvedata(6,1,1) = 8 /* 5 curvedata(6,1,2) = 12 /* 11 curvedata(6,1,3) = 14 /* 13 curvedata(6,2,1) = 11 /* 9 curvedata(6,2,2) = 16 /* 15 curvedata(6,2,3) = 18 /* 17 curvedata(6,3,1) = 13 /* 11 curvedata(6,3,2) = 20 /* 19 curvedata(6,3,3) = 22 /* 21 curvedata(6,4,1) = 16 /* 14 curvedata(6,4,2) = 24 /* 23 curvedata(6,4,3) = 25 /* 25 curvedata(7,1,1) = 7 /* 5 curvedata(7,1,2) = 11 /* 11 curvedata(7,1,3) = 14 /* 13 curvedata(7,1,4) = 15 /* 14 curvedata(7,2,1) = 11 /* 9 curvedata(7,2,2) = 16 /* 15 curvedata(7,2,3) = 18 /* 17 curvedata(7,2,4) = 19 /* 18 curvedata(7,3,1) = 14 /* 11 curvedata(7,3,2) = 20 /* 19 curvedata(7,3,3) = 22 /* 21 curvedata(7,3,4) = 23 /* 22 curvedata(7,4,1) = 16 /* 14 curvedata(7,4,2) = 24 /* 23 curvedata(7,4,3) = 26 /* 25 curvedata(7,4,4) = 27 /* 26 curvedata(8,1,1) = 7 /* 5 curvedata(8,1,2) = 11 /* 11 curvedata(8,1,3) = 14 /* 13 curvedata(8,1,4) = 15 /* 14 curvedata(8,2,1) = 11 /* 9 curvedata(8,2,2) = 16 /* 15 curvedata(8,2,3) = 18 /* 17 curvedata(8,2,4) = 19 /* 18 curvedata(8,3,1) = 14 /* 11 curvedata(8,3,2) = 20 /* 19 curvedata(8,3,3) = 22 /* 21 curvedata(8,3,4) = 23 /* 22 curvedata(8,4,1) = 16 /* 14 curvedata(8,4,2) = 24 /* 23 curvedata(8,4,3) = 26 /* 25 curvedata(8,4,4) = 27 /* 26 loop for c1 = 2 to 8 loop for c2 = 1 to 4 c4 = c1 + 1 / 2 + 1 c5 = 1 loop for c3 = c1 to c4 step -1 curvedata(c1,c2,c3) = curvedata(c1,c2,c5) ++c5 repeat repeat repeat &dA &dA &d@ Scale for notesize = 6 &dA #if SMALL loop for c1 = 1 to 8 loop for c2 = 1 to 4 loop for c3 = 1 to 8 curvedata(c1,c2,c3) = curvedata(c1,c2,c3) * 3 + 3 / 7 repeat repeat repeat #endif &dA* End of Initialization of parameters * Determine operating mode debug_point = 10000 pmode = 0 &D putc Debug above measure number ? (return = no debug) &D getc line &D line = trm(line) &D if line <> "" &D pmode = 4 &D debug_point = int(line) &D end putc putc &dAS2ED&d@ operates on stage2 source files. Since there is always a putc chance that the program will malfunction, either because of a bug putc or because &dAyou asked it to do something illegal&d@, it is generally putc a good idea to make a copy of the stage2 library before beginning putc the operation. putc putc &dAS2ED&d@ provides two mechanisms to help you save the results of your putc work, should the program fail prematurely. The &dAshift-F2&d@ key will putc save the current state of your edited version in a temporary file putc called &dIs2save&d@. If the program fails under certain circumstances, putc it will give you the opportunity to store the current state of your putc edited version in a temporary file called &dIs2abort&d@. These files will putc appear in the directory from which you ran the program (usually putc the work-name directory). putc putc Source library? getc inlib inlib = trm(inlib) inlib = inlib // "\" getdir line inlib = line // "\" // inlib putc Group name? (default = data) getc line line = trm(line) line = lcs(line) line = mrt(line) if "sound^short^parts^score^data" con line group = line else putc This is an unconventional group name. Would you please putc verify it by typing it again (or enter a conventional name). getc temp2 temp2 = trm(temp2) temp2 = mrt(temp2) temp2 = lcs(temp2) if "sound^short^parts^score^data^" con temp2 group = temp2 else if temp2 = line group = line else group = "data" putc group name has been set to "data" end end end putc putc &dAS2ED&d@ works on only one movement at a time. The output library putc (for stage2 files) must already be allocated. S2ED will name the putc output files (i-files) according to the order of the input files putc in the group; i.b46 e. part 1 from the input group becomes the file "01" putc in the output library. S2ED can work on a range of parts within putc a group. You will be asked to provide this range. putc Enter the output library and range now. putc putc Output library? (Enter a blank line to make output same as input) getc outlib outlib = trm(outlib) if outlib = "" outlib = inlib else outlib = outlib // "\" getdir line outlib = line // "\" // outlib end f1 = 10000 &dA &dA &d@ Get names of input files &dA open [1,1] inlib loop getf [1] line line = line // pad(12) line = line{1,12} if line{1} = " " close [1] goto FCHK end if line{10} <> " " line{9} = "." end line = trm(line) temp = inlib // "/" // line open [2,1] temp loop for i = 1 to 11 getf [2] line2 repeat if line2 con group loop for i = 1 to 8 getf [2] line2 if line2{1,len(group)} = group if line2 con "part " j = int(line2{sub+5..}) if f1 = 10000 k = 0 if line2 con " of " k = int(line2{sub+3..}) end putc putc There appear to be ~k parts in this group. Simply type to putc process all of them, or enter the &dAfirst&d@ and &dAlast&d@ numbers of the putc range you wish to process. f1 = 0 f2 = 0 getc f1 f2 if f1 = 0 f1 = 1 f2 = k end if f2 = 0 f2 = f1 end f3 = f1 end if j >= f1 and j <= f2 infiles(j) = line end end i = 100 end repeat if i <> 100 putc file ~line has a bad group membership format putc Please fix this problem before proceeding further. putc stop end end close [2] repeat FCHK: loop for i = f1 to f2 if infiles(i) = "" putc Unable to find an input file for track ~i . Please check putc to see that your tracks are within the range of the size of putc the group you are working with. putc stop end repeat BIG: &dA &dA &d@ Initialize display strings &dA #if SMALL setup curstr,5,32,1,0,0,80,180 setup gstr,1500,250,1,0,0,80,230 setup genmsgstr,18,30,1 setup msgstr,40,210,1 setup redmsgstr,40,206,1 setup bluemsgstr,40,206,1 setup msgstr2,40,65,1 setup redmsgstr2,40,65,1 setup helpmsgstr,hlpxz,hlpyz,1 setup supermsgstr,80,28,1 msgstr{21,30} = gline{1,30} msgstr{101,30} = gline{1,30} msgstr{8181,30} = gline{1,30} msgstr{8261,30} = gline{1,30} #else setup curstr,5,32,1,0,0,160,400 setup gstr,3000,500,1,0,0,160,500 setup genmsgstr,72,120,1 setup msgstr,80,440,1 setup redmsgstr,80,440,1 setup bluemsgstr,80,440,1 setup msgstr2,80,140,1 setup redmsgstr2,80,140,1 setup helpmsgstr,hlpxz,hlpyz,1 setup supermsgstr,160,60,1 msgstr{21,60} = gline{1,60} msgstr{261,60} = gline{1,60} msgstr{33221,60} = gline{1,60} msgstr{33461,60} = gline{1,60} #endif bitmode 2, xze, yze xze >>= 3 &dA &dA &d@ Initialize of single file operation &dA loop for i = 1 to 1000 s2marks(i,1) = 0 s2marks(i,2) = 0 s2marks(i,3) = 0 s2marks(i,4) = 0 repeat markcnt = 0 loop for i = 1 to 8 superignore(i) = 0 repeat ignorecnt = 0 ignoreset = 0 slur_incnt = 0 cmode = "j" newk = 0 jump_mnum = 0 active_clef = 0 active_clef_change = 0 old_active_clef = 0 loop for i = 1 to MAX_S2Z s2_to_ifile(i) = 0 ifile_to_s2(i) = 0 repeat display_flag = 0 loop for i = 1 to 16 current_line(i) = "" repeat current_iline = "" current_def = "" m_number = 0 tuflag = 0 loop for i = 1 to MAX_STAFF c8flag(i) = 0 transflag(i) = 0 repeat ctrflag = 0 loop for i = 1 to 4 loop for j = 1 to MAX_PASS loop for k = 1 to BM_SIZE beampar(i,j,k) = 0 repeat repeat repeat outslurs = "00000000" /* clear all pending slur flags snum = 0 esnum = 0 loop for j = 1 to MAX_PASS tsnum(j) = 0 pre_tsnum(j) = 0 repeat figdiv = 0 cuediv = 0 measnum = 0 divpoint = 0 sct = 0 /* necessary so that ts(.,.) will be completely cleared maxsct = 0 oldsct = 0 supcnt = 0 inctype = 0 vflag = 1 mcat = 0 granddist = vpar(66) global_tpflag = 0 tpflag = 0 xposi_shift = 0 yposi_shift = 0 restplace = 0 *********** Transfer file to Data Table *********** if f3 = 0 putc Suspected problem with the allocation of group memberships putc in this directory. Please check all relevent files before putc proceeding further. putc putc &dAProgram Halted&d@ putc stop end file = inlib // infiles(f3) if outlib = inlib outfile = outlib // infiles(f3) else if f3 < 10 outfile = outlib // "0" // chs(f3) else outfile = outlib // chs(f3) end end &dK &d@ putc &dK &d@ putc Input file = ~file &dK &d@ putc open [1,1] file loop for i = 1 to MAX_S2Z getf [1] line line = trm(line) tput [X,i] ~line list_order(i,1) = i - 1 list_order(i,2) = i + 1 list_order(i,3) = USE_REC repeat eof1: --i list_order(1,1) = TOP_FLAG list_order(i,2) = BOTTOM_FLAG ssize = i addrec = ssize close [1] tget [X,ssize] line line = line // pad(4) if line{1,4} <> "/END" putc File not properly terminated examine putc stop end &dA &dA &d@ Skip over group membership information &dA scnt = 11 tget [X,scnt] line line = trm(line) if line con ":" /* looking for group memberships j = mpt + 1 loop for k = 0 to 100 out = txt(line,[' '],j) repeat while out <> "" /* k = number of group memberships ++k loop for j = 1 to k ++scnt tget [X,scnt] line line = line // pad(1) loop while line{1} = "&" loop ++scnt if scnt > ssize putc Missing comment terminator "&". putc stop end tget [X,scnt] line line = line // pad(1) repeat while line{1} <> "&" ++scnt if scnt > ssize putc Missing comment terminator "&". putc stop end tget [X,scnt] line line = line // pad(1) repeat repeat end &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA³ Start Processing Data ³&d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ LOADED: ttext = "" firstoff = 0 sigflag = 0 key = 0 loop for i = 1 to 50 claveax(i) = 0 repeat repeater_flag = 0 nstaves = 1 * tget [X,8] mname tget [X,9] partname tget [X,10] out out = trm(out) a = 0 loop for i = 1 to len(out) if "SATB" con out{i} a = vpar(101) end repeat autop = 0 tput [Y,1] L 0 ~a !39~partname tput [Y,2] J D 4 500 -120 1 6913 0 0 tput [Y,3] W 0 0 44 ~mname outpnt = 3 &dA &dA &d@ Set movement word (if present) &dA out = mname partname = trm(partname) if partname <> "" out = out // ": " // partname end if out <> "" oby = 0 - vpar(33) - notesize obx = autop + hpar(39) + hpar(5) ++outpnt tput [Y,outpnt] J D 1 ~obx ~oby 1 6913 0 0 spn = 6913 ++outpnt tput [Y,outpnt] W 0 -~vpar(8) 44 ~out end mrest = 0 @n = 0 old@n = 0 mindist = hpar(4) * STRETCH minshort = 0 sugg_flg = 0 /* print suggestion flag scnt_start = scnt pan_resume = 0 first_outpnt = 0 goto PR &dA &dA &d@ &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA &d@ &dA³ Process the data file ³&d@ &dA &d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ &dA &d@ PR: loop while list_order(scnt,3) = IGNORE_REC scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error goto E(12) end repeat tget [X,scnt] line scnt = list_order(scnt,2) line = line // pad(80) d = int(line{6,3}) /* possible duration g = int(line{9,4}) /* possible measure number if "@Std" con line{1} goto PR end if line{1} = "&" PR101: loop while list_order(scnt,3) = IGNORE_REC scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error goto E(12) end repeat tget [X,scnt] line scnt = list_order(scnt,2) line = line // pad(1) if line{1} <> "&" goto PR101 end goto PR end if line{1} = "$" if mrest > 0 /* this code &dAadded 1-27-93&d@ &dK &d@ s2rec = scnt - 1 s2rec = scnt loop s2rec = list_order(s2rec,1) if s2rec = TOP_FLAG dputc Error goto E(12) end repeat while list_order(s2rec,3) = IGNORE_REC perform setmrest end if first_outpnt = 0 or line con "Q:" &dK &d@ s2rec = scnt - 1 s2rec = scnt loop s2rec = list_order(s2rec,1) if s2rec = TOP_FLAG dputc Error goto E(12) end repeat while list_order(s2rec,3) = IGNORE_REC first_outpnt = outpnt + 1 perform process_section s2_to_ifile(s2rec) = first_outpnt else perform process_section end sugg_flg = 0 goto PR end if line{1} = "P" line = line // pad(1) d = scnt loop d = list_order(d,1) if d = TOP_FLAG dputc Error goto E(12) end repeat while list_order(d,3) = IGNORE_REC pre_scnt = d /* i.e., pre_scnt = scnt - 1 loop d = list_order(d,1) if d = TOP_FLAG dputc Error goto E(12) end repeat while list_order(d,3) = IGNORE_REC tget [X,d] temp3 &dK &d@ tget [X,scnt-2] temp3 sub = 1 MORE_SUGG: if line{sub..} con "C" ++sub d = int(line{sub..}) /* column number ++sub /* skip ":" g = sub if d = 0 /* general suggestion PQST: if "dfpqrstn" con line{g} goto PSUG(mpt) PSUG(1): tword_height = int(line{g+1..}) g = sub goto PQST PSUG(2): mdirfont = int(line{g+1..}) g = sub goto PQST PSUG(3): mindist = int(line{g+1..}) * hpar(4) / 100 * STRETCH g = sub perform newnsp goto PQST PSUG(4): minshort = int(line{g+1..}) g = sub perform newnsp goto PQST PSUG(5): restplace = int(line{g+1..}) if restplace <> 1 restplace = 0 end g = sub goto PQST PSUG(6): granddist = int(line{g+1..}) g = sub granddist = granddist * vpar(2) / 10 &dA &dA &d@ Add this code to allow viewing of different grand staff spacings &dA tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 goto PQST PSUG(7): global_tpflag = int(line{g+1..}) g = sub if global_tpflag > 4 global_tpflag = 4 end if global_tpflag < 0 global_tpflag = 0 end tpflag = global_tpflag goto PQST PSUG(8): m_number = int(line{g+1..}) g = sub goto PQST end sub = g+1 goto MORE_SUGG end if d = 26 or d = 27 if "baA" con line{g} repeater_flag = mpt - 1 if d = 27 and repeater_flag > 0 repeater_flag += 4 end sub = g+1 goto MORE_SUGG end end if "ABCDEFGgcrif" con temp3{1} a3 = mpt if d = 1 if "pxyY" con line{g} ++@n tcode(@n) = zpd(4) tcode(@n){1} = chr(1) tv1(@n) = P_SUGGESTION tv2(@n) = 0x0300 tv5(@n) = pre_scnt end ABCL: if line{g} = "p" i = int(line{g+1..}) if i < 0 i = 0 end if i > 7 i = 7 end if i > 0 i = i << 1 + 1 end tcode(@n){1} = chr(i) g = sub goto ABCL end if "xyY" con line{g} a3 = mpt + 1 if line{g+1} = "+" ++g end i = int(line{g+1..}) i += 128 if i <= 0 i = 1 end if i > 255 i = 255 end i &= 0xff g = sub tcode(@n){a3} = chr(i) goto ABCL end end if d >= 32 and d <= 43 and a3 < 11 if "([{z" con temp3{d} i = mpt - 1 << 1 if "ou" con line{g} /* this is a forced slur suggestion i += mpt - 1 ++@n tv1(@n) = P_SUGGESTION tv2(@n) = i tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 end end if temp3{d} = "-" if "ou" con line{g} /* this is a specified tie ++@n tv1(@n) = P_SUGGESTION tv2(@n) = mpt + 7 tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 end end if "_.=i>VArtwMkvnoQ012345mpfZRFE" con temp3{d} i = mpt - 1 << 1 + 1 i = int("0101010203030304040404040606070808090909090914141414141516"{i,2}) if i = 9 /* fingering if d > 32 and temp3{d-1} = ":" i = 1000 /* i = 1000 means "do nothing" else ++sugg_flg i = sugg_flg & 0x0f + 8 end end if i = 14 if sugg_flg > 0x0f i = 1000 else sugg_flg += 0x10 end end if i < 1000 and "xyYab" con line{g} a3 = mpt ++@n tcode(@n) = zpd(4) tv1(@n) = P_SUGGESTION tv2(@n) = 0x0200 + i /* i is index into position string tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 NXYP: if a3 < 4 ++a3 ++g sub = g if line{sub} = "+" ++sub end a2 = int(line{sub..}) g = sub a2 += 128 if a2 < 1 a2 = 1 end a2 &= 0xff tcode(@n){a3} = chr(a2) a2 = ors(tcode(@n){1}) | 0x01 tcode(@n){1} = chr(a2) else a3 = a3 - 4 * 4 + 3 /* 3 -> 3, 4 -> 7 a2 = ors(tcode(@n){1}) | a3 tcode(@n){1} = chr(a2) ++g end if "xyYab" con line{g} a3 = mpt goto NXYP end end end if temp3{d} = "*" /* &dA03-21-97&d@ if "[(:;i" con line{g} a3 = mpt ++@n tv1(@n) = P_SUGGESTION tv2(@n) = 0x10 /* tuplet suggestion MOTUP: if a3 = 2 or a3 = 4 tv2(@n) |= 0x01 /* round tuplet end if a3 = 1 or a3 = 2 or a3 = 5 tv2(@n) |= 0x02 /* continuous tuplet end if a3 = 3 tv2(@n) = 0x10 /* square, broken tuplet (default) end if a3 = 5 tv2(@n) |= 0x04 /* tuplet number inside bracket end if "[(:;i" con line{g+1} ++g a3 = mpt goto MOTUP end sub = g+1 goto MORE_SUGG end end end end if temp3{1} = "*" if d >= 17 and d <= 18 if "fxypY" con line{g} ++@n tcode(@n) = zpd(4) tv1(@n) = P_SUGGESTION if "ABCDGPQ" con temp3{d} tv2(@n) = 0x0100 else tv2(@n) = 0x0101 end tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 end NXFP: if line{g} = "f" i = int(line{g+1..}) g = sub if "ABCDG" con temp3{d} /* this is a designated font number tcode(@n){1} = chr(i) end goto NXFP end if "xyYp" con line{g} a3 = mpt + 1 if a3 = 5 a3 -= 3 end if line{g+1} = "+" ++g end i = int(line{g+1..}) i += 0x80 if i <= 0 i = 1 end if i > 255 i = 255 end g = sub if "ABCDEFGHJPQUVW" con temp3{d} /* this is a position shift tcode(@n){a3} = chr(i) end goto NXFP end sub = g goto MORE_SUGG end if d >= 25 and line{g} = "f" i = int(line{g+1..}) g = sub temp3 = temp3 // pad(100) &dA &dA &d@ De-construct temp3 into ASCII and font changes &dA loop for a1 = 1 to 10 font_changes(a1,1) = 0 font_changes(a1,2) = 0 repeat changecnt = 0 sub = 25 NXFNUM: if temp3{sub..} con "!" and temp3{sub+1} in ['0'..'9'] a1 = sub a2 = int(temp3{a1+1..}) ++changecnt font_changes(changecnt,1) = a1 font_changes(changecnt,2) = a2 temp3 = temp3{1,a1-1} // temp3{sub..} sub = a1 goto NXFNUM end &dA &dA &d@ Add new font change and re-order in ascending order of location &dA ++changecnt font_changes(changecnt,1) = d font_changes(changecnt,2) = i loop for a1 = changecnt to 2 step -1 a2 = a1 - 1 if font_changes(a1,1) < font_changes(a2,1) a3 = font_changes(a1,1) font_changes(a1,1) = font_changes(a2,1) font_changes(a2,1) = a3 a3 = font_changes(a1,2) font_changes(a1,2) = font_changes(a2,2) font_changes(a2,2) = a3 end repeat &dA &dA &d@ Merge ASCII and font changes into new temp3 &dA temp4 = temp3{1,24} a2 = 25 loop for a1 = 1 to changecnt a3 = font_changes(a1,1) if a3 > a2 temp4 = temp4 // temp3{a2..a3-1} end a2 = a3 temp4 = temp4 // "!" // chs(font_changes(a1,2)) repeat temp4 = temp4 // temp3{a2..} temp3 = temp4 loop for a1 = @n to 1 step -1 if tv1(a1) = MUSICAL_DIR tdata(a1) = temp3{17..80} a1 = 0 end repeat sub = g goto MORE_SUGG end end sub = g goto MORE_SUGG end goto PR end if line{8} = " " d = 0 end if mrest > 0 out = trm(line) if len(out) > 15 /* this is a normal stage2 data line &dK &d@ s2rec = scnt - 1 s2rec = scnt loop s2rec = list_order(s2rec,1) if s2rec = TOP_FLAG dputc Error goto E(12) end repeat while list_order(s2rec,3) = IGNORE_REC perform setmrest else if line{1,4} <> "meas" and "rib" not_con line{1} &dK &d@ s2rec = scnt - 1 s2rec = scnt loop s2rec = list_order(s2rec,1) if s2rec = TOP_FLAG dputc Error goto E(12) end repeat while list_order(s2rec,3) = IGNORE_REC perform setmrest end end end if "ABCDEFGri" con line{1} ++@n i = NOTE if line{1} = "r" i = REST end if line{1} = "i" i = IREST end tv1(@n) = i tv2(@n) = d pre_scnt = scnt loop pre_scnt = list_order(pre_scnt,1) if pre_scnt = TOP_FLAG dputc Error goto E(12) end repeat while list_order(pre_scnt,3) = IGNORE_REC tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 if " 123" con line{24} if mpt = 1 tv3(@n) = 0 else tv3(@n) = mpt - 2 end else putc Illegal character in staff number column (col. 24). Please fix. putc Record = ~line goto EE end tcode(@n) = line{1,4} tdata(@n) = line{17..80} if line{1} = "r" tv3(@n) += restplace << 8 else if repeater_flag > 0 tv3(@n) += repeater_flag << 8 if bit(0,repeater_flag) = 1 and line{26} = "]" repeater_flag = 0 end end end sugg_flg = 0 goto PR end if line{1} = "/" if display_flag = 0 start_outpnt = outpnt start_s2rec = s2rec ++markcnt save_markcnt = markcnt s2marks(markcnt,1) = start_s2rec s2marks(markcnt,3) = outpnt s2marks(markcnt,4) = autop end display_flag = 1 old_active_clef = active_clef perform action /* <<<<<<<<<<< if active_clef <> old_active_clef active_clef_change = 1 end if outpnt <= start_outpnt or display_flag <> 2 goto PY2 end if ignoreset > 0 --ignoreset loop for i = 1 to 8 if superignore(i) > 0 goto PY2 end repeat end s2marks(markcnt,2) = s2rec display_flag = 0 perform pan active_clef_change = 0 j = 100000 loop for i = 1 to 8 if superignore(i) > 0 a1 = superignore(i) & 0xffffff if a1 < j j = a1 end end repeat if j <> 100000 ++ignorecnt ignoreset = ignorecnt a3 = j loop loop for a1 = save_markcnt to 1 step -1 a2 = s2marks(a1,1) if a3 = a2 goto PY30 end repeat a3 = list_order(a3,1) if a3 = TOP_FLAG dputc Error goto E(12) end repeat PY30: scnt = s2marks(a1,1) s2rec = scnt loop scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error goto E(12) end repeat while list_order(scnt,3) = IGNORE_REC outpnt = s2marks(a1,3) autop = s2marks(a1,4) markcnt = a1 - 1 else ignorecnt = 0 end #if SMALL setup curstr,5,32,1,0,0,80,180 setup gstr,1500,250,1,0,0,80,230 #else setup curstr,5,32,1,0,0,160,400 setup gstr,3000,500,1,0,0,160,500 #endif PY2: ++outpnt tput [Y,outpnt] J M 0 ~obx 0 0 10000 0 0 putc END goto NEXT end if " cgf*b" con line{1} a2 = mpt e = int(line{8}) if line{8} in ['A'..'E'] e = ors(line{8}) - 55 /* A = 10, etc. end ++@n tdata(@n) = line{17..80} if line{1} = "f" tv3(@n) = 0 else if " 123" con line{24} if mpt = 1 tv3(@n) = 0 else tv3(@n) = mpt - 2 end else putc Illegal character in staff number column (col. 24). Please fix. putc Record = ~line goto EE end end sugg_flg = 0 pre_scnt = scnt loop pre_scnt = list_order(pre_scnt,1) if pre_scnt = TOP_FLAG dputc Error goto E(12) end repeat while list_order(pre_scnt,3) = IGNORE_REC goto T(a2) /* a2 = mpt from ~20 lines above T(1): tv1(@n) = XNOTE tv2(@n) = 0 tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 tcode(@n) = line{2,4} goto PR T(2): i = CUE_NOTE if line{2} = " " i = XCUE_NOTE tcode(@n) = line{3,4} e = 0 else tcode(@n) = line{2,4} end if line{2} = "r" i = CUE_REST end tv1(@n) = i tv2(@n) = e tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 if line{2} = "r" tv3(@n) += restplace << 8 else if repeater_flag > 0 tv3(@n) += repeater_flag << 8 if bit(0,repeater_flag) = 1 and line{26} = "]" repeater_flag = 0 end end end goto PR T(3): i = GR_NOTE if line{2} = " " i = XGR_NOTE tcode(@n) = line{3,4} e = 0 else tcode(@n) = line{2,4} end tv1(@n) = i tv2(@n) = e tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 if repeater_flag > 0 tv3(@n) += repeater_flag << 8 if bit(0,repeater_flag) = 1 and line{26} = "]" repeater_flag = 0 end end goto PR T(4): tv1(@n) = FIGURES tv2(@n) = d tv3(@n) = 0 tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 tcode(@n) = line{2,4} goto PR T(5): tv1(@n) = MUSICAL_DIR tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 if "12345" con line{15} tv2(@n) = mpt else tv2(@n) = 1 end if d > 0 tv3(@n) += d << 8 end tcode(@n) = line{17,4} goto PR T(6): tv1(@n) = BACKSPACE tv2(@n) = d tv3(@n) = 0 tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 tcode(@n) = line{1,4} goto PR end if line{1} = "m" if display_flag = 0 start_outpnt = outpnt start_s2rec = s2rec ++markcnt save_markcnt = markcnt s2marks(markcnt,1) = start_s2rec s2marks(markcnt,3) = outpnt s2marks(markcnt,4) = autop end display_flag = 1 &dK &dK &d@ examine &dK sugg_flg = 0 if line{2,4} = "easu" and f4 = 0 out = trm(line) if len(out) < 16 if @n = 1 if "ir" con tcode(1){1} out = trm(tdata(1)) if out = "" ++mrest measnum = g @n = 0 out = trm(line) if len(out) > 7 if len(out) > 12 out = line{1,8} // chs(g-1) // pad(12) out = out // line{13..} out = trm(out) else out = line{1,8} // chs(g-1) out = trm(out) end end &dK &d@ putc ~out goto PR end end else if @n = vflag * 2 - 1 and nstaves = 1 &dA &dA &d@ examine &dA loop for i = 1 to vflag * 2 step 2 out = trm(tdata(i)) if "ir" not_con tcode(i){1} or out <> "" i = 10000 else if i < @n out = trm(tdata(i+1)) if tcode(i+1) <> "back" or out <> "" i = 10000 end end end repeat if i < 10000 ++mrest measnum = g @n = 0 out = trm(line) &dK &d@ putc ~out goto PR end end end end end f4 = 0 ++@n tv1(@n) = BAR_LINE tv2(@n) = g tv3(@n) = nstaves pre_scnt = scnt loop pre_scnt = list_order(pre_scnt,1) if pre_scnt = TOP_FLAG dputc Error goto E(12) end repeat while list_order(pre_scnt,3) = IGNORE_REC tv5(@n) = pre_scnt &dK &d@ tv5(@n) = scnt - 1 measnum = g tcode(@n) = line{4,4} tdata(@n) = line{17..80} if tdata(@n) not_con "*" out = trm(line) if len(out) > 7 if len(out) > 12 out = line{1,8} // chs(g-1) // pad(12) out = out // line{13..} out = trm(out) else out = line{1,8} // chs(g-1) out = trm(out) end end &dK &d@ putc ~out &dK &d@ if display_flag = 0 &dK &d@ start_outpnt = outpnt &dK &dK &d@ start_s2rec = s2rec &dK This was done above &dK &d@ ++markcnt &dK &dK &d@ save_markcnt = markcnt &dK &d@ s2marks(markcnt,1) = start_s2rec &dK &d@ s2marks(markcnt,3) = outpnt &dK &d@ s2marks(markcnt,4) = autop &dK &d@ end &dK &d@ &dK &d@ display_flag = 1 old_active_clef = active_clef perform action /* <<<<<<<<<<< if active_clef <> old_active_clef active_clef_change = 1 end if outpnt <= start_outpnt or display_flag <> 2 goto PY1 end if ignoreset > 0 --ignoreset loop for i = 1 to 8 if superignore(i) > 0 goto PY1 end repeat end s2marks(markcnt,2) = s2rec display_flag = 0 if jump_mnum = 0 or measnum >= jump_mnum perform pan active_clef_change = 0 end j = 100000 loop for i = 1 to 8 if superignore(i) > 0 a1 = superignore(i) & 0xffffff if a1 < j j = a1 end end repeat if j <> 100000 ++ignorecnt ignoreset = ignorecnt a3 = j loop loop for a1 = save_markcnt to 1 step -1 a2 = s2marks(a1,1) if a3 = a2 goto PY3 end repeat a3 = list_order(a3,1) if a3 = TOP_FLAG dputc Error goto E(12) end repeat PY3: scnt = s2marks(a1,1) s2rec = scnt loop scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error goto E(12) end repeat while list_order(scnt,3) = IGNORE_REC outpnt = s2marks(a1,3) autop = s2marks(a1,4) markcnt = a1 - 1 else ignorecnt = 0 end #if SMALL setup curstr,5,32,1,0,0,80,180 setup gstr,1500,250,1,0,0,80,230 #else setup curstr,5,32,1,0,0,160,400 setup gstr,3000,500,1,0,0,160,500 #endif PY1: loop for i = 1 to 50 loop for j = 1 to 3 measax(j,i) = claveax(i) repeat repeat @n = 0 end goto PR end putc ~line trp = 7 goto trap * NEXT: &dA &dA &d@ Open output file &dA putc putc Editing complete. Storing results in putc &dI~outfile &d@ . . . ... i = 1 open [3,2] outfile NXT01: if list_order(i,3) = USE_REC tget [X,i] line line = trm(line) putf [3] ~line end i = list_order(i,2) if i <> BOTTOM_FLAG goto NXT01 end close [3] putc Done! putc treset [X] treset [Y] * ++f3 if f3 > f2 putc putc &dATask Completed&d@ putc stop end goto BIG * trap: goto E(trp) E(1): putc Chord format error goto EE E(2): putc Figured harmony error goto EE E(3): putc Tie error putc putc This is most often caused by a tie that has &dAno terminating note&d@ putc in any part. You should first check to see that all ties in putc region where this error occurred are properly terminated. The putc problem can also be caused by excessive durations in a measure putc that has a tie. This will cause the program to think the measure putc has ended (early) and it will look for a terminating note in the putc &dAnext measure&d@; i.b46 e., it will skip a properly placed terminating note. putc If you still can't find the error, you might try deleting ties one putc at a time to see which one is causing the problem. putc putc Another cause can be trying to tie notes which are on different putc staves of the grand staff. At the moment, autoset does not support putc this feature. goto EE E(4): putc Bar error goto EE E(5): putc Text error goto EE E(6): putc Time signature error goto EE E(7): putc No recognizable control character goto EE E(8): putc Figured harmony out of order putc putc Possibly you have entered a figured offset improperly. putc putc For example, the offset &dAto&d@ the &dAsecond figure&d@ actually appears putc in the record for the first figure. The interpretation of the putc offset number is how must to advance the division counter &dAafter&d@ putc a figure is printed. goto EE E(9): putc Pitch decoding error goto EE E(10): putc putc General Program Failure goto EE E(11): putc putc You have pushed to terminate the &dAs2ed&d@ program. goto EE E(12): putc putc Possible problem in data, or logical error in program, putc resulting in premature termination of program. putc goto EE E(13): putc putc Error in trying to display Beams. Possible cause putc is illegal beaming format. goto EE /* This error condition added &dA10-12-96&d@ E(14): putc putc No pitch found to match tie termination (X) direction (*). putc putc Check musical direction records (*) in this measure for tie putc terminations and verify that the pitch in column 25 appears putc earlier in the measure, on the same staff. putc goto EE EE: putc putc &dEOptions for termination:&d@ putc putc There are two options for saving the work you have done thus far. putc if trp < 11 putc 1. Type 'y' to save the current state of editing in a file putc called &dIs2abort&d@ (in current directory). else putc 1. Type 'y' to save results of your work in &dIs2save&d@. This putc temporary file will be created in the current directory. end putc putc 2. Type 'Y' to save the current state of editing in the target putc output file &dI~outfile putc putc 3. Any other key will simply exit the program. putc getk k if k = 0x010059 putc putc Store edited results in putc &dI~outfile &d@ . . . ... i = 1 open [7,2] outfile EEE1: if list_order(i,3) = USE_REC tget [X,i] line line = trm(line) putf [7] ~line end i = list_order(i,2) if i <> BOTTOM_FLAG goto EEE1 end putc Done! close [7] end if k = 0x010079 putc i = 1 if trp < 11 putc Saving edited version of file in &dIs2abort&d@ . . . ... open [7,2] "s2abort" else putc Saving edited version of file in &dIs2save&d@ . . . ... open [7,2] "s2save" end EEE2: if list_order(i,3) = USE_REC tget [X,i] line line = trm(line) putf [7] ~line end i = list_order(i,2) if i <> BOTTOM_FLAG goto EEE2 end putc Done! close [7] end putc putc &dAProgram Halted&d@ putc stop &dA &d@ &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA &d@ &dA³ End of processing music data ³&d@ &dA &d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ &dA &d@ &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA &d@ &dA³ P R O C E D U R E S ³&d@ &dA &d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 1a. decodenote ³ &dA &d@³ ³ &dA &d@³ Input: note (string) ³ &dA &d@³ ³ &dA &d@³ Output: @c = clave number ³ &dA &d@³ 100 = rest ³ &dA &d@³ 200 = unprinted rest ³ &dA &d@³ ³ &dA &d@³ @d = &dAunmodified&d@ accidental flag ³ &dA &d@³ 0000 = no accidental ³ &dA &d@³ 0010 = sharp ³ &dA &d@³ 0011 = flat ³ &dA &d@³ 1010 = sharp sharp ³ &dA &d@³ 1111 = flat flat ³ &dA &d@³ ³ &dA &d@³ for rests, mf(1) = 0 ????????????? ³ &dA &d@³ ³ &dA &d@³ Note: decodenote is called only AFTER all note events have³ &dA &d@³ been reordered by time within the measure. ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure decodenote int a,b if note = "rest" @c = 100 @d = 0 mf(1) = 0 return end if note = "ires" @c = 200 @d = 0 return end if claves con note{1} a = mpt end @d = 0 loop for b = 2 to 4 if numbers con note{b} @c = mpt - 2 * 7 + a return end @d <<= 2 if accs con note{b} @d = @d | mpt end repeat putc note = ~note This will cause a ... return 9 &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 1a. decodeax (t1,t2) ³ &dA &d@³ ³ &dA &d@³ Input: t1 = pointer into ts array ³ &dA &d@³ t2 = index into measax array ³ &dA &d@³ bit(18,ts(t1,SUBFLAG_1)) = cautionary accidental flag³ &dA &d@³ (has effect only when no accidental would ³ &dA &d@³ otherwise be printed) ³ &dA &d@³ ³ &dA &d@³ Output: correct accidental in ts(.,AX) ³ &dA &d@³ ³ &dA &d@³ 0000 = no accidental ³ &dA &d@³ 0001 = natural ³ &dA &d@³ 0010 = sharp ³ &dA &d@³ 0011 = flat ³ &dA &d@³ 0110 = natural sharp ³ &dA &d@³ 0111 = natural flat ³ &dA &d@³ 1010 = sharp sharp ³ &dA &d@³ 1111 = flat flat ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure decodeax (t1,t2) int t1,t2,t3,t4,ax getvalue t1,t2 t3 = ts(t1,CLAVE) if t3 > 99 ts(t1,AX) = 0 return end &dA &dA &d@ adjust accident to reflect key and measure &dA t4 = ts(t1,AX) ax = t4 if ax = measax(t2,t3) if bit(18,ts(t1,SUBFLAG_1)) = 0 t4 = 0 else if t4 = 0 t4 = 1 /* natural end end else if ax = 0 t4 = 1 else if measax(t2,t3) > 7 if ax < 4 t4 = t4 | 4 end end end measax(t2,t3) = ax end ts(t1,AX) = t4 return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 2. action ³ &dA &d@³ ³ &dA &d@³ Purpose: Action is basically a continuation of the music ³ &dA &d@³ processing program. It is called when the data ³ &dA &d@³ for a measure is complete. ³ &dA &d@³ ³ &dA &d@³ Inputs: @n = number of elements in data arrays ³ &dA &d@³ tv1(.) = element type ³ &dA &d@³ ³ &dA &d@³ type element ³ &dA &d@³ ---- ------- ³ &dA &d@³ 1 regular note ³ &dA &d@³ 2 extra regular note in chord ³ &dA &d@³ 3 regular rest ³ &dA &d@³ 4 cue note ³ &dA &d@³ 5 extra cue note in chord ³ &dA &d@³ 6 cue rest ³ &dA &d@³ 7 grace note or grace rest ³ &dA &d@³ 8 extra grace note in chord ³ &dA &d@³ 9 figured harmony ³ &dA &d@³ 10 bar line ³ &dA &d@³ 11 musical direction ³ &dA &d@³ 12 invisable rest ³ &dA &d@³ 13 backspace ³ &dA &d@³ 14 clef change ³ &dA &d@³ 15 time designation or other directive ³ &dA &d@³ 16 time change ³ &dA &d@³ 17 change in divspq ³ &dA &d@³ 18 key change ³ &dA &d@³ 19 print suggestion ³ &dA &d@³ ³ &dA &d@³ tv2(.) = duration for types 1--9, 12,13 ³ &dA &d@³ = measure number for type 10 ³ &dA &d@³ = track number for type 11 (1 = default) ³ &dA &d@³ = new clef number for type 14 ³ &dA &d@³ = 0 for type 15 ³ &dA &d@³ = new time flag for type 16 ³ &dA &d@³ = new divspq for type 17 ³ &dA &d@³ = new key for type 18 ³ &dA &d@³ = type of suggestion for type 19 ³ &dA &d@³ ³ &dA &d@³ if between 0 and 7 ³ &dA &d@³ 0 = force slur 1 over ³ &dA &d@³ 1 = force slur 1 under ³ &dA &d@³ 2 = force slur 2 over ³ &dA &d@³ 3 = force slur 2 under ³ &dA &d@³ 4 = force slur 3 over ³ &dA &d@³ 5 = force slur 3 under ³ &dA &d@³ 6 = force slur 4 over ³ &dA &d@³ 7 = force slur 4 under ³ &dA &d@³ ³ &dA &d@³ if between 8 and 9 ³ &dA &d@³ 8 = overhanded tie (tips down) ³ &dA &d@³ 9 = underhanded tie (tips up) ³ &dA &d@³ ³ &dA &d@³ if between 16 and 31 (&dA03-21-97&d@) ³ &dA &d@³ bit 0: clear = square tuplet ³ &dA &d@³ set = round tuplet ³ &dA &d@³ bit 1: clear = broken tuplet ³ &dA &d@³ set = continuous tuplet ³ &dA &d@³ bit 2: clear = number outside tuplet ³ &dA &d@³ set = number inside tuplet ³ &dA &d@³ ³ &dA &d@³ if between 128 and 255 ³ &dA &d@³ font = type - 128 ³ &dA &d@³ ³ &dA &d@³ if between 0x100 and 0x1ff ³ &dA &d@³ vert and/or horz adj to musical dir ³ &dA &d@³ ³ &dA &d@³ if between 0x200 and 0x2ff ³ &dA &d@³ vert and/or horz adj to sub-obj ³ &dA &d@³ ³ &dA &d@³ if between 0x300 and 0x3ff ³ &dA &d@³ vert and/or horz adj to note/rest/fig ³ &dA &d@³ objects. ³ &dA &d@³ ³ &dA &d@³ tv3(.) & 0x00ff = staff number (0 or 1) ³ &dA &d@³ ³ &dA &d@³ For notes, ³ &dA &d@³ & 0xff00 = value of repeater_flag ³ &dA &d@³ For rests, ³ &dA &d@³ & 0xff00 = value of restplace ³ &dA &d@³ For musical directions ³ &dA &d@³ & 0xff00 = value of optional forward ³ &dA &d@³ offset for division counter ³ &dA &d@³ ³ &dA &d@³ tv5(.) = pointer to [X] table record which ³ &dA &d@³ generated this data entry ³ &dA &d@³ ³ &dA &d@³ tcode(.) = pitch (rest) for types 1--8 ³ &dA &d@³ = number of figure fields for type 9 ³ &dA &d@³ (figured harmony) ³ &dA &d@³ = bar type for type 10 ³ &dA &d@³ = musical direction code and position ³ &dA &d@³ for type 11 ³ &dA &d@³ = "ires" for type 12 ³ &dA &d@³ = "back" for type 13 ³ &dA &d@³ = "0" or "128" for type 14 (clef change) ³ &dA &d@³ = "" for types 15--18 ³ &dA &d@³ ³ &dA &d@³ tdata(.) = additional data for types 1--9, 11, 19 ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Output: ts(.,.) ³ &dA &d@³ Description of ts ³ &dA &d@³ -------------------------- ³ &dA &d@³ ³ &dA &d@³ Case I: Notes, Rests, Grace Notes, Cue Notes, Cue Rests ³ &dA &d@³ Extra Regular, Grace, and Cue notes in Chords ³ &dA &d@³ (types 1--8) ³ &dA &d@³ ³ &dA &d@³ ts(1) = type: 1 = note ³ &dA &d@³ 2 = extra regular note in chord ³ &dA &d@³ 3 = rest ³ &dA &d@³ 4 = cue note ³ &dA &d@³ 5 = extra cue note in chord ³ &dA &d@³ 6 = cue rest ³ &dA &d@³ 7 = grace note or grace rest ³ &dA &d@³ 8 = extra grace note in chord ³ &dA &d@³ ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = clave <100 = clave number ³ &dA &d@³ 100 = rest ³ &dA &d@³ 101 = movable rest ³ &dA &d@³ 200 = irest ³ &dA &d@³ ³ &dA &d@³ ts(4) (used initially to store pointer to tcode(.) ) ³ &dA &d@³ ³ &dA &d@³ ts(4) = accidental flag ³ &dA &d@³ ³ &dA &d@³ 0 = none 6 = natural-sharp ³ &dA &d@³ 1 = natural 7 = natural-flat ³ &dA &d@³ 2 = sharp 10 = double sharp ³ &dA &d@³ 3 = flat 15 = double flat ³ &dA &d@³ ³ &dA &d@³ ts(5) = note type ³ &dA &d@³ ³ &dA &d@³ 1 = 256th note 7 = quarter note ³ &dA &d@³ 2 = 128th note 8 = half note ³ &dA &d@³ 3 = 64th note 9 = whole note ³ &dA &d@³ 4 = 32nd note 10 = breve ³ &dA &d@³ 5 = 16th note 11 = longa ³ &dA &d@³ 6 = 8th note 12 = eighth with slash ³ &dA &d@³ ³ &dA &d@³ ts(6) = dot flag 0 = no dot, 1 = dot, 2 = double dot ³ &dA &d@³ ts(7) = tuplet flag 0 = no tuplet, # = tuplet ³ &dA &d@³ ts(8) = location on staff ³ &dA &d@³ ts(9) = spacing number ³ &dA &d@³ ts(10) = stem/chord flag bit clear set ³ &dA &d@³ ----- ------- --------- ³ &dA &d@³ 0 no stem stem ³ &dA &d@³ 1 step up stem down ³ &dA &d@³ 2 single note chord ³ &dA &d@³ 3 first note extra note ³ &dA &d@³ 4-7 (note number in chord) ³ &dA &d@³ ³ &dA &d@³ ts(11) = beam flag 0 = no beam ³ &dA &d@³ 1 = end beam ³ &dA &d@³ 2 = start beam ³ &dA &d@³ 3 = continue beam ³ &dA &d@³ ³ &dA &d@³ ts(12) = beam code (up to six digits) ³ &dA &d@³ ³ &dA &d@³ This is an integer less than 1000000. The one's ³ &dA &d@³ digit is the code for the eighth beam; the ³ &dA &d@³ tens digit is the code for the sixteenth beam, ³ &dA &d@³ etc. ³ &dA &d@³ ³ &dA &d@³ digit char meaning ³ &dA &d@³ ------- ---- --------- ³ &dA &d@³ 0 blank no beam ³ &dA &d@³ 1 = continued beam ³ &dA &d@³ 2 [ begin beam ³ &dA &d@³ 3 ] end beam ³ &dA &d@³ 4 / forward hook ³ &dA &d@³ 5 \ backward hook ³ &dA &d@³ 6 simple repeater ³ &dA &d@³ 7 begin repeated beam ³ &dA &d@³ 8 end repeated beam ³ &dA &d@³ ³ &dA &d@³ ts(13) = local x-offset (for chords) ³ &dA &d@³ ³ &dA &d@³ ts(14) = superflag bit set ³ &dA &d@³ ----- -------- ³ &dA &d@³ 0 tie ³ &dA &d@³ 1 begin ~~~~~ without tr. ³ &dA &d@³ 2 begin ~~~~~ with tr. ³ &dA &d@³ 3 end ~~~~~ ³ &dA &d@³ 4 begin tuplet ³ &dA &d@³ 5 end tuplet ³ &dA &d@³ 6 tuple has a bracket ³ &dA &d@³ 7 bracket is continuous ³ &dA &d@³ (0 = broken) ³ &dA &d@³ 8 number is inside ³ &dA &d@³ (0 = outside) ³ &dA &d@³ 9 bracket is round ³ &dA &d@³ (0 = square) ³ &dA &d@³ ³ &dA &d@³ 16 tie is editorial (dotted) ³ &dA &d@³ 17 ~~~ is editorial ³ &dA &d@³ 18 tuple is editorial ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ts(15) = slurflag bit set meaning ³ &dA &d@³ ------- ------- ³ &dA &d@³ 0 start slur1 (new slur) ³ &dA &d@³ 1 stop slur1 (from prev. note) ³ &dA &d@³ 2 start slur2 (etc.) ³ &dA &d@³ 3 stop slur2 ³ &dA &d@³ 4 start slur3 ³ &dA &d@³ 5 stop slur3 ³ &dA &d@³ 6 start slur4 ³ &dA &d@³ 7 stop slur4 ³ &dA &d@³ ³ &dA &d@³ for editorial slurs ³ &dA &d@³ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ &dA &d@³ 16 start slur1 (new slur) ³ &dA &d@³ 17 stop slur1 (from prev. note) ³ &dA &d@³ 18 start slur2 (etc.) ³ &dA &d@³ 19 stop slur2 ³ &dA &d@³ 20 start slur3 ³ &dA &d@³ 21 stop slur3 ³ &dA &d@³ 22 start slur4 ³ &dA &d@³ 23 stop slur4 ³ &dA &d@³ ³ &dA &d@³ for both kinds of slurs ³ &dA &d@³ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ &dA &d@³ 8 force slur1 ³ &dA &d@³ 9 0 = up, 1 = down ³ &dA &d@³ 10 force slur2 ³ &dA &d@³ 11 0 = up, 1 = down ³ &dA &d@³ 12 force slur3 ³ &dA &d@³ 13 0 = up, 1 = down ³ &dA &d@³ 14 force slur4 ³ &dA &d@³ 15 0 = up, 1 = down ³ &dA &d@³ ³ &dA &d@³ for ties ³ &dA &d@³ ÄÄÄÄÄÄÄÄ ³ &dA &d@³ 24 specify tie orientation ³ &dA &d@³ 25 0 = overhand; 1 = underhand ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ts(16) = subflag 1 bit item ³ &dA &d@³ ----- ------- ³ &dA &d@³ 0-3 ornaments ³ &dA &d@³ --------- ³ &dA &d@³ 0 = none ³ &dA &d@³ 1 = turn ³ &dA &d@³ 2 = trill(tr.) ³ &dA &d@³ 3 = shake ³ &dA &d@³ 4 = mordent ³ &dA &d@³ 5 = delayed turn ³ &dA &d@³ 6-15 (available) ³ &dA &d@³ ³ &dA &d@³ 4-9 accidental combinations ³ &dA &d@³ with ornaments ³ &dA &d@³ ----------------------- ³ &dA &d@³ 4-6 accidental above ornament ³ &dA &d@³ 7-9 accidental below ornament ³ &dA &d@³ ³ &dA &d@³ Accidental code ³ &dA &d@³ --------------- ³ &dA &d@³ 0 = none ³ &dA &d@³ 1 = sharp-sharp ³ &dA &d@³ 2 = flat-flat ³ &dA &d@³ 3 = sharp ³ &dA &d@³ 4 = natural ³ &dA &d@³ 5 = flat ³ &dA &d@³ 6 = (not used) ³ &dA &d@³ 7 = (not used) ³ &dA &d@³ ³ &dA &d@³ 10--13 dynamics ³ &dA &d@³ -------- ³ &dA &d@³ 0 = none ³ &dA &d@³ 1 = p ³ &dA &d@³ 2 = pp ³ &dA &d@³ 3 = ppp ³ &dA &d@³ 4 = pppp ³ &dA &d@³ 5 = f ³ &dA &d@³ 6 = ff ³ &dA &d@³ 7 = fff ³ &dA &d@³ 8 = ffff ³ &dA &d@³ 9 = mp ³ &dA &d@³ 10 = mf ³ &dA &d@³ 11 = fp ³ &dA &d@³ 12 = sfp ³ &dA &d@³ 13 = sf ³ &dA &d@³ 14 = sfz ³ &dA &d@³ 15 = rfz ³ &dA &d@³ ³ &dA &d@³ 14 upright fermata ³ &dA &d@³ 15 inverted fermata ³ &dA &d@³ ³ &dA &d@³ 16 print note in cue size ³ &dA &d@³ 17 editorial accidental ³ &dA &d@³ 18 cautionary accidental ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ts(17) = subflag 2 bit item ³ &dA &d@³ ----- ------- ³ &dA &d@³ n 0 down bow ³ &dA &d@³ v 1 up bow ³ &dA &d@³ i 2 spiccato ³ &dA &d@³ . 3 staccato ³ &dA &d@³ = 4 line over dot ³ &dA &d@³ _ 5 legato ³ &dA &d@³ > 6 horizontal accent ³ &dA &d@³ A 7 vertical sfortzando accent ³ &dA &d@³ V 8 vertical sfortzando accent ³ &dA &d@³ o 9 harmonic ³ &dA &d@³ Q 10 thumb (*) ³ &dA &d@³ 0 11 open string (0) ³ &dA &d@³ ³ &dA &d@³ 12-31 fingering (up to 5 numbers) ³ &dA &d@³ ---------- ³ &dA &d@³ 12-14 first number ³ &dA &d@³ 0 = no number ³ &dA &d@³ 1 = finger 1 ³ &dA &d@³ 2 = finger 2 ³ &dA &d@³ 3 = finger 3 ³ &dA &d@³ 4 = finger 4 ³ &dA &d@³ 5 = finger 5 ³ &dA &d@³ 15 substitution bit ³ &dA &d@³ 0 = no substitution ³ &dA &d@³ 1 = substitution ³ &dA &d@³ 16-19 (second number, see 11 to 14) ³ &dA &d@³ 20-23 (third number) ³ &dA &d@³ 24-27 (fourth number) ³ &dA &d@³ 28-31 (fifth number) ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ts(18) = used for sorting, later used to indicate position ³ &dA &d@³ of virtual note head (for placing slurs and ³ &dA &d@³ other articulations and signs). bit 24 ³ &dA &d@³ set if modified ³ &dA &d@³ ts(19) = used for sorting, later used to indicate global ³ &dA &d@³ x-offset for chord groups ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(22) = backtie flag (for regular, chord and cue notes) ³ &dA &d@³ ³ &dA &d@³ 0 = this note is not backward tied ³ &dA &d@³ # = this note is backward tied ³ &dA &d@³ ³ &dA &d@³ Actually the BACKTIE flag has multiple uses. ³ &dA &d@³ ³ &dA &d@³ (1) When the ts array is first being constructed, ³ &dA &d@³ there may be a tie &dAinto&d@ this group of notes ³ &dA &d@³ from a previous measure. In this case, a tiearr ³ &dA &d@³ ROW element has already been constructed. The ³ &dA &d@³ tiearr rows need to be searched and the proper ³ &dA &d@³ one found. This index (+ INT10000) is then ³ &dA &d@³ stored as the backtie flag. ³ &dA &d@³ ³ &dA &d@³ (2) For all other row elements of the ts array, ³ &dA &d@³ it is sufficient to store a back pointer to the ³ &dA &d@³ ts row that originated the tie. ³ &dA &d@³ ³ &dA &d@³ (3) When it comes time to process the ts array, ³ &dA &d@³ three cases may be encountered. ³ &dA &d@³ ³ &dA &d@³ (a) There is a non-zero backtie flag, and this ³ &dA &d@³ flag is greater than INT10000. In this case, ³ &dA &d@³ the backtie flag (- INT10000) points to a tiearr ³ &dA &d@³ ROW element, and the tie may be processed. ³ &dA &d@³ ³ &dA &d@³ (b) There is a forward tie from this note. In ³ &dA &d@³ this case, the backtie flag has already been ³ &dA &d@³ used to set a tie and the element is now free ³ &dA &d@³ for other use. We can generate a new row element³ &dA &d@³ in tiearr, and place the pointer to this element ³ &dA &d@³ in the backtie flag (the term "backtie" is now ³ &dA &d@³ a misnomer). ³ &dA &d@³ ³ &dA &d@³ (c) Now when we encounter a non-zero backtie ³ &dA &d@³ flag in a new ts ROW, we know this points to a ³ &dA &d@³ previous ts row, from which we can get the ³ &dA &d@³ pointer to the relevant tiearr ROW in that ³ &dA &d@³ ts(,.BACKTIE). ³ &dA &d@³ ³ &dA &d@³ For this method to work properly, it is ³ &dA &d@³ necessary that backward ties be processed before ³ &dA &d@³ forward ties. When a backward tie is processed ³ &dA &d@³ it is important to set the backtie flag to zero. ³ &dA &d@³ ³ &dA &d@³ ts(23) = note duration (in divisions) ³ &dA &d@³ ts(24) = increment distance flag ³ &dA &d@³ ³ &dA &d@³ 0 -- fixed distance (not to be modified by print) ³ &dA &d@³ # -- variable distance; # = time elaps between ³ &dA &d@³ this node and next node. ³ &dA &d@³ (576 divisions = quarter note) ³ &dA &d@³ ³ &dA &d@³ ts(25) = virtual end of stem (bit 24 set if modified ³ &dA &d@³ ts(26) = editorial version of ts(16), subflag 1 ³ &dA &d@³ ts(27) = editorial version of ts(17), subflag 2 ³ &dA &d@³ ts(28) = staff number ³ &dA &d@³ ts(29) = multi-track flag << 2 + mcat flag ³ &dA &d@³ ³ &dA &d@³ multi-track flag ³ &dA &d@³ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ &dA &d@³ 0 = this note lies on a staff that has notes from ³ &dA &d@³ only one pass (the simplest and most common ³ &dA &d@³ situation). ³ &dA &d@³ 1 = this note belongs to one of multiple passes ³ &dA &d@³ on this staff and all notes on this pass ³ &dA &d@³ have stems which point up ³ &dA &d@³ 2 = this note belongs to one of multiple passes ³ &dA &d@³ on this staff and all notes on this pass ³ &dA &d@³ have stems which point down ³ &dA &d@³ 3 = this note belongs to one of multiple passes ³ &dA &d@³ on this staff and the notes for at least one ³ &dA &d@³ these passes have stem directions which are ³ &dA &d@³ both up and down ³ &dA &d@³ ³ &dA &d@³ mcat flag ³ &dA &d@³ ÄÄÄÄÄÄÄÄÄ ³ &dA &d@³ 0 = only one independent instrument represented ³ &dA &d@³ in this measure (vflag = 1) ³ &dA &d@³ 1 = more than one independent instrument (vflag > 1)³ &dA &d@³ but only one pass and without chords (either ³ &dA &d@³ unison part, or single part) ³ &dA &d@³ 2 = more than one independent instrument (vflag > 1)³ &dA &d@³ but only one pass but with chords (more than ³ &dA &d@³ one part, but parts are isorhythmic) ³ &dA &d@³ 3 = more than one independent instrument (vflag > 1)³ &dA &d@³ and more than one pass (two or more musically ³ &dA &d@³ independent parts) ³ &dA &d@³ ³ &dA &d@³ ts(30) = spacing parameter (1 <= spn <= 6913) ³ &dA &d@³ ts(31) = y position of object (saves time in proc. chords) ³ &dA &d@³ ts(32) = pointer to extra ts() row element for storing data ³ &dA &d@³ on slurs. Elements 1-6 of new element are for ³ &dA &d@³ storing global data on slurs entering and leaving ³ &dA &d@³ the note. Elements 7-32 are taken in pairs, ³ &dA &d@³ making a total of 13 such groups. Each group ³ &dA &d@³ describes a slur entering or leaving this note. ³ &dA &d@³ The odd part of the group contains general info ³ &dA &d@³ + the x-offset, and the even part contains the ³ &dA &d@³ y-offset. See &dATS32&d@ for more information. ³ &dA &d@³ ³ &dA &d@³ ts(33) = node shift flag (positive and negative values) ³ &dA &d@³ ³ &dA &d@³ ts(34) = tsr pointer ³ &dA &d@³ ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ Case II: Figures ³ &dA &d@³ ³ &dA &d@³ ts(1) = 9 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = number of figures in this chord ³ &dA &d@³ ts(4) = space parameter ³ &dA &d@³ ts(5) = first figure -- position one ³ &dA &d@³ ts(6) = first figure -- position two ³ &dA &d@³ ts(7) = first start/stop flag for continuation line ³ &dA &d@³ ts(8) = second figure -- position one ³ &dA &d@³ ts(9) = second figure -- position two ³ &dA &d@³ ts(10) = second start/stop flag for continuation line ³ &dA &d@³ ts(11) = third figure -- position one ³ &dA &d@³ ts(12) = third figure -- position two ³ &dA &d@³ ts(13) = third start/stop flag for continuation line ³ &dA &d@³ ts(14) = fourth figure -- position one ³ &dA &d@³ ts(15) = fourth figure -- position two ³ &dA &d@³ ts(16) = fourth start/stop flag for continuation line ³ &dA &d@³ ³ &dA &d@³ figure field: 0 = blank ³ &dA &d@³ 1-19 = figure ³ &dA &d@³ 20 = + ³ &dA &d@³ 21 = x ³ &dA &d@³ 22 = 2+ ³ &dA &d@³ 23 = sharp ³ &dA &d@³ 24 = 4+ ³ &dA &d@³ 25 = 5+ ³ &dA &d@³ 26 = 6\ ³ &dA &d@³ 27 = 7\ ³ &dA &d@³ 28 = natural ³ &dA &d@³ 29 = flat ³ &dA &d@³ 30 = short continuation line (-) ³ &dA &d@³ ³ &dA &d@³ start/stop continuation flag: 0 = none ³ &dA &d@³ 1 = stop ³ &dA &d@³ 2 = start ³ &dA &d@³ 3 = continue ³ &dA &d@³ ³ &dA &d@³ ts(20) = minimum space for figure group ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(23) = figure duration in divisions (0 if not given) ³ &dA &d@³ ts(24) = increment distance flag (see notes) ³ &dA &d@³ ts(28) = staff number ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case III: Bar Lines ³ &dA &d@³ ³ &dA &d@³ ts(1) = 10 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = bar number (0 = none) ³ &dA &d@³ ts(4) = bar type ³ &dA &d@³ ³ &dA &d@³ 1 = regular 5 = double regular ³ &dA &d@³ 2 = heavy 6 = regular-heavy ³ &dA &d@³ 3 = dotted 9 = heavy-regular ³ &dA &d@³ 10 = heavy-heavy ³ &dA &d@³ ³ &dA &d@³ ts(5) = repeat flag ³ &dA &d@³ ³ &dA &d@³ 0 = no repeats 1 = forward repeat ³ &dA &d@³ 2 = back repeat 3 = both repeats ³ &dA &d@³ ³ &dA &d@³ ts(6) = backward ending flag ³ &dA &d@³ ³ &dA &d@³ 0 = no ending ³ &dA &d@³ # = ending number: positive = stop ending ³ &dA &d@³ negative = discontinue ³ &dA &d@³ ending ³ &dA &d@³ ³ &dA &d@³ ts(7) = forward ending flag ³ &dA &d@³ ³ &dA &d@³ 0 = no ending ³ &dA &d@³ # = ending number ³ &dA &d@³ ³ &dA &d@³ ts(8) = flags ³ &dA &d@³ ³ &dA &d@³ bit set clear ³ &dA &d@³ ----- ------------ ------- ³ &dA &d@³ 0 continue ~~~ stop ~~~ ³ &dA &d@³ 1 segno sign 0 ³ &dA &d@³ 2 fermata over bar 0 ³ &dA &d@³ 3 fermata under bar 0 ³ &dA &d@³ ³ &dA &d@³ ts(9) = space parameter (important for non-contr. bars) ³ &dA &d@³ ts(10) = number over previous measure: 0 = none ³ &dA &d@³ ³ &dA &d@³ ts(20) = index to ASCII tsdata &dAtaken out&d@ ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(28) = number of staves ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case IV: Signs, Words, Marks ³ &dA &d@³ ³ &dA &d@³ ts(1) = type sign = 11, words = 12, mark = 13 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = vertical position flag: 1 = below line ³ &dA &d@³ 2 = above line ³ &dA &d@³ ts(4) = sign number ³ &dA &d@³ ³ &dA &d@³ 0 = no sign ³ &dA &d@³ 1 = segno ³ &dA &d@³ 2 = ped ³ &dA &d@³ 3 = * ³ &dA &d@³ 4 = other letter dynamics ³ &dA &d@³ 5 = D.S or D.C. (right justified string) ³ &dA &d@³ 6 = fine (centered string) ³ &dA &d@³ 7 = words (left justified string) ³ &dA &d@³ 8 = tie terminator (added &dA10-12-96&d@) ³ &dA &d@³ ³ &dA &d@³ ts(5) = super flag ³ &dA &d@³ ³ &dA &d@³ 0 = no super-object ³ &dA &d@³ 1 = start wedge ³ &dA &d@³ 2 = stop wedge ³ &dA &d@³ 3 = start dashes (after words) ³ &dA &d@³ 4 = stop dashes ³ &dA &d@³ 5 = start 8ve up ³ &dA &d@³ 6 = stop 8ve up ³ &dA &d@³ 7 = start 8ve down ³ &dA &d@³ 8 = stop 8ve down ³ &dA &d@³ 9 = start 15 up ³ &dA &d@³ 10 = stop 15 up ³ &dA &d@³ 11 = start 15 down ³ &dA &d@³ 12 = stop 15 down ³ &dA &d@³ 13 = normal transposition (temporary flag) ³ &dA &d@³ ³ &dA &d@³ ts(6) = parameter for words: optional font designation ³ &dA &d@³ ³ &dA &d@³ ts(7) = wedge offset (for cases where a wedge begins after ³ &dA &d@³ or stops at a letter dynamic) ³ &dA &d@³ ³ &dA &d@³ ts(8) = track number (useful for multiple wedges, dashes ³ &dA &d@³ or transpositions of the same type) ³ &dA &d@³ ³ &dA &d@³ ts(9) = spacing (for case of isolated mark) ³ &dA &d@³ ³ &dA &d@³ ts(10) = parameter for wedges: wedge spread ³ &dA &d@³ ³ &dA &d@³ ts(11) = parameter for musical directions which are ³ &dA &d@³ objects: position shift ³ &dA &d@³ ³ &dA &d@³ ts(12) = special flag for case where this element is ³ &dA &d@³ isolated on a division (possibly with other ³ &dA &d@³ members of this same group). ³ &dA &d@³ ³ &dA &d@³ ts(13) = parameter for musical directions which are ³ &dA &d@³ super-objects: position shift ³ &dA &d@³ ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ³ &dA &d@³ ts(22) = backtie flag (for tie terminators) (added &dA10-12-96&d@) ³ &dA &d@³ ³ &dA &d@³ ts(28) = staff number ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case V: Clef change in middle of a measure ³ &dA &d@³ ³ &dA &d@³ ts(1) = type = 14 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = clef number ³ &dA &d@³ ts(4) = clef font number ³ &dA &d@³ ts(5) = transpostion flag: ³ &dA &d@³ ³ &dA &d@³ 1 = notes written octave higher than sound ³ &dA &d@³ 0 = notes written at sound ³ &dA &d@³ -1 = notes written octave lower than sound ³ &dA &d@³ ³ &dA &d@³ ts(6) = position on staff ³ &dA &d@³ ts(9) = space parameter ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(28) = staff number ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case VI: Time designation in middle of a measure ³ &dA &d@³ ³ &dA &d@³ ts(1) = type = 15 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(9) = space parameter ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(28) = staff number ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case VII: Meter change in middle of a measure ³ &dA &d@³ ³ &dA &d@³ ts(1) = type = 16 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = time number (100 time numerator + denominator) ³ &dA &d@³ ts(9) = space parameter ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(28) = number of currently active staves ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case VIII: Change in number of divisions per quarter ³ &dA &d@³ ³ &dA &d@³ ts(1) = type = 17 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = divisions per quarter ³ &dA &d@³ ts(9) = space parameter ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Case IX: Change in key signature ³ &dA &d@³ ³ &dA &d@³ ts(1) = type = 18 ³ &dA &d@³ ts(2) = division number (starting with 1) ³ &dA &d@³ ts(3) = new key signature ³ &dA &d@³ ts(4) = old key signature ³ &dA &d@³ ts(9) = space parameter ³ &dA &d@³ ts(20) = index to ASCII tsdata ³ &dA &d@³ ts(21) = pass number ³ &dA &d@³ ts(28) = number of currently active staves ³ &dA &d@³ ts(35) = pointer to record in X table which generated this ³ &dA &d@³ entry ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure action int t1,t2,t3,t4,t5,t6 int t7,t8 /* (added &dA10-12-96&d@) if @n = 0 return end passnum = 1 &dA &dA &d@ If there are no pending slurs, then clear the ts array and set sct = 0 &dA if sct = 0 loop for a9 = 1 to MAX_OBJECTS loop for a10 = 1 to TS_SIZE ts(a9,a10) = 0 repeat &dA &d@ tsdata(a9) = "" tsr(a9) = zpd(68) ts(a9,TSR_POINT) = a9 repeat outslurs = "00000000" else if outslurs = "00000000" if sct > maxsct maxsct = sct end loop for a9 = 1 to maxsct + 10 loop for a10 = 1 to TS_SIZE ts(a9,a10) = 0 repeat &dA &d@ tsdata(a9) = "" tsr(a9) = zpd(68) ts(a9,TSR_POINT) = a9 repeat sct = 0 old@n = 0 else if sct > maxsct maxsct = sct end loop for a9 = sct+1 to maxsct+10 loop for a10 = 1 to TS_SIZE ts(a9,a10) = 0 repeat &dA &d@ tsdata(a9) = "" tsr(a9) = zpd(68) ts(a9,TSR_POINT) = a9 repeat end end oldsct = sct &dA &dA &d@ Store original data in set array &dA divpoint = 1 cuediv = 0 totdiv = 1 qflag = 0 divspq = olddivspq loop for a9 = 1 to @n tsdata(a9+old@n) = "" line = tdata(a9) tvar1 = tv1(a9) tvar2 = tv2(a9) tvar5 = tv5(a9) if tv3(a9) > 0xff if tvar1 <= NOTE_OR_REST if tvar1 = REST or tvar1 = CUE_REST restplace2 = tv3(a9) >> 8 else repeater_flag2 = tv3(a9) >> 10 + 1 end else mdir_offset = tv3(a9) >> 8 end tv3(a9) &= 0xff else repeater_flag2 = 0 restplace2 = 0 mdir_offset = 0 end &dA &dA &d@ Deal with situation where there is an irest followed by a &dA &d@ print suggestion that it should be allocated space &dA if tvar1 = IREST and a9 < @n and tv1(a9+1) = P_SUGGESTION if tv2(a9+1) & 0xff00 = 0x0300 pcontrol = ors(tcode(a9+1){1}) if pcontrol = 3 or pcontrol = 5 tvar1 = REST /* send it through the system tcode(a9) = "rest" end end end &dA &d@ &dA &d@ Case I: notes, rests, cue notes, grace notes, &dA &d@ extra notes in chords, figures &dA if tvar1 <> FIGURES and tvar1 <> P_SUGGESTION figdiv = 0 end if tvar1 <= NOTE_OR_REST loop for a3 = 1 to 7 step 3 a4 = a3 + 1 if tvar1 = a4 /* extra chord tone if a9 = 1 return 1 end c5 = 1 loop while tv1(a9-c5) = P_SUGGESTION and a9 > c5 + 1 ++c5 repeat if tv1(a9-c5) <> a3 if tv1(a9-c5) <> a4 return 1 end else * tricky code to set chord bit on first note in chord ts(sct,STEM_FLAGS) += 4 /* sct -> previous array entry end end repeat ++sct ts(sct,TYPE) = tvar1 ts(sct,XTABLE_POINT) = tvar5 &dA &dA &d@ &dASet DIV&d@ (for cue notes) &dA if chr(tvar1) in [CUE_NOTE,XCUE_NOTE,CUE_REST] if tvar1 <> XCUE_NOTE ts(sct,DIV) = divpoint + cuediv else ts(sct,DIV) = divpoint + cuediv - chorddur end goto WC end &dA &dA &d@ &dASet DIV&d@ (for regular and grace notes) &dA if tvar1 = XNOTE ts(sct,DIV) = divpoint - chorddur else ts(sct,DIV) = divpoint end cuediv = 0 &dA &dA &d@ Normally at this point, we would decode the note and get &dA &d@ its clave number and accidental. The reason we cannot safely &dA &d@ do this at this time is that the backspace command might &dA &d@ cause us to insert some accidentals at earlier points in &dA &d@ the measure. Because of the current order, these notes &dA &d@ would not be accidentalized, whereas a later one (from &dA &d@ an earlier pass) would be. Also, we would like to allow &dA &d@ the various passes to run through non-controlling bar &dA &d@ lines. In any event, we must put off decoding and other &dA &d@ calculations that depend on this data until the entries &dA &d@ can be ordered by time. In the meantime, we will store &dA &d@ the a pointer to the proper tcode element in ts(4) WC: ts(sct,4) = a9 a4 = tvar2 /* duration field, in this case if tvar1 > REST a5 = tvar2 /* this will become NTYPE if chr(tvar1) in [CUE_NOTE,CUE_REST] &dA &dA &d@ We must, in this case, try to assign a length to the &dA &d@ cue-type entity in terms of the current value of divspq. &dA &d@ The parameter, a4, indicates the note type: &dA &dA &d@ 1 = 256th note 7 = quarter note &dA &d@ 2 = 128th note 8 = half note &dA &d@ 3 = 64th note 9 = whole note &dA &d@ 4 = 32nd note 10 = breve &dA &d@ 5 = 16th note 11 = longa &dA &d@ 6 = 8th note &dA &dA &d@ Columns 4-6 of the variable line contain tuple modifications &dA &d@ to the note value &dA --a4 a3 = 1 << a4 &dA &dA &d@ a3 = 64 --> means quarter note, etc. &dA a3 *= divspq &dA &dA &d@ a3 --> length of notetype as measured in units (64*divspq) &dA if line{4} <> " " a4 = int(line{4}) if line{4} in ['A'..'Z'] a4 = ors(line{4}) - 55 /* A = 10, etc end a8 = a4 / 3 /* default values for "denominator" if rem = 0 a8 *= 2 else a8 = a4 - 1 end if line{6} <> " " a8 = int(line{6}) if line{6} in ['A'..'Z'] a8 = ors(line{6}) - 55 /* A = 10, etc end end a3 *= a8 a3 /= a4 if rem <> 0 putc Unable to represent cue note in terms of current putc value of divisions per quarter putc &dAType /e &d@ to terminate examine return 10 end end &dA &dA &d@ a3 --> length of note measured in units (64*divspq) &dA &d@ as modified by tuple information &dA if ".:;!" con line{2} /* code modified &dA12-24-96 if mpt = 1 a3 = a3 / 2 * 3 else if mpt = 2 a3 = a3 / 4 * 7 else if mpt = 3 a3 = a3 / 8 * 15 else a3 = a3 / 16 * 31 end end end end &dA &dA &d@ a3 --> length of note measured in units (64*divspq) &dA &d@ as further modified by dot information &dA chorddur = a3 / 64 if rem <> 0 putc Unable to represent cue note in terms of current putc value of divisions per quarter putc &dAType /e &d@ to terminate examine return 10 end &dA &dA &d@ chorddur --> length of measured in units (divspq) &dA cuediv += chorddur end else if tvar1 <> XNOTE chorddur = a4 divpoint += a4 if divpoint > totdiv totdiv = divpoint end end if "zyxtseqhwbL" con line{1} a5 = mpt /* this will become NTYPE else if "123456789AB" con line{1} a5 = mpt /* this will become NTYPE ts(sct,SUBFLAG_1) |= 0x010000 /* set small print flag else if tvar1 = REST ts(sct,CLAVE) = 1 /* temporary floating rest flag a5 = WHOLE /* this will become NTYPE else &dA &dA &d@ Note type is missing, try to construct it. &dA &d@ (the presence of tuplets will through this off) &dA putc Missing note type (column 17). Will attempt to construct it. a8 = chorddur << 5 / divspq a5 = 1 loop while a8 > 0 a8 >>= 1 ++a5 repeat end end end end &dA &dA &d@ &dASet NTYPE &dA ts(sct,NTYPE) = a5 &dA &dA &d@ &dASet STAFFLOC (for rests)&d@ &dA if tvar1 = REST or tvar1 = CUE_REST ts(sct,STAFFLOC) = restplace2 end &dA &dA &d@ &dASet NOTE_DUR&d@ &dA if chr(tvar1) in [GR_NOTE,XGR_NOTE] ts(sct,NOTE_DUR) = 0 else ts(sct,NOTE_DUR) = chorddur end a8 = int(line{4}) if line{4} in ['A'..'Z'] a8 = ors(line{4}) - 55 end if a8 > 0 &dA &dA &d@ Code added to account for complex tuples: 5-11-93 &dA a3 = int(line{6}) if line{6} in ['A'..'Z'] a3 = ors(line{6}) - 55 /* A = 10, etc end a3 *= 1000 &dA &dA &d@ &dASet TUPLE &dA ts(sct,TUPLE) = a8 + a3 end &dA &dA &d@ &dASet DOT&d@ &dA if ".^:^^^;^^^^^^^!" con line{2} /* code modified &dA12-24-96&d@ ts(sct,DOT) = mpt /* 1 = single dot; 3 = double dot; 7 = triple dot; 15 = end if tcode(a9) <> "rest" &dAÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸&d@ &dA³&d@ This calculation must be delayed until after the decoding &dA³&d@ &dA³&d@ --------------------------------------------------------- &dA³&d@ &dA³&d@ a1 = 52 - ts(sct,3) - cline(.) + c8flag(.) &dA³&d@ &dA³&d@ ts(sct,8) = a1 * notesize / 2 &dA³&d@ &dAÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;&d@ &dA &dA &d@ &dASet STEM_FLAGS&d@ (incomplete) &dA a1 = 0 if "u@d" con line{7} /* stem direction "u" or "d" a1 = mpt end if tvar1 = XNOTE a1 += 12 end ts(sct,STEM_FLAGS) = a1 &dA &dA &d@ &dASet BEAM_FLAG&d@ &dA if "][=" con line{10} ts(sct,BEAM_FLAG) = mpt else ts(sct,BEAM_FLAG) = NO_BEAM end &dA &dA &d@ &dASet BEAM_CODE&d@ &dA a4 = 0 if ts(sct,BEAM_FLAG) > NO_BEAM if "[]=" con line{10} a3 = 1 loop for a1 = 10 to 15 if " =[]/\" con line{a1} a4 = mpt - 1 * a3 + a4 end if mpt = 1 a1 = 15 else a3 *= 10 end repeat end end ts(sct,BEAM_CODE) = a4 &dA &dA &d@ &dAI think this is the place to alter the ts array, in the case where&d@ &dA &d@ &dAa repeater is requested &dA if repeater_flag2 > 0 and ts(sct,BEAM_FLAG) = END_BEAM &dA &dA &d@ Decision Point No. 1: Decide if repeaters are possible &dA a3 = 1 REP2: if a4 / a3 > 9 a3 *= 10 goto REP2 end c6 = bit(1,ts(sct,STEM_FLAGS)) c7 = ts(sct,NTYPE) &dA &dA &d@ For purposes of the code that follows, we need to keep track of the &dA &d@ subscripts which point to real data (i.e. not print suggestions) &dA &d@ in the data(.), tcode(.), and tv(.) arrays. We will store these &dA &d@ "valid" subscripts in the mf(.) array. &dA c10 = a9 c2 = 0 /* counter for primary type c4 = 100 /* secondary beam break flag loop for a1 = sct to 1 step -1 loop while tv1(c10) = P_SUGGESTION --c10 repeat mf(a1) = c10 --c10 if ts(a1,TYPE) < tvar1 or ts(a1,TYPE) > tvar1 + 1 goto NO_REP end if ts(a1,TYPE) = tvar1 if ts(a1,TUPLE) > 0 c4 = 1000 + ts(a1,TUPLE) /* flag tuple end a5 = ts(a1,BEAM_CODE) / a3 if a5 > 3 or a5 = 0 goto NO_REP end if a1 < sct and a5 = 3 and c4 < 1000 /* secondary beam ends and starts again if c4 = 100 c4 = 16 end loop while c4 > 1 c5 = c2 / c4 if rem <> 0 c4 >>= 1 end repeat while rem <> 0 if c4 = 1 goto NO_REP end end ++c2 mf2(c2) = a1 end if bit(1,ts(a1,STEM_FLAGS)) <> c6 or ts(a1,NTYPE) <> c7 or ts(a1,DOT) > 0 goto NO_REP end codes = tdata(mf(a1)){16,9} /* &dAspecifically changed from {16,12} for this program if ts(a1,BEAM_FLAG) = START_BEAM &dK &d@ if codes con ['-','(',')','[',']','{','}','~','>','.','_','=',','] if codes con ['-',')',']','}','~','>','.','_','=',','] /* &dA02/19/97&d@ change accomodates slurs starting on beginning of beam goto NO_REP end if codes con ['b','c','h'..'k','n','o','r'..'z','A','E','F','M','Q','S','V'] goto NO_REP end goto REP1 end if ts(a1,BEAM_FLAG) = END_BEAM &dK &d@ if codes con ['-','(',')','[',']','{','}','~','>','.','_','=',','] if codes con ['-','(','[','{','~','>','.','_','=',','] /* &dA02/19/97&d@ change accomodates slurs ending on end of beam goto NO_REP end else if codes con ['-','(',')','[',']','{','}','~','>','.','_','=','0'..'5',',',':'] goto NO_REP end end if codes con ['b','c','f','h'..'z','A','E','F','M','Q'..'S','V','Z'] goto NO_REP end repeat &dA &dA &d@ Case 1: Check to see if all chords under the beam are the same &dA REP1: chordsize = 1 chord_tones(1) = tcode(mf(a1)) loop for a2 = a1 + 1 to sct if ts(a2,TYPE) = tvar1 a2 = sct else ++chordsize chord_tones(chordsize) = tcode(mf(a2)) end repeat &dA &dA &d@ In case of chord at end of beam, finish building mf(.) array &dA c10 = a9 + 1 last_chordsize = 1 loop for a2 = sct + 1 to 100000 loop while tv1(c10) = P_SUGGESTION ++c10 repeat if tv1(c10) = tvar1 + 1 mf(a2) = c10 if "zyxtseqhwbL" con tdata(c10){1} if mpt <> c7 /* NTYPE of last chord tones goto NO_REP end else if "123456789AB" con tdata(c10){1} if mpt <> c7 /* NTYPE of last chord tones goto NO_REP end end end ++c10 ++last_chordsize else a2 = 100000 end repeat if c4 < 100 /* secondary beams have breaks goto REP3 end loop for a2 = a1 + chordsize to sct if ts(a2,TYPE) <> tvar1 goto REP3 end c5 = 0 loop for c6 = 1 to chordsize checkoff(c6) = 1 repeat REP4: c14 = 0 loop for c3 = 1 to chordsize if checkoff(c3) = 1 and chord_tones(c3) = tcode(mf(a2)) checkoff(c3) = 0 c14 = 1 c3 = chordsize end repeat if c14 = 0 goto REP3 end ++c5 if c5 < chordsize ++a2 if a2 <= sct if ts(a2,TYPE) <> tvar1 + 1 goto REP3 end else &dK &d@ if "zyxtseqhwbL" con tdata(mf(a2)){1} &dK &d@ &dKThis was done&d@ if mpt <> c7 /* NTYPE of last chord tones &dK &d@ &dKearlier &d@ goto NO_REP &dK &d@ &dK &d@ end &dK &d@ end if tv1(mf(a2)) <> tvar1 + 1 goto REP3 end end goto REP4 else if a2 > sct + chordsize - 1 goto NO_REP end end repeat &dA &d@ &dA &d@ At this point, we have determined that all chords under the &dA &d@ beam are the same. We must compact all of these notes &dA &d@ into one note (simplest case). &dA &d@ c3 = sct - a1 / chordsize + 1 /* number of notes c5 = ts(a1,NTYPE) c6 = 0 c14 = ts(a1,TUPLE) if c14 > 999 /* no complex tuples allowed goto NO_REP end if c14 > 0 if c14 = c3 c7 = 2 loop c5 += 1 c8 = c3 / c7 if c8 > 1 c7 <<= 1 end repeat while c8 > 1 goto REP5 else goto NO_REP /* if tuple, then # must = group size end else if chr(c3) not_in [2,3,4,6,7,8,12,14,15,16,24,28,30,31,32] /* modified &dA12-24-96 goto NO_REP /* must be representable with note value + dot(s) end c7 = 2 loop c5 += 1 c8 = c3 / c7 if c8 = 1 if rem > 0 /* code modified &dA12-24-96&d@ if rem = c7 >> 1 c6 = 1 else if rem = c7 / 4 * 3 c6 = 3 else if rem = c7 / 8 * 7 c6 = 7 else c6 = 15 end end end end else c7 <<= 1 end repeat while c8 > 1 end REP5: if chordsize > 1 a9 += chordsize - 1 /* advance a9 over rest of last chord end c7 = 6 loop for a2 = 1 to QUARTER - ts(a1,NTYPE) - 1 c7 *= 10 c7 += 6 repeat ts(a1,BEAM_CODE) = c7 /* 666... etc loop for a2 = a1 to a1 + chordsize - 1 ts(a2,NTYPE) = c5 ts(a2,DOT) = c6 ts(a2,NOTE_DUR) *= c3 ts(a2,BEAM_FLAG) = NO_BEAM if a2 > a1 ts(a2,BEAM_CODE) = 0 end repeat loop for a2 = a1 + chordsize to sct loop for a3 = 1 to TS_SIZE if a3 <> TSR_POINT ts(a2,a3) = 0 end repeat repeat sct = a1 + chordsize - 1 goto EBL REP3: &dA &dA &d@ Case 2: Check to see if chords under the beam can be arranged &dA &d@ in groups of 2, 4, 8, or 16 &dA &dA &d@ c2 = number of chords &dA &d@ mf2(.) = ts subscripts for primary notes of each chord &dA &d@ c4 = either: maximum group size &dA &d@ or: 100 (no group size limitation) &dA &d@ or: >= 1000 (tuples are present; no groups allowed) &dA if c4 >= 1000 goto REP15 /* &dA02/19/97&d@ change accomodates tuples end if c4 = 100 c4 = 32 loop while c4 > c2 / 2 c4 >>= 1 repeat end loop while c4 > 1 c3 = c2 / c4 if rem <> 0 c4 >>= 1 end repeat while rem <> 0 c5 = ts(a1,NTYPE) c6 = 1 loop while c5 < EIGHTH c6 <<= 1 ++c5 repeat if c4 > c6 c4 = c6 end if c4 = 1 goto REP15 end &dA &dA &d@ c4 is now the largest possible group notes under beam &dA &d@ Next we investigate the question of whether c4 is a &dA &d@ "legal" group size. &dA REP11: &dA &dA &d@ Look for first (actually last) chord prototype &dA c1 = 1 /* index into mf2 c3 = mf2(c1) /* c3 should start as sct chordsize = 1 chord_tones(1) = tcode(mf(c3)) ++c3 loop while chordsize < last_chordsize /* ++chordsize chord_tones(chordsize) = tcode(mf(c3)) /* accumulate chord tones ++c3 repeat &dA &dA &d@ Look for additional chords to match prototype &dA REP9: c6 = 1 /* chord counter REP8: ++c1 c3 = mf2(c1) /* ts index to next primary note backward in list c5 = 0 loop for c11 = 1 to chordsize checkoff(c11) = 1 repeat REP6: c11 = 0 loop for c12 = 1 to chordsize if checkoff(c12) = 1 and chord_tones(c12) = tcode(mf(c3)) checkoff(c12) = 0 c11 = 1 c12 = chordsize end repeat if c11 = 0 goto REP7 /* this pitch (tcode) was not found in chord end ++c5 ++c3 if c5 < chordsize if c3 = mf2(c1-1) goto REP7 /* this chord is not big enough end goto REP6 else if c3 <> mf2(c1-1) goto REP7 /* this chord is too big end end ++c6 /* "valid" chord found if c6 < c4 goto REP8 end &dA &dA &d@ Set up to look for new chord prototype &dA if c1 < c2 ++c1 /* index into mf2 c3 = mf2(c1) /* c3 should start as sct chordsize = 1 chord_tones(1) = tcode(mf(c3)) ++c3 loop while c3 < mf2(c1-1) ++chordsize chord_tones(chordsize) = tcode(mf(c3)) /* accumulate chord tones ++c3 repeat goto REP9 end goto REP10 /* successful pattern match REP7: c4 >>= 1 if c4 > 1 goto REP11 else goto REP15 end &dA &dA &d@ Repeaters on groups of chords will work, if group size = c4 &dA REP10: c5 = ts(a1,NTYPE) c7 = c4 c15 = 0 loop ++c15 ++c5 c7 >>= 1 repeat while c7 > 1 c1 = c2 c6 = mf2(c2) /* position for revised data REP13: /* loop between groups c3 = mf2(c1) REP12: /* loop within chord ts(c3,NTYPE) = c5 ts(c3,NOTE_DUR) *= c4 if c3 <> mf2(c1) c13 = NO_BEAM ts(c3,BEAM_CODE) = 0 else temp3 = chs(ts(c3,BEAM_CODE)) c14 = len(temp3) if c1 = c2 /* beginning of first group c13 = START_BEAM temp3 = "222222"{1,c14} else if c1 = c4 /* beginning of last group c13 = END_BEAM temp3 = "333333"{1,c14} else c13 = CONT_BEAM temp3 = "111111"{1,c14} end end temp3{1,c15} = "666666"{1,c15} ts(c3,BEAM_CODE) = int(temp3) end ts(c3,BEAM_FLAG) = c13 ++c3 /* next pitch in chord if c3 < mf2(c1-1) goto REP12 end chordsize = c3 - mf2(c1) &dA &dA &d@ Move data to revised position &dA if c1 <> c2 c7 = mf2(c1) /* source location; c6 = destination loop for c8 = 1 to chordsize loop for c9 = 1 to TS_SIZE if c9 <> TSR_POINT ts(c6,c9) = ts(c7,c9) end repeat ++c6 ++c7 repeat else c6 += chordsize end if c1 > c4 c1 -= c4 goto REP13 end if last_chordsize > 1 a9 += last_chordsize - 1 /* advance a9 over rest of last chord end &dA &dA &d@ Clear the rest of the ts array and reset sct &dA loop for c8 = c6 to sct loop for c9 = 1 to TS_SIZE if c9 <> TSR_POINT ts(c8,c9) = 0 end repeat repeat sct = c6 - 1 goto EBL REP15: &dA &dA &d@ Alternating case is the only possibility left &dA &dA &d@ Case 3: Check to see if chords under the beam alternate &dA &d@ in groups of 4, 8, 16, or 32, or a tuple size which is even &dA &dA &d@ c2 = number of chords &dA &d@ mf2(.) = ts subscripts for primary notes of each chord &dA if chr(c2) not_in [4,8,16,32] if c4 > 1000 /* &dA02/19/97&d@ change accomodates tuples c4 -= 1000 if c4 & 0x01 = 0 if c4 = c2 and c4 >= 6 goto REP15A end end end goto REP16 end &dA &dA &d@ Look for first (actually last) chord prototype &dA REP15A: c1 = 1 /* index into mf2 c3 = mf2(c1) /* c3 should start as sct chordsize = 1 chord_tones(1) = tcode(mf(c3)) ++c3 loop while chordsize < last_chordsize /* ++chordsize chord_tones(chordsize) = tcode(mf(c3)) /* accumulate chord tones ++c3 repeat &dA &dA &d@ Check all "odd" chords for a match &dA loop for c1 = 3 to c2 - 1 step 2 c3 = mf2(c1) /* ts index to next "odd" primary note backward in list c5 = 0 loop for c11 = 1 to chordsize checkoff(c11) = 1 repeat REP17: c11 = 0 loop for c12 = 1 to chordsize if checkoff(c12) = 1 and chord_tones(c12) = tcode(mf(c3)) checkoff(c12) = 0 c11 = 1 c12 = chordsize end repeat if c11 = 0 goto NO_REP /* this pitch (tcode) was not found in chord end ++c5 ++c3 if c5 < chordsize if c3 = mf2(c1-1) goto NO_REP /* this chord is not big enough end goto REP17 else if c3 <> mf2(c1-1) goto NO_REP /* this chord is too big end end repeat &dA &dA &d@ Look for second (actually penultimate) chord prototype &dA c1 = 2 /* index into mf2 c3 = mf2(c1) chordsize2 = 1 chord_tones(1) = tcode(mf(c3)) ++c3 loop while c3 <> mf2(c1-1) ++chordsize2 chord_tones(chordsize2) = tcode(mf(c3)) /* accumulate chord tones ++c3 repeat &dA &dA &d@ Check all "even" chords for a match &dA loop for c1 = 4 to c2 step 2 c3 = mf2(c1) /* ts index to next "even" primary note backward in list c5 = 0 loop for c11 = 1 to chordsize2 checkoff(c11) = 1 repeat REP18: c11 = 0 loop for c12 = 1 to chordsize2 if checkoff(c12) = 1 and chord_tones(c12) = tcode(mf(c3)) checkoff(c12) = 0 c11 = 1 c12 = chordsize2 end repeat if c11 = 0 goto NO_REP /* this pitch (tcode) was not found in chord end ++c5 ++c3 if c5 < chordsize2 if c3 = mf2(c1-1) goto NO_REP /* this chord is not big enough end goto REP18 else if c3 <> mf2(c1-1) goto NO_REP /* this chord is too big end end repeat &dA &dA &d@ At this point, we have determined that there are c2/2 matching &dA &d@ pairs of chords, and that c2 = 4,8,16 or 32, or an even tuple &dA &d@ of 6 or greater. In this situation we may reduce these c2 &dA &d@ entries to two entries. The duration of each entry is c2/2 &dA &d@ times the old duration. The old duration determines the number &dA &d@ of beams; the new duration determines the number of through &dA &d@ beams. We are going to have to change the the division number &dA &d@ for the second member of the group. It is the same as the &dA &d@ division number of the (c2/2+1)-th member of the group. &dA c4 = c2 / 2 c5 = ts(a1,NTYPE) c7 = c4 loop ++c5 /* new duration c7 >>= 1 repeat while c7 > 1 if c5 > 6 and c2 < 8 /* don't do a four group of eighths, etc. goto NO_REP end c15 = 7 - ts(a1,NTYPE) /* total number of beams c14 = 7 - c5 /* number through beams if c14 < 0 c14 = 0 end #if OLD_REPEATERS if c5 = 7 c5 = 8 c14 = c15 end #endif c15 -= c14 /* number of shortened beams c12 = mf2(c4) c12 = ts(c12,DIV) /* division number for second member c6 = mf2(c2) /* position for revised data c3 = mf2(c2) REP19: /* loop within first chord ts(c3,NTYPE) = c5 ts(c3,NOTE_DUR) *= c4 if c3 <> mf2(c2) c13 = NO_BEAM ts(c3,BEAM_CODE) = 0 else temp3 = "777777"{1,c15} // "222222"{1,c14} ts(c3,BEAM_CODE) = int(temp3) c13 = START_BEAM end ts(c3,BEAM_FLAG) = c13 ++c3 /* next pitch in chord if c3 < mf2(c2-1) goto REP19 end chordsize = c3 - mf2(c2) c6 += chordsize REP20: /* loop within second chord ts(c3,DIV) = c12 ts(c3,NTYPE) = c5 ts(c3,NOTE_DUR) *= c4 if c3 <> mf2(c2-1) c13 = NO_BEAM ts(c3,BEAM_CODE) = 0 else temp3 = "888888"{1,c15} // "333333"{1,c14} ts(c3,BEAM_CODE) = int(temp3) c13 = END_BEAM end ts(c3,BEAM_FLAG) = c13 ++c3 /* next pitch in chord if c3 < mf2(c2-2) goto REP20 end chordsize = c3 - mf2(c2-1) c6 += chordsize if last_chordsize > 1 a9 += last_chordsize - 1 /* advance a9 over rest of last chord end &dA &dA &d@ Clear the rest of the ts array and reset sct &dA loop for c8 = c6 to sct loop for c9 = 1 to TS_SIZE if c9 <> TSR_POINT ts(c8,c9) = 0 end repeat repeat sct = c6 - 1 &dA &d@ goto EBL process array for last member of group &dA &dA &d@ Note &dA02/19/97&d@: The goto EBL has been commented out so that &dA &d@ in the case where a tuple or a slur has been started, it will &dA &d@ be completed. This feature has not been fully tested, and &dA &d@ may cause other problems. Beware! &dA REP16: end NO_REP: end &dA &dA &d@ &dAConstruct SUPER_FLAG&d@ &dA a14 = 0 /* a14 will become ts(14) codes = line{16,9} /* &dAspecifically changed from {16,12} for this program &dA &dA &d@ look for starting tuplet &dA if ts(sct,TUPLE) > 0 if tuflag = 0 and codes con "*" tuflag = 1 a1 = mpt a14 |= 0x10 /* begin tuplet if codes con "&" and mpt < a1 a14 |= 0x40000 /* editorial tuplet flag &dA03-21-97 end end end &dA &dA &d@ look for end of ~~~~~ &dA if ctrflag > 0 /* ctrflag = continue trill flag if codes con "c" else a14 |= 0x08 /* end ~~~~~ if ctrflag >= 0x100 a14 |= 0x20000 /* editorial ~~~ flag &dA03-21-97 end ctrflag = 0 end end &dA &dA &d@ look for start of ~~~~~ &dA if codes con "~" if ctrflag = 0 a7 = mpt if codes con "&" and mpt < a7 ctrflag = 0x0200 /* editorial start ~~~~~ a14 |= 0x20000 /* editorial ~~~ flag &dA03-21-97 else ctrflag = 0x02 /* start ~~~~~ end if codes con "t" ctrflag <<= 1 a14 |= 0x04 /* begin ~~~ with trill else a14 |= 0x02 /* begin ~~~ without trill end end end &dA &dA &d@ look for forward tie &dA if codes con "-" a7 = mpt a14 |= 0x01 /* tie flag if codes con "&" and mpt < a7 a14 |= 0x10000 /* editorial tie (dotted) &dA03-21-97 end end &dA &dA &d@ look for end of tuplet &dA if codes con "!" and tuflag = 1 a7 = mpt a14 |= 0x20 /* end tuplet if codes con "&" and mpt < a7 a14 |= 0x40000 /* editorial tuplet flag &dA03-21-97 end tuflag = 0 end &dA &dA &d@ &dASet SUPER_FLAG&d@ &dA ts(sct,SUPER_FLAG) = a14 a14 = 0 loop for a1 = 1 to 9 /* &dAspecifically changed from 12 to 9 for this program if codes{a1} = "&" /* and codes{a1+1} in ['0'..'9'] a14 = 1 if codes{a1+1} in ['0'..'9'] ++a1 end goto TLP1 /* skip &# end if "()[]{}zx" con codes{a1} --mpt a7 = 1 << mpt if a14 = 1 a7 <<= 16 end ts(sct,SLUR_FLAG) |= a7 goto TLP1 end &dA &dA &d@ look for turns, trills, mordents, and their accidentals &dA if "rtwMk" con codes{a1} /* new code &dA03/01/97&d@ a7 = mpt if a14 = 0 ts(sct,SUBFLAG_1) |= a7 else ts(sct,ED_SUBFLAG_1) |= a7 end temp3 = codes // pad(13) loop for a3 = a1 + 1 to 13 repeat while "shbu" con temp3{a3} if a3 = a1 + 1 goto TLP1 end a7 = 0 temp3 = codes{a1+1..a3-1} a1 = a3 - 1 if temp3 con "u" temp4 = temp3{mpt..} // "..." if mpt = 1 temp3 = "" else temp3 = temp3{1,mpt-1} end if "uss.ubb.us..uh..ub.." con temp4{1,4} a7 = mpt + 3 a7 = a7 << 1 end end temp4 = temp3 // "...." if "ss..bb..s...h...b..." con temp4{1,4} mpt += 3 mpt >>= 2 a7 |= mpt end a7 <<= 4 if a14 = 0 ts(sct,SUBFLAG_1) |= a7 else ts(sct,ED_SUBFLAG_1) |= a7 end goto TLP1 end if "FE@^+" con codes{a1} &dK &d@ if "^+@@@@FE" con codes{a1} accidental flags moved &dA03/01/97 &dK &d@ mpt += 7 mpt += 13 a7 = 1 << mpt if a14 = 0 ts(sct,SUBFLAG_1) |= a7 else ts(sct,ED_SUBFLAG_1) |= a7 end goto TLP1 end &dA &dA &d@ look for dynamics &dA if "mpfZR" con codes{a1} if mpt < 4 if mpt = 1 if "pf" con codes{a1+1} a7 = mpt + 8 /* mp = 9; mf = 10 ++a1 else a7 = 0 end else a7 = mpt - 2 * 4 + 1 /* p = 1; f = 5 if "pf" con codes{a1+1} ++a1 if codes{a1-1} <> codes{a1} if codes{a1} = "p" a7 = 11 /* fp = 11 end else ++a7 /* pp = 2; ff = 6 if codes{a1} = codes{a1+1} ++a1 ++a7 /* ppp = 3; fff = 7 if codes{a1} = codes{a1+1} ++a1 ++a7 /* pppp = 4; ffff = 8 end end end else if a7 = 5 and codes{a1+1} = "z" a7 = 13 /* fz = 13 ++a1 end end end else if mpt = 4 and a1 < len(codes) and codes{a1+1} = "p" /* Zp = sfp a7 = 12 ++a1 else a7 = mpt + 10 /* Z = sfz = 14; R = rfz = 15 end end a7 <<= 10 if a14 = 0 if ts(sct,SUBFLAG_1) & 0x3c00 = 0 ts(sct,SUBFLAG_1) |= a7 end else if ts(sct,ED_SUBFLAG_1) & 0x3c00 = 0 ts(sct,ED_SUBFLAG_1) |= a7 end end goto TLP1 end &dA &dA &d@ other directions connected with notes &dA if "nvi.=_>AVoQ0" con codes{a1} --mpt a7 = 1 << mpt if a14 = 0 ts(sct,SUBFLAG_2) |= a7 else ts(sct,ED_SUBFLAG_2) |= a7 end goto TLP1 end &dA &dA &d@ fingering connected with notes &dA if "12345" con codes{a1} a4 = mpt a7 = 0 a3 = 0 FINNN: if a1 < len(codes) and "12345:" con codes{a1+1} if mpt = 6 a4 += 8 else a4 <<= a3 a7 += a4 a4 = mpt a3 += 4 end ++a1 goto FINNN end a4 <<= a3 a7 += a4 a7 <<= 12 if a14 = 0 ts(sct,SUBFLAG_2) |= a7 else ts(sct,ED_SUBFLAG_2) |= a7 end goto TLP1 end TLP1: repeat tsdata(a9+old@n) = line{28..} ts(sct,TEXT_INDEX) = a9 + old@n ts(sct,PASSNUM) = passnum ts(sct,STAFF_NUM) = tv3(a9) goto EBL end * * Case II: figures * if tvar1 = FIGURES ++sct ts(sct,TYPE) = tvar1 ts(sct,XTABLE_POINT) = tvar5 if figdiv = 0 figdiv = divpoint end ts(sct,DIV) = figdiv ts(sct,FIG_DUR) = tvar2 figdiv += tvar2 a3 = sct - 1 a4 = 0 loop while a3 > oldsct if ts(a3,TYPE) = FIGURES a4 = a3 end --a3 repeat while a4 = 0 * a4 = pointer to previous figure data in measure (or 0) ts(sct,NUMBER_OF_FIG) = int(tcode(a9)) if ts(sct,NUMBER_OF_FIG) > 4 return 2 end a7 = FIG_DATA loop for a5 = 1 to ts(sct,NUMBER_OF_FIG) out = rev(line) out = trm(out) line = rev(out) if line = "" return 2 end line = line // " " if line con " " temp = line{1,mpt-1} line = line{mpt..} end * putc Test1 temp = ~temp line = ~line temp = temp // pad(3) if "_-" con temp{1} if mpt = 1 if a4 = 0 return 2 end if ts(a4,a7+2) = 0 ts(a4,a7+2) = 2 else ts(a4,a7+2) = 3 end ts(sct,a7+2) = 1 else ts(sct,a7) = 30 /* 30 end else if "x@#@@@@nf" con temp{1} /* 21,23,28,29 ts(sct,a7) = mpt + 20 a6 = 2 goto WB1 end if "2@45" con temp{1} and temp{2} = "+" /* 22,24,25 ts(sct,a7) = mpt + 21 a6 = 4 goto WB1 end if "/\" con temp{2} and "67" con temp{1} /* 26,27 ts(sct,a7) = mpt + 25 a6 = 4 goto WB1 end a6 = int(temp) /* 1..19 if a6 < 0 or a6 > 19 return 2 end ts(sct,a7) = a6 if ts(sct,a7) < 10 a6 = 2 else a6 = 3 end WB1: if a6 < 4 temp = temp{a6..} if "+x@#@@@@nf" con temp{1} ts(sct,a7+1) = mpt + 19 else ts(sct,a7+1) = int(temp) end end end a7 += 3 repeat &dA ts(sct,TEXT_INDEX) = a9 &d@ Removing this line ts(sct,PASSNUM) = passnum ts(sct,STAFF_NUM) = nstaves - 1 goto EBL end &dA &dA &d@ Case III: bar lines &dA if tvar1 = BAR_LINE ++sct ts(sct,TYPE) = tvar1 ts(sct,XTABLE_POINT) = tvar5 ts(sct,DIV) = divpoint ts(sct,BAR_NUMBER) = tvar2 if tcode(a9) = "sure" ts(sct,BAR_TYPE) = REGULAR else if "@1d@e2@@34" con tcode(a9){4} ts(sct,BAR_TYPE) = mpt end end if line con ":|" ts(sct,REPEAT) |= 0x02 end if line con "|:" ts(sct,REPEAT) |= 0x01 end if line con "stop-end" ts(sct,BACK_ENDING) = int(line{mpt+8..}) end if line con "start-end" ts(sct,FORW_ENDING) = int(line{mpt+9..}) end if line con "disc-end" a3 = int(line{mpt+8..}) ts(sct,BACK_ENDING) = 0 - a3 end if ctrflag > 0 and line con "~" ts(sct,BAR_FLAGS) |= 0x01 end if line con "A" ts(sct,BAR_FLAGS) |= 0x02 end if line con "F" ts(sct,BAR_FLAGS) |= 0x04 end if line con "E" ts(sct,BAR_FLAGS) |= 0x08 end ts(sct,SPACING) = hpar(37) ts(sct,M_NUMBER) = m_number if m_number > 0 ++m_number end &dA ts(sct,TEXT_INDEX) = a9 &d@ Removing this line ts(sct,PASSNUM) = passnum ts(sct,NUM_STAVES) = tv3(a9) goto EBL end &dA &dA &d@ Case IV: signs, words, marks &dA if tvar1 = MUSICAL_DIR ++sct ts(sct,XTABLE_POINT) = tvar5 a4 = 0 temp = tcode(a9) loop for a3 = 1 to 2 if "APQG" con temp{a3} ts(sct,TYPE) = SIGN ts(sct,SIGN_TYPE) = mpt end if temp{a3} = "X" /* (added &dA10-12-96&d@) ts(sct,TYPE) = SIGN ts(sct,SIGN_TYPE) = TIE_TERM end if "BCD" con temp{a3} ts(sct,TYPE) = WORDS ts(sct,SIGN_TYPE) = mpt + 4 end if "EFHJ" con temp{a3} ts(sct,SUPER_TYPE) = mpt if mpt < 3 a4 = int(line{5..7}) /* get numerical parameter for wedges ts(sct,WEDGE_SPREAD) = a4 * notesize / 10 end end if "UWV" con temp{a3} if mpt = 2 ts(sct,SUPER_TYPE) = NORMAL_TRANS else ts(sct,SUPER_TYPE) = mpt + 4 /* 5 or 7 */ if int(tdata(a9){5,3}) <> 0 ts(sct,SUPER_TYPE) += 4 end end end repeat if ts(sct,TYPE) = 0 ts(sct,TYPE) = MARK end ts(sct,DIV) = divpoint + cuediv ts(sct,DIV) += mdir_offset if temp{3} = "+" ts(sct,SIGN_POS) = ABOVE else ts(sct,SIGN_POS) = BELOW end if a4 = 0 a4 = int(line{5..7}) ts(sct,FONT_NUM) = a4 /* get numerical parameter for words, etc. end ts(sct,WEDGE_OFFSET) = vpar(1) if ts(sct,SUPER_TYPE) = WEDGES << 1 /* end of wedge if ts(sct,WEDGE_SPREAD) = 0 /* point of wedge ts(sct,WEDGE_OFFSET) = notesize end end if ts(sct,SIGN_TYPE) = LETTER_DYNAM if ts(sct,SUPER_TYPE) = 1 /* start wedge line = trm(line) line = line // pad(9) temp = line{9..} &dA &dA &d@ Adjust temp for "Zp", "Z", and "R". &dA temp = " " // temp // " " if temp con "Zp" temp = temp{1..mpt-1} // "sfp" // temp{mpt+2..} end if temp con "Z" #if SFZ temp = temp{1..mpt-1} // "sfz" // temp{mpt+1..} #else temp = temp{1..mpt-1} // "sf" // temp{mpt+1..} #endif end if temp con "R" #if SFZ temp = temp{1..mpt-1} // "rfz" // temp{mpt+1..} #else temp = temp{1..mpt-1} // "rf" // temp{mpt+1..} #endif end temp = temp{2..} temp = trm(temp) a5 = notesize / 2 loop for a4 = 1 to len(temp) if "pmfszr" con temp{a4} mpt += 59 a5 += hpar(mpt) end repeat ts(sct,WEDGE_OFFSET) = a5 end if ts(sct,SUPER_TYPE) = 2 /* stop wedge ts(sct,WEDGE_OFFSET) = 0 - hpar(46) end end if ts(sct,SIGN_TYPE) = CENTER_STR or ts(sct,SIGN_TYPE) = LEFT_JUST_STR if ts(sct,SUPER_TYPE) = 1 /* start wedge if len(line) > 8 ttext = line{9..} ttext = trm(ttext) c5 = mtfont perform wordspace &dA &d@³ Outputs: a5 = space taken up by word if ts(sct,SIGN_TYPE) = CENTER_STR /* centered word a5 >>= 1 end a5 += notesize / 2 ts(sct,WEDGE_OFFSET) = a5 end end if ts(sct,SUPER_TYPE) = 2 /* stop wedge ts(sct,WEDGE_OFFSET) = 0 - notesize end end tsdata(a9+old@n) = line{9..} ts(sct,TEXT_INDEX) = a9 + old@n ts(sct,PASSNUM) = passnum ts(sct,STAFF_NUM) = tv3(a9) ts(sct,TRACK_NUM) = tvar2 goto EBL end &dA &dA &d@ Case V, VI, VII and VIII: &dA &d@ clef change, time designation, meter change, divspq change &dA if chr(tvar1) in [CLEF_CHG,DESIGNATION,METER_CHG,DIV_CHG] ++sct ts(sct,TYPE) = tvar1 ts(sct,XTABLE_POINT) = tvar5 ts(sct,DIV) = divpoint ts(sct,3) = tvar2 /* first parameter if tvar1 = CLEF_CHG ts(sct,CLEF_FONT) = int(tcode(a9)) end tsdata(a9+old@n) = tdata(a9) ts(sct,TEXT_INDEX) = a9 + old@n ts(sct,PASSNUM) = passnum ts(sct,STAFF_NUM) = tv3(a9) &dA &d@ assure proper current value of divspq for this loop if tvar1 = DIV_CHG qflag = 1 divspq = tvar2 end goto EBL end &dA &dA &d@ Case IX: key change &dA if tvar1 = AX_CHG ++sct ts(sct,TYPE) = tvar1 ts(sct,XTABLE_POINT) = tvar5 ts(sct,DIV) = divpoint ts(sct,3) = tvar2 /* new key ts(sct,4) = key /* old key tsdata(a9+old@n) = tdata(a9) ts(sct,TEXT_INDEX) = a9 + old@n ts(sct,PASSNUM) = passnum ts(sct,NUM_STAVES) = tv3(a9) goto EBL end &dA &dA &d@ Case X: irst, backspace &dA if tvar1 = IREST divpoint += tvar2 if divpoint > totdiv totdiv = divpoint end cuediv = 0 goto EBL end if tvar1 = BACKSPACE ++passnum divpoint -= tvar2 cuediv = 0 goto EBL end &dA &dA &d@ Case XI: print suggestions &dA if tvar1 = P_SUGGESTION if tvar2 < 8 /* forced slur suggestion a3 = tvar2 & 0x06 a4 = tvar2 & 0x01 a4 <<= 1 ++a4 /* 1 = over; 3 = under a4 <<= a3 + 8 ts(sct,SLUR_FLAG) |= a4 /* turn on forced slur flag goto EBL end if tvar2 < 10 if tvar2 = 8 ts(sct,SLUR_FLAG) |= 0x1000000 /* overhanded tie else ts(sct,SLUR_FLAG) |= 0x3000000 /* underhanded tie end goto EBL end if tvar2 < 32 ts(sct,SUPER_FLAG) |= 0x40 /* tuplet has a bracket &dA03-21-97 if bit(0,tvar2) = 1 ts(sct,SUPER_FLAG) |= 0x200 /* bracket is round &dA03-21-97 end if bit(1,tvar2) = 1 ts(sct,SUPER_FLAG) |= 0x80 /* bracket is continuous &dA03-21-97 end if bit(2,tvar2) = 1 ts(sct,SUPER_FLAG) |= 0x100 /* tuplet number is inside &dA03-21-97 end goto EBL end if tvar2 >= 0x100 and tvar2 < 0x200 /* musical direction a3 = ors(tcode(a9){1}) if a3 > 0 ts(sct,FONT_NUM) = a3 end a3 = ors(tcode(a9){2}) << 8 + ors(tcode(a9){3}) if tvar2 & 0xff = 0 ts(sct,POSI_SHIFT1) = a3 << 8 + ors(tcode(a9){4}) else ts(sct,POSI_SHIFT2) = a3 << 8 + ors(tcode(a9){4}) end goto EBL end if tvar2 & 0xff00 = 0x0200 /* position of ornaments, etc. a3 = tvar2 & 0xff * 4 + 1 tsr(sct){a3,4} = tcode(a9){1,4} goto EBL end if tvar2 & 0xff00 = 0x0300 /* printing of actual objects a3 = ors(tcode(a9){1}) if a3 > 6 a3 >>= 1 & 0x07 &dA &d@ 3 = print object, no extension dot &dA &d@ 4 = print object, include extension dot &dA &d@ 5 = double note length, no extension dot &dA &d@ 6 = double note length, include extension dot &dA &d@ 7 = quadruple note length, no extension dot if a3 > 2 if a3 = 4 or a3 = 6 ts(sct,DOT) = 1 else ts(sct,DOT) = 0 end if a3 > 4 ++ts(sct,NTYPE) end if a3 > 6 ++ts(sct,NTYPE) end ts(sct,SUPER_FLAG) &= 0xfffffffe /* turn off ties end end tsr(sct){1,4} = tcode(a9){1,4} goto EBL end end EBL: repeat old@n += @n &dA ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA ³ End of storing original data in set array ³ &dA ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA &dA &d@ ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» &dA &d@ º N E W S O R T A L G O R I T H M º &dA &d@ ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ &dA &dA &d@ &dA09/30/93&d@ &dA &dA &d@ Reorder set array according to location in measure. Do not &dA &d@ separate extra chord notes from their original lead notes. &dA &d@ Do not change the order of bar/clef/grace-note. Do not &dA &d@ extract signs, words, or marks when they precede a bar, &dA &d@ clef or grace note; otherwise extract them and put them &dA &d@ in front of figures, cues and regular notes. Do not &dA &d@ extract time designations when they precede a bar, &dA &d@ clef or grace note; otherwise extract them and put them &dA &d@ in front of words, signs, marks, figures, cues and regular &dA &d@ notes. &dA &dA &d@ For objects at same location, the order is as follows: &dA &dA &d@ 1. bar, clef, grace note/chord (in original order for each div) &dA &d@ 2. &dA &d@ 3. &dA &d@ 4. change in divisions per quarter &dA &d@ 5. time designation, meter change, key change &dA &d@ 6. word, sign, mark &dA &d@ 7. figure &dA &d@ 8. cue note/chord, cue rest &dA &d@ 9. regular note/chord, regular rest &dA &dA &d@ Summary of algorithm: &dA &dA &d@ 1. For each division, assign parameters as listed above &dA &d@ 2. bar, clef, and grace note/chord will be assigned numbers &dA &d@ 1, 2, and 3 in the order in which they first occur &dA &d@ in the array on this division &dA &d@ 3. For time designations, words, signs and marks, if &dA &d@ they preceed a type 1,2,or 3, or if they preceed &dA &d@ another or this kind which preceeds a 1,2 or 3, &dA &d@ then they take this respective type &dA &d@ 4. order the elments of mf(.) on each division according &dA &d@ to the parameter numbers assigned to them. mf(.) &dA &d@ will now contain the indexes for the proper order &dA &d@ of ts(.) from oldsct to sct. &dA &d@ 5. reorder the elements of ts(.) accordingly &dA a7 = 0 /* global counter in measure a3 = ts(sct,DIV) /* divisions per measure loop for a2 = 1 to a3 temp = "999888007066606545" /* initial "priority" string (with unknowns = 0) a6 = 0 a8 = a7 /* local counter on this division loop for a1 = oldsct + 1 to sct if ts(a1,DIV) = a2 a4 = ts(a1,TYPE) a5 = int(temp{a4}) if a5 = 0 /* setting "unknowns" in the order they are encountered ++a6 if a4 = 7 or a4 = 8 temp{7} = chs(a6) temp{8} = chs(a6) else temp{a4} = chs(a6) end a5 = a6 end ts(a1,SORTPAR1) = a5 ++a8 mf(a8) = a1 end repeat a5 = 20 loop for a3 = a8 to a7 + 1 step -1 a1 = mf(a3) a4 = ts(a1,SORTPAR1) if a4 = 6 /* time designation, word, sign, mark if a5 < 4 /* bar, clef, grace note/chord or ... ts(a1,SORTPAR1) = a5 a4 = a5 else if ts(a1,TYPE) = DESIGNATION ts(a1,SORTPAR1) = 5 end end end a5 = a4 repeat &dA &dA &d@ Sort this section of mf(.) according to SORTPAR1, taking care &dA &d@ &dAnot&d@ to separate chord tones from their principal tones. &dA if a8 > a7 + 1 /* (1) transfer relevant portion to mf2 array loop for a3 = a7+1 to a8 mf2(a3) = mf(a3) repeat /* (2) move elements back using order of sort priorites &dAonly&d@ a6 = a7 loop for a1 = 1 to 9 /* sort priorities loop for a3 = a7+1 to a8 a5 = mf2(a3) /* a5 is a ts(.) index if a5 <> 1000 a5 = ts(a5,SORTPAR1) /* a5 is a sort priority (0 to 9) if a5 = a1 ++a6 mf(a6) = mf2(a3) /* move element back to mf mf2(a3) = 1000 /* and disqualify this element end end repeat repeat if a6 <> a8 putc Program Error in mf() sort return 10 end end &dA &dA &d@ End of mf() section sort &dA a7 = a8 repeat /* now sort the ts(.,.) array according to the mf(.) order &dA &d@ loop for a2 = 1 to a8 &dA &d@ putc ~mf(a2) &dA &d@ repeat a5 = sct + 1 /* address of "hole" a1 = oldsct + 1 loop for a2 = 1 to a8 a3 = mf(a2) if a3 <> a1 /* move ts(a1) to "hole" and put ts(a3) in a1 slot loop for a6 = 1 to TS_SIZE ts(a5,a6) = ts(a1,a6) ts(a1,a6) = ts(a3,a6) repeat /* search mf(.) array for reference to a1 element /* and tell it that this element is now in a5 loop for a7 = a2+1 to a8 if mf(a7) = a1 mf(a7) = a5 a7 = a8 end repeat &dA &d@ mf(a2) = a1 /* set a5 to the new "hole", which is a3 a5 = a3 end /* advance the destination, a1 ++a1 repeat &dA &dA &d@ Clear work space &dA loop for a1 = oldsct + 1 to sct ts(a1,SORTPAR1) = 0 repeat loop for a1 = 1 to TS_SIZE ts(sct+1,a1) = 0 repeat goto TS_SORTED &dA &dA &d@ ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» &dA &d@ º O L D S O R T A L G O R I T H M º &dA &d@ ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ &dA &dA &d@ Reorder set array according to location in measure. Do not &dA &d@ separate extra chord notes from their original lead notes. &dA &d@ Do not change the order of bar/clef/grace-note. Do not &dA &d@ extract signs, words, or marks when they precede a bar, &dA &d@ clef or grace note; otherwise extract them and put them &dA &d@ in front of figures, cues and regular notes. &dA &dA &d@ For objects at same location, the order is as follows: &dA &dA &d@ 1. bar, clef, grace note/chord &dA &d@ 2. change in divisions per quarter &dA &d@ 3. time designation, meter change, key change &dA &d@ 4. word, sign, mark &dA &d@ 5. figure &dA &d@ 6. cue note/chord &dA &d@ 7. cue rest &dA &d@ 8. regular note/chord &dA &d@ 9. regular rest &dA &dA &d@ Designations have a certain amount of "glue". If they preceed &dA &d@ a clef change, they want to keep that position. If they &dA &d@ preceed grace notes, they want to stay there also. If they &dA &d@ preceed a bar line, they want to stay there. Otherwise &dA &d@ they get moved in front of everything except changes in divspq &dA &dA &dA &d@ Because the position of words, signs, and marks depends on what &dA &d@ follows, we must assign order priorities starting at the &dA &d@ bottom of the array. &dA TS_SORTED: &dA &dA &d@ Reorder multiple grace notes &dA loop for a3 = 1 to MAX_PASS passpar(a3) = 200 /* reverse order scheme, starting at 200 repeat a6 = 200 a5 = 0 loop for a1 = sct to oldsct step -1 if a1 > oldsct and chr(ts(a1,TYPE)) in [GR_NOTE,XGR_NOTE] if a5 = 0 a5 = a1 end a2 = ts(a1,PASSNUM) ts(a1,SORTPAR1) = passpar(a2) if a6 > passpar(a2) a6 = passpar(a2) end if ts(a1,TYPE) = GR_NOTE --passpar(a2) end else if a5 > 0 /* some grace notes were found a5 -= a1 /* a5 = number of elements a4 = 0 loop for a7 = a6 to 200 a3 = 0 loop for a8 = 1 to a5 if ts(a1+a8,SORTPAR1) = a7 ++a4 mf(a4) = a1 + a8 /* here is where we must add space parameter for GRACE notes if a3 = 0 if ts(a1+a8,BEAM_FLAG) = NO_BEAM ts(a1+a8,SPACING) = hpar(97) /* Removed * 4 / 3 &dA05-15-95 else ts(a1+a8,SPACING) = hpar(97) end a3 = 1 else ts(a1+a8,SPACING) = 0 end end repeat repeat /* mf(.) now contains the locations of array elements (in reordered form) loop for a8 = 1 to a5 a4 = mf(a8) if a1+a8 <> a4 /* what's there now is not what goes there loop for a7 = 1 to TS_SIZE ts(sct+1,a7) = ts(a1+a8,a7) /* make hole for new element ts(a1+a8,a7) = ts(a4,a7) /* move in new element ts(a4,a7) = ts(sct+1,a7) /* put old element in vacancy repeat loop for a7 = 1 to a5 if mf(a7) = a1 + a8 /* this element has been moved mf(a7) = a4 /* now give new location a7 = a5 end repeat mf(a8) = a1 + a8 end repeat /* re-initialize sorting parameters loop for a3 = 1 to MAX_PASS passpar(a3) = 200 repeat a5 = 0 a6 = 200 end end repeat loop for a1 = oldsct+1 to sct ts(a1,SORTPAR1) = 0 repeat &dA ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA ³ End of reorder process. ³ &dA ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA &dA &d@ Check for isolated SIGNS, WORDS, or MARKS &dA a2 = oldsct + 1 a5 = ts(a2,DIV) loop for a1 = oldsct+1 to sct if ts(a1,DIV) <> a5 loop for a3 = a2 to a1 - 1 nodtype = ts(a3,TYPE) if chr(nodtype) not_in [SIGN,WORDS,MARK] a3 = 1000000 end repeat if a3 <> 1000000 loop for a3 = a2 to a1 - 1 ts(a3,ISOLATED) = 1 repeat end a2 = a1 a5 = ts(a2,DIV) end repeat &dA &dA &d@ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@ ³ Before decoding the notes, we must determine if this part ³ &dA &d@ ³ represents more than one independent instrument. If so then ³ &dA &d@ ³ the rules regarding accidentals are slightly different. Each ³ &dA &d@ ³ instrumental part must have its own, independent measax array. ³ &dA &d@ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA &dA &dA &d@ For the case where more than one independent instrument is being &dA &d@ represented on this measure, (vflag > 1) we need to catagorize &dA &d@ the measure into one of three types: &dA &dA &d@ (1) one pass, no chords. &dA &dA &d@ This situation arrises when we have an a2 (zu 2) situation, &dA &d@ i.e., all instruments are active, but are playing the same &dA &d@ music, or a 1. (2. or 3.) situation, i.e., only one &dA &d@ instrument is specifically active -- all other instruments &dA &d@ have been told not to play. In this case, the music is &dA &d@ easy to typeset. &dA &dA &d@ (2) one pass, chords. &dA &dA &d@ This is the situation more than 90% of the time. Two or &dA &d@ more parts (99.99% of the time, it is two parts) are &dA &d@ represented in the measure, and the following conditions &dA &d@ hold true: &dA &dA &d@ a) all parts have the same rhythm (including resting &dA &d@ at the same time) &dA &d@ b) part 1 is at unison or is higher than part 2, etc. &dA &dA &d@ c) all parts have identical slurs and articulations. &dA &d@ This includes slurs entering and leaving the &dA &d@ measure. &dA &dA &d@ d) if there is a unison and it is an eighth note or less, &dA &d@ then it is not attached to a beam. &dA &dA &d@ The parts will be printed as chords. Slurs and articulations &dA &d@ will be attached to the note head at the end of stem. Unison &dA &d@ notes (represented as chords with two or more identical notes) &dA &d@ will be printed in one of two ways: &dA &dA &d@ a) whole notes and larger will be printed side-by-side. &dA &dA &d@ b) half notes and smaller will be printed with two stems &dA &d@ (up and down) regardless of the listed stem direction. &dA &d@ (three unisons cannot be handled by this program) &dA &dA &d@ &dAWith this type, each part (defined by its position in the chord)&d@ &dA &d@ &dAwill have its own measax array. This is because accidentals &dA &d@ &dAmust be repeated, if they appear in different parts. &dA &dA &d@ (3) more than one pass. &dA &dA &d@ With this type, notes occuring on the same division and having &dA &d@ the same duration and same stem direction will be combined into &dA &d@ one chord. &dA As with type (2) above, each part (defined in this &dA &d@ &dAcase by pass number) will have its own measax array. Accidentals&d@ &dA &d@ &dAmust be repeated, if they appear in different parts.&d@ Unison &dA &d@ whole notes and larger will be printed side-by-side. &dA if vflag > 1 if passnum = 1 &dA &d@ &dA &d@ Must determine if there are chords in this measure &dA mcat = 1 loop for a1 = 1 to sct if ts(a1,TYPE) = XNOTE mcat = 2 a1 = sct end repeat else mcat = 3 end else mcat = 0 end &dA &dA &d@ (added &dA10-12-96&d@) &dA &dA &d@ Determine links between tie terminators and earlier pitches &dA &dA &d@ Basically, we look backward through the data to find the pitch &dA &d@ referred to by the tie terminator. If the pitch cannot be found, &dA &d@ this is an error condition. We must search on the correct staff &dA &d@ number. Once we have found the pitch, we need to store its &dA &d@ index number. Later we will determine the STAFFLOC parameter. &dA &d@ This will be used later to generate the mark object and the tie &dA &d@ super object. &dA loop for a1 = oldsct+1 to sct if ts(a1,TYPE) = SIGN and ts(a1,SIGN_TYPE) = TIE_TERM tsdata(ts(a1,TEXT_INDEX)) = tsdata(ts(a1,TEXT_INDEX)) // pad(4) note = tsdata(ts(a1,TEXT_INDEX)){1,4} loop for t7 = a1 to oldsct+1 step -1 if ts(t7,TYPE) <= NOTE_OR_REST if ts(t7,STAFF_NUM) = ts(a1,STAFF_NUM) t8 = ts(t7,4) if note = tcode(t8) ts(a1,BACKTIE) = t7 /* store ts index of pitch generating tie goto TIE_TERM_FOUND end end end repeat return 14 end TIE_TERM_FOUND: repeat &dA &dA &d@ End of &dA10-12-96&d@ addition &dA &dA &dA &d@ Decode pitches, store &dAunmodified&d@ accidentals in ts(.,AX) &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a2 = ts(a1,4) note = tcode(a2) perform decodenote if @c = 100 @c += ts(a1,CLAVE) /* see "floating rest flag" c. line 1978 end ts(a1,CLAVE) = @c ts(a1,AX) = @d a4 = ts(a1,STAFF_NUM) + 1 if @c < 100 ts(a1,STAFFLOC) = 52 - @c - cline(a4) + c8flag(a4) * notesize / 2 end end if chr(nodtype) in [SIGN,WORDS,MARK] a4 = ts(a1,STAFF_NUM) + 1 /* staff number a2 = ts(a1,SUPER_TYPE) + 1 / 2 if chr(a2) in [OCT_UP,OCT_DOWN,DBL_OCT_UP,DBL_OCT_DOWN] &dA &dA &d@ adjust c8flag(.) &dA if a2 = OCT_UP c8flag(a4) = -7 end if a2 = OCT_DOWN c8flag(a4) = 7 end if a2 = DBL_OCT_UP c8flag(a4) = -14 end if a2 = DBL_OCT_DOWN c8flag(a4) = 14 end transflag(a4) = 2 * a2 end if ts(a1,SUPER_TYPE) = NORMAL_TRANS c8flag(a4) = 0 /* return to normal if transflag(a4) < 2 * OCT_UP putc Possible Coding error with transpositions putc Type to continue getc end ts(a1,SUPER_TYPE) = transflag(a4) transflag(a4) = 0 end end if nodtype = CLEF_CHG a4 = ts(a1,STAFF_NUM) + 1 /* staff number clef(a4) = ts(a1,CLEF_NUM) active_clef = clef(a4) perform zjcline (a4) * this resets clef and cline /* ts(a1,CLEF_FONT) += z &dA Unnecessary and, in fact, an error! &d@ ts(a1,TRANS_FLAG) = k /* &dA ts(a1,CLEF_STAFF_POS) = 5 - j * notesize /* &dA Possibly a3 = hpar(8) * 5 / 6 /* &dA unnecessary if ts(a1,CLEF_FONT) >= 128 /* music font /* &dA at this a3 = a3 * 8 / 10 /* &dA point end /* &dA ts(a1,SPACING) = a3 /* &dA end repeat &dA &dA &d@ If mcat = 3, reorganize notes on the same division. If two notes &dA &d@ with different pass numbers have the same duration and stem directions &dA &d@ in the same direction, and these notes do not have beam connections, &dA &d@ then these notes can be combined into one chord. This will save &dA &d@ considerable trouble later during the computing of x-offsets (both &dA &d@ local and global) and the setting of stems. &dA &dA &d@ &dA09/22/93&d@ Actually I would like to expand this section. &dA &dA &d@ (1) I would like to try to combine isorhythmic passages that do connect &dA &d@ to beams &dA &dA &d@ (2) If the entire measure is isorhythmic, then I would like to set &dA &d@ mcat to 2 and reduce the number of passes &dA &dA &d@ (3) Also, if the measure is isorhythmic, I would like to print out &dA &d@ rests only one time &dA &dA &d@ (4) Also, if mcat > 1, accidentals on the same line should NOT be &dA &d@ reprinted. This should be easy to fix, simply by looping though &dA &d@ all simultanities on a staff and removing accidentals that &dA &d@ occur twice on the same pitch. &dA &dA &d@ available variables: a1 --> a12 &dA if mcat = 3 /* %%% add code here for changing ax behavior &dA &dA &d@ First thing: fix accidentals according to pass number &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a4 = ts(a1,PASSNUM) if a4 > 3 putc This code will not work with more than 3 passes putc &dAType /e &d@ to terminate examine return 10 end perform decodeax (a1,a4) end if nodtype = BAR_LINE loop for a3 = 1 to 50 loop for a4 = 1 to 3 measax(a4,a3) = claveax(a3) repeat repeat end if nodtype = CLEF_CHG a4 = ts(a1,STAFF_NUM) + 1 /* staff number clef(a4) = ts(a1,CLEF_NUM) active_clef = clef(a4) perform zjcline (a4) * this resets clef and cline ts(a1,CLEF_FONT) += z /* music font ts(a1,TRANS_FLAG) = k ts(a1,CLEF_STAFF_POS) = 5 - j * notesize a3 = hpar(8) * 5 / 6 /* Added &dA06-24-94&d@ if ts(a1,CLEF_FONT) > 128 /* music font a3 = a3 * 8 / 10 end ts(a1,SPACING) = a3 if nstaves > 1 /* Case: assume one part to stave (usual case) loop for a3 = 1 to 50 measax(a4,a3) = claveax(a3) repeat else loop for a4 = 1 to 3 loop for a3 = 1 to 50 measax(a4,a3) = claveax(a3) repeat repeat end end repeat &dA &dA &d@ Now you can combine notes into chords (and alter pass numbers) &dA &dA &dA &d@ First check to see if the entire measure is isorhythmic. This will &dA &d@ save time in the end, and is also necessary in determining whether or &dA &d@ not to eliminate duplicate rests. There are some caviats here: &dA &dA &d@ (1) Notes with lower pass numbers must always be unison or higher &dA &d@ on the staff &dA &d@ (2) All stem directions must be the same (for a particular division) &dAREMOVED &dA &dA &d@ (3) All beam flags for notes from each pass must be identical. &dA &dA &d@ (4) Every division must have a representative from each pass. These &dA &d@ must be either all notes or all rests. &dA /* %%% add code here for disabling isorhythmic compression loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST loop for a2 = a1 + 1 to sct if ts(a2,DIV) <> ts(a1,DIV) or ts(a2,SPACING) <> 0 goto JOL1 end if nodtype = REST or nodtype = CUE_REST if ts(a2,TYPE) <> nodtype goto JOL1 end else if ts(a2,TYPE) <> nodtype and ts(a2,TYPE) <> nodtype + 1 goto JOL1 end end repeat JOL1: --a2 if a2 - a1 + 1 < passnum goto ISO_FAIL end a4 = 0 a5 = 0 a6 = ts(a1,PASSNUM) a7 = 1000 loop for a3 = a1 to a2 if ts(a3,CLAVE) < 100 if ts(a3,STAFF_NUM) <> ts(a1,STAFF_NUM) goto ISO_FAIL end &dA &d@ if bit(1,ts(a3,STEM_FLAGS)) <> bit(1,ts(a1,STEM_FLAGS)) &dA &d@ goto ISO_FAIL &dA &d@ end if ts(a3,BEAM_FLAG) <> ts(a1,BEAM_FLAG) goto ISO_FAIL end if bit(0,ts(a3,SUPER_FLAG)) <> bit(0,ts(a1,SUPER_FLAG)) /* ties goto ISO_FAIL end if bit(2,ts(a3,STEM_FLAGS)) = 0 /* number of "events" ++a4 end if ts(a3,PASSNUM) = a6 /* order of pitches */ if ts(a3,CLAVE) < a7 a7 = ts(a3,CLAVE) end else if ts(a3,CLAVE) > a7 goto ISO_FAIL end a6 = ts(a3,PASSNUM) a7 = ts(a3,CLAVE) end else ++a5 end repeat if a4 = 0 if a5 <> passnum goto ISO_FAIL end else if a4 <> passnum or a5 > 0 goto ISO_FAIL end end a1 = a2 end repeat &dA &dA &d@ The measure meets the conditions of isorhythmic compression. Here is &dA &d@ what we must do: &dA &dA &d@ (1) Rests: Delete duplicate rests. Do this all at one time, &dA &d@ since this involves resizing the ts array. &dA &dA &d@ (2) Notes--situation 1: Note not connected to a beam &dA &dA &d@ If no unison and no chords in separate parts, then combine all &dA &d@ pitches into one chord &dA &d@ If separate stem directions do not agree, determine &dA &d@ best direction; otherwise use common direction &dA &dA &d@ TYPE: for each note group, make first type 1,4,7 and &dA &d@ all others 2,5,8 &dA &d@ STEM_FLAGS: set all bit2's; set all bit3's for all but first &dA &d@ member of group &dA &d@ BEAM_FLAG: zero for all but first member of chord group &dA &d@ BEAM_CODE: zero for all but first member of chord group &dA &d@ PASSNUM: equal to PASSNUM for first member of group &dA &dA &d@ Otherwise, set the stem direction for the upper pass &dA &d@ to up and for the lower pass to down. &dA &dA &d@ (3) Notes--situation 2: Note is connected to a beam &dA &dA &d@ For all notes on that beam determine if there are any unisons &dA &d@ or any chords in separate chords. &dA &dA &d@ If no unisons and no chords, then combine all pitches into one chord &dA &d@ If separate stem directions do not agree, determine &dA &d@ best direction; otherwise use common direction &dA &dA &d@ TYPE: for each note group, make first type 1,4,7 and &dA &d@ all others 2,5,8 &dA &d@ STEM_FLAGS: set all bit2's; set all bit3's for all but first &dA &d@ member of group &dA &d@ BEAM_FLAG: zero for all but first member of chord group &dA &d@ BEAM_CODE: zero for all but first member of chord group &dA &d@ PASSNUM: equal to PASSNUM for first member of group &dA &dA &d@ If unisons, then set the stem direction for the upper pass &dA &d@ to up and for the lower pass to down. &dA &dA &d@ (4) If all notes in measure were combined into chords, then &dA &d@ decrease passnum by amount of largest PASSNUM + 1 / 2 &dA &dA &dA &d@ (1) Rests: Delete duplicate rests &dA a1 = oldsct+1 COMPRESS1: nodtype = ts(a1,TYPE) if nodtype = REST or nodtype = CUE_REST loop for a2 = a1 + 1 to sct if ts(a2,DIV) <> ts(a1,DIV) goto JOL2 end repeat while ts(a2,TYPE) = nodtype JOL2: if a2 > a1 + 1 /* do this only if another rest is found a5 = a1 + 1 loop for a3 = a2 to sct loop for a4 = 1 to TS_SIZE ts(a5,a4) = ts(a3,a4) repeat ++a5 repeat loop for a4 = 1 to TS_SIZE /* &dA1/30/96&d@ clear last ts(.,.) line ts(sct,a4) = 0 repeat sct -= a2 - a1 - 1 end end ++a1 if a1 <= sct goto COMPRESS1 end &dA &dA &d@ (2) (3) Notes-- situations 1 and 2 &dA a10 = 0 a5 = 0 a6 = 0 a7 = 0 a8 = 0 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype = NOTE or nodtype = CUE_NOTE or nodtype = GR_NOTE loop for a2 = a1 + 1 to sct if ts(a2,DIV) <> ts(a1,DIV) or ts(a2,SPACING) <> 0 goto JOL3 end repeat while ts(a2,TYPE) = nodtype or ts(a2,TYPE) = nodtype + 1 JOL3: --a2 &dA &dA &d@ Move all dynamics for notes on same division to first note (because it is easy &dA &d@ to do at this point) &dA a4 = 0 loop for a3 = a1 to a2 a4 |= ts(a3,SUBFLAG_1) & 0x3c00 /* 0000 0000 0011 1100 0000 0000 ts(a3,SUBFLAG_1) &= 0xffc3ff /* 1111 1111 1100 0011 1111 1111 repeat ts(a1,SUBFLAG_1) |= a4 &dA &dA &d@ Remove duplicate fermatas for notes on same division (because it is easy &dA &d@ to do at this point) &dA a4 = ts(a1,SUBFLAG_1) & 0x0080 /* 0000 0000 0000 0000 1000 0000 loop for a3 = a1 + 1 to a2 if ts(a3,SUBFLAG_1) & 0x0080 = a4 ts(a3,SUBFLAG_1) &= 0xffff7f /* 1111 1111 1111 1111 0111 1111 end repeat if a2 - a1 + 1 > passnum a7 = 1 /* chords are present on this division end &dA &dA &d@ Determine if there is a unison in this group &dA if a7 = 0 loop for a3 = a1 + 1 to a2 if ts(a3,CLAVE) = ts(a3-1,CLAVE) a7 = 1 end repeat end if a6 = 0 loop for a3 = a1 + 1 to a2 if bit(1,ts(a3,STEM_FLAGS)) <> bit(1,ts(a1,STEM_FLAGS)) a8 = 1 /* conflicting stem directions end repeat end if ts(a1,BEAM_FLAG) <> 0 /* this note is on a beam if ts(a1,BEAM_FLAG) = START_BEAM a6 = a1 /* index starts beam end if ts(a1,BEAM_FLAG) = END_BEAM a6 += INT10000 /* index ends beam end else a6 = a1 + INT10000 end if a6 > INT10000 /* process notes here a6 -= INT10000 &dA &dA &d@ Case 1: either a unison between passes or a chord on one of the passes &dA if a7 = 1 loop for a3 = a6 to a2 a7 = ts(a3,TYPE) if a7 <= NOTE_OR_REST and a7 <> REST and a7 <> CUE_REST if ts(a3,PASSNUM) = ts(a6,PASSNUM) ts(a3,STEM_FLAGS) &= 0xfffd else ts(a3,STEM_FLAGS) |= 0x0002 end end repeat a10 = 1 else &dA &dA &d@ Case 2: no unisons, no chords -- combine passes in one chord &dA if a8 = 1 /* determine stem direction a8 = 0 loop for a3 = a6 to a2 a7 = ts(a3,TYPE) if a7 <= NOTE_OR_REST and a7 <> REST and a7 <> CUE_REST a8 += ts(a3,STAFFLOC) end repeat a8 <<= 1 a8 /= notesize a9 = a2 - a6 + 1 a8 += a9 + 1 / 2 a8 /= a9 if a8 >= 5 a9 = UP else a9 = DOWN end else a9 = bit(1,ts(a6,STEM_FLAGS)) end a11 = 0 a12 = 0 loop for a3 = a6 to a2 /* put all notes into chords a7 = ts(a3,TYPE) if a7 <= NOTE_OR_REST and a7 <> REST and a7 <> CUE_REST ts(a3,STEM_FLAGS) &= 0xfffd ts(a3,STEM_FLAGS) |= a9 << 1 if ts(a3,DIV) <> a11 or ts(a3,SPACING) <> 0 or a12 <> a7 a12 = a7 a11 = ts(a3,DIV) ts(a3,STEM_FLAGS) |= 0x04 a8 = a3 else ts(a3,TYPE) = ts(a8,TYPE) + 1 ts(a3,STEM_FLAGS) |= 0x0c ts(a3,BEAM_FLAG) = 0 ts(a3,BEAM_CODE) = 0 if ts(a3,PASSNUM) > a5 a5 = ts(a3,PASSNUM) /* save max passnum end ts(a3,PASSNUM) = ts(a8,PASSNUM) end end repeat end a6 = 0 a7 = 0 a8 = 0 end a1 = a2 end repeat &dA &dA &d@ (4) If all notes in measure were combined into chords, then &dA &d@ Adjust PASSNUM for all nodes and decrease passnum by &dA &d@ amount of largest PASSNUM + 1 / 2 (not fully implemented) &dA if a10 = 0 if a5 > 2 putc This program may have problems with more than putc two separate instruments on a staff line end loop for a1 = oldsct+1 to sct ts(a1,PASSNUM) = 1 repeat passnum = 1 end goto ISO_DONE ISO_FAIL: loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST and ts(a1,BEAM_FLAG) = NO_BEAM a4 = ts(a1,DIV) /* test note a5 = ts(a1,NOTE_DUR) a6 = bit(1,ts(a1,STEM_FLAGS)) a7 = ts(a1,STAFF_NUM) if nodtype = NOTE or nodtype = CUE_NOTE loop for a3 = a1+1 to sct if ts(a3,DIV) = a4 if ts(a3,TYPE) = nodtype and ts(a3,NOTE_DUR) = a5 if bit(1,ts(a3,STEM_FLAGS)) = a6 and ts(a3,BEAM_FLAG) = NO_BEAM if ts(a3,STAFF_NUM) = a7 &dA &dA &d@ Move this to be part of a chord on test note &dA a9 = a1+1 perform rotate_array (a9,a3) ts(a9,TYPE) = nodtype + 1 /* chord note ts(a9,STEM_FLAGS) |= 0x0c ts(a1,STEM_FLAGS) |= 0x04 /* make note at a1 "first" in chord &dA1/30/96 ts(a9,PASSNUM) = ts(a1,PASSNUM) end end end else a3 = sct end repeat end if nodtype = GR_NOTE a8 = ts(a1,NTYPE) loop for a3 = a1+1 to sct if ts(a3,DIV) = a4 if ts(a3,TYPE) = GR_NOTE and ts(a3,NTYPE) = a8 and ts(a3,SPACING) = 0 if bit(1,ts(a3,STEM_FLAGS)) = a6 and ts(a3,BEAM_FLAG) = NO_BEAM if ts(a3,STAFF_NUM) = a7 &dA &dA &d@ Move this to be part of a chord on test note &dA a9 = a1+1 perform rotate_array (a9,a3) ts(a9,TYPE) = XGR_NOTE ts(a9,STEM_FLAGS) |= 0x0c ts(a1,STEM_FLAGS) |= 0x04 /* make note at a1 "first" in chord &dA1/30/96 ts(a9,PASSNUM) = ts(a1,PASSNUM) end end end else a3 = sct end repeat end end repeat &dA &dA &d@ New code &dA1/30/96&d@ to look for cases where groups of notes might be combined &dA &d@ under the same beam. At the moment, this works only with two parts and &dA &d@ with regular notes. &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype = NOTE and ts(a1,BEAM_FLAG) = START_BEAM a4 = ts(a1,DIV) /* test note a5 = ts(a1,NOTE_DUR) a6 = bit(1,ts(a1,STEM_FLAGS)) a7 = ts(a1,STAFF_NUM) a2 = a1 + 1 if ts(a2,TYPE) = NOTE and ts(a2,BEAM_FLAG) = START_BEAM if ts(a2,DIV) = a4 and ts(a2,NOTE_DUR) = a5 if bit(1,ts(a2,STEM_FLAGS)) = a6 and ts(a2,STAFF_NUM) = a7 c1 = a1 + 2 c2 = a2 + 2 loop while ts(c1,BEAM_FLAG) = CONT_BEAM or ts(c1,BEAM_FLAG) = END_BEAM if ts(c2,BEAM_FLAG) <> ts(c1,BEAM_FLAG) goto NO_BCOM end if ts(c1,TYPE) <> NOTE or ts(c2,TYPE) <> NOTE goto NO_BCOM end if ts(c2,DIV) <> ts(c1,DIV) or ts(c2,NOTE_DUR) <> ts(c1,NOTE_DUR) goto NO_BCOM end if bit(1,ts(c1,STEM_FLAGS)) <> a6 or bit(1,ts(c2,STEM_FLAGS)) <> a6 goto NO_BCOM end if ts(c1,STAFF_NUM) <> a7 or ts(c2,STAFF_NUM) <> a7 goto NO_BCOM end c1 += 2 c2 += 2 repeat c1 -= 2 c2 -= 2 if ts(c1,BEAM_FLAG) <> END_BEAM or ts(c2,BEAM_FLAG) <> END_BEAM goto NO_BCOM end &dA &dA &d@ Move these notes to be part of chords on test notes &dA loop for c3 = a1 to c1 step 2 a9 = c3 + 1 ts(a9,TYPE) = nodtype + 1 /* chord note ts(a9,STEM_FLAGS) |= 0x0c ts(c3,STEM_FLAGS) |= 0x04 ts(a9,PASSNUM) = ts(c3,PASSNUM) ts(c3,SUBFLAG_1) |= ts(a9,SUBFLAG_1) /* &dA02-11-96&d@ move subflags to main note ts(a9,SUBFLAG_1) = 0 /* this may cause problems repeat a1 = a9 end end end end NO_BCOM: repeat &dA &dA &d@ Check to see if the number of passes has been reduced &dA &d@ (omitted for the moment; may not be necessary) &dA ISO_DONE: end &dA &dA &d@ Make sure at this point that all chords are oriented with the top &dA &d@ note first. Also, for each note (or set of notes = chord), compute &dA &d@ the position of the note head at the end of the stem, and also &dA &d@ compute the position of the end of the stem. Later, we will make &dA &d@ a "best guess" about what the beam height for those notes belonging &dA &d@ to a beam. Store the note position in VIRT_NOTE (for all notes &dA &d@ of the chord) and the stem position in VIRT_STEM (for all notes &dA &d@ of the chord) &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if chr(nodtype) in [NOTE,CUE_NOTE,GR_NOTE] if bit(2,ts(a1,STEM_FLAGS)) = 1 /* This is a chord a5 = ts(a1,STEM_FLAGS) & 0x03 /* save lower two bits a2 = a1 + 1 loop while ts(a2,TYPE) = nodtype + 1 ++a2 repeat --a2 /* a2 = last note in chord &dA &dA &d@ Bubble sort &dA loop for a3 = a1 to a2-1 loop for a4 = a3 to a2 if ts(a3,CLAVE) < ts(a4,CLAVE) loop for a7 = 2 to TS_SIZE /* keep primary type on top if a7 <> BEAM_FLAG and a7 <> BEAM_CODE /* and don't move beam flags, etc. ts(sct+1,a7) = ts(a3,a7) /* make hole for new element ts(a3,a7) = ts(a4,a7) /* move in new element ts(a4,a7) = ts(sct+1,a7) /* put old element in vacancy end repeat end repeat repeat &dA &dA &d@ Rewrite stem flags &dA loop for a3 = a1 to a2 if a3 = a1 ts(a3,STEM_FLAGS) = a5 + 0x04 /* turn bit 2 else ts(a3,STEM_FLAGS) = a5 + 0x0c /* turn bits 2 and 3 (&dA01-31-97&d@ added a5) end a4 = a3 - a1 + 1 << 4 ts(a3,STEM_FLAGS) += a4 /* note number in chord repeat else a2 = a1 end &dA &dA &d@ Put in y location of object, y location of end note head &dA &d@ and (tentitive) y location of end of stem. &dA if bit(1,ts(a1,STEM_FLAGS)) = UP a4 = ts(a1,STAFFLOC) a5 = ts(a2,STAFFLOC) a6 = ts(a1,STAFFLOC) if a6 >= vpar(5) c3 = vpar(7) else c3 = vpar(6) if ts(a1,NTYPE) > EIGHTH and a6 < 0 - vpar(1) c3 -= vpar(1) end end if nodtype <> NOTE and c3 > vpar(5) c3 -= vpar(1) end a6 -= c3 a6 += vpar(1) /* &dAFUDGE&d@ if a6 > vpar(5) a6 = vpar(5) end else a4 = ts(a2,STAFFLOC) a5 = ts(a1,STAFFLOC) a6 = ts(a2,STAFFLOC) if a6 <= vpar(3) c3 = vpar(7) else c3 = vpar(6) if ts(a1,NTYPE) > EIGHTH and a6 >= vpar(10) c3 -= vpar(1) end end if nodtype <> NOTE and c3 > vpar(5) c3 -= vpar(1) end a6 += c3 a6 -= vpar(1) /* &dAFUDGE&d@ if a6 < vpar(3) a6 = vpar(3) end end loop for a3 = a1 to a2 ts(a3,OBY) = a4 ts(a3,VIRT_NOTE) = a5 ts(a3,VIRT_STEM) = a6 repeat a1 = a2 /* advance index to last note of chord end repeat &dA &dA &d@ Now we can make a "best guess" about what the beam height for those &dA &d@ notes (chords) belonging to a beam. Store the modified height &dA &d@ (for all notes of the chord) in VIRT_STEM. &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if chr(nodtype) in [NOTE,CUE_NOTE,GR_NOTE] c5 = ts(a1,BEAM_FLAG) if c5 <> NO_BEAM c3 = ts(a1,PASSNUM) c4 = nodtype + 2 / 3 /* 1, 2, or 3 if c5 = START_BEAM passcnt(c3,c4) = 0 end ++passcnt(c3,c4) c6 = passcnt(c3,c4) beamdata(c4,c3,c6) = a1 /* index to this note if c5 = END_BEAM stem = bit(1,ts(a1,STEM_FLAGS)) &dA &d@ c8 = 1 &dA &d@ if stem = DOWN &dA &d@ c8 = -1 &dA &d@ end if c4 = 1 c5 = 0 else c5 = 1 end loop for c7 = 1 to c6 c1 = beamdata(c4,c3,c7) mf(c7) = ts(c1,OBY) /* vpar(7) * c8 + ts(c1,VIRT_STEM) beamcode(c7) = ts(c1,BEAM_CODE) repeat perform guessbeam (c10, c11) &dA &dA &d@ Put in "new" values for virtual stem position &dA loop for c7 = 1 to c6 c9 = c7 - 1 * vpar(6) * c10 / BHPAR1 c1 = beamdata(c4,c3,c7) ts(c1,VIRT_STEM) = c11 + c9 repeat end end end repeat loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if chr(nodtype) in [XNOTE,XCUE_NOTE,XGR_NOTE] ts(a1,VIRT_STEM) = ts(a1-1,VIRT_STEM) end repeat &dA &dA &d@ If mcat = 2, decode all accidentals using a measax array which depends &dA &d@ on the note position in a chord. &dA if mcat = 2 /* %%% add code here for changing ax behavior loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a4 = ts(a1,STEM_FLAGS) >> 4 /* Note number in chord if a4 = 0 a4 = 1 end if a4 > 3 putc This code will not work with more than 3 notes in chord putc &dAType /e &d@ to terminate examine return 10 end perform decodeax (a1,a4) end if nodtype = BAR_LINE loop for a3 = 1 to 50 loop for a4 = 1 to 3 measax(a4,a3) = claveax(a3) repeat repeat end if nodtype = CLEF_CHG a4 = ts(a1,STAFF_NUM) + 1 /* staff number clef(a4) = ts(a1,CLEF_NUM) active_clef = clef(a4) perform zjcline (a4) * this resets clef and cline ts(a1,CLEF_FONT) += z /* music font ts(a1,TRANS_FLAG) = k ts(a1,CLEF_STAFF_POS) = 5 - j * notesize a3 = hpar(8) * 5 / 6 /* Added &dA06-24-94&d@ if ts(a1,CLEF_FONT) > 128 /* music font a3 = a3 * 8 / 10 end ts(a1,SPACING) = a3 if nstaves > 1 /* Case: assume one part to stave (usual case) loop for a3 = 1 to 50 measax(a4,a3) = claveax(a3) repeat else loop for a4 = 1 to 3 loop for a3 = 1 to 50 measax(a4,a3) = claveax(a3) repeat repeat end end repeat end &dA &dA &d@ Decode all accidentals for all other cases &dA if mcat < 2 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a4 = ts(a1,STAFF_NUM) + 1 /* staff number perform decodeax (a1,a4) end if nodtype = BAR_LINE loop for a3 = 1 to 50 loop for a4 = 1 to 3 measax(a4,a3) = claveax(a3) repeat repeat end if nodtype = CLEF_CHG a4 = ts(a1,STAFF_NUM) + 1 /* staff number clef(a4) = ts(a1,CLEF_NUM) active_clef = clef(a4) perform zjcline (a4) * this resets clef and cline ts(a1,CLEF_FONT) += z /* music font ts(a1,TRANS_FLAG) = k ts(a1,CLEF_STAFF_POS) = 5 - j * notesize a3 = hpar(8) * 5 / 6 /* Added &dA06-24-94&d@ if ts(a1,CLEF_FONT) > 128 /* music font a3 = a3 * 8 / 10 end ts(a1,SPACING) = a3 loop for a3 = 1 to 50 measax(a4,a3) = claveax(a3) repeat end repeat end &dA &dA &d@ Now remove all places where accidentals have been placed twice on &dA &d@ the same line as a result of multiple parts playing the same &dA &d@ altered note. This code added &dA09/22/93&d@ &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST loop for a2 = a1 + 1 to sct repeat while ts(a2,SPACING) = 0 and ts(a2,DIV) = ts(a1,DIV) and ts(a2,TYPE) <= NOTE_OR_REST --a2 if a2 > a1 loop for a3 = a1 to a2 if ts(a3,AX) > 0 loop for a4 = a3 + 1 to a2 if ts(a4,STAFF_NUM) = ts(a3,STAFF_NUM) if ts(a4,CLAVE) = ts(a3,CLAVE) if ts(a4,AX) = ts(a3,AX) ts(a4,AX) = 0 end end end repeat end repeat end a1 = a2 end repeat &dA &dA &d@ Set backtie for division 1 elements in the ts() array. &dA &d@ &dA &d@ If this is the measure in a group of measures, then &dA &d@ BACKTIE for division 1 will point to a ROW element of tiearr, &dA &d@ otherwise (2) BACKTIE for division 1 will point to the ts() ROW &dA &d@ element that originated the tie. &dA &d@ loop for a1 = 1 to MAX_TIES if tiearr(a1,TIE_SNUM) > 0 and tiearr(a1,TIE_FOUND) = 0 &dA &dA &d@ Case 1: division 1 of first measure in group &dA if oldsct = 0 loop for a2 = 1 to sct if ts(a2,DIV) = 1 a3 = tiearr(a1,TIE_NTYPE) a4 = ts(a2,TYPE) xbyte = chr(a3) // chr(a4) if ts(a2,STAFFLOC) = tiearr(a1,TIE_VLOC) if ts(a2,STAFF_NUM) = tiearr(a1,TIE_STAFF) if ts(a2,BACKTIE) = 0 if xbyte in [NOTE,XNOTE] /* i.e., both a3 and a4 are in set ts(a2,BACKTIE) = a1 + INT10000 /* backtie = tie number goto TS1 end if xbyte in [CUE_NOTE,XCUE_NOTE] ts(a2,BACKTIE) = a1 + INT10000 /* backtie = tie number goto TS1 end end end end end repeat return 3 else &dA &dA &d@ Case 2: division 1 for subsequent measures in group &dA loop for a2 = oldsct+1 to sct if ts(a2,DIV) = 1 a3 = tiearr(a1,TIE_NTYPE) a4 = ts(a2,TYPE) xbyte = chr(a3) // chr(a4) if ts(a2,STAFFLOC) = tiearr(a1,TIE_VLOC) if ts(a2,STAFF_NUM) = tiearr(a1,TIE_STAFF) if xbyte in [NOTE,XNOTE] /* i.e., both a3 and a4 are in set ts(a2,BACKTIE) = tiearr(a1,TIE_NDX) /* backtie = ts index tiearr(a1,TIE_SNUM) = 0 /* free-up this ROW element of tiearr goto TS1 end if xbyte in [CUE_NOTE,XCUE_NOTE] ts(a2,BACKTIE) = tiearr(a1,TIE_NDX) /* backtie = ts index tiearr(a1,TIE_SNUM) = 0 /* free-up this ROW element of tiearr goto TS1 end end end end repeat return 3 end TS1: tiearr(a1,TIE_FOUND) = 1 end repeat &dA &dA &d@ Set backtie for all non-division-1 elements in the ts() array. &dA &d@ loop for a1 = oldsct+1 to sct if chr(ts(a1,TYPE)) in [NOTE,XNOTE,CUE_NOTE,XCUE_NOTE] if bit(0,ts(a1,SUPER_FLAG)) = 1 and a1 < sct /* tie present a4 = ts(a1,DIV) + ts(a1,NOTE_DUR) &dA &dA &d@ Try it first where pass numbers must be the same (usual case) &dA loop for a2 = a1+1 to sct if ts(a2,DIV) = a4 and ts(a1,PASSNUM) = ts(a2,PASSNUM) if ts(a1,STAFFLOC) = ts(a2,STAFFLOC) if chr(ts(a1,TYPE)) in [NOTE,XNOTE] if chr(ts(a2,TYPE)) in [NOTE,XNOTE] ts(a2,BACKTIE) = a1 /* Case: backtie = ts index to first note goto SEARCH_DONE end else if chr(ts(a2,TYPE)) in [CUE_NOTE,XCUE_NOTE] ts(a2,BACKTIE) = a1 /* Case: backtie = ts index to first note goto SEARCH_DONE end end end end repeat &dA &dA &d@ Now try it where pass numbers need not be the same (unusual case) &dA loop for a2 = a1+1 to sct if ts(a2,DIV) = a4 if ts(a1,STAFFLOC) = ts(a2,STAFFLOC) if chr(ts(a1,TYPE)) in [NOTE,XNOTE] if chr(ts(a2,TYPE)) in [NOTE,XNOTE] ts(a2,BACKTIE) = a1 /* Case: backtie = ts index to first note goto SEARCH_DONE end else if chr(ts(a2,TYPE)) in [CUE_NOTE,XCUE_NOTE] ts(a2,BACKTIE) = a1 /* Case: backtie = ts index to first note goto SEARCH_DONE end end end end repeat &dA &dA &d@ If you reach this point (i.e., you have not found a terminating &dA &d@ note), then you must use the tiearr to temporarily store the &dA &d@ information about this note for future reference. This info must &dA &d@ be discarded before the final processing of the ts() array. &dA * identify free slice of tiearr loop for c7 = 1 to MAX_TIES if tiearr(c7,TIE_SNUM) = 0 goto XXX2 end repeat &dA &dA &d@ Here is where the pseudo tiearr is built &dA XXX2: tiearr(c7,TIE_SNUM) = INT1000000 /* pseudo super number tiearr(c7,TIE_NTYPE) = ts(a1,TYPE) tiearr(c7,TIE_VLOC) = ts(a1,STAFFLOC) tiearr(c7,TIE_NDX) = a1 tiearr(c7,TIE_STAFF) = ts(a1,STAFF_NUM) tiearr(c7,TIE_FOUND) = 0 tiearr(c7,TIE_FORCE) = ts(a1,SLUR_FLAG) >> 24 SEARCH_DONE: end end repeat &dA &dA &d@ Determine space parameter for notes and figures (and isolated signs, words and marks) &dA loop for a1 = 1 to 120 mf(a1) = 0 repeat a9 = 0 divspq = olddivspq loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype = DIV_CHG mdiv = ts(a1,DIV) divspq = ts(a1,DIVSPQ) end if nodtype = METER_CHG perform newnsp end if nodtype > NOTE_OR_REST and nodtype <> FIGURES if chr(nodtype) in [SIGN,WORDS,MARK] and ts(a1,ISOLATED) = 1 else goto TS3 end end if chr(nodtype) not_in [XNOTE,XCUE_NOTE,XGR_NOTE] if nodtype = GR_NOTE goto TS3 /* grace note spacing has already been computed. see GRACE end &dA &dA &d@ determine space and duration for this note/figure &dA if nodtype <= NOTE_OR_REST a5 = a1 perform getspace a7 = a6 a8 = ts(a1,NOTE_DUR) &dA &dA &d@ Code added &dA05-29-94&d@ We cannot allow a8 to be less than time &dA &d@ distance to the next division. &dA &dA &d@ Code added &dA06-18-94&d@ We also cannot allow a8 to be more than the &dA &d@ time distance to the next division, if the &dA &d@ next division contains an isolated sign, &dA &d@ words, or mark. &dA loop for a2 = a1+1 to sct a3 = ts(a2,DIV) - ts(a1,DIV) if a3 > 0 if a3 > a8 a8 = a3 end if chr(ts(a2,TYPE)) in [SIGN,WORDS,MARK] and ts(a2,ISOLATED) = 1 if a3 < a8 a8 = a3 end end a2 = sct end repeat else &dA &dA &d@ case 2: figures (and isolated signs, words, and marks) &dA &dA &d@ 1) determine duration (given or implied) &dA if nodtype = FIGURES and ts(a1,FIG_DUR) > 0 a8 = ts(a1,FIG_DUR) else &dA &d@ if figure is not isolated, adopt a duration, else &dA &d@ impute duration if a1 <> sct loop for a11 = a1+1 to sct if ts(a11,DIV) = ts(a1,DIV) if ts(a11,TYPE) <= NOTE_OR_REST a8 = ts(a11,NOTE_DUR) goto TS4 end else &dA &d@ isolated figure in middle of data a8 = ts(a11,DIV) - ts(a1,DIV) goto TS4 end repeat end &dA &d@ isolated figure at end of data a8 = divspq end &dA &dA &d@ 2) compute space for this duration &dA TS4: a10 = a8 &dA &d@ a) adjust duration for triplet a12 = 0 a11 = divspq / 3 if rem = 0 a11 = a10 / 3 if rem > 0 a10 = a10 * 3 / 2 a12 = 1 end end &dA &d@ b) find index into space parameter array a11 = 35 - a12 a12 = divspq * 16 loop a13 = a10 / a12 a12 >>= 1 a11 -= 3 repeat while a13 = 0 if rem > 0 ++a11 end a7 = nsp(a11) end a14 = a7 &dA &dA &d@ notes and figures re-unified at this point in program &dA &dA &d@ a7 = space for first note/figure in node &dA &d@ a8 = duration for first note/figure in node &dA &d@ a14 = largest space for shortest full duration on this division (initially a14 = a7) &dA ++a9 ts(oldsct+a9,TEMP1) = a7 ts(oldsct+a9,TEMP2) = a8 mf(a9) = a8 &dA &dA &d@ proceeding from this point, we have only regular and cue notes, &dA &d@ rests and chords on this division &dA if a1 < sct loop for a2 = a1+1 to sct if ts(a2,DIV) <> ts(a1,DIV) --a2 goto TS2 else a11 = ts(a2,TYPE) if a11 <> XNOTE and a11 <> XCUE_NOTE a5 = a2 perform getspace a15 = ts(a2,NOTE_DUR) if a15 < a8 /* modified &dA3/20/94&d@ a7 = a6 a14 = a7 &dA &dA &d@ Code added &dA05-29-94&d@ We cannot allow the "time-space increment" &dA &d@ to be less than the time distance to the &dA &d@ next division. &dA loop for a3 = a2+1 to sct if ts(a3,DIV) <> ts(a1,DIV) a15 = ts(a3,DIV) - ts(a1,DIV) a8 = a15 a3 = sct end repeat else if a15 = a8 if a6 < a7 a7 = a6 end if a6 > a7 a14 = a6 end end end ++a9 ts(oldsct+a9,TEMP1) = a6 ts(oldsct+a9,TEMP2) = a15 mf(a9) = a15 end end repeat a2 = sct else a2 = a1 end &dA &d@ a2 = pointer into set for last figure/note/rest/cue &dA &d@ on this division &dA &d@ a7 = smallest space for notes for shortest duration on this division &dA &d@ a8 = duration of notes of shortest duration on this division &dA &d@ a9 = total size of mf array (notes longer than smallest) &dA &d@ a14 = largest space for shortest full duration on this division TS2: a4 = 10000 a5 = 10000 a6 = a7 loop for a3 = 1 to a9 if mf(a3) > 0 if mf(a3) < a4 a4 = mf(a3) end if ts(oldsct+a3,TEMP2) < a5 a5 = ts(oldsct+a3,TEMP2) a6 = ts(oldsct+a3,TEMP1) end end repeat &dA &d@ a4 = smallest number of divisions from left over notes &dA &d@ a5 = duration of shortest note sounding at this point &dA &d@ a6 = space parameter for this shortest note &dA &d@ a4 < a8 means syncopation &dA &d@ here also is where we set the increment distance flag. &dA &d@ Since we are going to increment the distance, we &dA &d@ know at this point what technique we will be using. &dA &d@ ts(24) describes this technique. if a4 < a8 a7 = a6 * a4 / a5 a8 = a4 else a7 = a14 end &dA &d@ a7 = space parameter for this node &dA &d@ a8 = real duration of this node dv4 = 576 * a8 / divspq ts(a1,DINC_FLAG) = dv4 loop for a3 = 1 to a9 mf(a3) -= a8 if mf(a3) < 0 mf(a3) = 0 end repeat if chr(nodtype) in [SIGN,WORDS,MARK] ts(a1,SPACING) = a7 /* must be small, but non-zero else if nodtype <= NOTE_OR_REST ts(a1,SPACING) = a7 else if a1 = a2 ts(a1,FIG_SPACE) = a7 ts(a1,MIN_FIG_SPAC) = a7 else a6 = a1 + 1 if ts(a6,TYPE) <= NOTE_OR_REST ts(a6,SPACING) = a7 else return 8 end end end end a1 = a2 end TS3: repeat &dA &dA &d@ Update olddivspq &dA olddivspq = divspq if mdiv = totdiv /* &dAadded 1-27-93 This code is necessary&d@ qflag = 0 /* &dAto cope with the situation where the end /* &dAdivisions-per-quarter is changed at the&d@ /* &dAend of the measure * loop for a1 = 1 to a9 ts(oldsct+a1,TEMP1) = 0 ts(oldsct+a1,TEMP2) = 0 repeat &dA &dA &d@ Space parameter is initialized &dA &dA &dA &d@ We have computed ts(24), the distance increment flag, for all &dA &d@ regular/cue/figure nodes. This parameter is the time elaps &dA &d@ between this node and the next node in the measure. It is &dA &d@ measured in divisions, with 576 divisions being the equivalent &dA &d@ of a quarter note. In the example below the notes are triplet &dA &d@ eights and regular sixteenths respectively. The distances are &dA &d@ listed by letter. &dA &dA &d@ :=======:=======: &dA &d@ triplet 8ths | | | | a = 144 (reg 16th) &dA &d@ @ @ @ O b = 48 &dA &d@ / a /b/ c / d /e/ f / c = 96 &dA &d@ @ @ @ @ O d = 96 &dA &d@ sixteenths | | | | | e = 48 &dA &d@ |_____|_____|_____| f = 144 (reg 16th) &dA &d@ *=====*=====*=====* &dA &dA &d@ These parameters will be assigned to the first object in the &dA &d@ node FOLLOWING THE DISTANCE, whatever it is. It might, for &dA &d@ example, be a grace note, or some kind of sign. The first &dA &d@ object in the node is the one where we can best describe the &dA &d@ distance that has been traversed. In order to accomplish this, &dA &d@ we do not set the inctype parameter until after the object &dA &d@ containing the ts(24) parameter is processed. When spn rolls &dA &d@ over to a new value, the object in question will be assigned &dA &d@ the prior ts(24) parameter. &dA tfirstsp = 0 &dA &dA &d@*************************************************************** &dA &d@ Debug Information &dA g = measnum - 1 if bit(2,pmode) = 1 and g >= debug_point putc Set Array at Point No. 1: measure ~g putc Look? getc jtype if jtype = "y" perform display_ts end end &dA &dA &d@ End debug information &dA &d@*************************************************************** &dA &dA &d@ Adjust accidentals for case where tie crosses bar line &dA a10 = 1 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if ts(a1,DIV) = a10 and ts(a1,BACKTIE) > 0 if chr(nodtype) in [NOTE,XNOTE,CUE_NOTE,XCUE_NOTE] loop for a3 = a1+1 to sct if ts(a3,DIV) > a10 and ts(a3,TYPE) <= NOTE_OR_REST if ts(a3,CLAVE) = ts(a1,CLAVE) if ts(a3,STAFF_NUM) = ts(a1,STAFF_NUM) /* added &dA3-23-94&d@ if ts(a3,AX) = 0 ts(a3,AX) = ts(a1,AX) end &dA &dA &d@ Now remove any similar accidentals which might have &dA &d@ existed previously on this &dA &d@ combination. &dA loop for a4 = a3 + 1 to sct repeat while ts(a4,SPACING) = 0 and ts(a4,DIV) = ts(a3,DIV) and ts(a4,TYPE) <= NOTE_OR_REST --a4 loop for a5 = a3 + 1 to a4 if ts(a5,STAFF_NUM) = ts(a3,STAFF_NUM) if ts(a5,CLAVE) = ts(a3,CLAVE) if ts(a5,AX) = ts(a3,AX) ts(a5,AX) = 0 end end end repeat goto XD end end end repeat XD: ts(a1,AX) = 0 end end if nodtype = BAR_LINE /* non-controlling case a10 = ts(a1,DIV) end repeat &dA &dA &d@ We have a tiny chore to do here. In the case where we have &dA &d@ a down-up pattern of stems on the same beam, we need to be &dA &d@ sure the spacing between these notes is at least some minimum &dA &d@ distance. (This code will work most of the time). &dA a5 = hpar(4) * 4 / 5 + hpar(82) a4 = 0 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a3 = nodtype + 1 / 3 /* &dAThis code assumes if rem <> 0 /* &dAXNOTE=2 XCUE_NOTE=5 XGR_NOTE=8&d@ if ts(a1,SPACING) > 0 a4 = a1 /* save index to spacing number end end if nodtype = NOTE or nodtype = GR_NOTE or nodtype = CUE_NOTE if bit(1,ts(a1,STEM_FLAGS)) = UP c12 = ts(a1,BEAM_FLAG) if c12 = CONT_BEAM or c12 = START_BEAM a3 = 0 loop for a2 = a1 + 1 to sct if ts(a2,SPACING) > 0 ++a3 if a3 > 1 goto NEXTNOTE end end if ts(a2,TYPE) = nodtype if ts(a2,PASSNUM) = ts(a1,PASSNUM) if bit(1,ts(a2,STEM_FLAGS)) = DOWN if a4 = 0 putc Program error examine end if ts(a4,SPACING) < a5 ts(a4,SPACING) = a5 end end goto NEXTNOTE end end repeat end end end end NEXTNOTE: repeat &dA &dA &d@ Make space for text &dA &dA &d@ This is not an easy task to perform. I have tried a couple of &dA &d@ methods already and am not too happy with them. Let me start &dA &d@ by summarizing the objectives. &dA &dA &d@ 1) We want to underlay the text in as compact a way as possible &dA &d@ The reason for this is that in the later stages of typesetting &dA &d@ we almost always &dAexpand&d@ the music, so we want to start with &dA &d@ as compact a version as possible. &dA &dA &d@ 2) We want the notes to be as true to their rythmic values as &dA &d@ possible. &dA &dA &d@ 3) We need to preserve spacings attached to grace notes, clef &dA &d@ signs, key changes, etc. &dA a2 = firstoff a3 = hpar(37) + tfirstsp a11 = 0 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype = NOTE a8 = ts(a1,TEXT_INDEX) temp2 = trm(tsdata(a8)) temp2 = temp2 // pad(1) if temp2{1} in ['A'..'Z','a'..'z','!'..'(','\','='] &dA &dA &d@ Look for case of multiple text &dA c6 = 0 c7 = 0 temp2 = temp2 // "| " CCCB: if temp2 con "|" ttext = temp2{1,mpt-1} temp2 = temp2{mpt+1..} c5 = mtfont perform wordspace a6 = len(ttext) if "-_" con ttext{a6} if mpt = 1 a5 -= spc(45) else a5 -= spc(95) end else c7 = 1 end if c6 < a5 c6 = a5 end goto CCCB end a5 = c6 if c7 = 0 /* all words end in "_" or "-" if a1 <> sct and ts(a1+1,TYPE) = NOTE c8 = ts(a1+1,TEXT_INDEX) temp2 = trm(tsdata(c8)) temp2 = temp2 // pad(1) if "-_" con temp2{1} a4 = a5 - ts(a1,SPACING) - hpar(51) / 3 if a4 < 0 a4 = 0 end goto CCCC end end if bit(0,ts(a1,SUPER_FLAG)) = 1 a4 = a5 - ts(a1,SPACING) - hpar(51) / 3 if a4 < 0 a4 = 0 end goto CCCC end else if a1 <> oldsct+1 c8 = ts(a1-1,TEXT_INDEX) temp2 = trm(tsdata(c8)) temp2 = temp2 // pad(1) if "-_" con temp2{1} a4 = a5 >> 1 - (spc(45) >> 1) goto CCCC end end end a4 = a5 / 3 - (spc(45) >> 1) CCCC: a6 = a3 - a4 a7 = a2 - a6 &dA &dA &d@ a5 = projected space taken up by syllable &dA &d@ a4 = amount by which a syllable is backed up from the note &dA &d@ position &dA &d@ tfirstsp = amount by which first note is shifted forward to make &dA &d@ space for text &dA &d@ a3 = projected position of current note from bar line &dA &d@ a6 = projected position of beginning of current syllable &dA &d@ firstoff = amount by which last syllable from previous measure &dA &d@ overhangs the space allowed for the last note &dA &d@ a2 = smallest value of a6 allowed &dA &d@ a7 = difference between smallest allowed a6 and current a6 &dA if a7 > 0 if a11 = 0 tfirstsp += a7 &dA &d@ a3 += a7 else if ts(a10,TYPE) = NOTE c8 = ts(a10,TEXT_INDEX) temp2 = trm(tsdata(c8)) temp2 = temp2 // pad(1) if "-_" con temp2{1} c9 = 0 loop for c10 = a10 - 1 to oldsct + 1 step -1 if ts(c10,SPACING) > 0 and ts(c10,TYPE) < GR_NOTE c9 = c10 c10 = 0 end repeat if c9 > 0 ts(c9,SPACING) += a7 >> 1 ts(a10,SPACING) += a7 >> 1 goto CCCA end end end ts(a10,SPACING) += a7 /* a10 set later end &dA &d@ a3 += a7 end CCCA: tsdata(a8) = trm(tsdata(a8)) // "$$$$" // chs(a4) a5 -= a4 a2 = a3 + a5 + 16 /* 16 = space between words (magic) end if temp2{1} = "_" a5 = a3 + spc(95) if a5 > a2 a2 = a5 end end a11 = 1 end if ts(a1,TYPE) = BAR_LINE if a2 - hpar(36) > a3 ts(a10,SPACING) += a2 - hpar(36) - a3 a3 = a2 - hpar(36) end end * a10 = backpointer to prior space for note/rest object set if ts(a1,SPACING) > 0 and ts(a1,TYPE) < GR_NOTE a10 = a1 end firstoff = 0 if a1 = sct a4 = a2 - hpar(36) if a4 > a3 firstoff = a4 - a3 end else &dA &d@ if nodtype < 11 a3 += ts(a1,SPACING) &dA &d@ end end repeat &dA &dA &d@***************************************************************** &dA &d@ Debugging Information &dA if jtype = "y" if bit(2,pmode) = 1 and g >= debug_point putc Set Array at Point No. 2: including text, ... putc measure ~g putc firstspace = ~tfirstsp putc perform display_ts end end &dA &dA &d@ If there is more that one pass in this measure, one of the &dA &d@ things we need to know is the number of passes per staff. &dA &d@ If this number is greater than one for a particular staff, &dA &d@ then we are going to need to know (1) whether ties have tips &dA &d@ up or down for each pass, and (2) whether slurs should connect &dA &d@ to note heads or to stems. &dA &dA &d@ I propose the following rule: If there is more than one track &dA &d@ on a particular staff and if stem directions are consistant &dA &d@ for each track on that particular staff, then &dA &dA &d@ (1) tie tips will always go the opposite direction of the &dA &d@ stem direction &dA &d@ (2) slurs should connect to stems rather than to note heads &dA &dA &d@ Before beginning the processing loop, I need to determine the &dA &d@ situation, since it is dependent on what happens in the entire &dA &d@ measure. I propose (6-4-93) to add a new element to the ts(.) &dA &d@ array, in this case, element 29 = MULTI_TRACK flag. The meaning &dA &d@ of this flag will be as follows: &dA &dA &d@ 0 = this note lies on a staff that has notes from only one &dA &d@ pass. &dA &dA &d@ In this situation, mcat can be 0, 1 or 2 &dA &dA &d@ (1) mcat = 0 or mcat = 1. Any tie or slur &dA &d@ starting or ending on this note will follow the &dA &d@ rules for a single part on a staff. &dA &dA &d@ (2) mcat = 2 There is only one pass, but notes &dA &d@ will occur in chords. In this case, slurs and &dA &d@ articulations will mainly fall on the note head at &dA &d@ the end of the stem. In the case where both stem &dA &d@ directions are involved, slurs are generally put &dA &d@ above the notes (tips down) &dA &dA &dA &d@ 1 = this note belongs to one of multiple passes on this &dA &d@ staff and all notes on this pass have stems which &dA &d@ point up. &dA &dA &d@ In this situation, mcat can be either 0 or 3, depending &dA &d@ on the value of vflag. Whatever the case, slurs &dA &d@ will go above the notes (tips down). &dA &dA &dA &d@ 2 = this note belongs to one of multiple passes on this &dA &d@ staff and all notes on this pass have stems which &dA &d@ point down. &dA &dA &d@ In this situation, mcat can be either 0 or 3, depending &dA &d@ on the value of vflag. Whatever the case, slurs &dA &d@ will go below the notes (tips up). &dA &dA &d@ 3 = this note belongs to one of multiple passes on this &dA &d@ staff and the stem directions for the note of at least &dA &d@ one of these passes on this staff are inconsistant &dA &d@ (both up and down). &dA &dA &d@ In this situation, mcat can be either 0 or 3, depending &dA &d@ on the value of vflag. In either case, the placement of &dA &d@ slurs cannot be inferred from this parameter. The note &dA &d@ in question might belong to a track that is "well behaved", &dA &d@ i.e., not the "rogue track". In this case, determining &dA &d@ the type and placement of the slur will be straight- &dA &d@ forward. In the case where mcat = 0 (i.e. vflag = 1), &dA &d@ it is likely that the rules for a single part may work &dA &d@ fairly well. In the case where mcat = 3 (i.e. vflag > 1), &dA &d@ a number of difficult situations can arrise, such as a &dA &d@ slur from a stem-up chord note (pass one) to a stem down &dA &d@ note (pass two). Such situation will have to be handled &dA &d@ in a way that seems best under the particular circumstances. &dA &dA &dA &d@ The MULTI_TRACK parameter will actually be combination of the &dA &d@ multi-track flag and the value of mcat, according to the &dA &d@ formula below: &dA &dA &d@ ts(.,MULTI_TRACK) = multi-track << 2 + mcat &dA loop for a2 = 1 to 3 loop for a3 = 1 to passnum /* assume passnum = total # of passes loop for a4 = 1 to MAX_STAFF multichk(a2,a3,a4) = 0 repeat repeat repeat loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a2 = nodtype + 2 / 3 a3 = ts(a1,PASSNUM) a4 = ts(a1,STAFF_NUM) + 1 /* staff number a6 = multichk(a2,a3,a4) if rem <> 2 a5 = bit(1,ts(a1,STEM_FLAGS)) + 1 if a6 = 0 or a6 = 4 multichk(a2,a3,a4) = a5 else if a6 <> a5 multichk(a2,a3,a4) = 3 end end else if a6 = 0 multichk(a2,a3,a4) = 4 /* rest (stem direction unspecified) end end end repeat loop for a2 = 1 to 3 /* loop through note types i.e. reg,cue,grace loop for a4 = 1 to MAX_STAFF a5 = 0 a6 = 0 loop for a3 = 1 to passnum a7 = multichk(a2,a3,a4) if a7 = 3 /* Case: multiple stem directions a6 = 100 end if a7 > 0 ++a5 if a7 = 4 a8 = a3 + 1 / 2 /* set multichk to 1 for odd passnums, 2 for even multichk(a2,a3,a4) = rem + 1 /* for parts with only rests end end repeat if a6 = 100 and a5 > 1 /* Case: mult passes on staff and ambiguous stem dirs loop for a3 = 1 to passnum multichk(a2,a3,a4) = 3 /* all notes (for this type) on this staff have mt = 3 repeat end if a5 = 1 /* Case: single pass on this staff (for this note type) loop for a3 = 1 to passnum multichk(a2,a3,a4) = 0 /* all notes (for this type) on this staff have mt = 0 repeat end repeat repeat loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a2 = nodtype + 2 / 3 a3 = ts(a1,PASSNUM) a4 = ts(a1,STAFF_NUM) + 1 /* staff number a5 = multichk(a2,a3,a4) << 2 ts(a1,MULTI_TRACK) = a5 + mcat end repeat if oldsct = 0 firstsp = tfirstsp else &dA &dA &d@ Include tfirstsp in the spacing after previous completed bar &dA if ts(oldsct,TYPE) <> BAR_LINE if ts(oldsct,SPACING) = 0 putc There is something you didn't think about putc &dAType /e &d@ to terminate examine return 10 end ts(oldsct,SPACING) += tfirstsp else ts(oldsct,SPACING) += tfirstsp end end &dA &dA &d@ Compute the spn (spacing) parameter &dA loop for a1 = oldsct+1 to sct if ts(a1,TYPE) = DIV_CHG and qflag = 1 qflag = 2 end if qflag = 0 a5 = totdiv - 1 a4 = ts(a1,DIV) - 1 if a5 = a4 spn = 6913 else spn = 6912 / a5 * a4 + 1 end else if qflag = 1 a5 = mdiv - 1 a4 = ts(a1,DIV) - 1 if a5 = a4 spn = 3457 else spn = 3456 / a5 * a4 + 1 end else a5 = totdiv - mdiv a4 = ts(a1,DIV) - mdiv if a5 = a4 spn = 6913 else spn = 3456 / a5 * a4 + 3457 end end end ts(a1,SPN_NUM) = spn repeat &dA &dA &d@ We have a choice at this point whether to do extra calculations on &dA &d@ the placement of notes, note-dots, and note-accidentals, or to wait &dA &d@ to do this until the point when we process the entire array. I think &dA &d@ now is a good time to do this, because (1) I prefer to do work I think &dA &d@ I know how to do earlier rather than later (you never know just what &dA &d@ kinds of tasks you may have to do later, so why not get this one out &dA &d@ of the way), and (2) the information gained in the this process might &dA &d@ help us in the placement of slurs (which we will need to do first &dA &d@ thing when we begin processing the entire array). &dA &dA &d@ Basically we are going to try to compute the following information for &dA &d@ each "musical node". The definition of a "musical node" is the set of &dA &d@ one or more objects (chords + dots + accidentals) occuring on the same &dA &d@ division number and &dAwhich would, if possible, be placed in the same&d@ &dA &d@ &dAx-position on the staff&d@. &dA &dA &d@ (1) the global x-offset. This is the amount by which each &dAobject&d@ &dA &d@ is displaced from the 0 x-position of all objects on this &dA &d@ musical node. I believe the global x-offset is always >= 0. &dA &d@ &dA &d@ (2) the local x-offset for note heads. This is the amount by which &dA &d@ each note head of a particular object is displaced from the &dA &d@ x position of the object. &dA &dA &d@ (3) the location of rests on the staff (based on the position of &dA &d@ other objects at this location). &dA &dA &d@ (4) the x and y offsets for any dot(s) which might follow each &dA &d@ note head of a particular object. &dA Note: the y-position of &dA &d@ &dAan object which has more than one note head (chord) is &dA &d@ &dAthe y position of the note head furthest from the note-end &dA &d@ &dAof the stem (i.e., therefore nearest to the beam end of &dA &d@ &dAthe stem, if there is a beam). &dA &dA &d@ (5) the x offset (as measured to the left) of any accidental(s) &dA &d@ which might precede each note head. &dA &dA &dA &d@ I. How to store this information. &dA &dA &d@ (0) The grouping of elements in the ts(.,.) array into "musical &dA &d@ nodes" can be determined by the space parameter "&dLSPACING&d@". &dA &d@ The first array element of a "musical node" will have a &dA &d@ non-zero space parameter, and any other element in the node &dA &d@ will have a space parameter = 0. &dA &dA &d@ (1) The global x-offset can be stored in the GLOBAL_XOFF element &dA &d@ of the ts(.,.) array. If we further specify that the GLOBAL_XOFF &dA &d@ element will be set to INT10000 * a1 (index of first note in the &dA &d@ chord) + a2 (index of last note in chord), this will give us an &dA &d@ easy way to determine the number of array elements (note heads) &dA &d@ in the object (chord). &dA &dA &d@ (2) The local x-offset for note heads can be stored in the &dA &d@ LOCAL_XOFF element of the ts(.,.) array. &dA &dA &d@ (3) The location of rests on the staff can be stored in the &dA &d@ STAFFLOC element of the ts(.,.) array. &dA &dA &d@ (4) For the x and y offsets for any dots(s), we can use the DOT (modified &dA12-24-96&d@) &dA &d@ element of the ts(.,.) array. Up to this point, the DOT element &dA &d@ could have five values: 0 = no dot; 1 = single dot; 3 = double dot; &dA &d@ 7 = triple dot; 15 = quadruple dot. We need to preserve this &dA &d@ information, which uses bits 0 through 3 of the integer. Since &dA &d@ the x offset is always positive, and the y offset may be positive &dA &d@ or negative, we can construct a number which is x * INT10000 + y, &dA &d@ shift it over 4 and &dAOR&d@ it with the current value of DOT. &dA &dA &d@ (5) For the x offset of any accidental(s), we can use the AX &dA &d@ element of the ts(.,.) array. Up to this point, the AX element &dA &d@ could have sixteen values: 0 to 15. We need to preserve this &dA &d@ information, which uses bits 0 through 3 of the integer. Since &dA &d@ the x offset (measured to the left) is always positive, we can &dA &d@ simply shift this offset over 4 and &dAOR&d@ with the current value &dA &d@ of AX. &dA &dA &d@ II. Method of computation. &dA &dA &d@ The first task will be to compute the global and local x-offset &dA &d@ for the note heads in each musical node. We have a way of doing &dA &d@ this, which we call pseudo-typesetting. A concurrent task will &dA &d@ be to compute the y location of rests in each musical node. &dA &dA &d@ The second task will be to compute the x and y offsets for any &dA &d@ dots(s). The method will be as follows (for each staff): &dA &dA &d@ (1) If there is only one note head on the staff, use the &dA &d@ single note method for determining dot position. &dA &dA &d@ Otherwise, determine the x position for a "row of dots". &dA &d@ This position will be to the right of the right-most &dA &d@ note head on the stave. (Note that the x-offset for &dA &d@ each dot is the x position minus the global x-offset &dA &d@ for each object). &dA &dA &d@ (2) Starting with the left-most objects in the "musical node" &dA &d@ and moving to the right, set dot positions according to &dA &d@ the following algorithm (keeping track of all previous &dA &d@ dots for this stave): &dA &dA &d@ Start with the note head furtherest from note-end of stem &dA &d@ If note on line, &dA &d@ if space above is free, put dot there &dA &d@ else put dot in first free space below &dA &d@ else &dA &d@ if space is free, put dot there &dA &d@ else put dot in first free space in reverse direction &dA &d@ end &dA &dA &d@ The third task will be to compute the x offsets for any &dA &d@ accidental(s) for each note head. The method will be as &dA &d@ follows (for each staff): &dA &dA &d@ (1) Check the left-hand border from the typesetting operation. &dA &d@ If there are any accidentals that could be set on right- &dA &d@ shifted note heads, set these first, starting from the &dA &d@ top down. This defines column 1 of the accidentals. &dA &dA &d@ Otherwise, column one is the first free location to the &dA &d@ left of the left-most note head. &dA &dA &d@ (2) For all remaining accidentals to set, start at the top &dA &d@ of the group. Make successive passes until all accidentals &dA &d@ are set. &dA &dA &d@ (a) moving down, put in as many accidentals as possible &dA &d@ where the distance between eligible notes (delta) >= &dA &d@ vpar(6), with the caviat that you do not put an &dA &d@ accidental on the lower half of a second before the &dA &d@ upper half of a second (as you move down). &dA &dA &d@ (b) move to the left by the largest thickness of accidentals &dA &d@ just placed. Decide on the direction to move for the &dA &d@ next pass and goto (a). The new direction will be &dA &d@ down (again) if the previous pass hit the lowest remaining &dA &d@ accidental; otherwise, the new direction will be up. &dA &dA &dA &d@ Good Luck with all of this! If you get it right, you will have &dA &d@ accomplished a good deal of the task of setting simultaneous &dA &d@ notes! &dA &dA &d@ &dA3-23-94&d@: &dA &dA &d@ I am going to add another element to this process. It turns out that &dA &d@ this is the best time to determine whatever extra space is required &dA &d@ for each object, based on the items previously typeset. (We had been &dA &d@ doing this later, but without the detailed information available in this &dA &d@ part of the process, i.e. global-right boundaries, etc.). &dA &dA &d@ We start with the fact that the process below begins either after the &dA &d@ initial setting of the clef, key and time, or after a controlling bar &dA &d@ line. In either case, we know the profile of "emptyspace" relative &dA &d@ to the position we are about to put something. &dA &dA &d@ After processing each object, we need to be sure two things are done. &dA &dA &d@ (1) If there will be a need to shift the position of a node, the &dA &d@ value of this shift (positive or negative) needs to be stored in the &dA &d@ array element: NODE_SHIFT. &dA &dA &d@ (2) The values of emptyspace need to be updated. &dA olda1 = 0 loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype > NOTE_OR_REST &dA &dA &d@ A. Figure out space for Bar Line &dA if nodtype = BAR_LINE a5 = 1000000 loop for a3 = 1 to MAX_STAFF loop for a4 = 1 to 45 if emptyspace(a3,a4) < a5 a5 = emptyspace(a3,a4) end repeat repeat a6 = mindist - hpar(82) - a5 &dA &d@ Task (1) if a6 > 0 ts(a1,NODE_SHIFT) = a6 end &dA &d@ Task (2) a5 = ts(a1,SPACING) - hpar(93) loop for a4 = 1 to MAX_STAFF loop for a3 = 1 to 45 emptyspace(a4,a3) = a5 repeat repeat goto WWWW end &dA &dA &d@ B. Figure out space for Clef change &dA if nodtype = CLEF_CHG a3 = ts(a1,STAFF_NUM) + 1 /* staff number &dA &dA &d@ Check to see if we can "backup" the node position &dA a5 = 1000000 loop for a4 = 1 to 45 if emptyspace(a3,a4) < a5 a5 = emptyspace(a3,a4) /* minimum emptyspace on this staff end repeat &dA &d@ Task (1) if a5 > ts(a1,SPACING) >> 1 a4 = a5 * 2 / 3 a7 = ts(a1,SPACING) c2 = 0 loop for c1 = a1+1 to sct /* check if following note has accidentals if ts(c1,DIV) <> ts(a1,DIV) goto HJKO end a6 = ts(c1,TYPE) if a6 > FIGURES goto HJKO end if a6 <> REST and a6 <> CUE_REST and a6 <> FIGURES if ts(c1,STAFF_NUM) = ts(a1,STAFF_NUM) a6 = ts(c1,AX) & 0x0f if a6 > 0 and hpar(a6) > c2 c2 = hpar(a6) end end end repeat HJKO: a7 += c2 if a4 > a7 a4 = a7 end ts(a1,NODE_SHIFT) = 0 - a4 /* negative shift else a6 = mindist - hpar(82) - a5 if a6 > 0 ts(a1,NODE_SHIFT) = a6 end end &dA &d@ Task (2) a5 = ts(a1,SPACING) - a4 /* amount by position really advanced a7 = hpar(86) if z > 128 a7 = a7 * 7 / 10 /* use to be 8 / 10 end a7 = ts(a1,SPACING) - a7 /* empty space after clef sign loop for a4 = 1 to MAX_STAFF if a4 = a3 loop for a6 = 1 to 45 emptyspace(a4,a6) = a7 repeat else loop for a6 = 1 to 45 emptyspace(a4,a6) += a5 repeat end repeat goto WWWW end &dA &dA &d@ C. Figure out space for Time change &dA if nodtype = METER_CHG a5 = 1000000 loop for a3 = 1 to MAX_STAFF loop for a4 = 1 to 45 if emptyspace(a3,a4) < a5 a5 = emptyspace(a3,a4) end repeat repeat a6 = hpar(12) - a5 &dA &d@ Task (1) if a6 > 0 ts(a1,NODE_SHIFT) = a6 end &dA &d@ Task (2) loop for a4 = 1 to MAX_STAFF loop for a3 = 1 to 45 emptyspace(a4,a3) = hpar(29) repeat repeat goto WWWW end &dA &dA &d@ D. Figure out space for Key change &dA if nodtype = AX_CHG a5 = 1000000 loop for a3 = 1 to MAX_STAFF loop for a4 = 1 to 45 if emptyspace(a3,a4) < a5 a5 = emptyspace(a3,a4) end repeat repeat a6 = hpar(37) - hpar(93) - a5 &dA &d@ Task (1) if a6 > 0 ts(a1,NODE_SHIFT) = a6 end &dA &d@ Task (2) loop for a4 = 1 to MAX_STAFF loop for a3 = 1 to 45 emptyspace(a4,a3) = hpar(12) repeat repeat goto WWWW end &dA &dA &d@ E. Figure out space for Signs, Words and Marks which are Objects &dA &d@ if nodtype = SIGN or nodtype = WORDS or nodtype = MARK ts(a1,NODE_SHIFT) = 0 goto WWWW end &dA &dA &d@ F. Figure out space for Figures &dA &d@ if nodtype = FIGURES c3 = FIG_DATA c11 = 0 loop for c2 = 1 to ts(a1,NUMBER_OF_FIG) c12 = 0 c6 = ts(a1,c3) if c6 > 0 and c6 < 20 /* figure if c6 < 10 c12 += hpar(66) else c12 += hpar(66) << 1 end c4 = ts(a1,c3+1) if c4 > 0 /* accidental following number temp = chr(c4+28) if "01389" con temp c12 += hpar(c4+47) end end else c12 += hpar(c6+67) end if c12 > c11 c11 = c12 end c3 += 3 repeat c11 += hpar(75) /* free space = width of natural if ts(a1,MIN_FIG_SPAC) < c11 ts(a1,MIN_FIG_SPAC) = c11 end if ts(a1,FIG_SPACE) > 0 and ts(a1,FIG_SPACE) < c11 ts(a1,FIG_SPACE) = c11 end a4 = ts(a1,FIG_SPACE) ts(a1,NODE_SHIFT) = 0 if a4 > 0 loop for a3 = 1 to MAX_STAFF loop for a2 = 1 to 45 emptyspace(a3,a2) += a4 repeat repeat end goto WWWW end goto WWWW end &dA &dA &d@ &dA PROCESSING NOTES AND RESTS NOW &dA npasses = 1 a3 = 1 if a1 = sct /* added &dA01-31-97&d@ a2 = a1 pitchcnt(1) = 1 goto X1 end loop for a2 = a1+1 to sct if ts(a2,SPACING) <> 0 --a2 pitchcnt(npasses) = a3 goto X1 end if ts(a2,TYPE) > NOTE_OR_REST --a2 pitchcnt(npasses) = a3 goto X1 end if nodtype = GR_NOTE if ts(a2,TYPE) = XGR_NOTE ++a3 else pitchcnt(npasses) = a3 a3 = 1 ++npasses end else if ts(a2,TYPE) = XNOTE or ts(a2,TYPE) = XCUE_NOTE ++a3 else pitchcnt(npasses) = a3 a3 = 1 ++npasses end end repeat X1: &dA &dA &d@ a2 = index to last element in node &dA &d@ npasses = number of passes &dA &d@ pitchcnt(.) = size of chord for each pass &dA &dA &d@ if a1 = a2 /* Simple (and most common) case: single element, a2 = a1 &dA if ts(a1,MULTI_TRACK) < 4 and a1 = a2 a3 = ts(a1,STAFF_NUM) + 1 /* staff number c1 = a1 passnum = ts(c1,PASSNUM) ntype = ts(c1,NTYPE) stem = bit(1,ts(c1,STEM_FLAGS)) if nodtype <= REST passtype = REG passsize = FULLSIZE if bit(16,ts(c1,SUBFLAG_1)) = 1 passsize = CUESIZE /* EXPERIMENT &dA06-24-94&d@ end else passsize = CUESIZE if nodtype <= CUE_REST passtype = CUE else passtype = GRACE end end &dA &dA &d@ a) rests &dA if nodtype = REST or nodtype = CUE_REST if nodtype = REST c8 = vpar(4) else c8 = vpar(2) end if ts(c1,STAFFLOC) = 1 c8 = vpar(4) end ts(c1,STAFFLOC) = c8 ts(c1,OBY) = c8 if ts(c1,DOT) > 0 c4 = 0 /* additions to "eighth rest" c2 = 0 /* y shift down for starting rests c6 = 0 /* extra height of dot (negative shift) if ntype <= SIXTEENTH c6 = notesize c4 = EIGHTH - ntype c2 = notesize if ntype < THIRTY_SECOND c2 = THIRTY_SECOND - ntype * notesize + c2 end end if ntype > QUARTER c3 = hpar(30) else c3 = c4 * hpar(54) + hpar(31) c6 *= c4 end if passsize = CUESIZE c3 = c3 * 8 / 10 end c7 = c3 c6 += vpar(1) /* shift to space /* c3 is the x shift to the dot(s) c2 -= c6 /* final y offset c9 = c2 /* x * INT10000 + y, shift it over 4 and &dAOR&d@ it with DOT (code modified &dA12-24-96&d@) c3 *= INT10000 c3 += c2 c3 <<= 4 /* (code modified &dA12-24-96&d@) ts(c1,DOT) |= c3 else c7 = 0 c9 = 0 end &dA &d@ Task (1) a5 = 1000000 loop for a4 = 1 to 45 if emptyspace(a3,a4) < a5 a5 = emptyspace(a3,a4) /* minimum emptyspace on this staff end repeat a6 = mindist - hpar(82) - a5 if a6 > 0 ts(a1,NODE_SHIFT) = a6 end &dA &d@ Task (2) loop for a6 = 1 to 45 gr(a3,a6) = -200 repeat perform rest_occupy_space (c8,a3) /* ntype is read directly if ts(c1,DOT) > 0 c8 += c9 if c8 >= 0 c8 = 2 * c8 + 1 / vpar(2) else c8 = 2 * c8 - 1 / vpar(2) end c8 = 23 - c8 c7 += hpar(80) if ts(c1,DOT) & 0x0e > 0 /* code modified &dA12-24-96 if ts(c1,DOT) & 0x02 > 0 c7 += hpar(91) /* extra shift to second dot end if ts(c1,DOT) & 0x04 > 0 c7 += hpar(91) /* extra shift to third dot end if ts(c1,DOT) & 0x08 > 0 c7 += hpar(91) /* extra shift to fourth dot end end loop for a6 = c8 - 1 to c8 + 1 gr(a3,a6) += c7 repeat end c10 = ts(c1,SPACING) loop for c11 = 1 to MAX_STAFF if c11 = a3 loop for c6 = 1 to 45 if gr(c11,c6) = -200 emptyspace(c11,c6) += c10 else emptyspace(c11,c6) = c10 - gr(c11,c6) end repeat else loop for c6 = 1 to 45 emptyspace(c11,c6) += c10 repeat end repeat else &dA &dA &d@ b) notes &dA repeater_case = 0 ts(c1,LOCAL_XOFF) = 0 ts(c1,GLOBAL_XOFF) = 0 c6 = ts(c1,STAFFLOC) / vpar(1) if ts(c1,DOT) > 0 if ntype > HALF c3 = hpar(32) else c3 = hpar(33) end if stem = UP if ts(c1,BEAM_FLAG) = NO_BEAM and ts(c1,NTYPE) < QUARTER c3 += hpar(27) if bit(0,c6) = 1 c3 -= hpar(34) end end end * if dot is on staff line, c6 = even if bit(0,c6) = 0 c2 = 0 - vpar(12) /* lower dot if more than one track and stem is down if bit(3,ts(c1,MULTI_TRACK)) = 1 if stem = DOWN c2 = vpar(12) end end c3 -= hpar(34) else c2 = 0 end if passsize = CUESIZE c3 = c3 * 8 / 10 end /* c3 = x shift /* c2 = y offset /* x * INT10000 + y, shift it over 2 and &dAOR&d@ it with DOT (code modified &dA12-24-96&d@) c7 = c3 c8 = c2 c3 *= INT10000 c3 += c2 c3 <<= 4 /* code modified &dA12-24-96 ts(c1,DOT) |= c3 end &dK &dK &d@ Delete this code from this location. Add this task below &dK &d@ where limits for accidentals are established &dK &dK &d@ if ts(c1,AX) > 0 &dK &d@ c5 = ts(c1,AX) & 0x0f &dK &d@ c7 = hpar(c5) &dK &d@ /* shift this offset over 4 and &dAOR&d@ with AX &dK &d@ c7 <<= 4 &dK &d@ ts(c1,AX) |= c7 &dK &d@ end &dK &dA &d@ Task (1) loop for c10 = 1 to 45 gl(a3,c10) = 200 pseudo_gl(a3,c10) = 200 gr(a3,c10) = -200 repeat c6 = 23 - c6 /* Determine thickness of note: c11 if ntype <= HALF or ntype = SLASH8 c11 = hpar(82) else if ntype >= BREVE c11 = hpar(84) else c11 = hpar(83) end end if passsize = CUESIZE c11 = c11 * 8 / 10 end /* Put in limits of note head if c6 < 1 or c6 > 45 /* note out of range putc Note out of vertical range; possible problem with clef change. putc This is a program bug (not your fault), but in order to continue putc you must manually edit the stage2 file. putc return 10 end gl(a3,c6+1) = hpar(95) pseudo_gl(a3,c6+1) = 0 gl(a3,c6) = 0 gr(a3,c6+1) = c11 gr(a3,c6) = c11 - hpar(95) if ntype < WHOLE /* Determine length of stem: c10 if ntype > EIGHTH c10 = 8 /* length of stem else c10 = 7 if ntype < EIGHTH c10 += EIGHTH - ntype end end if passsize = CUESIZE c10 = c10 * 8 / 10 end if ts(c1,BEAM_FLAG) = NO_BEAM and ts(c1,BEAM_CODE) > 0 repeater_case = 1 c13 = ts(c1,BEAM_CODE) / 10 loop while c13 > 0 c13 /= 10 c10 += 2 repeat end /* Determine thickness of stem: c12 if ts(c1,BEAM_FLAG) = NO_BEAM and ntype < QUARTER c12 = hpar(26) if passsize = CUESIZE c12 = c12 * 8 / 10 end else if stem = UP c12 = 0 else c12 = hpar(90) end end /* Put in limits of for stem if stem = UP c13 = c6 + c10 if c13 > 45 c13 = 45 end gr(a3,c6+1) = c11 + c12 if repeater_case = 1 c15 = hpar(98) + hpar(90) if ntype >= QUARTER c12 += hpar(98) end else c15 = hpar(90) end loop for c14 = c6 + 2 to c13 gr(a3,c14) = c11 + c12 gl(a3,c14) = c11 - c15 repeat else c13 = c6 - c10 if c13 < 1 c13 = 1 end if repeater_case = 1 c11 = hpar(98) else c11 = 0 end loop for c14 = c13 to c6 - 1 gr(a3,c14) = c12 gl(a3,c14) = 0 - c11 repeat end end &dA &dA &d@ Put in limits of for accidentals &dA &d@ and store location of accidental &dA if ts(c1,AX) > 0 c5 = ts(c1,AX) & 0x0f c7 = passsize perform place_accidental (a3,c6,c5,c7) /* returns c7 = negative offset /* shift the offset over 4 and &dAOR&d@ with AX c7 = 0 - c7 /* we store positive value c7 <<= 4 ts(c1,AX) |= c7 end &dA &dA &d@ Adjust the gr(.,.) array to accommodate space for dots &dA &d@ (added &dA04/04/94&d@) &dA c8 = ts(a1,STAFF_NUM) + 1 /* staff number c3 = ts(a1,DOT) if c3 > 0 /* code modified &dA12-24-96 c4 = c3 & 0x0f /* dot flag /* &dA12-24-96&d@ c3 >>= 4 /* &dA12-24-96&d@ c5 = c3 / INT10000 /* x offset c6 = rem /* y offset if c6 > INT10000 >> 1 c6 -= INT10000 ++c5 end c6 = c6 + vpar(8) - 1 / vpar(1) - 7 c6 = 0 - ts(a1,STAFFLOC) / vpar(1) + 23 - c6 c5 += hpar(80) if c4 > 1 /* modified &dA12-24-96 c5 += hpar(91) /* second dot if c4 > 4 c5 += hpar(91) /* third dot end if c4 > 8 c5 += hpar(91) /* fourth dot end end if c6 < 46 and c6 > 0 gr(c8,c6) = c5 end end /* Calculate NODE_SHIFT c10 = 0 if c1 = 1 or ts(c1-1,TYPE) < CUE_NOTE c6 = hpar(29) else c6 = hpar(29) / 2 end loop for c11 = 1 to 45 if gl(a3,c11) > pseudo_gl(a3,c11) gl(a3,c11) = pseudo_gl(a3,c11) end c12 = c6 - gl(a3,c11) - emptyspace(a3,c11) /* should be negative if c12 > c10 /* most of the time c10 = c12 end repeat if ts(c1,AX) > 0 and ts(c1,SPACING) = mindist and c10 < hpar(94) c10 = hpar(94) end if c10 > 0 ts(c1,NODE_SHIFT) = c10 end &dA &d@ Task (2) c10 = ts(c1,SPACING) loop for c11 = 1 to MAX_STAFF if c11 = a3 loop for c6 = 1 to 45 if gr(c11,c6) = -200 emptyspace(c11,c6) += c10 else emptyspace(c11,c6) = c10 - gr(c11,c6) end repeat else loop for c6 = 1 to 45 emptyspace(c11,c6) += c10 repeat end repeat end else &dA &d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAº&d@ Here is where you deal with chords and with multiple passes &dAº&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ &dA &d@ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@ ³ D I S C U S S I O N ³ &dA &d@ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA &dA &d@ To start with, a major difference between the single note version &dA &d@ and this multiple note version is the placement of (1) the note heads &dA &d@ in chords and (2) the chord groups, themselves. The major problem is &dA &d@ to determine the x-offset for each note in a chord and the x-offset for &dA &d@ each chord group. Once this information is known, it will then be &dA &d@ possible to typeset the various entities in a manner somewhat similar &dA &d@ to the case of the single note version above. &dA &dA &d@ The x placement of all of the elements of a multiple note node &dA &d@ requires consideration of all of the elements; i.e., they cannot be &dA &d@ simply put down in a serial fashion. Therefore, we must do a pseudo- &dA &d@ typesetting of the elements, and from this extract the x-offsets we &dA &d@ need to do the real job. I note that set array elements 13 and 19 &dA &d@ are free at this point, so we can use them to store local x-offset and &dA &d@ global x-offset, respectively (&dDLOCAL_XOFF&d@, &dDGLOBAL_XOFF&d@). &dA &dA &d@ Also, the vertical placement of rests must be taken into &dA &d@ consideration. There is no definite parameter in the stage2 source &dA &d@ file that tells us were to locate rests vertically. We have two &dA &d@ indirect parameters available: (1) the pass number, based on the &dA &d@ the order of encoding the material, and (2) the optional track &dA &d@ number. I would favor using the pass number at this point. Where &dA &d@ the maximum pass number is 2, rests could be located "high" and &dA &d@ "low" for passes 1 and 2, respectively; where the maximum pass number &dA &d@ is 3, rests could be located "high", "medium" and "low", etc. In the &dA &d@ case of the grand staff (two or more staves), these locations could &dA &d@ be refined to reflect the staff on which the rests are being put. &dA &dA &dA &d@ &dA ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» &dA &d@ &dA º &d@ &dA º &dA &d@ &dA º &d@ (A) pseudo-typeset the notes &dA º &dA &d@ &dA º &d@ &dA º &dA &d@ &dA ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ &dA &dA &d@ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@ ³ construct note data ³ &dA &d@ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA &d@ &dA &d@ ndata(1) = pass number (set to 0, after chord is typeset) &dA &d@ ndata(2) = stem flag: &dA &d@ bit 0: direction 0 = up, 1 = down &dA &d@ bit 1: repeater 0 = none, 1 = present &dA &d@ bits 2-4: flag flag 0 = no flag &dA &d@ 1 = eighth flag &dA &d@ 2 = sixteenth flag &dA &d@ 3 = 32nd flag &dA &d@ 4 = 64th flag &dA &d@ 5 = 128th flag &dA &d@ 6 = 256th flag &dA &dA &d@ ndata(3) = color 0 = black, 1 = half, 2 = whole, 3 = breve &dA &d@ ndata(4) = dot 0 = none, 1 = dot &dA &d@ ndata(5) = pitch &dA &d@ ndata(6) = position in chord (from note end of stem) &dA &d@ ndata(7) = final x-position of this pitch within chord &dA &d@ ndata(8) = pass number &dA &d@ ndata(9) = staff number &dA &d@ ndata(10) = note size (full size vs. que size) &dA &d@ ndata(11) = ntype &dA &d@ pcnt = total number of notes (and rests) &dA &d@ #define PS_PASS 1 #define PS_STEM 2 #define PS_COLOR 3 #define PS_DOT 4 #define PS_PITCH 5 #define PS_RANK 6 #define PS_XPOS 7 #define PS_PASS2 8 #define PS_STAFF 9 #define PS_NSIZE 10 #define PS_NTYPE 11 loop for i = 1 to 45 /* initialize right and left boundaries gr(1,i) = -200 gr(2,i) = -200 pseudo_gr(1,i) = -200 pseudo_gr(2,i) = -200 pseudo_gl(1,i) = 200 pseudo_gl(2,i) = 200 gl(1,i) = 200 gl(2,i) = 200 repeat pcnt = 0 &dA &d@ putc Note data array &dA &d@ putc ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ c1 = a1 ps_passcount(1) = 0 ps_passcount(2) = 0 loop for thispass = 1 to npasses c2 = ts(c1,STAFF_NUM) + 1 /* staff number ++ps_passcount(c2) c2 = 0 loop for c3 = 1 to pitchcnt(thispass) ++pcnt ndata(pcnt,PS_PASS2) = thispass ndata(pcnt,PS_PASS) = thispass ndata(pcnt,PS_STEM) = bit(1,ts(c1,STEM_FLAGS)) if c3 = 1 and ts(c1,BEAM_FLAG) = NO_BEAM if ts(c1,BEAM_CODE) > 0 ndata(pcnt,PS_STEM) += 2 end if ts(c1,NTYPE) < QUARTER c4 = QUARTER - ts(c1,NTYPE) << 2 ndata(pcnt,PS_STEM) += c4 end end if ts(c1,CLAVE) < 100 /* note if ts(c1,NTYPE) < HALF ndata(pcnt, PS_COLOR) = 0 else ndata(pcnt,PS_COLOR) = ts(c1,NTYPE) - 7 end else ndata(pcnt,PS_COLOR) = ts(c1,NTYPE) end ndata(pcnt,PS_NTYPE) = ts(c1,NTYPE) if ts(c1,TYPE) <= REST ndata(pcnt,PS_NSIZE) = bit(16,ts(c1,SUBFLAG_1)) else ndata(pcnt,PS_NSIZE) = CUESIZE end ndata(pcnt,PS_DOT) = ts(c1,DOT) if ts(c1,CLAVE) < 100 /* note ndata(pcnt,PS_PITCH) = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 else ndata(pcnt,PS_PITCH) = 100 /* rest end ndata(pcnt,PS_XPOS) = 0 ndata(pcnt,PS_STAFF) = ts(c1,STAFF_NUM) ++c1 &dA &d@ compute horizontal placement of notes for down stems (on the fly) if bit(0,ndata(pcnt,PS_STEM)) = DOWN and c3 > 1 c4 = ndata(pcnt-1,PS_PITCH) - ndata(pcnt,PS_PITCH) if c4 = 1 if c2 = 0 ndata(pcnt,PS_XPOS) = -1 c2 = 1 else c2 = 0 end else c2 = 0 end end &dA &d@ rank the notes in a chord if bit(0,ndata(pcnt,PS_STEM)) = UP ndata(pcnt,PS_RANK) = pitchcnt(thispass) + 1 - c3 else ndata(pcnt,PS_RANK) = c3 end repeat &dA &d@ compute horizontal placement of notes for up stems if pcnt > 0 and bit(0,ndata(pcnt,PS_STEM)) = UP and pitchcnt(thispass) > 1 c5 = pcnt c2 = 0 loop for c3 = 2 to pitchcnt(thispass) c4 = ndata(c5-1,PS_PITCH) - ndata(c5,PS_PITCH) if c4 = 1 and c2 = 0 ndata(c5-1,PS_XPOS) = 1 c2 = 1 else c2 = 0 end --c5 repeat end c2 = pcnt - pitchcnt(thispass) + 1 &dA &d@ loop for c3 = c2 to pcnt &dA &d@ loop for c5 = 1 to 7 &dA &d@ putc .w4 ~ndata(c3,c5) ... &dA &d@ repeat &dA &d@ putc &dA &d@ repeat repeat &dA &dA &d@ determine all clashes between chords &dA loop for c2 = 1 to npasses loop for c3 = 1 to npasses clashes(c2,c3) = 0 repeat repeat loop for c2 = 1 to pcnt - 1 loop for c3 = c2+1 to pcnt c4 = ndata(c2,PS_PASS) c5 = ndata(c3,PS_PASS) if c4 <> c5 and ndata(c2,PS_STAFF) = ndata(c3,PS_STAFF) if ndata(c2,PS_XPOS) = 0 and ndata(c3,PS_XPOS) = 0 if ndata(c2,PS_PITCH) < 100 c6 = ndata(c2,PS_PITCH) - ndata(c3,PS_PITCH) if c6 = 0 /* same pitch if bit(0,ndata(c2,PS_STEM)) = bit(0,ndata(c3,PS_STEM)) clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end if ndata(c2,PS_COLOR) <> ndata(c3,PS_COLOR) clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end if ndata(c2,PS_NSIZE) <> ndata(c3,PS_NSIZE) clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end #if DOT_DIFFERENCE if ndata(c2,PS_DOT) <> ndata(c3,PS_DOT) clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end #endif if ndata(c2,PS_RANK) * ndata(c3,PS_RANK) <> 1 clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end &dA &d@ &dA &d@ We must now ask the question: are all notes of first chord either &dA &d@ equal/above all notes of second chord, or equal/below all notes &dA &d@ of second chord. &dA c10 = 0 loop for c9 = 1 to pcnt if ndata(c9,PS_PASS) = ndata(c2,PS_PASS) if ndata(c9,PS_PITCH) <> ndata(c2,PS_PITCH) if ndata(c9,PS_PITCH) > ndata(c2,PS_PITCH) if c10 = -1 c10 = 1000 else c10 = 1 end end if ndata(c9,PS_PITCH) < ndata(c2,PS_PITCH) if c10 = 1 c10 = 1000 else c10 = -1 end end end end repeat if c10 = 1000 clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end loop for c9 = 1 to pcnt if ndata(c9,PS_PASS) = ndata(c3,PS_PASS) if ndata(c9,PS_PITCH) <> ndata(c3,PS_PITCH) if ndata(c9,PS_PITCH) > ndata(c3,PS_PITCH) if c10 = 0 c10 = -1 end if c10 = 1 c10 = 1000 end end if ndata(c9,PS_PITCH) < ndata(c3,PS_PITCH) if c10 = 0 c10 = 1 end if c10 = -1 c10 = 1000 end end end end repeat if c10 = 1000 clashes(c4,c5) = 1 clashes(c5,c4) = 1 goto PS_D2 end clashes(c4,c5) = 2 clashes(c5,c4) = 2 goto PS_D2 end if c6 = 1 or c6 = -1 clashes(c4,c5) = 1 clashes(c5,c4) = 1 end end end end PS_D2: repeat repeat &dA &dA &d@ typeset all groups of chords for which there are no clashes &dA loop for c2 = 1 to npasses tgroup(c2) = 0 repeat ntgroups = 0 loop for c2 = 1 to npasses c5 = 0 loop for c3 = c2+1 to npasses if clashes(c2,c3) <> 1 and tgroup(c3) = 0 if c5 = 0 ++ntgroups c5 = 1 tgroup(c2) = ntgroups tgroup(c3) = ntgroups else loop for c4 = c2+1 to c3-1 if tgroup(c4) = ntgroups and clashes(c4,c3) = 1 c4 = 1000 end repeat if c4 <> 1000 tgroup(c3) = ntgroups end end end repeat repeat &dA &d@ loop for c3 = 1 to npasses &dA &d@ putc tgroup(~c3 ) = ~tgroup(c3) &dA &d@ repeat c10 = 0 /* initialize right-hand chord boundary loop for c3 = 1 to ntgroups /* number of typeset groups &dA &dA &d@ typeset chords &dA loop for c4 = 1 to 2 /* typeset stem down first c5 = 2 - c4 PS_CC: c6 = 0 c7 = 0 c15 = 0 loop for c2 = 1 to pcnt c9 = ndata(c2,PS_PASS) if c9 > 0 and tgroup(c9) = c3 /* this typeset group if bit(0,ndata(c2,PS_STEM)) = c5 if ndata(c2,PS_PITCH) > c6 /* typeset highest pitch first if c6 > 0 and c15 > EIGHTH /* but check first to see if if ndata(c2,PS_NTYPE) < QUARTER /* type is quarter or greater if ndata(c2,PS_PITCH) - c6 < 3 goto NOSWITCH end end end c6 = ndata(c2,PS_PITCH) c7 = ndata(c2,PS_PASS) c15 = ndata(c2,PS_NTYPE) NOSWITCH: else if c15 < QUARTER and ndata(c2,PS_NTYPE) > EIGHTH if c6 - ndata(c2,PS_PITCH) < 3 c6 = ndata(c2,PS_PITCH) c7 = ndata(c2,PS_PASS) c15 = ndata(c2,PS_NTYPE) end end end end end repeat if c7 > 0 c8 = 100 loop for c2 = 1 to npasses if clashes(c2,c7) = 2 /* unison c8 = c2 c2 = 100 end repeat perform ps_setchord (c7, c8, c10) goto PS_CC end repeat repeat &dA &dA &d@ determine if there are clashes left &dA PS_B: loop for c2 = 1 to pcnt - 1 if ndata(c2,PS_PASS) > 0 and ndata(c2,PS_XPOS) = 0 /* chord(PS_PASS) has not been set loop for c3 = c2+1 to pcnt if ndata(c3,PS_XPOS) = 0 and ndata(c3,PS_PASS) > 0 if ndata(c2,PS_STAFF) = ndata(c3,PS_STAFF) if ndata(c2,PS_PITCH) < 100 c4 = ndata(c2,PS_PITCH) - ndata(c3,PS_PITCH) if c4 = 0 if bit(0,ndata(c2,PS_STEM)) = bit(0,ndata(c3,PS_STEM)) goto PS_CL end if ndata(c2,PS_COLOR) <> ndata(c3,PS_COLOR) goto PS_CL end #if DOT_DIFFERENCE if ndata(c2,PS_DOT) <> ndata(c3,PS_DOT) goto PS_CL end #endif if ndata(c2,PS_RANK) * ndata(c3,PS_RANK) <> 1 goto PS_CL end &dA &d@ &dA &d@ We must now ask the question: are all notes of first chord either &dA &d@ equal/above all notes of second chord, or equal/below all notes &dA &d@ of second chord. &dA c10 = 0 loop for c9 = 1 to pcnt if ndata(c9,PS_PASS) = ndata(c2,PS_PASS) if ndata(c9,PS_PITCH) <> ndata(c2,PS_PITCH) if ndata(c9,PS_PITCH) > ndata(c2,PS_PITCH) if c10 = -1 c10 = 1000 else c10 = 1 end end if ndata(c9,PS_PITCH) < ndata(c2,PS_PITCH) if c10 = 1 c10 = 1000 else c10 = -1 end end end end repeat if c10 = 1000 goto PS_CL end loop for c9 = 1 to pcnt if ndata(c9,PS_PASS) = ndata(c3,PS_PASS) if ndata(c9,PS_PITCH) <> ndata(c3,PS_PITCH) if ndata(c9,PS_PITCH) > ndata(c3,PS_PITCH) if c10 = 0 c10 = -1 end if c10 = 1 c10 = 1000 end end if ndata(c9,PS_PITCH) < ndata(c3,PS_PITCH) if c10 = 0 c10 = 1 end if c10 = -1 c10 = 1000 end end end end repeat if c10 = 1000 goto PS_CL end goto PS_UNIS /* typeset unison end if c4 = 1 or c4 = -1 if ndata(c2,PS_PASS) <> ndata(c3,PS_PASS) goto PS_CL end end end end end repeat end repeat &dA &dA &d@ no clashes found &dA &dA &d@ putc No clashes &dA &dA &d@ typeset chords &dA loop for c4 = 1 to 2 /* typeset stem down first c5 = 2 - c4 PS_C: c6 = 0 c7 = 0 loop for c2 = 1 to pcnt if ndata(c2,PS_PASS) > 0 and bit(0,ndata(c2,PS_STEM)) = c5 if ndata(c2,PS_PITCH) > c6 /* typeset highest pitch first c6 = ndata(c2,PS_PITCH) c7 = ndata(c2,PS_PASS) end end repeat if c7 > 0 c8 = 100 perform ps_setchord (c7, c8, c10) goto PS_C end repeat &dA &dA &d@ Note: When you have reached this point in the code, you have determined &dA &d@ the local position of all notes (but not rests) in the simultaneity. The &dA &d@ arrays gr(.,.) and gl(,.,) have been computed (if there were notes in &dA &d@ the simultaneity). You can now use this information to try to place &dA &d@ any rests vertically as best you can. After this, you need to compute &dA &d@ the NODE_SHIFT parameter (from emptyspace(.,.) and gl(,.,) and then &dA &d@ the new values for emptyspace(.,.) &dA &dA &dA &d@ putc typeset music on page &dA &d@ loop for c2 = 1 to npasses &dA &d@ putc position of chord ~c2 is ~printpos(c2) &dA &d@ repeat &dA &dA &d@ Now store results in set array (watch out for c9 and c10 in this loop) &dA c2 = 0 c5 = 0 pitchcnt(1) = 0 pitchcnt(2) = 0 loop for c1 = a1 to a2 ++c2 c4 = ts(c1,STAFF_NUM) + 1 /* staff number thispass = ndata(c2,PS_PASS2) if thispass <> c5 c5 = thispass ++pitchcnt(c4) end if ndata(c2,PS_PITCH) = 100 /* rest ntype = ndata(c2,PS_COLOR) c6 = ntype << 1 - 1 c8 = int("1008060402020402030303"{c6,2}) c7 = int("0505050505030301000101"{c6,2}) if ps_passcount(c4) = 1 c3 = vpar(4) if ts(c1,MULTI_TRACK) >= 4 c6 = ts(c1,MULTI_TRACK) >> 2 if c6 = 1 c3 -= vpar(2) end if c6 = 2 c3 += vpar(4) end end else if ps_passcount(c4) = 2 if pitchcnt(c4) = 1 if chr(ts(c1+1,TYPE)) in [NOTE,CUE_NOTE] c3 = ts(c1+1,STAFFLOC) else c3 = vpar(2) if ts(c1,NTYPE) < EIGHTH and c3 > 0 c3 = 0 end end c6 = 0 - c3 / vpar(1) + 23 c13 = c6 loop while gr(c4,c6) <> -200 c3 -= vpar(1) ++c6 repeat c6 -= c7 /* c7 is lower part of rest loop while gr(c4,c6) <> -200 c3 -= vpar(1) ++c6 repeat if c6 > c13 + 8 c3 += vpar(2) end if c3 > vpar(2) c3 = vpar(2) end c6 = c3 / notesize if rem <> 0 c3 -= vpar(1) end else if chr(ts(c1-1,TYPE)) in [REST,CUE_REST] c3 = vpar(8) else c3 = ts(c1-1,STAFFLOC) + vpar(2) end c6 = 0 - c3 / vpar(1) + 23 c13 = c6 loop while gr(c4,c6) <> -200 c3 += vpar(1) --c6 repeat c6 += c8 /* c8 is "clearance" at top of rest loop while gr(c4,c6) <> -200 c3 += vpar(1) --c6 repeat if c6 < c13 - 8 c3 -= vpar(2) end if c3 < vpar(8) c3 = vpar(8) end c6 = c3 / notesize if rem <> 0 c3 += vpar(1) end end else if pitchcnt(c4) = 1 if chr(ts(c1+1,TYPE)) in [NOTE,CUE_NOTE] c3 = ts(c1+1,STAFFLOC) else c3 = vpar(2) end if ts(c1,NTYPE) < EIGHTH and c3 > 0 c3 = 0 end c6 = 0 - c3 / vpar(1) + 23 c13 = c6 loop while gr(c4,c6) <> -200 c3 -= vpar(1) ++c6 repeat c6 -= c7 /* c7 is lower part of rest loop while gr(c4,c6) <> -200 c3 -= vpar(1) ++c6 repeat if c6 > c13 + 8 c3 += vpar(2) end if c3 > vpar(2) c3 = vpar(2) end c6 = c3 / notesize if rem <> 0 c3 -= vpar(1) end else if pitchcnt(c4) = ps_passcount(c4) if chr(ts(c1-1,TYPE)) in [REST,CUE_REST] c3 = vpar(10) else c3 = ts(c1-1,STAFFLOC) + vpar(2) end c6 = 0 - c3 / vpar(1) + 23 c13 = c6 loop while gr(c4,c6) <> -200 c3 += vpar(1) --c6 repeat c6 += c8 /* c8 is "clearance" at top of rest loop while gr(c4,c6) <> -200 c3 += vpar(1) --c6 repeat if c6 < c13 - 8 c3 -= vpar(2) end if c3 < vpar(8) c3 = vpar(8) end c6 = c3 / notesize if rem <> 0 c3 += vpar(1) end else &dA &dA &d@ Look for empty space in middle of staff &dA loop for c3 = 45 to 1 step -1 repeat while gr(c4,c3) = -200 loop while c3 > 0 --c3 repeat while gr(c4,c3) <> -200 RTYY: loop for c6 = 1 to 8 --c3 repeat while c3 > 0 and gr(c4,c3) = -200 if c6 = 8 or c3 <= 0 c3 += 3 else goto RTYY end c3 = 23 - c3 * vpar(1) end end end end if ts(c1,STAFFLOC) = 1 c3 = vpar(4) end ts(c1,STAFFLOC) = c3 perform rest_occupy_space (c3,c4) /* ntype is read directly ts(c1,OBY) = ts(c1,STAFFLOC) else c3 = ndata(c2,PS_COLOR) if c3 < 3 c4 = hpar(82) else if c3 = 3 c4 = hpar(83) else c4 = hpar(84) end end if ndata(c2,PS_NSIZE) = CUESIZE c4 = c4 * 8 / 10 end c4 -= 1 ts(c1,LOCAL_XOFF) = c4 * ndata(c2,PS_XPOS) &dA &dA &d@ &dA NOTE: Do not call procedure get_topbottom before this point in the program &dA if chr(ts(c1,TYPE)) in [NOTE,CUE_NOTE,GR_NOTE] c9 = c1 ts(c1,GLOBAL_XOFF) = printpos(thispass) c10 = c1 + 1 loop while ts(c10,TYPE) = ts(c1,TYPE) + 1 ++c10 repeat --c10 else ts(c1,GLOBAL_XOFF) = c9 * INT10000 + c10 end end repeat &dA &dA &d@*************************************************************** &dA &d@ Debug Information &dA &dK &d@ g = measnum - 1 &dK &d@ if bit(2,pmode) = 1 and g >= debug_point &dK &d@ putc Set Array at Point No. 3: measure ~g &dK &d@ putc Look? &dK &d@ getc jtype &dK &d@ if jtype = "y" &dK &d@ perform display_ts &dK &d@ end &dK &d@ end &dA &dA &d@ End debug information &dA &d@*************************************************************** &dA goto PS_END &dA &dA &d@ Clashes &dA PS_CL: &dA &d@ putc clash c2 = ~c2 c3 = ~c3 c4 = ndata(c2,PS_PASS) c5 = ndata(c3,PS_PASS) if ndata(c2,PS_DOT) > 0 and ndata(c3,PS_DOT) = 0 c7 = c5 goto PS_CLT end if ndata(c2,PS_DOT) = 0 and ndata(c3,PS_DOT) > 0 c7 = c4 goto PS_CLT end if bit(0,ndata(c2,PS_STEM)) = UP and bit(0,ndata(c3,PS_STEM)) = DOWN c7 = c4 goto PS_CLT end if bit(0,ndata(c2,PS_STEM)) = DOWN and bit(0,ndata(c3,PS_STEM)) = UP c7 = c5 goto PS_CLT end if ndata(c2,PS_PITCH) >= ndata(c3,PS_PITCH) c7 = c4 else c7 = c5 end PS_CLT: &dA &d@ putc clash between pitch chords ~c4 and ~c5 c8 = 100 perform ps_setchord (c7, c8, c10) goto PS_B * PS_UNIS: &dA &d@ putc unison c2 = ~c2 c3 = ~c3 c7 = ndata(c2,PS_PASS) c8 = ndata(c3,PS_PASS) perform ps_setchord (c7, c8, c10) goto PS_B PS_END: &dA &dA &d@ At this point you have accomplished tasks (1), (2), and (3) &dA &d@ for the case of multiple note heads on a division. You now &dA &d@ need to do the following (for all ts(.,.) elements from a1 &dA &d@ to a2). &dA &dA &d@ (4) Compute the x and y offsets for any dot(s) which might &dA &d@ follow each note head. &dA &dA &d@ (5) Compute the x offset (as measured to the left) of any &dA &d@ accidental(s) which might precede each note head. &dA &dA &dA &d@ (4) X and Y offsets for dots &dA &dA &d@ (a) determine number and spacing of note heads on each stave &dA &d@ to determine method of placement of dots. Use column &dA &d@ method if note heads (with dots) occur on space and line &dA &d@ on the same staff. Otherwise use conventional placement. &dA &d@ (This code assumes MAX_STAFF <= 3) &dA &dA &d@ First find all staves where all offsets (global and local) &dA &d@ are zero. In these cases, we can use the absolute method. &dA tgroup(1) = 4 tgroup(2) = 4 tgroup(3) = 4 loop for c1 = a1 to a2 c8 = ts(c1,STAFF_NUM) + 1 /* staff number if chr(ts(c1,TYPE)) in [NOTE,CUE_NOTE,GR_NOTE] if ts(c1,GLOBAL_XOFF) > 0 tgroup(c8) = 0 end end if ts(c1,LOCAL_XOFF) > 0 tgroup(c8) = 0 end repeat loop for c1 = a1 to a2 if ts(c1,DOT) > 0 c8 = ts(c1,STAFF_NUM) + 1 /* staff number if tgroup(c8) <> 4 c9 = ts(c1,STAFFLOC) / vpar(1) c9 = bit(0,c9) + 1 if tgroup(c8) = 0 tgroup(c8) = c9 else if tgroup(c8) <> c9 tgroup(c8) = 3 /* use column method end end end end repeat &dA &dA &d@ (b) for those staves using the column method, determine the &dA &d@ x offset of the column. &dA c5 = 0 loop for c8 = 1 to 3 if tgroup(c8) = 3 tgroup(c8) = 1 c5 = 1 else tgroup(c8) = 0 end repeat if c5 = 1 loop for c1 = a1 to a2 if ts(c1,GLOBAL_XOFF) < INT10000 c9 = ts(c1,GLOBAL_XOFF) /* global offset end if ts(c1,DOT) > 0 c8 = ts(c1,STAFF_NUM) + 1 /* staff number if tgroup(c8) > 0 c7 = c9 + ts(c1,LOCAL_XOFF) /* note head position c10 = ts(c1,TYPE) / 3 if rem = 0 if ts(c1,NTYPE) > QUARTER c3 = hpar(30) else c3 = hpar(31) end else if ts(c1,NTYPE) > HALF c3 = hpar(32) else c3 = hpar(33) end end if rem = 1 and bit(1,ts(c1,STEM_FLAGS)) = UP if ts(c1,BEAM_FLAG) = NO_BEAM and ts(c1,NTYPE) < QUARTER c3 += hpar(27) end end if ts(c1,TYPE) > REST c3 = c3 * 8 / 10 end c7 += c3 /* dot position for this note head if tgroup(c8) < c7 tgroup(c8) = c7 end end end repeat &dA &d@ &dA &d@ (c) place dots for all staves which use the column method &dA &d@ (relative x placement; absolute y placement) &dA &dA &d@ Starting with the left-most objects in the "musical node" &dA &d@ and moving to the right, set dot positions according to &dA &d@ the following algorithm (keeping track of all previous &dA &d@ dots for this stave): &dA &dA &d@ Start with the note head furtherest from note-end of stem &dA &d@ If note on line, &dA &d@ if space above is free, put dot there &dA &d@ else put dot in first free space below &dA &d@ else &dA &d@ if space is free, put dot there &dA &d@ else put dot in first free space in reverse direction &dA &d@ end &dA loop for c13 = 1 to 3 /* loop though staves if tgroup(c13) > 0 c5 = 0 c10 = 0 /* count up for stems up c11 = 1000 /* count down for stems down &dA &dA &d@ Special case: two notes on stave and multi-tracks on this stave &dA if a2 = a1 + 1 if ts(a1,MULTI_TRACK) >= 4 if abs(ts(a1,STAFFLOC) - ts(a2,STAFFLOC)) > notesize if bit(1,ts(a1,STEM_FLAGS)) <> bit(1,ts(a2,STEM_FLAGS)) loop for c1 = a1 to a2 c10 = ts(c1,STAFFLOC) c9 = c10 / notesize if rem = 0 /* note on line if bit(1,ts(c1,STEM_FLAGS)) = UP c10 -= vpar(12) else c10 += vpar(12) end end c10 -= ts(c1,OBY) /* convert to relative y offset c9 = tgroup(c13) - ts(c1,GLOBAL_XOFF) /* relative x offset from obx c9 *= INT10000 c9 += c10 c9 <<= 4 /* code modified &dA12-24-96 ts(c1,DOT) |= c9 repeat goto X_DOT end end end end /* global offset loop for c1 = a1 to a2 if ts(c1,GLOBAL_XOFF) < INT10000 c9 = ts(c1,GLOBAL_XOFF) /* global offset end c8 = ts(c1,STAFF_NUM) + 1 /* staff number if ts(c1,DOT) > 0 and c8 = c13 /* dot on this staff ++c5 c12 = bit(1,ts(c1,STEM_FLAGS)) if c12 = UP /* stem up ndata(c5,1) = c10 ++c10 else ndata(c5,1) = c11 --c11 end ndata(c5,1) += c9 * 10000 /* tricky code (for ordering) ndata(c5,2) = c1 ndata(c5,3) = c12 /* stem direction ndata(c5,4) = c9 /* global x offset ndata(c5,5) = 100 end repeat &dA &dA &d@ Sort the ndata array by ndata(.,1) smallest on top &dA &d@ first by global offset, then by stem (up first), then by order &dA &d@ on stem (up in order, down reverse order) &dA loop for c8 = 1 to c5 c6 = 10000000 loop for c4 = 1 to c5 if ndata(c4,5) = 100 and ndata(c4,1) < c6 c6 = ndata(c4,1) c7 = c4 end repeat ndata(c7,6) = c8 ndata(c7,5) = 0 repeat &dA &dA &d@ Typeset dots on this staff &dA loop for c8 = 1 to 50 mf(c8) = 0 repeat loop for c8 = 1 to c5 c7 = ndata(c8,6) /* typeset this note head c1 = ndata(c7,2) /* c1 is the index c9 = tgroup(c13) - ndata(c7,4) /* relative x offset from obx c4 = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 /* 23 = top line of staff &dA &dA &d@ If note on line, &dA &d@ if space above is free, put dot there &dA &d@ else put dot in first free space below &dA &d@ else &dA &d@ if space is free, put dot there &dA &d@ else put dot in first free space in reverse direction &dA &d@ end &dA if bit(0,c4) = 1 /* if note on line if mf(c4+1) = 0 mf(c4+1) = 1 c10 = c4 + 1 /* absolute y offset (23 = top line) else c10 = 0 --c4 loop if mf(c4) = 0 mf(c4) = 1 c10 = c4 else c4 -= 2 if c4 = 0 putc Program error setting dots return 10 end end repeat while c10 = 0 end else /* else, note on space if mf(c4) = 0 mf(c4) = 1 c10 = c4 else if ndata(c7,3) = UP /* if stem up, look up c10 = 0 c4 += 2 loop if mf(c4) = 0 mf(c4) = 1 c10 = c4 else c4 += 2 if c4 = 50 putc Program error setting dots return 10 end end repeat while c10 = 0 else /* else, stem is down; look down c10 = 0 c4 -= 2 loop if mf(c4) = 0 mf(c4) = 1 c10 = c4 else c4 -= 2 if c4 = 0 putc Program error setting dots return 10 end end repeat while c10 = 0 end end end &dA &dA &d@ Store relative values of x and y for this note head &dA &d@ c9 is the relative x shift to the dot(s) from obx &dA &d@ c10 is the absolute y position (23 = top line) for the dot(s) &dA &d@ x * INT10000 + y, shift it over 4 and &dAOR&d@ it DOT (modified &dA12-24-96&d@) &dA c9 *= INT10000 c10 = 23 - c10 * vpar(1) /* convert to absolute staff position c10 -= ts(c1,OBY) /* convert to relative y offset c9 += c10 c9 <<= 4 /* code modified &dA12-24-96&d@ ts(c1,DOT) |= c9 repeat X_DOT: end repeat end &dA &d@ &dA &d@ (d) place dots for all remaining note heads (absolute placement first) &dA loop for c1 = a1 to a2 if ts(c1,DOT) > 0 and ts(c1,DOT) < INT9000 /* dot not yet placed ntype = ts(c1,NTYPE) c10 = ts(c1,TYPE) / 3 if rem = 0 /* rests if ntype > QUARTER c3 = hpar(30) else c3 = hpar(31) end else if ntype > HALF c3 = hpar(32) else c3 = hpar(33) end end c6 = ts(c1,STAFFLOC) / vpar(1) if bit(1,ts(c1,STEM_FLAGS)) = UP if ts(c1,BEAM_FLAG) = NO_BEAM and ts(c1,NTYPE) < QUARTER c10 = ts(c1,TYPE) / 3 if rem = 1 c3 += hpar(27) if bit(0,c6) = 1 c3 -= hpar(34) end end end end * if dot is on staff line, c6 = even if bit(0,c6) = 0 c2 = 0 - vpar(12) /* lower dot if more than one track and stem is down if bit(3,ts(c1,MULTI_TRACK)) = 1 if bit(1,ts(c1,STEM_FLAGS)) = DOWN c2 = vpar(12) end end c3 -= hpar(34) else c2 = 0 end if ts(c1,TYPE) <= REST c5 = bit(16,ts(c1,SUBFLAG_1)) else c5 = CUESIZE end if c5 = 1 c3 = c3 * 8 / 10 end c2 += ts(c1,STAFFLOC) - ts(c1,OBY) /* c3 = x offset to the dot(s) from obx /* c2 = y offset to the dot(s) from oby /* x * INT10000 + y, shift it over 4 and &dAOR&d@ it with DOT (modified &dA12-24-96&d@) c3 *= INT10000 c3 += c2 c3 <<= 4 /* code modified &dA12-24-96 ts(c1,DOT) |= c3 end repeat &dA &dA &d@ Adjust the gr(.,.) array to accommodate space for dots &dA loop for c1 = a1 to a2 if ts(c1,GLOBAL_XOFF) < INT10000 c9 = ts(c1,GLOBAL_XOFF) /* global offset end c8 = ts(c1,STAFF_NUM) + 1 /* staff number c3 = ts(c1,DOT) if c3 > 0 c4 = c3 & 0x0f /* dot flag (modified &dA12-24-96&d@) c3 >>= 4 /* code modified &dA12-24-96 c5 = c3 / INT10000 /* x offset c6 = rem /* y offset if c6 > INT10000 >> 1 c6 -= INT10000 ++c5 end c6 = c6 + vpar(8) - 1 / vpar(1) - 7 c6 = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 - c6 c5 += c9 + ts(c1,LOCAL_XOFF) /* final offset for dot c5 += hpar(80) if c4 > 1 /* code modified &dA12-24-96 c5 += hpar(91) /* second dot if c4 > 4 c5 += hpar(91) /* third dot end if c4 > 8 c5 += hpar(91) /* fourth dot end end if c6 < 46 and c6 > 0 gr(c8,c6) = c5 end end repeat &dA &dA &d@ (5) Compute the x offset (as measured to the left) of any &dA &d@ accidental(s) which might precede each note head. &dA &dA &d@ (a) Check the left-hand border from the typesetting operation. &dA &d@ If there are any accidentals that could be set on right- &dA &d@ shifted note heads, set these first, starting from the &dA &d@ top down. This defines column 1 of the accidentals. &dA &dA &d@ Otherwise, column one is the first free location to the &dA &d@ left of the left-most note head. &dA &dA &d@ (b) For all remaining accidentals to set, start at the top &dA &d@ of the group. Make successive passes until all accidentals &dA &d@ are set. &dA &dA &d@ 1. moving down, put in as many accidentals as possible &dA &d@ where the distance between eligible notes (delta) >= &dA &d@ vpar(6), with the caviat that you do not put an &dA &d@ accidental on the lower half of a second before the &dA &d@ upper half of a second (as you move down). &dA &dA &d@ 2. move to the left by the largest thickness of accidentals &dA &d@ just placed. Decide on the direction to move for the &dA &d@ next pass and goto (a). The new direction will be &dA &d@ down (again) if the previous pass hit the lowest remaining &dA &d@ accidental; otherwise, the new direction will be up. &dA &dA &d@ (Maximum staves for this code is 2, because this is the size of gl(.,.)) &dA tgroup(1) = 0 tgroup(2) = 0 tgroup(3) = 0 c5 = 0 loop for c1 = a1 to a2 if ts(c1,AX) > 0 c8 = ts(c1,STAFF_NUM) + 1 /* staff number ++tgroup(c8) ndata(tgroup(c8),c8) = c1 c5 = 1 end repeat if c5 = 1 /* &dADon't change this variable (c5) /* &dAuntil task (1) is complete loop for c13 = 1 to 2 /* loop though staves if tgroup(c13) > 0 if a1 = a2 /* simple case (one note group) c1 = ndata(1,c13) /* index c3 = ts(c1,AX) & 0x0f c2 = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 if ts(c1,TYPE) > REST c4 = CUESIZE else c4 = bit(16,ts(c1,SUBFLAG_1)) end perform place_accidental (c13,c2,c3,c4) /* returns c4 = absolute x /* shift offset left 4 and &dAOR&d@ with AX c4 = 0 - c4 c4 <<= 4 ts(c1,AX) |= c4 else &dA &dA &d@ (1) We must re-order elements so that they are in descending &dA &d@ order on the staff. Use bubble sort. &dA loop for c7 = 1 to tgroup(c13) - 1 loop for c8 = c7+1 to tgroup(c13) c1 = ndata(c7,c13) c2 = ndata(c8,c13) if ts(c1,STAFFLOC) > ts(c2,STAFFLOC) ndata(c7,c13) = c2 ndata(c8,c13) = c1 end repeat repeat &dA &d@ &dA &d@ (2) Try first to set accidentals on "right shifted chords" &dA loop for c8 = 1 to tgroup(c13) c1 = ndata(c8,c13) if c8 > 1 c2 = ndata(c8-1,c13) if c2 < DUMMY_VALUE if ts(c1,STAFFLOC) - ts(c2,STAFFLOC) = vpar(1) /* second if ts(c1,LOCAL_XOFF) < ts(c2,LOCAL_XOFF) /* don't set accidental in this situation goto QQQ1 end end end end c2 = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 c4 = 200 c12 = ts(c1,AX) & 0x0f c14 = c2 - int("221002200100001"{c12}) /* lower limit c15 = c2 + int("333003300200003"{c12}) /* upper limit loop for c3 = c14 to c15 if c3 > 0 and c3 <= 45 if gl(c13,c3) <= 0 c3 = 1000 else if gl(c13,c3) < c4 c4 = gl(c13,c3) end end end repeat if c3 < 1000 c3 = ts(c1,AX) & 0x0f if ts(c1,TYPE) > REST c4 = CUESIZE else c4 = bit(16,ts(c1,SUBFLAG_1)) end perform place_accidental (c13,c2,c3,c4) /* returns c4 = absolute x c3 = ts(c1,GLOBAL_XOFF) if c3 > INT10000 c3 /= INT10000 /* index of top of chord c3 = ts(c3,GLOBAL_XOFF) end c6 = c3 - c4 /* relative x offset (to the left) /* shift offset left 4 and &dAOR&d@ with AX c6 <<= 4 ts(c1,AX) |= c6 ndata(c8,c13) = DUMMY_VALUE /* accidental set end QQQ1: repeat &dA &d@ &dA &d@ (3) Now make successive passes until all accidentals are set &dA c10 = DOWN loop c6 = 0 loop for c8 = 1 to tgroup(c13) if ndata(c8,c13) <> DUMMY_VALUE /* accidental not set c6 = c8 end repeat if c6 = 0 goto QQQ2 /* DONE end if c10 = DOWN c11 = 1 c12 = tgroup(c13) c9 = 1 else c11 = tgroup(c13) c12 = 1 c9 = -1 end c10 = UP loop for c8 = c11 to c12 step c9 c1 = ndata(c8,c13) if c1 = DUMMY_VALUE goto QQQ3 end if c8 > 1 c2 = ndata(c8-1,c13) if c2 < DUMMY_VALUE if ts(c1,STAFFLOC) - ts(c2,STAFFLOC) = vpar(1) /* second if ts(c1,LOCAL_XOFF) < ts(c2,LOCAL_XOFF) /* don't set accidental in this situation goto QQQ3 end end end end if c8 = c6 c10 = DOWN end c2 = 0 - ts(c1,STAFFLOC) / vpar(1) + 23 c3 = ts(c1,AX) & 0x0f if ts(c1,TYPE) > REST c4 = CUESIZE else c4 = bit(16,ts(c1,SUBFLAG_1)) end perform place_accidental (c13,c2,c3,c4) /* returns c4 = absolute x c3 = ts(c1,GLOBAL_XOFF) if c3 > INT10000 c3 /= INT10000 /* index of top of chord c3 = ts(c3,GLOBAL_XOFF) end c15 = c3 - c4 /* relative x offset (to the left) /* shift offset left 4 and &dAOR&d@ with AX c15 <<= 4 ts(c1,AX) |= c15 ndata(c8,c13) = DUMMY_VALUE /* accidental set QQQ3: repeat repeat QQQ2: end end repeat end &dA &dA &d@ Task (1) Calculate NODE_SHIFT &dA &d@ c10 = 0 loop for a3 = 1 to nstaves loop for c11 = 1 to 45 if gl(a3,c11) > pseudo_gl(a3,c11) gl(a3,c11) = pseudo_gl(a3,c11) end c12 = hpar(29) - gl(a3,c11) - emptyspace(a3,c11) /* should be negative if c12 > c10 /* most of the time c10 = c12 end repeat repeat if c5 > 0 and ts(a1,SPACING) = mindist and c10 < hpar(94) c10 = hpar(94) end if c10 > 0 ts(a1,NODE_SHIFT) = c10 end &dA &d@ Task (2) c10 = ts(a1,SPACING) loop for a3 = 1 to nstaves loop for c6 = 1 to 45 if pseudo_gr(a3,c6) > gr(a3,c6) gr(a3,c6) = pseudo_gr(a3,c6) end if gr(a3,c6) = -200 emptyspace(a3,c6) += c10 else emptyspace(a3,c6) = c10 - gr(a3,c6) end repeat repeat &dA &d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAº&d@ End of where you deal with chords and with multiple passes &dAº&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ end &dA &dA &d@ We need to check (for now) if the present simultaneity generates &dA &d@ a "clash" with the previous simultaneity. &dA if olda1 > 0 c6 = -1000 loop for c3 = 1 to 2 loop for c4 = 1 to 45 c5 = oldgr(c3,c4) - gl(c3,c4) if c5 > c6 c6 = c5 end repeat repeat &dK &d@ if c6 > ts(olda1,SPACING) + ts(olda1,NODE_SHIFT) &dK &d@ putc Potential clash, possible program error &dK &d@ end end loop for c3 = 1 to 2 loop for c4 = 1 to 45 oldgr(c3,c4) = gr(c3,c4) repeat repeat olda1 = a1 a1 = a2 WWWW: repeat &dA &dA &d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAº&d@ End of calculations on the placement of notes, note-dots, &dAº&d@ &dA &d@ &dAº&d@ and note-accidentals. &dAº&d@ &dA &d@ &dAº&d@ &dAº&d@ &dA &d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ &dA &dA &dA &d@*************************************************************** &dA &d@ Debug Information &dA g = measnum - 1 if bit(2,pmode) = 1 and g >= debug_point putc Set Array at Point No. 3: measure ~g putc Look? getc jtype if jtype = "y" perform display_ts end end &dA &dA &d@ End debug information &dA &d@*************************************************************** &dA &dA &dA &d@ &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dA &d@ &dAº &d@ &dA º&d@ &dA &d@ &dAº &d@ At this point, we have a decision to make. Either we process the &dA º&d@ &dA &d@ &dAº &d@ ts array now (i.e. typeset the music) or we return from this &dA º&d@ &dA &d@ &dAº &d@ procedure and let the ts array continue to grow. The question that &dA º&d@ &dA &d@ &dAº &d@ must be answered is "will all outstanding slurs be processed when &dA º&d@ &dA &d@ &dAº &d@ the ts array is fully processed?" If "yes", then we can go ahead &dA º&d@ &dA &d@ &dAº &d@ and process the ts array; otherwise, not. &dA º&d@ &dA &d@ &dAº &d@ &dA º&d@ &dA &d@ &dAº &d@ The information we need is contained in the SLUR_FLAG protion &dA º&d@ &dA &d@ &dAº &d@ of the ts array. We need to cycle through the array elements we &dA º&d@ &dA &d@ &dAº &d@ have added, taking note of where slurs terminate and where they &dA º&d@ &dA &d@ &dAº &d@ start. We need a variable to keep track of the state of slur &dA º&d@ &dA &d@ &dAº &d@ completion. We call this variable bstr "outslurs". The relevant &dA º&d@ &dA &d@ &dAº &d@ bits will be bits 1 to 8. When a slur is initiated, the relevant &dA º&d@ &dA &d@ &dAº &d@ bit will be turned on; when a slur is terminated, the relevant &dA º&d@ &dA &d@ &dAº &d@ bit will be turned off. If at the end of this process, &dA º&d@ &dA &d@ &dAº &d@ outslurs = "00000000", then we can process the array. &dA º&d@ &dA &d@ &dAº &d@ &dA º&d@ &dA &d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ &dA loop for a1 = oldsct+1 to sct nodtype = ts(a1,TYPE) if nodtype <= NOTE_OR_REST a2 = ts(a1,SLUR_FLAG) & 0xff a3 = ts(a1,SLUR_FLAG) >> 8 a3 &= 0xff00 a3 += a2 /* 16 bits, i.e., stop,start,stop,start etc. if a3 > 0 a5 = 1 loop for a4 = 1 to 8 if bit(a5,a3) = 1 if outslurs{a4} = "0" /* can't stop a non-existant slur putc Slur error: Can't stop a non-existant slur (possible missing instigation) return 10 else outslurs{a4} = "0" end end --a5 if bit(a5,a3) = 1 if outslurs{a4} = "1" /* can't start an existing slur putc Slur error: Can't start an existing slur (possible missing termination) return 10 else outslurs{a4} = "1" end end a5 += 3 repeat end end repeat if outslurs <> "00000000" return end &dA &dA &d@ At this point we will be working with the entire ts array. First &dA &d@ thing, we must clear the pseudo tiearr ROWs. &dA loop for c7 = 1 to MAX_TIES if tiearr(c7,TIE_SNUM) = INT1000000 /* pseudo super number tiearr(c7,TIE_SNUM) = 0 end repeat &dA &dA &d@ &dASlur Analysis&d@ &dA &dA &d@ We am now in a position to compile complete information on slurs, &dA &d@ so that they can more or less be set properly. We possess the &dA &d@ following information for the notes on which the slur starts and &dA &d@ ends: &dA &d@ &dA &d@ (1) pitch (also whether it is part of a chord, also top or not) &dA &d@ (2) stem direction (dist from end of stem, also if beam connects) &dA &d@ (3) pass number &dA &d@ (4) staff number &dA &d@ (5) values of mcat and MULTI &dA &d@ &dA &d@ In addition, we need to compile the following information for each &dA &d@ slur: &dA &d@ &dA &d@ (1) the "high point" and "low point" for all objects on the &dA &d@ slur staff between the starting and ending notes. &dA &d@ &dA &d@ Based on this analysis, it should be possible to state: &dA &d@ &dA &d@ (1) whether the slur has tips up or down &dA &d@ &dA &d@ (2) the x-shift and y-shift for the start of the slur &dA &d@ &dA &d@ (3) the x-shift and y-shift for the end of the slur &dA &d@ &dA &d@ (4) any extra curviture that might help the situation &dA &d@ &dA &d@ In computing the parameters in (2), (3) and (4), it may be helpful &dA &d@ to something about the profile of the desired slur. For example: &dA &d@ &dA &d@ * * * * * * * * * * * * * &dA &d@ * * * * * * * * * * &dA &d@ * 1. * * 2. * * 3. * * 4. * * 5. * &dA &d@ raise start raise both raise end raise both add to &dA &d@ some a lot curviture &dA &d@ &dA &d@ &dAStorage of Information&d@ &dA &d@ &dA &d@ We need to figure out where we are going to store this information. &dA &d@ The way this program is constructed, it is possible (in theory at &dA &d@ least) for eight slurs to end and for eight slurs to start on the &dA &d@ same note. This could require as many as 32 separate parameters &dA &d@ at one ts(.,.) element, to say nothing about the 16 curviture &dA &d@ numbers, which must be stored somewhere. Rather than extend the &dA &d@ size of the second dimension of the ts array by this amount, I &dA &d@ would rather propose that we add one more element, call it &dA &d@ SLUR_X, which would be a pointer to an additional ROW element in the &dA &d@ ts array, somewhere below sct (the size of ts, after all, must be &dA &d@ much larger than necessary, in order to accommodate 99.99% of all &dA &d@ situations). &dA &dA &d@ While it is possible for eight slurs (four regular and four editorial) &dA &d@ to start or end on one chord, I think it is unlikely that more than &dA &d@ four would do so. I would therefore propose that we use a system of &dA &d@ flags to define the meaning of a data element within the ROW. As &dA &d@ will be explained below, the first 6 elements of the ROW are reserved &dA &d@ for current information about the chord generating the slur, and after &dA &d@ this, elements 7 to 32 can be used to hold data on slurs. We will &dA &d@ need to use two elements to contain all of the data. Let us establish &dA &d@ the convention that the first element will contain the key to the &dA &d@ meaning of data as well as the type of slur (tips up/down), extra &dA &d@ information on curvature, and the x-offset. Specifically, the key &dA &d@ will occupy bits 24-27, with the slur number (1-8) being stored in &dA &d@ bits 24-26, and bit 27 being the the start/end flag (0 = start, &dA &d@ 1 = end). Bit 16 will be the up/down flag (0 = tips up, 1 = tips &dA &d@ down) and bits 17-23 will contain information on extra curvature &dA &d@ (this information is necessary only in a slur-end element). Bits &dA &d@ 0-15 will contain the x-offset + 1000 (always a positive number). &dA &d@ The second element will contain the absolute y-position. Since &dA &d@ there are 26 free elements in the ROW, we can accommodate 13 data &dA &d@ groups in this fashion (surely more than necessary). &dA &dA &d@ Several points to note: &dA &dA &d@ (1) for purposes of these calculations, and temporary data stroage, &dA &d@ it will be simplest to record all y values as absolute y positions &dA &d@ (relative to the staff lines). x values can be stored as offsets. &dA &dA &d@ (2) In cases where more than one slur starts on a note head, or more &dA &d@ than one slur ends on a note head, care must be taken to insure &dA &d@ that the "longer" slur stays "on top" (assuming they have tips &dA &d@ going in the same direction). Let's take the situation pictured &dA &d@ below: &dA &dA &d@ * * * * * * * * slur 1 * * * * * * * * &dA &d@ * * slur 1a &dA &d@ * * * * * slur 2 * * * * * &dA &d@ * * slur 4 * * * slur 3 * * * * &dA &d@ ** * ** * *** &dA &d@ note 1 note 2 note 3 note 4 note 5 &dA &d@ &dA &d@ Slur 1 would be encountered first as we proceeded through the ts &dA &d@ array. If we were to try to process this slur when we first &dA &d@ encountered it, we would discover that another slur (slur 2) &dA &d@ ended on the same note as slur 1. Since slur 2 is shorter than &dA &d@ slur 1, (and therefore should lie "under" it), we cannot fully &dA &d@ process slur 1 until we have processed slur 2. But in looking back &dA &d@ to the beginning of slur 2, we see that another slur (slur 3) also &dA &d@ starts on the same note, and that slur 3 (which also we have not &dA &d@ seen before) must be processed before we can process slur 2. &dA &d@ Clearly we cannot simply follow the rule of "process a slur when &dA &d@ you first come to it". A similar argument can be used to show &dA &d@ that you cannot simply work your way through the ts array from &dA &d@ end to the start. &dA &d@ &dA &d@ Here is how the process must be conducted: You proceed forward &dA &d@ though the ts array, but do nothing until you encounter the end &dA &d@ of a slur (or more than one end, as in the case of note 5 above). &dA &d@ If there is more than one slur ending on this note (chord), you can &dA &d@ determine which one is shorter by looking backward in the array. &dA &d@ The shorter one should be processed first. In this way, you can &dA &d@ always be sure that shorter slurs will be processed before longer &dA &d@ ones. &dA &dA &d@ This method will require extra work in keeping track of what has &dA &d@ already been done. This is the purpose of the first 6 elements of &dA &d@ the extra ts ROW element. In our example above, slur 4 will be the &dA &d@ first to be processed. Since it is the first slur for both note 1 &dA &d@ and note 2, SLUR_X records must be generated for both of these &dA &d@ notes. In the case of note 2, this is the only slur, but for note 1 &dA &d@ we will be processing another slur (slur 1) much later. We need &dA &d@ to keep track of what has already transpired as a result of slur 4. &dA &d@ The first 6 elements of the SLUR_X ROW element will contain the &dA &d@ information listed below: &dA &d@ &dA &d@ (1) current y-position above object for incoming slurs. &dA &d@ (2) " below " " " " . &dA &d@ (3) " above " " outgoing " . &dA &d@ (4) " below " " " " . &dA &d@ (5) y-position for staccato, legato, etc. &dA &d@ (6) 2 = marks above chord; 1 = marks below chord; 0 = don't use &dA &dA &d@ Clearly, the information about what has happened at note 1 will &dA &d@ be available when it comes time to set slur 1. &dA &dA &d@ One more thing: in handling this problem, we must deal with a chord &dA &d@ as one object. A chord may be made up of several elements (notes), &dA &d@ and slurs coming to or leaving this chord may be coded on separate &dA &d@ elements. Nevertheless, the processing of information requires &dA &d@ that all data related to slurs be stored in one place. Therefore, &dA &d@ when a slur ROW element is allocated, the pointer to the element &dA &d@ must be put in SLUR_X for &dGall notes in the chord&d@. &dA &d@ &dA &d@ (3) It should be noted that the smallest meaningful resolution of a &dA &d@ y-position as far as slurs are concerned is vpar(1), since the &dA &d@ printing program treats these shifts as adjusted note positions. &dA &d@ &dA &d@ (4) The curvature parameter should be a number from 0 to 9 (9 being &dA &d@ the most curved). The printing program actually uses a look-up &dA &d@ method to determine which slur to put in a particular position. &dA &d@ One of the characterizations of such a slur is its curvature &dA &d@ (this is part of the slur number). It only makes sense to change &dA &d@ this number if the new curvature is more than the "look up" &dA &d@ value. Since increasing the curvature will put the "cross part" &dA &d@ of the slur at a different height, a new curvature should only &dA &d@ be suggested in those cases where it is thought that the slur &dA &d@ will not be interfering with staff lines. One other thing: &dA &d@ we do not know the final length of the slur until print time. &dA &d@ It turns out that for slurs longer than a certain length &dA &d@ (I think about .6 inches) there are varients available which &dA &d@ are asymmetric (where the relative high point comes either &dA &d@ earlier or later in the slur). It is possible to "make a &dA &d@ suggestion" to the print program that an asymmetric slur &dA &d@ be used, if one is available. Adding 10 to the curvature &dA &d@ will suggest that the high point be delayed; and adding 20 &dA &d@ to the curvature will suggest that the high point come &dA &d@ earlier. Actually, as I remember it, slurs longer about 1.3 &dA &d@ inches only come in asymmetric versions, so for slurs that &dA &d@ appear to be really long (either many notes, or multiple &dA &d@ measures), it might actually be helpful to make a recommendation. &dA &d@ &dA &d@ S U M M A R Y O F I N F O R M A T I O N (TS32) &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ &dA &d@ 1. A slur is processed when its &dGend&d@ is encountered. If there is more &dA &d@ than one slur on a &dGchord&d@, the shortest one is processed first. If &dA &d@ more than one of the same length is encountered, the one on the &dA &d@ lowest note is processed first. &dA &d@ &dA &d@ 2. The first time a slur is encountered on a chord, a new ts ROW &dA &d@ element is allocated and a pointer to it is placed in the SLUR_X &dA &d@ element for all notes in the chord. &dA &d@ &dA &d@ 3. The first six elements of a slur ROW element are reserved for the &dA &d@ following information: &dA &d@ &dA &d@ (1) current y-position above object for incoming slurs. &dA &d@ (2) " below " " " " . &dA &d@ (3) " above " " outgoing " . &dA &d@ (4) " below " " " " . &dA &d@ (5) y-position for staccato, legato, etc. &dA &d@ (6) 2 = marks above chord; 1 = marks below chord; 0 = don't use &dA &d@ &dA &d@ 4. Specific information about slurs coming to or leaving a chord is &dA &d@ stored in groups of two elements, starting with element 7. &dA &d@ The format is as follows: &dA &d@ &dA &d@ odd numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ bit 27: start/end flag (0 = start, 1 = end) &dA &d@ bits 24-26: slur number - 1 (0 to 7) &dA &d@ bits 17-23: curvature information (end only) &dA &d@ bit 16: up/down flag (0 = tips up, 1 = tips down) (end only) &dA &d@ bits 0-15: x-offset + 1000 (always a positive number) &dA &d@ even numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ y position relative to the staff &dA &d@ &dA &dA &d@ &dA ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@ &dA ³ &d@ &dA ³ &dA &d@ &dA ³ &d@ P R O C E S S I N G S L U R S &dA ³ &dA &d@ &dA ³ &d@ &dA ³ &dA &d@ &dA ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA a14 = sct + 2 /* SLUR_X pointer loop for a1 = 1 to sct nodtype = ts(a1,TYPE) if nodtype > NOTE_OR_REST goto YYYY end a4 = ts(a1,SLUR_FLAG) & 0x00aa00aa if a4 > 0 /* a slur ends here &dA &dA &d@ Compile a list of all slurs that end on this note and on any &dA &d@ other (lower) notes in this chord. &dA a5 = a4 >> 1 a5 &= 0x00ff00ff /* a list of starts to look for ndata(1,1) = a5 ndata(1,2) = a1 pcnt = 1 perform get_topbottom (a1,c1,c2) loop for a2 = a1+1 to c2 a4 = ts(a2,SLUR_FLAG) & 0x00aa00aa if a4 > 0 /* a slur ends here a5 = a4 >> 1 a5 &= 0x00ff00ff /* a list of starts to look for ++pcnt ndata(pcnt,1) = a5 ndata(pcnt,2) = a2 end repeat a1 = c2 /* so that we don't look at these notes again &dA &dA &d@ examine /* &dA09/28/93&d@ &dA nsgroups = 0 c9 = pcnt /* moved here from +3 lines &dA09/28/93 loop for c7 = c1-1 to 1 step -1 if ts(c7,TYPE) <= NOTE_OR_REST a6 = ts(c7,SLUR_FLAG) & 0x00550055 /* starts on this note loop for c8 = 1 to pcnt a5 = ndata(c8,1) /* list of starts for this note of chord a2 = ndata(c8,2) /* index to this note of chord a7 = a6 & a5 /* a7 = matches if a7 > 0 &dA &d@ if a7 & 0x00100010 > 0 &dA &d@ This code a2 |= 0x00010000 /* this is a "force over" slur &dA &d@ must be else &dA &d@ changed if a7 & 0x00400040 > 0 &dA &d@ to below a2 |= 0x00020000 /* this is a "force under" slur &dA &d@ &dA10-09-93&d@ end &dA &d@ end c11 = a7 >> 8 c11 &= 0xff00 c11 += a7 & 0xff /* compact a7 into 16 bits a7 = not(a7) a5 &= a7 /* remove this slur from a5 ndata(c8,1) = a5 c10 = 0 /* slur number - 1 c6 = a2 loop while c11 > 0 if bit(0,c11) = 1 c4 = c10 & 0x03 /* slur number mod(4) c5 = 1 << (c4 * 2) c5 <<= 8 if c5 & ts(c7,SLUR_FLAG) > 0 /* this slur is forced c5 <<= 1 if c5 & ts(c7,SLUR_FLAG) = 0 c6 |= 0x00010000 /* this is a "force over" slur else c6 |= 0x00020000 /* this is a "force under" slur end end ++nsgroups sgroup(nsgroups,1) = c7 /* record index starting note sgroup(nsgroups,2) = c6 /* record index ending note (+ flags) sgroup(nsgroups,3) = c10 /* slur number - 1 end c11 >>= 2 ++c10 repeat if a5 = 0 --c9 if c9 = 0 /* no more slurs to look for c7 = 0 end end end repeat end repeat if nsgroups = 0 or c9 > 0 putc Can't find start to a slur putc &dAType /e &d@ to terminate examine return 10 end &dA &d@ &dA &d@ At this point, we have a list of slurs which end on this chord. &dA &d@ We need to decide what to do with them. We certainly can proceed &dA &d@ by looping though the group, but we should probably first learn &dA &d@ something about the chords we are dealing with. For example, &dA &d@ is the stem up or down? Where on the chords do the slurs attach? &dA &d@ Do the note heads (or chords) have staccato, legato or spiccato &dA &d@ marks on them? (Remember that the notes of a chord have been &dA &d@ re-ordered so that the top note comes first; i.e., the top note &dA &d@ head may not be at the note end of the stem.) The purpose of &dA &d@ all of this "research" is basically to answer the following &dA &d@ two questions: &dA &dA &d@ (1) should the slur be oriented with tips up or tips down, and &dA &dA &d@ (2) should the slur take its position from the note head or &dA &d@ from the end of the stem? &dA &dA &d@ I think I have found a system which will at least (1) give an answer &dA &d@ to every possible situation, and (2) give "right" answers for most &dA &d@ situations. Essentially, what I will use is "situation based" &dA &d@ programming, rather than "rule based" programming. I have described &dA &d@ all possible situations under two conditions: (1) the final note &dA &d@ has the multi-track flag = 0, and (2) the final note has the multi-track &dA &d@ flag > 0. These templates are laid out below &dA &dA &d@ I. Final note multi-track flag = 0 &dA &dA &d@ starting note ending note x-shift stem option overrides &dA &d@ stem position stem position tips 1st 2nd 1st 2nd code over under &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄ &dA &d@ up single up single ³ up ³H H ³ no ³ F ³ l ³ F ³ &dA &d@ (multi-track = 0) up top of many ³down³ no ³s s ³ p ³ p ³ G ³ &dA &d@ up middle of many ³down³nr Y ³ no ³ m ³ p ³ H ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ p ³ F ³ &dA &d@ down single ³down³nr H ³s H (if flag)³ j ³ j ³ I ³ &dA &d@ down top of many ³down³ no ³s H ³ o ³ o ³ G ³ &dA &d@ down middle of many ³down³nr H ³ ³ i ³ i ³ O ³ &dA &d@ down bottom of many ³ up ³ no ³H s ³ O ³ o ³ O ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ up single up single ³down³nr H ³s s (mid stf)³ l ³ l ³ F ³ &dA &d@ (multi-track > 0) up top of many ³down³ no ³s s ³ p ³ p ³ G ³ &dA &d@ up middle of many ³down³nr Y ³ no ³ m ³ p ³ H ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ p ³ F ³ &dA &d@ down single ³down³ no ³s H ³ o ³ j ³ I ³ &dA &d@ down top of many ³down³ no ³s H ³ o ³ o ³ G ³ &dA &d@ down middle of many ³down³nr H ³ ³ i ³ i ³ O ³ &dA &d@ down bottom of many ³ up ³ no ³H s ³ O ³ o ³ O ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ up top of many up single ³down³ no ³s s ³ p ³ p ³ F ³ &dA &d@ (multi-track = 0) up top of many ³down³nr n ³s s (no oths)³ h ³ h ³ N ³ &dA &d@ (multi-track > 0) up middle of many ³down³ no ³s s ³ p ³ p ³ F ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ p ³ F ³ &dA &d@ down single ³down³ no ³s H ³ o ³ o ³ I ³ &dA &d@ down top of many ³down³nr H ³s H (no oths)³ k ³ k ³ N ³ &dA &d@ down middle of many ³down³ no ³s H ³ o ³ o ³ G ³ &dA &d@ down bottom of many ³down³nr H ³ no ³ i ³ i ³ G ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ up middle of many up single ³down³Yr n ³ no ³ f ³ f ³ F ³ &dA &d@ (multi-track = 0) up top of many ³down³Yr n ³ no ³ f ³ f ³ F ³ &dA &d@ (multi-track > 0) up middle of many ³down³nr nl³ no ³ n ³ n ³ N ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ r ³ F ³ &dA &d@ down single ³down³Yr H ³ no ³ g ³ g ³ I ³ &dA &d@ down top of many ³down³Yr H ³ no ³ g ³ g ³ G ³ &dA &d@ down middle of many ³down³nr nl³ no ³ n ³ n ³ N ³ &dA &d@ down bottom of many ³ up ³H nl³ no ³ H ³ g ³ H ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ up botton of many up single ³ up ³H H ³ no ³ F ³ f ³ F ³ &dA &d@ (multi-track = 0) up top of many ³down³Yr n ³ no ³ f ³ f ³ F ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³H H ³ no ³ F ³ s ³ F ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ n ³ F ³ &dA &d@ down single ³ up ³H nl³H s (positio)³ I ³ g ³ I ³ &dA &d@ down top of many ³down³Yr H ³ no ³ g ³ g ³ G ³ &dA &d@ down middle of many ³ up ³H Yl³ ³ G ³ g ³ G ³ &dA &d@ down bottom of many ³ up ³H nl³H s (p n oth)³ J ³ n ³ J ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ down single up single ³down³H n ³H s (positio)³ c ³ c ³ B ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³H s (positio)³ c ³ c ³ B ³ &dA &d@ up middle of many ³down³H Y ³ no ³ e ³ e ³ B ³ &dA &d@ up bottom of many ³ up ³n H ³s H (positio)³ B ³ e ³ B ³ &dA &d@ down single ³down³H H ³ no ³ d ³ d ³ E ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ d ³ C ³ &dA &d@ down middle of many ³down³H H ³ no ³ d ³ d ³ C ³ &dA &d@ down bottom of many ³ up ³ no ³s s ³ Q ³ d ³ Q ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ down single up single ³ up ³n H ³s H (positio)³ B ³ c ³ B ³ &dA &d@ (multi-track > 0) up top of many ³down³H n ³ no ³ a ³ c ³ B ³ &dA &d@ up middle of many ³ up ³n H ³ no ³ A ³ e ³ B ³ &dA &d@ up bottom of many ³ up ³ no ³s H ³ P ³ e ³ B ³ &dA &d@ down single ³ up ³n nl³s s (mid stf)³ E ³ d ³ E ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ d ³ C ³ &dA &d@ down middle of many ³ up ³ no ³s s ³ Q ³ d ³ C ³ &dA &d@ down bottom of many ³ up ³ no ³s s ³ Q ³ d ³ Q ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ down top of many up single ³down³H n ³H s (positio)³ c ³ c ³ K ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³H s (p n oth)³ b ³ b ³ C ³ &dA &d@ (multi-track > 0) up middle of many ³down³H Y ³ no ³ e ³ e ³ K ³ &dA &d@ up bottom of many ³down³H Y ³ no ³ e ³ e ³ K ³ &dA &d@ down single ³down³H H ³ no ³ d ³ d ³ Q ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ d ³ N ³ &dA &d@ down middle of many ³down³H H ³ no ³ d ³ d ³ L ³ &dA &d@ down bottom of many ³ up ³Y nl³ no ³ M ³ d ³ M ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ down middle of many up single ³ up ³Y H ³ no ³ K ³ c ³ K ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³ no ³ a ³ a ³ K ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³nr nl³ no ³ N ³ n ³ N ³ &dA &d@ up bottom of many ³ up ³Y H ³ no ³ K ³ a ³ K ³ &dA &d@ down single ³down³H H ³ no ³ d ³ d ³ M ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ d ³ L ³ &dA &d@ down middle of many ³ up ³nr nl³ no ³ N ³ n ³ N ³ &dA &d@ down bottom of many ³ up ³Y nl³ no ³ M ³ d ³ M ³ &dA &d@ ³ ³ ³ ³ ³ ³ ³ &dA &d@ down bottom of many up single ³ up ³n H ³s H (positio)³ B ³ c ³ B ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³ no ³ a ³ a ³ K ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³n H ³ no ³ A ³ e ³ A ³ &dA &d@ up bottom of many ³ up ³n H ³ no ³ A ³ n ³ A ³ &dA &d@ down single ³ up ³n nl³s s (mid stf)³ E ³ d ³ E ³ &dA &d@ down top of many ³ up ³n Yl³ no ³ C ³ d ³ C ³ &dA &d@ down middle of many ³ up ³n Yl³ no ³ C ³ d ³ C ³ &dA &d@ down bottom of many ³ up ³n nl³s s (no oths)³ D ³ n ³ D ³ &dA &dA &dA &d@ II. Final note multi-track flag > 0 &dA &dA &d@ starting note ending note x-shift stem option (same) &dA &d@ stem position stem position tips 1st 2nd 1st 2nd code (overrides) &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄ &dA &d@ up single up single ³down³nr H ³s s (mid stf)³ l ³ &dA &d@ (multi-track = 0) up top of many ³down³ no ³s s ³ p ³ &dA &d@ up middle of many ³down³nr Y ³ no ³ m ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ &dA &d@ down single ³ up ³H nl³H s (positio)³ I ³ &dA &d@ down top of many ³ up ³H Yl³ no ³ G ³ &dA &d@ down middle of many ³ up ³H Yl³ no ³ G ³ &dA &d@ down bottom of many ³ up ³ no ³H s ³ O ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ up single up single ³down³nr H ³s s (mid stf)³ l ³ &dA &d@ (multi-track > 0) up top of many ³down³ no ³s s ³ p ³ &dA &d@ up middle of many ³down³nr Y ³ no ³ m ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ &dA &d@ down single ³ up ³ no ³H s ³ O ³ &dA &d@ down top of many ³ up ³H Yl³ no ³ G ³ &dA &d@ down middle of many ³ up ³ no ³H s ³ O ³ &dA &d@ down bottom of many ³ up ³ no ³H s ³ O ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ up top of many up single ³down³ no ³s s ³ p ³ &dA &d@ (multi-track = 0) up top of many ³down³nr n ³s s (no oths)³ h ³ &dA &d@ (multi-track > 0) up middle of many ³down³ no ³s s ³ p ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ &dA &d@ down single ³down³ no ³s H ³ o ³ &dA &d@ down top of many ³down³nr H ³ no ³ i ³ &dA &d@ down middle of many ³ up ³H Yl³ no ³ G ³ &dA &d@ down bottom of many ³ up ³H nl³ no ³ H ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ up middle of many up single ³down³Yr n ³ no ³ f ³ &dA &d@ (multi-track = 0) up top of many ³down³Yr n ³ no ³ f ³ &dA &d@ (multi-track > 0) up middle of many ³down³nr nl³ no ³ n ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ &dA &d@ down single ³down³Yr H ³ no ³ g ³ &dA &d@ down top of many ³down³Yr H ³ no ³ g ³ &dA &d@ down middle of many ³ up ³nr nl³ no ³ N ³ &dA &d@ down bottom of many ³ up ³H nl³ no ³ H ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ up botton of many up single ³ up ³H H ³ no ³ F ³ &dA &d@ (multi-track = 0) up top of many ³down³Yr n ³ no ³ f ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³H H ³ no ³ F ³ &dA &d@ up bottom of many ³ up ³H H ³ no ³ F ³ &dA &d@ down single ³ up ³H nl³H s (positio)³ I ³ &dA &d@ down top of many ³down³Yr H ³ no ³ g ³ &dA &d@ down middle of many ³ up ³H Yl³ no ³ G ³ &dA &d@ down bottom of many ³ up ³H nl³H s (p n oth)³ J ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ down single up single ³down³H n ³H s (positio)³ c ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³H s (positio)³ c ³ &dA &d@ up middle of many ³down³H Y ³ no ³ e ³ &dA &d@ up bottom of many ³ up ³n H ³s H (positio)³ B ³ &dA &d@ down single ³ up ³n nl³s s (mid stf)³ E ³ &dA &d@ down top of many ³ up ³n Yl³ no ³ C ³ &dA &d@ down middle of many ³ up ³ no ³s s ³ Q ³ &dA &d@ down bottom of many ³ up ³ no ³s s ³ Q ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ down single up single ³down³H n ³H s (positin)³ c ³ &dA &d@ (multi-track > 0) up top of many ³down³H H ³ no ³ d ³ &dA &d@ up middle of many ³down³H Y ³ no ³ e ³ &dA &d@ up bottom of many ³ up ³n H ³ no ³ A ³ &dA &d@ down single ³ up ³n nl³s s (mid stf)³ E ³ &dA &d@ down top of many ³ up ³n Yl³ no ³ C ³ &dA &d@ down middle of many ³ up ³ no ³s s ³ Q ³ &dA &d@ down bottom of many ³ up ³ no ³s s ³ Q ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ down top of many up single ³down³H n ³H s (positio)³ c ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³H s (p n oth)³ b ³ &dA &d@ (multi-track > 0) up middle of many ³down³H Y ³ no ³ e ³ &dA &d@ up bottom of many ³down³H Y ³ no ³ e ³ &dA &d@ down single ³down³H H ³ no ³ d ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ &dA &d@ down middle of many ³ up ³Y Yl³ no ³ L ³ &dA &d@ down bottom of many ³ up ³Y nl³ no ³ M ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ down middle of many up single ³ up ³Y H ³ no ³ K ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³ no ³ a ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³nr nl³ no ³ N ³ &dA &d@ up bottom of many ³ up ³Y H ³ no ³ K ³ &dA &d@ down single ³ up ³Y nl³ no ³ M ³ &dA &d@ down top of many ³down³H H ³ no ³ d ³ &dA &d@ down middle of many ³ up ³nr nl³ no ³ N ³ &dA &d@ down bottom of many ³ up ³Y nl³ no ³ M ³ &dA &d@ ³ ³ ³ ³ ³ &dA &d@ down bottom of many up single ³ up ³n H ³ no ³ A ³ &dA &d@ (multi-track = 0) up top of many ³down³H n ³ no ³ a ³ &dA &d@ (multi-track > 0) up middle of many ³ up ³n H ³ no ³ A ³ &dA &d@ up bottom of many ³ up ³n H ³ no ³ A ³ &dA &d@ down single ³ up ³n nl³s s (mid stf)³ E ³ &dA &d@ down top of many ³ up ³n Yl³ no ³ C ³ &dA &d@ down middle of many ³ up ³n Yl³ no ³ C ³ &dA &d@ down bottom of many ³ up ³n nl³s s (p n oth)³ D ³ &dA &dA &dA &d@ Meaning of codes &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ x-shift stem option &dA &d@ code tips 1st 2nd 1st 2nd &dA &d@ ÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ A up n H no &dA &d@ B up n H s H (position) &dA &d@ C up n Yl no &dA &d@ D up n nl s s (no others) &dA &d@ E up n nl s s (mid stuff) &dA &d@ F up H H no &dA &d@ G up H Yl no &dA &d@ H up H nl no &dA &d@ I up H nl H s (position) &dA &d@ J up H nl H s (pos no oth) &dA &d@ K up Y H no &dA &d@ L up Y Yl no &dA &d@ M up Y nl no &dA &d@ N up nr nl no &dA &d@ O up no H s &dA &d@ P up no s H &dA &d@ Q up no s s &dA &dA &d@ a down H n no &dA &d@ b down H n H s (pos no oth) &dA &d@ c down H n H s (position) &dA &d@ d down H H no &dA &d@ e down H Y no &dA &d@ f down Yr n no &dA &d@ g down Yr H no &dA &d@ h down nr n s s (no oths) &dA &d@ i down nr H no &dA &d@ j down nr H s H (if flag) &dA &d@ k down nr H s H (no oths) &dA &d@ l down nr H s s (mid stuff) &dA &d@ m down nr Y no &dA &d@ n down nr nl no &dA &d@ o down no s H &dA &d@ p down no s s &dA &dA &dA &d@ Extra codes &dA &d@ Meaning of codes &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ x-shift 2nd option &dA &d@ code tips 1st 2nd 1st 2nd &dA &d@ ÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ R up n nl no &dA &dA &dA &d@ q down nr n no &dA &d@ r down Yr Yl no &dA &d@ s down Yr Y no &dA &d@ t down no H s &dA &dA &d@ This information is combined into a 160 byte string. By correctly &dA &d@ diagnosing the situation, we can therefore determine what actions &dA &d@ should be taken. For both and starting note and the ending note &dA &d@ we need to determine: &dA &dA &d@ (1) multi-track flag? (zero or non-zero) &dA &d@ (2) stem direction? (up or down) &dA &d@ (3) note catagory? (single, top of many, &dA &d@ middle of many, bottom of many) &dA &d@ &dA &d@ &dA ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» &dA &d@ &dA º This is the loop which processes slurs º &dA &d@ &dA ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ loop for a4 = 1 to nsgroups /* loop through all slurs ending on this chord &dA &dA &d@ examine &dA a6 = sgroup(a4,1) a7 = sgroup(a4,2) c7 = a7 >> 16 /* get forced slur flag a7 &= 0xffff /* clean up index &dA &dA &d@ 1a. Get information on starting note &dA &dA &d@ c1 = multi-track flag for this note &dA &d@ c2 = stem direction for this note &dA &d@ c3 = note catagory for this note: 0 = single &dA &d@ 1 = top of many &dA &d@ 2 = middle of many &dA &d@ 3 = bottom of many &dA &d@ c7 = forced slur flag &dA c1 = ts(a6,MULTI_TRACK) >> 2 c2 = bit(1,ts(a6,STEM_FLAGS)) c3 = bit(2,ts(a6,STEM_FLAGS)) if c3 = 1 and bit(3,ts(a6,STEM_FLAGS)) = 1 ++c3 if ts(a6+1,TYPE) <> ts(a6,TYPE) ++c3 end end &dA &dA &d@ 1b. Get information on ending note &dA &dA &d@ c4 = multi-track flag for this note &dA &d@ c5 = stem direction for this note &dA &d@ c6 = note catagory for this note: 0 = single &dA &d@ 1 = top of many &dA &d@ 2 = middle of many &dA &d@ 3 = bottom of many &dA c4 = ts(a7,MULTI_TRACK) >> 2 c5 = bit(1,ts(a7,STEM_FLAGS)) c6 = bit(2,ts(a7,STEM_FLAGS)) if c6 = 1 and bit(3,ts(a7,STEM_FLAGS)) = 1 ++c6 if ts(a7+1,TYPE) <> ts(a7,TYPE) ++c6 end end &dA &dA &d@ 1c. Modify multi-track flags under certain conditions &dA if c1 > 0 and c4 > 0 /* &dACHANGED&d@ from = 3 on 9-10-93 if ts(a6,PASSNUM) = ts(a7,PASSNUM) and c2 = c5 if ts(a6,PASSNUM) = 1 and c2 = DOWN c1 = 0 c4 = 0 end if ts(a6,PASSNUM) = 2 and c2 = UP c1 = 0 c4 = 0 end end end &dA &dA &d@ 2. Derive "situation" letter from c1 - c7. &dA &d@ c8 = c3 if c8 <> 0 or c1 <> 0 ++c8 end if c2 = DOWN c8 += 5 end if c4 > 0 and c7 = 0 c8 += 10 end c8 *= 8 /* c8 ranges by 8's from 0 to 19*8 c8 += c6 if c5 = DOWN c8 += 4 end ++c8 /* c8 ranges from 1 to 160 (1 to 80 for forced slurs) if c7 = 0 slurlet = slurstr{c8} if c1 = 0 and c4 = 0 if chr(ts(a6,TYPE)) in [GR_NOTE,XGR_NOTE] if chr(ts(a7,TYPE)) in [NOTE,XNOTE] slurlet = slurunder{c8} /* force under end end end else if c7 = 1 slurlet = slurover{c8} /* force over else slurlet = slurunder{c8} /* force under end end &dA &dA &d@ 2a. Attempt to account for interfering beams &dA if ts(a6,TYPE) < GR_NOTE or ts(a7,TYPE) > XNOTE if "abcIJijAB" con slurlet if mpt < 6 c12 = ts(a7,BEAM_FLAG) if c12 = CONT_BEAM or c12 = END_BEAM if mpt < 4 /* down-up; tips down; modify end slurlet = "t" else /* up-down; tips up; modify end slurlet = "O" end end else c12 = ts(a6,BEAM_FLAG) if c12 = CONT_BEAM or c12 = START_BEAM if mpt < 8 /* down-up; tips up; modify beginning slurlet = "o" else /* up-down; tips down; modify beginning slurlet = "P" end end end end end &dA &dA &d@ 3. Decompose "compound" situations into separate "simple" situations &dA &dA &d@ (1) if code in [D,J,b,h,k], are there other slurs between the chords? &dA &d@ If yes, then these codes become [R,H,a,q,i] &dA &dA &d@ (2) if code = I or J, is ending note vpar(6) higher than starting note? &dA &d@ If yes, then these codes both become O, otherwise they become H &dA &dA &d@ (3) if code in [B,b,c], is ending note vpar(6) lower than starting note? &dA &d@ If yes, then codes become [P,t,t]; otherwise they become [A,a,a] &dA &dA &d@ (4) if code = j, does starting note have a flag? If yes, it becomes &dA &d@ an "o". Otherwise it is an "i" &dA &dA &d@ (5) if code = l or E, is there anything between the notes (chords) &dA &d@ If yes, they become p and Q; otherwise they are i and R. &dA if "DJbhk" con slurlet c12 = mpt perform get_topbottom (a6,c1,c2) perform get_topbottom (a7,c4,c5) if c2 > c1 and c5 > c4 /* both chords loop for c3 = c1 to c2 /* first chord if c3 <> a6 /* look for other slurs c8 = ts(c3,SLUR_FLAG) & 0x00550055 if c8 > 0 /* slur(s) start(s) c8 <<= 1 /* set of end flags for these slurs loop for c9 = c2 + 1 to c5 c10 = ts(c9,TYPE) if chr(c10) in [NOTE,XNOTE,CUE_NOTE,XCUE_NOTE,GR_NOTE,XGR_NOTE] c11 = ts(c9,SLUR_FLAG) & c8 if c11 > 0 /* slur ends if c9 >= c4 and c9 <> a7 /* condition met! slurlet = "RHaqi"{c12} goto SSEND1 else c11 = not(c11) c8 &= c11 /* turn off this possibility end end end repeat end /* now look for ties if bit(0,ts(c3,SUPER_FLAG)) = 1 loop for c9 = c4 to c5 if c9 <> a7 c10 = ts(c9,BACKTIE) if c10 = c3 /* condition met! (tricky code) slurlet = "RHaqi"{c12} goto SSEND1 end end repeat end end repeat end slurlet = "QJbpo"{c12} end SSEND1: c7 = 0 /* option flag if "IJBbcjlE" con slurlet c8 = ts(a6,BEAM_FLAG) c9 = ts(a7,BEAM_FLAG) goto SS(mpt) SS(1): /* "IJ" if ts(a6,STAFFLOC) - ts(a7,STAFFLOC) > vpar(7) c7 = 1 end if ts(a6,TYPE) < GR_NOTE or ts(a7,TYPE) > XNOTE if c9 = CONT_BEAM or c9 = END_BEAM c7 = 1 end end goto SSEND SS(3): /* "Bbc" if ts(a7,STAFFLOC) - ts(a6,STAFFLOC) > vpar(7) if slurlet = "B" c7 = 1 else if ts(a7,SUBFLAG_2) & 0x3c > 0 if ts(a7,STAFFLOC) - ts(a6,STAFFLOC) > vpar(9) c7 = 1 end else c7 = 1 end end end if mpt = 3 if c8 = START_BEAM or c8 = CONT_BEAM c7 = 1 end else if c9 = CONT_BEAM or c9 = END_BEAM c7 = 1 end end goto SSEND SS(6): /* "j" if c8 = NO_BEAM if ts(a6,NTYPE) < QUARTER c7 = 1 end else if c8 = START_BEAM or c8 = CONT_BEAM c7 = 1 end end goto SSEND SS(7): /* "lE" beams on both notes of slur? if c8 > NO_BEAM and c9 > NO_BEAM slurlet = " pQ"{mpt} end goto SSEND2 &dA &dA &d@ At this point in the code, a1,a4,a6,a7 and a14 should not be changed &dA SSEND: &dA &dA &d@ Break 'm up &dA &d@ if c7 = 1 slurlet = "OOPttopQ"{mpt} else slurlet = "HHAaaiiR"{mpt} end end &dA &dA &d@ At this point, you have determined the "situation" letter for the &dA &d@ between "a6" and "a7" (with the exception of the cases "l" and "E", &dA &d@ which depend on the material between the slurs). You now need to &dA &d@ compile a profile of whatever material might be between the slurs &dA &d@ on this staff. (organized by advancing division) &dA SSEND2: c12 = 0 if "lE" con slurlet /* we do cases "l" and "E" here c12 = mpt c3 = ts(a6,STAFFLOC) c4 = ts(a7,STAFFLOC) if c3 < c4 c3 = c4 c4 = ts(a6,STAFFLOC) end if mpt = 1 c4 -= vpar(4) else c3 += vpar(4) end end c9 = 0 c7 = 0 c8 = ts(a7,STAFF_NUM) c15 = ts(a6,DIV) c10 = a7 loop while chr(ts(c10,TYPE)) in [XNOTE,XCUE_NOTE,XGR_NOTE] --c10 repeat --c10 /* c10 will not point to the last chord loop for c1 = a6+1 to c10 if ts(c1,STAFF_NUM) = c8 nodtype = ts(c1,TYPE) if chr(nodtype) in [NOTE,CUE_NOTE,GR_NOTE] if bit(1,ts(c1,STEM_FLAGS)) = UP c5 = ts(c1,VIRT_STEM) c6 = ts(c1,VIRT_NOTE) else c5 = ts(c1,VIRT_NOTE) c6 = ts(c1,VIRT_STEM) end else if chr(nodtype) in [REST,CUE_REST] c5 = ts(c1,STAFFLOC) - vpar(3) c6 = ts(c1,STAFFLOC) + vpar(3) else if nodtype = CLEF_CHG c5 = 0 c6 = vpar(8) else c5 = 10000 end end end if c5 < 10000 if c12 > 0 if c3 > c5 and c4 < c6 c7 = 1 end end if ts(c1,DIV) <> c15 ++c9 /* Case 1: profile(c9,1) = c5 - vpar(2) /* new division profile(c9,2) = c6 + vpar(2) /* else if c9 > 0 c5 -= vpar(2) /* Case 2: c6 += vpar(2) /* more notes if c5 < profile(c9,1) /* on same profile(c9,1) = c5 /* division end /* if c6 > profile(c9,2) profile(c9,2) = c6 end end end end end if ts(c1,TYPE) = BAR_LINE c15 = 0 else c15 = ts(c1,DIV) end repeat if c12 > 0 if c7 = 1 slurlet = "pQ"{c12} else slurlet = "iR"{c12} end end &dA &dA &d@ More modifications to slurlet. If there are staccatos, legatos, &dA &d@ or spiccatos connected to the note head, then under certain &dA &d@ conditions the slur must start at the stem of the note. &dA if slurlet < chr(96) /* tips up if ts(a6,SUBFLAG_2) & 0x3c > 0 if bit(1,ts(a6,STEM_FLAGS)) = DOWN if "ACRKLM" con slurlet slurlet = "PQQPQQ"{mpt} end end end if ts(a7,SUBFLAG_2) & 0x3c > 0 and ts(a6,TYPE) < GR_NOTE if bit(1,ts(a7,STEM_FLAGS)) = DOWN if "CGHLMR" con slurlet slurlet = "QOOQQQ"{mpt} end end end else /* tips down if ts(a6,SUBFLAG_2) & 0x3c > 0 if bit(1,ts(a6,STEM_FLAGS)) = UP if "fgimqrs" con slurlet slurlet = "poopppp"{mpt} end end end if ts(a7,SUBFLAG_2) & 0x3c > 0 if bit(1,ts(a7,STEM_FLAGS)) = UP if slurlet = "o" slurlet = "p" end end end &dK &d@ if ts(a7,SUBFLAG_2) & 0x3c > 0 &dK &d@ if bit(1,ts(a7,STEM_FLAGS)) = UP &dK &d@ if "aefmqrs " con slurlet &dK &d@ slurlet = "ttppppp"{mpt} &dK &d@ end &dK &d@ end &dK &d@ end end &dA &dA &d@ Updated list of letter codes &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ tips up tips down explanation &dA &d@ code 1st 2nd code 1st 2nd letter meaning &dA &d@ ÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ A n H a H n n note &dA &d@ C n Yl d H H nr start right of note &dA &d@ F H H e H Y nl end left of note &dA &d@ G H Yl f Yr n H head of chord &dA &d@ H H nl g Yr H Y position of object &dA &d@ K Y H i nr H (opposite of H) &dA &d@ L Y Yl m nr Y Yr start right of object &dA &d@ M Y nl n nr nl Yl end left of object &dA &d@ N nr nl o s H s stem &dA &d@ O H s p s s &dA &d@ P s H q nr n &dA &d@ Q s s r Yr Yl &dA &d@ R n nl s Yr Y &dA &d@ t H s &dA &dA &dA &d@ At this point, we need to check to see of this is the first time &dA &d@ either chord has been touched by a slur. When creating the &dA &d@ slur element ROW, we need to write in the first four elements: &dA &dA &d@ (1) current y-position above object for incoming slurs. &dA &d@ (2) " below " " " " . &dA &d@ (3) " above " " outgoing " . &dA &d@ (4) " below " " " " . &dA perform get_topbottom (a6,c1,c2) if ts(a6,SLUR_X) = 0 ++a14 loop for c8 = c1 to c2 ts(c8,SLUR_X) = a14 repeat if bit(1,ts(a6,STEM_FLAGS)) = UP ts(a14,1) = ts(a6,VIRT_STEM) ts(a14,2) = ts(a6,VIRT_NOTE) ts(a14,3) = ts(a6,VIRT_STEM) ts(a14,4) = ts(a6,VIRT_NOTE) else ts(a14,1) = ts(a6,VIRT_NOTE) ts(a14,2) = ts(a6,VIRT_STEM) ts(a14,3) = ts(a6,VIRT_NOTE) ts(a14,4) = ts(a6,VIRT_STEM) end end if bit(1,ts(a6,STEM_FLAGS)) = UP c3 = c2 c2 = c1 c1 = c3 end perform get_topbottom (a7,c3,c4) if ts(a7,SLUR_X) = 0 ++a14 loop for c8 = c3 to c4 ts(c8,SLUR_X) = a14 repeat if bit(1,ts(a7,STEM_FLAGS)) = UP ts(a14,1) = ts(a7,VIRT_STEM) ts(a14,2) = ts(a7,VIRT_NOTE) ts(a14,3) = ts(a7,VIRT_STEM) ts(a14,4) = ts(a7,VIRT_NOTE) else ts(a14,1) = ts(a7,VIRT_NOTE) ts(a14,2) = ts(a7,VIRT_STEM) ts(a14,3) = ts(a7,VIRT_NOTE) ts(a14,4) = ts(a7,VIRT_STEM) end end if bit(1,ts(a7,STEM_FLAGS)) = UP c5 = c4 c4 = c3 c3 = c5 end &dA &dA &d@ a6 = note we are looking at in first chord &dA &d@ c1 = head of first chord &dA &d@ c2 = last note (Y) of first chord &dA &dA &d@ a7 = note we are looking at in second chord &dA &d@ c3 = head of second chord &dA &d@ c4 = last note (Y) of second chord &dA &dA &d@ If this slur starts or ends on an element which has either (1) a &dA &d@ staccato dot and/or a legato line, or (2) a spiccato indication &dA &d@ associated with it, then we need to check to see if this is the &dA &d@ first time the element in question has been encountered, i.e., &dA &d@ element (5) of the slur element ROW is zero. If so, this parameter &dA &d@ needs to be adjusted to make space for the indication. This will &dA &d@ also shift the position of the slur. &dA &dA &dA &d@ (1) starting &dA c5 = ts(a6,SUBFLAG_2) c14 = ts(a6,SLUR_X) /* index to slur element ROW temp = "FGHOadet" /* note (changed at bottom of loop) temp2 = "PQop" /* stem (changed at bottom of loop) loop for c15 = 2 to 0 step -2 /* cases: 2 = start; 0 = end if c5 & 0x3c > 0 if ts(c14,5) = 0 if temp con slurlet /* if slur starts (ends) on a note &dA &d@ &dA &d@ We need to write elements (5) and (6) and to modify elements &dA &d@ (1) and (3), or elements (2) and (4). &dA &d@ if mpt < 5 /* this works for both cases stem = UP t3 = 1 y = ts(c14,c15+2) else stem = DOWN t3 = -1 y = ts(c14,c15+1) end if c5 & 0x38 > 0 /* staccato or legato t2 = notesize y += t2 * t3 /* check for interference t4 = 1 if stem = DOWN if y >= 0 t1 = y / notesize t4 = rem else y = 0 - notesize / 4 + y end else if y <= vpar(8) t1 = y / notesize t4 = rem else y = notesize / 4 + y end end /* adjust for interference with staff if t4 = 0 /* interference t2 += vpar(1) y = vpar(1) * t3 + y end c10 = t2 if c5 & 0x10 > 0 /* line over dot y = notesize * t3 + y c10 += notesize end /* write elements ts(c14,5) = y if stem = UP ts(c14,2) += c10 ts(c14,4) += c10 ts(c14,6) = BELOW else ts(c14,1) -= c10 ts(c14,3) -= c10 ts(c14,6) = ABOVE end end if c5 & 0x04 > 0 /* spiccato if stem = DOWN if y > vpar(1) y = vpar(1) end else if y < vpar(7) y = vpar(7) end end y = 5 * notesize / 4 * t3 + y if stem = UP y += vpar(50) end /* write elements ts(c14,5) = y if stem = UP ts(c14,2) = y ts(c14,4) = y ts(c14,6) = BELOW else ts(c14,1) = y - vpar(50) ts(c14,3) = y - vpar(50) ts(c14,6) = ABOVE end end else if temp2 con slurlet /* if slur starts (ends) on the stem &dA &d@ &dA &d@ We need to write element (5) and (6) and to modify elements &dA &d@ (1) and (3), or elements (2) and (4). &dA &d@ if mpt > 2 /* works in both cases stem = UP t3 = -1 y = ts(c14,c15+1) else stem = DOWN t3 = 1 y = ts(c14,c15+2) end if c5 & 0x38 > 0 /* staccato or legato t2 = vpar(1) y += t2 * t3 /* check for interference t4 = 1 if stem = UP if y >= 0 t1 = y / notesize t4 = rem else y = 0 - notesize / 4 + y end else if y <= vpar(8) t1 = y / notesize t4 = rem else y = notesize / 4 + y end end /* adjust for interference with staff if t4 = 0 /* interference t2 += vpar(1) y = vpar(1) * t3 + y end c10 = t2 if c5 & 0x10 > 0 /* line over dot y = notesize * t3 + y c10 += notesize end /* write elements ts(c14,5) = y if stem = DOWN ts(c14,2) += c10 ts(c14,4) += c10 ts(c14,6) = ABOVE else ts(c14,1) -= c10 ts(c14,3) -= c10 ts(c14,6) = BELOW end end if c5 & 0x04 > 0 /* spiccato if stem = DOWN if y < vpar(8) y = vpar(8) end else if y > 0 y = 0 end end y = vpar(1) * t3 + y if stem = DOWN y += vpar(50) end /* write elements ts(c14,5) = y if stem = DOWN ts(c14,2) = y ts(c14,4) = y ts(c14,6) = ABOVE else ts(c14,1) = y - vpar(50) ts(c14,3) = y - vpar(50) ts(c14,6) = BELOW end end end end end end &dA &dA &d@ (2) ending &dA c5 = ts(a7,SUBFLAG_2) c14 = ts(a7,SLUR_X) /* index to slur element ROW temp = "AFKPdgio" temp2 = "OQpt" repeat &dA &dA &d@ Now you can affix the position of the slur, and store the results &dA &d@ in the appropriate slur element ROWS. Also, the values of elements &dA &d@ (1) (2) (3) or (4) can be updated. &dA &dA &d@ T H E P L A N &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ 1. Using slurlet and elements (1) to (4), determine tentative start-y &dA &d@ and end-y values for slur. Determine orientation (tips up/down) &dA &dA &d@ 2. If c9 = 0, no adjustments are necessary; proceed with placing slur. &dA &dA &d@ 3. Using curve data, convert actual interior y-values to relative &dA &d@ interior y-values. If all interior y-values fall below (above) the &dA &d@ straight line connecting the end points, proceed with placing slur. &dA &dA &d@ 4. Determine interior point with maximum deviation, and raise (lower) &dA &d@ the slur end-point on that side to the next multiple of vpar(1). &dA &d@ If there is more than one interior point at the maximum, or if the &dA &d@ interior point with the maximum is in the center of the slur, &dA &d@ raise (lower) both slur end-points to the next multiple of vpar(1). &dA &dA &d@ 5. If all interior y-values now fall below (above) straight line &dA &d@ connecting the end points, proceed with placing slur. &dA &dA &d@ 6. Determine interior point(s) with maximum deviation. If this point &dA &d@ (all of these points) fall with the 25%-75% region of the slur, &dA &d@ increase the curvature one notch, and goto (3); otherwise goto (4). &dA &dA &d@ To execute this plan, we will need to set up some temporary variables. &dA &dA &d@ y1 = starting point of slur &dA &d@ y2 = ending point of slur &dA &d@ c5 = counting index for interior points &dA &d@ c6 = index for maximum on left &dA &d@ c7 = index for maximum on right &dA &d@ c9 = number of interior points (don't change this) &dA &dA &d@ I think the easiest way to handle the up/down situation is to convert &dA &d@ all down values to 1000 * vpar(1) - down, and treat this as part of the &dA &d@ "up" case. Initial data includes y1, y2 and the profile data. When we &dA &d@ are done, we simply perform the same tranformation to get the final &dA &d@ y1 and y2 values. &dA &dA &d@ A C T I O N &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ 1. Using slurlet and elements (1) to (4), determine tentative start-y &dA &d@ and end-y values for slur. Determine orientation (tips up/down) &dA if "ACNRimnq" con slurlet /* slur starts on note y1 = ts(a6,STAFFLOC) else if "KLMfgrs" con slurlet /* slur starts on Y y1 = ts(a6,OBY) else c13 = 3 c14 = ts(a6,SLUR_X) c15 = bit(1,ts(a6,STEM_FLAGS)) if "FGHOadet" con slurlet /* slur starts on H if c15 = UP ++c13 end else if c15 = DOWN ++c13 end end y1 = ts(c14,c13) end end if "HMNRafnq" con slurlet /* slur ends on note y2 = ts(a7,STAFFLOC) else if "CGLemrs" con slurlet /* slur ends on Y y2 = ts(a7,OBY) else c13 = 1 c14 = ts(a7,SLUR_X) c15 = bit(1,ts(a7,STEM_FLAGS)) if "AFKPdgio" con slurlet /* slur ends on H if c15 = UP ++c13 end else if c15 = DOWN ++c13 end end y2 = ts(c14,c13) end end &dA &dA &d@ 2. If c9 = 0, no adjustments are necessary; proceed with placing slur. &dA if c9 = 0 curve = 1 goto PLACE_SLUR end c10 = 1000 * vpar(1) if slurlet < chr(96) /* tips up y1 = c10 - y1 y2 = c10 - y2 loop for c13 = 1 to c9 profile(c13,1) = c10 - profile(c13,2) /* first cut repeat else y1 += c10 y2 += c10 loop for c13 = 1 to c9 profile(c13,1) += c10 repeat end &dA &dA &d@ 3. Using curve data, convert actual interior y-values to relative &dA &d@ interior y-values. If all interior y-values fall below (above) the &dA &d@ straight line connecting the end points, proceed with placing slur. &dA &d@ (see beginning of program for construction of curvedata). &dA t1 = 0 t2 = 0 curve = 1 sflag = 1 if abs(ts(a6,STAFFLOC) - ts(a7,STAFFLOC)) <= vpar(1) if bit(1,ts(a6,STEM_FLAGS)) = bit(1,ts(a7,STEM_FLAGS)) sflag = 0 end end NEW_CURVE: if c9 < 9 loop for c10 = 1 to c9 profile(c10,2) = profile(c10,1) + curvedata(c9,curve,c10) repeat else loop for c10 = 1 to 4 profile(c10,2) = profile(c10,1) + curvedata(8,curve,c10) repeat loop for c10 = 5 to c9 - 4 profile(c10,2) = profile(c10,1) + curvedata(8,curve,4) - 1 repeat c11 = 1 loop for c10 = c9 to c9 - 4 step -1 profile(c10,2) = profile(c10,1) + curvedata(8,curve,c11) ++c11 repeat end r1 = flt(y1) + .5 - flt(vpar(2)) r2 = flt(y2 - y1) r3 = flt(c9+1) r2 = r2 / r3 c14 = 0 c15 = 0 c12 = c9 + 1 >> 1 c13 = c9 >> 1 + 1 t5 = 0 t6 = 0 loop for c5 = 1 to c9 r1 += r2 c11 = fix(r1) c11 -= profile(c5,2) if c11 > 0 if c5 <= c12 if c11 > c14 c14 = c11 t5 = c5 end end if c5 >= c13 if c11 > c15 c15 = c11 t6 = c5 end end end repeat if c14 = 0 and c15 = 0 goto FIX_ENDS end &dA &dA &d@ 4. Determine interior point with maximum deviation, and raise (lower) &dA &d@ the slur end-point on that side to the next multiple of vpar(1). &dA &d@ If there is more than one interior point at the maximum, or if the &dA &d@ interior point with the maximum is in the center of the slur, &dA &d@ raise both slur end-points to the next multiple of vpar(1). &dA c7 = 0 if c9 > 4 and bit(0,c9) = 0 /* c6 = c9 >> 1 /* &dA if t5 = c6 or t6 - 1 = c6 /* &dA TRIAL c7 = 1 /* &dA if bit(1,ts(a6,STEM_FLAGS)) <> bit(1,ts(a7,STEM_FLAGS)) /* if abs(ts(a6,STAFFLOC) - ts(a7,STAFFLOC)) <= vpar(10) /* if curve = 1 /* if c15 > c14 /* t1 = 2 /* else /* &dA t2 = 2 /* &dA end /* &dA TRIAL c7 = 0 /* &dA end /* end /* end /* end end NEW_HEIGHT: if c15 = c14 or sflag = 0 or c7 = 1 y2 /= vpar(1) --y2 y2 *= vpar(1) /* raise the end y1 /= vpar(1) --y1 y1 *= vpar(1) /* raise the start if sflag = 0 sflag = 1 end else JKL: if c15 > c14 if t2 > 0 t1 = 0 t2 = 0 end if t1 = 2 t1 = 0 c14 = c15 + 1 else ++t1 y2 /= vpar(1) --y2 y2 *= vpar(1) /* raise the end end end if c14 > c15 if t1 > 0 t1 = 0 t2 = 0 end if t2 = 2 t2 = 0 c15 = c14 + 1 goto JKL else y1 /= vpar(1) --y1 y1 *= vpar(1) /* raise the start end end end &dA &dA &d@ 5. If all interior y-values now fall below (above) straight line &dA &d@ connecting the end points, proceed with placing slur. &dA r1 = flt(y1) + .5 - flt(vpar(2)) r2 = flt(y2 - y1) r3 = flt(c9+1) r2 = r2 / r3 c14 = 0 c15 = 0 c6 = 0 c7 = 0 c12 = c9 + 1 >> 1 c13 = c9 >> 1 + 1 loop for c5 = 1 to c9 r1 += r2 c11 = fix(r1) c11 -= profile(c5,2) if c11 > 0 if c5 <= c12 if c11 > c14 c6 = c5 c14 = c11 end end if c5 >= c13 if c11 > c15 c7 = c5 c15 = c11 end end end repeat if c6 = 0 and c7 = 0 goto FIX_ENDS end t5 = c6 t6 = c7 &dA &dA &d@ 6. Determine interior point(s) with maximum deviation. If this point &dA &d@ (all of these points) fall with the 25%-75% region of the slur, &dA &d@ increase the curvature one notch, and goto (3); otherwise goto (4). &dA c5 = 10000 / (c9 + 1) c6 *= c5 c7 *= c5 if c14 >= c15 and c6 >= 2500 and curve < 4 ++curve goto NEW_CURVE end if c14 <= c15 and c7 <= 7500 and curve < 4 ++curve goto NEW_CURVE end goto NEW_HEIGHT &dA &dA &d@ Transform to actual y-values &dA FIX_ENDS: c10 = 1000 * vpar(1) if slurlet < chr(96) /* tips up y1 = c10 - y1 y2 = c10 - y2 else y1 -= c10 y2 -= c10 end &dA &dA &d@ Adjust slur height if both ends show tuplet &dA if bit(4,ts(a6,SUPER_FLAG)) = 1 and bit(5,ts(a7,SUPER_FLAG)) = 1 c10 = 0 /* = no goto ADJS(tpflag+1) ADJS(1): if ts(a6,BEAM_FLAG) > 0 and ts(a7,BEAM_FLAG) > 0 if ts(a7,MULTI_TRACK) = 0 c10 = 1 end else c10 = 1 end goto ADJSE ADJS(2): /* always c10 = 1 goto ADJSE ADJS(3): /* never goto ADJSE ADJS(4): /* only when tips down if slurlet > chr(96) /* tips down c10 = 1 end goto ADJSE ADJS(5): /* only when tips up if slurlet < chr(96) /* tips up c10 = 1 end ADJSE: if c10 = 1 if slurlet < chr(96) /* tips up if y1 + y2 > vpar(6) << 1 y1 += vpar(2) y2 += vpar(2) end else if y1 + y2 < vpar(4) y1 -= vpar(2) y2 -= vpar(2) end end end end &dA &dA &d@ For both starting and ending chords, (1) find next empty slot in &dA &d@ in each SLUR_X row and construct the following information: &dA &dA &d@ odd numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ bit 27: start/end flag (0 = start, 1 = end) &dA &d@ bits 24-26: slur number - 1 (0 to 7) &dA &d@ bits 17-23: curvature information (end only) &dA &d@ bit 16: up/down flag (0 = tips up, 1 = tips down) (end only) &dA &d@ bits 0-15: x-offset + 1000 (always a positive number) &dA &d@ even numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ y position relative to the staff &dA PLACE_SLUR: &dA &dA &d@ Starting point &dA c10 = 1000 /* x-offset if "ACRNimnq" con slurlet /* start on "n" if ts(a6,LOCAL_XOFF) > 0 c10 += ts(a6,LOCAL_XOFF) end if mpt > 3 c10 += hpar(82) * 3 / 4 end else if "KLMfgrs" con slurlet /* start on "Y" if bit(1,ts(a6,STEM_FLAGS)) = UP if ts(c2,LOCAL_XOFF) > 0 c10 += ts(a6,LOCAL_XOFF) end if mpt > 3 c10 += hpar(82) * 3 / 4 end end else if "PQop" con slurlet /* start on "s" if mpt < 3 c10 -= hpar(82) / 3 else c10 += hpar(82) / 3 end end end end c11 = sgroup(a4,3) << 24 /* slur number c11 += c10 /* odd numbered element c12 = ts(a6,SLUR_X) loop for c13 = 7 to 31 step 2 if ts(c12,c13) = 0 goto PLACE_SLUR1 end repeat PLACE_SLUR1: ts(c12,c13) = c11 ++c13 ts(c12,c13) = y1 &dA &dA &d@ Fine tuning for special situation &dA if slurlet = "i" if ts(a6,STAFFLOC) - ts(a7,STAFFLOC) >= 0 if ts(a7,SUBFLAG_2) & 0x3c > 0 ts(c12,c13) -= vpar(2) end end end &dK &dK &d@ &dA05-27-94&d@ &dK &d@ Somehow, I can't figure out why this code was written this way &dK &d@ It seems that tips up would automatically imply that the slur &dK &d@ was under the object, and tips down would imply that the slur &dK &d@ was over the object. The revised code reflects this thought &dK &d@ (which may very well be naive). &dK &dK &d@ if "PQadet" con slurlet /* starting from over (3) &dK &d@ ts(c12,3) = y1 /*? - vpar(1) &dK &d@ end &dK &d@ if "FGHOop" con slurlet /* starting from under (4) &dK &d@ ts(c12,4) = y1 /*? + vpar(1) &dK &d@ end &dK if "opadet" con slurlet /* starting from over (3) ts(c12,3) = y1 - vpar(1) /* new value end if "FGHOPQ" con slurlet /* starting from under (4) ts(c12,4) = y1 + vpar(1) /* new value end &dA &dA &d@ Ending point &dA c10 = 1000 /* x-offset if "HMNRnafq" con slurlet /* end on "n" if ts(a7,LOCAL_XOFF) < 0 c10 += ts(a6,LOCAL_XOFF) end if mpt < 6 c10 -= hpar(82) * 3 / 4 end else if "CGLrems" con slurlet /* end on "Y" if bit(1,ts(a7,STEM_FLAGS)) = DOWN if ts(c4,LOCAL_XOFF) < 0 c10 += ts(a6,LOCAL_XOFF) end if mpt < 5 c10 -= hpar(82) * 3 / 4 end end else if "OQpt" con slurlet /* end on "s" if mpt < 3 c10 -= hpar(82) / 3 else c10 += hpar(82) / 3 end end end end c11 = sgroup(a4,3) /* slur number c11 += 16 /* end flag c11 <<= 8 c11 += curve << 1 /* curvature if slurlet > chr(96) /* tips up ++c11 /* tips up/down flag end c11 <<= 16 c11 += c10 /* x-offset c12 = ts(a7,SLUR_X) loop for c13 = 7 to 31 step 2 if ts(c12,c13) = 0 goto PLACE_SLUR2 end repeat PLACE_SLUR2: ts(c12,c13) = c11 ++c13 ts(c12,c13) = y2 &dK &dK &d@ &dA05-27-94&d@ &dK &d@ See above. I don't understand how this code got written &dK &d@ as it did. It seems self evident that the over-under &dK &d@ question is decided entirely by the direction of the &dK &d@ slur tips. &dK &dK &d@ if "OQdgio" con slurlet /* ending from over (1) &dK &d@ ts(c12,1) = y2 /*? - vpar(1) &dK &d@ end &dK &d@ if "AFKPpt" con slurlet /* ending from under (2) &dK &d@ ts(c12,2) = y2 /* + vpar(1) &dK &d@ end &dK &dK if "ptdgio" con slurlet /* ending from over (1) ts(c12,1) = y2 - vpar(1) /* new value end if "AFKPOQ" con slurlet /* ending from under (2) ts(c12,2) = y2 + vpar(1) /* new value end repeat &dA &d@ &dA ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» &dA &d@ &dA º This is the end of the loop which processes slurs º &dA &d@ &dA ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ end YYYY: repeat maxsct = a14 &dA &dA &d@***************************************************************** &dA &d@ Processing loop (loop ends at ZZZ) PROCESSING TS ARRAY &dA &dA &d@ Actions: &dA &dA &d@ I. Construct text sub-object, if present &dA &dA &d@ II. Deal with music &dA &dA &d@ A. Bar Lines &dA &dA &d@ B. Clef changes, Time changes &dA &dA &d@ C. Signs, Words, Marks &dA &dA &d@ D. Figures &dA &dA &d@ E. Notes/Rests &dA &dA &d@ 1. Accidentals &dA &d@ 2. Note heads, dots &dA &d@ 3. Leger lines &dA &d@ 4. Stems and beams &dA &dA &d@ III. Write object records into intermediate file &dA autop += firstsp loop for a1 = 1 to sct s2rec = ts(a1,XTABLE_POINT) nodtype = ts(a1,TYPE) a5 = ts(a1,TEXT_INDEX) if a5 > 0 ttext = tsdata(a5) // pad(1) else ttext = pad(1) end sobcnt = 0 obx = autop if nodtype = DIV_CHG goto ZZZ end &dA &dA &d@ Get the spn (spacing) parameter &dA spn = ts(a1,SPN_NUM) &dA &dA &d@ II. Typeset Music &dA &dA &d@ A. Typeset Bar Line &dA if nodtype = BAR_LINE a2 = hpar(36) a14 = ts(a1,BAR_TYPE) &dA &dA &d@ determine location of obx for this object &dA if bit(1,ts(a1,REPEAT)) = 1 /* backward repeat a2 += hpar(43) end a10 = hpar(43) + hpar(93) - hpar(80) &dI &d@ &dI Old Version&d@ shift for &dI &d@ forward dots(repeats) &dI &d@ a14 a2+ (add to p) a4 (1st shft) a5 (2nd shft) a8 (inc) a10 &dI &d@ ---- ---- ---- --------- ---- ----- &dI &d@ 1 0 0 0 0 a10 &dI &d@ 2 hpar(79) -hpar(79) 0 0 a10 &dI &d@ 3 0 0 0 0 a10 &dI &d@ 5 hpar(44) -a2 0 0 a10 &dI &d@ 6 hpar(81) + hpar(79) -a2 -hpar(79) 0 a10 &dI &d@ 9 0 0 +hpar(45) hpar(45) a10 + hpar(45) &dI &d@ 10 hpar(45) -hpar(45) 0 hpar(79) hpar(43)+hpar(96)-hpar(80) &dI &dA &dA &d@ hpar(44) = actual white space between two light lines &dA &d@ hpar(45) = actual white space between heavy/light, light/heavy and heavy/heavy combinations &dA &d@ hpar(79) = thickness of light line &dA &d@ hpar(81) = thickness of heavy line &dA &dA &d@ shift for &dA &d@ forward dots(repeats) &dA &d@ a14 a2+ (add to p) a4 (1st shft) a5 (2nd shft) a8 (inc) a10 &dA &d@ ---- ---- ---- --------- ---- ----- &dA &d@ 1 0 0 0 0 a10 &dA &d@ 2 { hpar(81) - hpar(79 a2 0 0 a10 &dA &d@ + 1 } &dA &d@ 3 0 0 0 0 a10 &dA &d@ 5 hpar(44) + hpar(79) a2 0 0 a10 &dA &d@ 6 { hpar(45) + hpar(81) a2 - { hpar(81) - hpar(79) 0 a10 &dA &d@ + 1 } + 1 } &dA &d@ 9 0 0 hpar(81) + hpar(45) a5 a10 + a5 &dA &d@ 10 hpar(81) + hpar(45) a2 0 { hpar(81) - hpar(43)+hpar(96)-hpar(80) &dA &d@ hpar(79) + 1 } &dA a4 = 0 a5 = 0 a8 = 0 if a14 = HEAVY a2 += hpar(81) - hpar(79) + 1 a4 = hpar(81) - hpar(79) + 1 end if a14 = DOUBLE_REG or a14 = DOUBLE_DOTTED a2 += hpar(44) + hpar(79) a4 = hpar(44) + hpar(79) end if a14 = REG_HEAVY a2 += hpar(45) + hpar(81) + 1 a4 = hpar(45) + hpar(81) + 1 a5 = 0 - (hpar(81) - hpar(79) + 1) end if a14 = HEAVY_REG a5 = hpar(81) + hpar(45) a8 = a5 a10 += a5 end if a14 = DOUBLE_HEAVY a2 += hpar(81) + hpar(45) a4 = hpar(81) + hpar(45) a8 = hpar(81) - hpar(79) + 1 a10 = hpar(43) + hpar(96) - hpar(80) end obx = autop + a2 if ts(a1,NODE_SHIFT) > 0 &dA &d@ putc node_shift for barline = ~ts(a1,NODE_SHIFT) obx += ts(a1,NODE_SHIFT) end * * put out signet signs (if present) * if bit(1,ts(a1,BAR_FLAGS)) = 1 /* segno sign out = "0" jtype = "D" jcode = 8 + sigflag pcode = 106 /* music font oby = vpar(45) if nstaves = 2 oby += 1000 end putobjpar = 0 perform putobj jcode = 5 - sigflag oby = 0 - vpar(43) perform putobj if sigflag = 0 sigflag = 1 end end * * put out fermata signs (if present) * if ts(a1,BAR_FLAGS) & 0x000c > 0 putobjpar = 0 if bit(2,ts(a1,BAR_FLAGS)) = 1 /* fermata over bar out = "0" jtype = "D" jcode = 5 pcode = 101 /* music font oby = 0 - vpar(3) obx -= vpar(2) perform putobj obx += vpar(2) end if bit(3,ts(a1,BAR_FLAGS)) = 1 /* fermata under bar out = "0" jtype = "D" jcode = 9 pcode = 102 /* music font oby = vpar(3) + vpar(8) if nstaves = 2 oby += 1000 end obx -= vpar(2) perform putobj obx += vpar(2) end end oby = 0 &dA &dA &d@ contruct superobject string for bar line &dA supcnt = 0 * look for termination of ending a9 = ts(a1,BACK_ENDING) if a9 <> 0 if esnum > 0 ++supcnt supnums(supcnt) = esnum a6 = esnum else return 4 end esnum = 0 end * look for termination of long trill ~~~~ if bit(0,ts(a1,BAR_FLAGS)) = 0 loop for a3 = 1 to MAX_PASS if tsnum(a3) > 0 ++supcnt /* stop trill supnums(supcnt) = tsnum(a3) end repeat end * look for origination of ending if ts(a1,FORW_ENDING) > 0 ++snum esnum = snum ++supcnt supnums(supcnt) = esnum end * construct supernumber string for object out = chs(supcnt) loop for a3 = 1 to supcnt out = out // " " // chs(supnums(a3)) repeat supcnt = 0 &dA &dA &d@ Typeset elements of the bar line &dA * numbered measure /* Code added &dA02-23-97&d@ a3 = ts(a1,M_NUMBER) if a3 > 0 c5 = 38 perform spacepar c5 = spc(176) >> 1 /* space for small "0" if a3 > 9 c5 <<= 1 end sobl(1) = "W " // "-" // chs(c5) // " 0 38 " sobcnt = 1 if a3 > 9 c5 = a3 / 10 a3 = rem sobl(1) = sobl(1) // "\0" // chs(c5) end sobl(1) = sobl(1) // "\0" // chs(a3) end * back-repeat if bit(1,ts(a1,REPEAT)) = 1 /* backward repeat x = autop + hpar(36) y = vpar(3) z = 44 /* music font perform subj y = vpar(5) perform subj end * first of double bar y = 0 if a14 > 3 a3 = a14 & 0x0c z = a3 / 2 + 80 /* music font x = obx - a4 perform subj end * second or single bar a3 = ts(a1,BAR_TYPE) & 0x03 z = a3 * 2 + 80 /* music font x = obx + a5 perform subj * forward-repeat if bit(0,ts(a1,REPEAT)) = 1 /* forward repeat x = obx + a10 a8 += hpar(43) y = vpar(3) z = 44 /* music font perform subj y = vpar(5) perform subj end * put out object (and sub-objects) jtype = "B" jcode = ts(a1,BAR_NUMBER) if sobcnt = 1 pcode = z /* music font else pcode = sobcnt end oby = ts(a1,NUM_STAVES) - 1 * 1000 + a14 putobjpar = 0 perform putobj &dA &dA * put out ending super-object if a9 <> 0 /* backward ending if ts(a1,FORW_ENDING) > 0 out = "-" // chs(hpar(41)) else out = "0" end out = out // " -" // chs(vpar(40)) // " " out = out // chs(vpar(41)) // " " if a9 > 0 /* ending stops out = out // chs(vpar(41)) else /* ending discontinues a9 = 0 - a9 out = out // "0" end ++outpnt tput [Y,outpnt] H ~a6 E ~a9 0 ~out end * put out long trill super-object if bit(0,ts(a1,BAR_FLAGS)) = 0 loop for c5 = 1 to MAX_PASS if tsnum(c5) > 0 out = "H " // chs(tsnum(c5)) // " R " // chs(ctrarrf(c5)) out = out // " 0" ++outpnt tput [Y,outpnt] ~out -~hpar(42) ~try(c5) tsnum(c5) = 0 ctrarrf(c5) = 0 end repeat end * adjust autop autop = obx + ts(a1,SPACING) + a8 goto ZZZ end &dA &dA &d@ B. Typeset Clef change, Time change, Key change &dA if nodtype = CLEF_CHG a3 = ts(a1,STAFF_NUM) + 1 /* staff number if ts(a1,NODE_SHIFT) < 0 a7 = 0 - ts(a1,NODE_SHIFT) &dK &d@ putc backing up clef sign by amount = ~a7 autop += ts(a1,NODE_SHIFT) end obx = autop clef(a3) = ts(a1,CLEF_NUM) active_clef = clef(a3) z = ts(a1,CLEF_FONT) /* music font k = ts(a1,TRANS_FLAG) oby = ts(a1,STAFF_NUM) * 1000 /* added &dA5-28-93&d@ oby += ts(a1,CLEF_STAFF_POS) perform putclef (a3) autop += ts(a1,SPACING) goto ZZZ end * if nodtype = DESIGNATION jtype = "D" jcode = 5 obx = autop oby = ts(a1,STAFF_NUM) * 1000 /* added &dA5-28-93&d@ oby -= tword_height * vpar(1) out = "0" sobl(1) = "" temp3 = "W 0 0 37 " // ttext pcode = 1 putobjpar = 0 perform putobj goto ZZZ end * if nodtype = METER_CHG tnum = ts(a1,TIME_NUM) / 100 tden = rem oby = 0 k = autop loop for h = 1 to ts(a1,NUM_STAVES) autop = k perform settime (a3) oby += 1000 repeat if tnum = 1 and tden = 1 tnum = 4 tden = 4 end if tnum = 0 and tden = 0 tnum = abflg tden = 2 end goto ZZZ end * if nodtype = AX_CHG h = ts(a1,3) /* new key k = ts(a1,4) /* old key a3 = ts(a1,NUM_STAVES) /* number of staves a4 = 0 perform key_change (h, k, a3, a4) /* emptyspace(.,.) not set key = h end &dA &dA &d@ C. Typeset Signs, Words and Marks which are Objects &dA if nodtype = SIGN or nodtype = WORDS or nodtype = MARK putobjpar = 0 * obx = autop a4 = ts(a1,TEXT_INDEX) ttext = tsdata(a4) ttext = trm(ttext) out = "0" &dA &dA &d@ determine vertical positions of object and superobject &dA if ts(a1,SIGN_TYPE) = SEGNO oby = 0 - vpar(43) else if ts(a1,SIGN_POS) = ABOVE oby = 0 - vpar(44) else oby = vpar(45) end end oby1 = oby oby2 = oby obx1 = obx obx2 = obx if ts(a1,POSI_SHIFT1) > 0 a3 = ts(a1,POSI_SHIFT1) & 0xff if a3 > 0 oby1 = a3 - 0x80 * vpar(2) / 10 yposi_shift = 0 else a3 = ts(a1,POSI_SHIFT1) >> 8 yposi_shift = a3 & 0xff if yposi_shift > 0 yposi_shift = yposi_shift - 0x80 * vpar(2) / 10 end end xposi_shift = ts(a1,POSI_SHIFT1) >> 16 if xposi_shift > 0 xposi_shift = xposi_shift - 0x80 * vpar(2) / 10 end else yposi_shift = 0 xposi_shift = 0 end obx1 += xposi_shift oby1 += yposi_shift if ts(a1,POSI_SHIFT2) > 0 a3 = ts(a1,POSI_SHIFT2) & 0xff if a3 > 0 oby2 = a3 - 0x80 * vpar(2) / 10 yposi_shift = 0 else a3 = ts(a1,POSI_SHIFT2) >> 8 yposi_shift = a3 & 0xff if yposi_shift > 0 yposi_shift = yposi_shift - 0x80 * vpar(2) / 10 end end xposi_shift = ts(a1,POSI_SHIFT2) >> 16 if xposi_shift > 0 xposi_shift = xposi_shift - 0x80 * vpar(2) / 10 end else yposi_shift = 0 xposi_shift = 0 end obx2 = xposi_shift oby2 += yposi_shift temp = " " // chs(oby1) temp2 = " " // chs(oby2) a2 = ts(a1,SUPER_TYPE) * construct superflags for object if a2 > 0 a3 = a2 + 1 / 2 a8 = 0 if a3 = 4 a8 = 1 a3 = 3 end if rem = 0 /* start of super-object a4 = a3 - WEDGES * 5 + ts(a1,TRACK_NUM) /* row element loop for a5 = 1 to 5 if smusdir(a4,1) = 0 /* must be zero to use a5 = 1000 else /* else look at others ++a4 if a4 > a3 * 5 a4 -= 5 /* in the set end end repeat if a5 <> 1000 putc Too many active ... if a3 = WEDGES putc wedges. else if a3 = DASHES putc sets of dashes. else putc transpositions of one type. end end putc Typesetting halted return 10 end ++snum smusdir(a4,1) = snum smusdir(a4,4) = oby2 if a3 = WEDGES smusdir(a4,2) = ts(a1,WEDGE_SPREAD) smusdir(a4,3) = ts(a1,WEDGE_OFFSET) + obx2 else if a3 = DASHES if ts(a1,FONT_NUM) = 0 c5 = mtfont else c5 = ts(a1,FONT_NUM) end smusdir(a4,3) = c5 perform wordspace smusdir(a4,2) = a5 + obx2 else smusdir(a4,3) = obx2 smusdir(a4,4) -= oby /* tricky code if a3 = OCT_UP smusdir(a4,2) = 0 end if a3 = OCT_DOWN smusdir(a4,2) = 1 end if a3 = DBL_OCT_UP smusdir(a4,2) = 2 end if a3 = DBL_OCT_DOWN smusdir(a4,2) = 3 end end end else /* end of super-object a4 = a3 - WEDGES * 5 + ts(a1,TRACK_NUM) /* row element loop for a5 = 1 to 5 if smusdir(a4,1) <> 0 /* must be non zero to use a5 = 1000 else /* else look at others ++a4 if a4 > a3 * 5 a4 -= 5 /* in the set end end repeat if a5 <> 1000 putc Attempt to end a ... if a3 = WEDGES putc wedge ... else if a3 = DASHES putc set of dashes ... else putc transposition of a type ... end end putc that wasn't properly started. putc Typesetting halted return 10 end save_a4 = a4 end out = "1 " // chs(smusdir(a4,1)) end &dA &dA &d@ if single character, write object &dA a3 = ts(a1,SIGN_TYPE) if a3 = PED or a3 = END_PED pcode = 112 + a3 /* music font jtype = "S" jcode = 0 obx = obx1 oby = ts(a1,STAFF_NUM) * 1000 + oby1 if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj goto VT2 end if a3 = LETTER_DYNAM /* one letter dynamics if ttext con "Z" #if SFZ ttext{mpt,1} = "sfz" #else ttext{mpt,1} = "sf" #endif end if len(ttext) = 1 and "pf" con ttext if mpt = 1 pcode = 108 /* music font else pcode = 110 /* music font end jtype = "S" jcode = 0 obx = obx1 oby = ts(a1,STAFF_NUM) * 1000 + oby1 if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj goto VT2 end end &dA &dA &d@ put out segno signs (as directives) &dA if a3 = SEGNO pcode = 106 /* music font jtype = "D" jcode = 8 + sigflag obx = obx1 oby = ts(a1,STAFF_NUM) * 1000 + vpar(45) /* oby reset here if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj jcode = 5 - sigflag oby = ts(a1,STAFF_NUM) * 1000 + oby1 if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj if sigflag = 0 sigflag = 1 end goto VT2 end &dA &dA &dA &d@ This code added &dA10-12-96&d@ &dA &dA &dA &d@ Put out mark for tie terminator &dA if a3 = TIE_TERM jtype = "M" jcode = 0 obx = obx1 + hpar(81) + hpar(45) /* guarenteed to put you beyond bar line oby = 0 pcode = 0 c7 = ts(a1,BACKTIE) c7 = ts(c7,BACKTIE) out = "1 " // chs(tiearr(c7,TIE_SNUM)) perform putobj &dA &dA &d@ Now put out the Tie Super-object &dA &dA &d@ compute sitf (situation flag) &dA &dA &d@ Description of sitf: range 1 to 16 &dA &d@ &dA &d@ If the range were from 0 to 15, then bits 3 to 0 &dA &d@ would have the following meanings: &dA &d@ &dA &d@ zero | one &dA &d@ -------------------------------------------- &dA &d@ bit 3: tips down | tips up &dA &d@ bit 2: note on space | note on line &dA &d@ bit 1: no stem interfenence | stem interference &dA &d@ bit 0: staff interference | no staff interference &dA c9 = tiearr(c7,TIE_VLOC) c10 = tiearr(c7,TIE_FHDIS) /* local x-offset for first note c11 = 0 /* local x-offset for second note c12 = tiearr(c7,TIE_FORCE) /* force flag if c12 = 3 c12 = 9 end &dA &dA &d@ Rules for single note &dA c5 = tiearr(c7,TIE_FSTEM) if c5 = 0 sitf = 9 /* stem up else sitf = 1 end if c12 > 0 sitf = c12 /* forced situation end if tiearr(c7,TIE_FSTEM) = UP and sitf < 9 sitf += 2 /* stem interference end &dA &dA &d@ Note: you won't know if there is staff interference until &dA &d@ you know the final length of the tie &dA c9 += tiearr(c7,TIE_STAFF) * 1000 ++outpnt tput [Y,outpnt] H ~tiearr(c7,TIE_SNUM) T ~c9 ~c10 ~c11 0 0 0 ~sitf 0 tiearr(c7,TIE_SNUM) = 0 ts(a1,BACKTIE) = 0 goto VT2 end &dA &d@ &dA &d@ End of &dA10-12-96&d@ addition &dA &dA if nodtype = MARK jtype = "M" jcode = 0 obx = obx1 oby = 0 pcode = 0 if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj goto VT2 end * words if nodtype = WORDS jtype = "D" jcode = 0 if ttext = "Fine" jcode = 9 end if ttext = "fine" jcode = 9 end if ttext = "[fine]" jcode = 9 end if ttext con " " if ttext{1,mpt-1} = "da" jcode = 9 end if ttext{1,mpt-1} = "dal" jcode = 9 end if ttext{1,mpt-1} = "Dal" jcode = 9 end if ttext{1,mpt-1} = "Da" jcode = 9 end if ttext con " da " jcode = 9 end end if ttext con "D.C." or ttext con "D. C." jcode = 9 end pcode = 1 a4 = ts(a1,FONT_NUM) if a4 = 0 a4 = mdirfont end if a3 > 4 if a3 < 7 c5 = a4 perform wordspace if a3 = 6 a5 /= 2 else a5 += 10 end else a5 = 0 end end if a5 > 0 temp3 = "W -" // chs(a5) else temp3 = "W 0" end temp3 = temp3 // temp // " " // chs(a4) // " " // ttext sobl(1) = "" obx = obx1 oby = ts(a1,STAFF_NUM) * 1000 if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj goto VT2 end * multi-letter dynamics jtype = "S" jcode = 0 pcode = len(ttext) obx = obx1 oby = oby1 x = obx y = oby loop for a4 = 1 to pcode if "pmfszr" con ttext{a4} z = mpt + 107 /* music font mpt += 59 perform subj x += hpar(mpt) end repeat oby = ts(a1,STAFF_NUM) * 1000 + oby if ts(a1,ISOLATED) = 1 jtype = "I" end perform putobj &dA &dA &d@ put out super-objects &dA VT2: a2 = ts(a1,SUPER_TYPE) if a2 > 0 a2 /= 2 if rem = 0 and a2 >= 1 and a2 <= 6 a4 = save_a4 /* this was computed above if a2 = WEDGES * wedges line = chs(smusdir(a4,2)) // " " line = line // chs(ts(a1,WEDGE_SPREAD)) // " " line = line // chs(smusdir(a4,3)) // " " // chs(smusdir(a4,4)) // " " line = line // chs(ts(a1,WEDGE_OFFSET) + obx2) // " " // chs(smusdir(a4,4)) ++outpnt tput [Y,outpnt] H ~smusdir(a4,1) W ~line end if a2 = DASHES * dashes if ts(a1,SIGN_TYPE) = LETTER_DYNAM a6 = obx2 - (2 * hpar(46)) else a6 = obx2 end line = chs(a6) // " " // chs(smusdir(a4,4)) // " 0" a6 = smusdir(a4,3) ++outpnt tput [Y,outpnt] H ~smusdir(a4,1) D ~smusdir(a4,2) ~line ~a6 end * range shifts /* ??? rewrite to deal with x-shifts if chr(a2) in [OCT_UP,OCT_DOWN,DBL_OCT_UP,DBL_OCT_DOWN] if a2 = OCT_UP or a2 = DBL_OCT_UP a5 = smusdir(a4,4) + vpar(47) else a5 = smusdir(a4,4) - vpar(46) end line = chs(smusdir(a4,2)) // " " // chs(smusdir(a4,3)) // " " a6 = obx2 - hpar(47) line = line // chs(a6) // " " // chs(a5) // " " // chs(vpar(41)) ++outpnt tput [Y,outpnt] H ~smusdir(a4,1) V ~line end smusdir(a4,1) = 0 /* clear the row for next use end end if ts(a1,DINC_FLAG) > 0 inctype = ts(a1,DINC_FLAG) end goto ZZZ end &dA &dA &d@ D. Typeset Figures &dA if nodtype = FIGURES obx = autop &dA &dA &d@ We need to run a little check here. If there is an element &dA &d@ in the ts array that has the same division number and is a note or &dA &d@ cue-note, then the possibility exist that this object might &dA &d@ have to be shifted to the right in order to be placed under &dA &d@ the note (and not under some accidental to the note). &dA if ts(a1+1,DIV) = ts(a1,DIV) if ts(a1+1,TYPE) = NOTE or ts(a1+1,TYPE) = CUE_NOTE obx += ts(a1+1,NODE_SHIFT) autop += ts(a1+1,NODE_SHIFT) ts(a1+1,NODE_SHIFT) = 0 if ts(a1+1,SPACING) < ts(a1,MIN_FIG_SPAC) ts(a1+1,SPACING) = ts(a1,MIN_FIG_SPAC) end end end a3 = FIG_DATA supcnt = 0 * determine if accidentals precede any figures in this set loop for a2 = 1 to 4 mf(a2) = 0 repeat a10 = FIG_DATA loop for a2 = 1 to ts(a1,NUMBER_OF_FIG) a4 = ts(a1,a10) + 28 /* tricky code, possible rewrite temp = chr(a4) if "1389" con temp if ts(a1,a10+1) > 0 and ts(a1,a10+1) < 20 mf(a2) = a4 - 48 end end a10 += 3 repeat * construct sub-objects oby = vpar(49) y = vpar(49) loop for a2 = 1 to ts(a1,NUMBER_OF_FIG) x = obx a6 = ts(a1,a3) if a6 > 0 if mf(a2) > 0 a9 = mf(a2) + 67 a9 = hpar(a9) x = obx - a9 z = mf(a2) + 210 /* music font else a9 = hpar(66) if a6 = 30 z = 220 /* music font else if a6 < 10 z = a6 + 199 else if a6 < 20 z = 200 perform subj x += a9 z = a6 + 189 else a9 = a6 + 47 a9 = hpar(a9) z = a6 + 190 end end end end perform subj x += a9 a6 = ts(a1,a3+1) if a6 > 0 a9 = hpar(66) if a6 < 10 z = a6 + 199 else if a6 < 20 z = 200 perform subj x += a9 z = a6 + 189 else a9 = a6 + 47 a9 = hpar(a9) z = a6 + 190 end end perform subj x += a9 end end * set up for dealing with continuation lines if ts(a1,a3+2) = 2 ++snum figarr(a2,FIG_SNUM) = snum dv4 = x - obx if a6 > 0 dv4 += hpar(66) end figarr(a2,FIG_HOFF1) = dv4 ++supcnt supnums(supcnt) = snum end if ts(a1,a3+2) = 1 figarr(a2,FIG_HOFF2) = hpar(77) figarr(a2,FIG_READY) = 1 ++supcnt supnums(supcnt) = figarr(a2,FIG_SNUM) end a3 += 3 y += vpar(48) repeat * put out object and sub-objects out = chs(supcnt) loop for a3 = 1 to supcnt out = out // " " // chs(supnums(a3)) repeat supcnt = 0 jtype = "F" jcode = 0 pcode = sobcnt oby = ts(a1,STAFF_NUM) * 1000 + oby &dA &dA &d@ Now look for print suggestions for this figure object &dA putobjpar = 0 c5 = ts(a1,TSR_POINT) pcontrol = ors(tsr(c5){1}) if bit(0,pcontrol) = 1 px = ors(tsr(c5){2}) << 8 py = ors(tsr(c5){4}) << 16 if py > 0 putobjpar = pcontrol + px + py + 0x1000000 else py = ors(tsr(c5){3}) << 16 putobjpar = pcontrol + px + py end end perform putobj * write out continuation line super-objects loop for a2 = 1 to MAX_FIG if figarr(a2,FIG_READY) > 0 ++outpnt tput [Y,outpnt] H ~figarr(a2,FIG_SNUM) F ~a2 ~figarr(a2,FIG_HOFF1) ~figarr(a2,FIG_HOFF2) loop for a3 = 1 to 4 figarr(a2,a3) = 0 repeat end repeat a4 = ts(a1,FIG_SPACE) if a4 > 0 autop += a4 end if ts(a1,DINC_FLAG) > 0 inctype = ts(a1,DINC_FLAG) end goto ZZZ end &dA &dA &d@ ================================================================= &dA &d@ GENERAL SECTION COMMENT &dA &dA &d@ At this point, we have only notes (grace, regular and cue) &dA &d@ and rests (regular and cue) left to typeset. This is actually &dA &d@ where the process becomes interesting and can be quite complex. &dA &d@ For music on the grand staff (the most complex situation) &dA &d@ there can be as many as &dDten&d@ (&dDMAX_PASS&d@) passes and as many as &dA &d@ &dDsix&d@ notes in a single pass (maximum chord size) &dA &dA &d@ We need to review the way note events are organized in the set &dA &d@ array and how this relates to the way they are organized in the &dA &d@ i-files. In the i-files, the basic unit of organization is the &dA &d@ object. An object can contain a note, a set of notes (chord), or a &dA &d@ rest. Items which normally attach to notes such as accidentals, &dA &d@ ornaments, articulations, leger lines, etc., are included as &dA &d@ sub-objects to the object. Items which normally connect notes such &dA &d@ as beams, ties, and slurs, are represented by superobjects. Among &dA &d@ the parameters associated with an object are (1) &dDhorizontal location&d@, &dA &d@ (2) &dDspace node number&d@, and (3) &dDdistance&d@ &dDincrement flag&d@. &dA &dA &d@ &dDThe first level of organization in the set array is by division&d@. &dA &d@ A division is a time-location with a measure. A division may have &dA &d@ several note events belonging to it (as well as other types of events, &dA &d@ which, at this point in the program have already been dealt with). &dA &d@ &dDAll members of a division will have the same space node number.&d@ &dA &d@ The first object in a division will have a non-zero distance &dA &d@ increment flag. This feature is handled automatically by the &dA &d@ putobj procedure. &dA &dA &d@ Within a division, we first find all of the grace notes (and &dA &d@ grace chord notes). Since grace notes generally precede regular and &dA &d@ cue notes, these notes can have non-zero advance-space parameters &dA &d@ associated with them. This means that grace notes objects can &dA &d@ advance the horizontal location pointer. On the other hand, cue-size &dA &d@ and regular objects will generally have the same horizontal location &dA &d@ (except for for shifts to accomodate clashes). &dA &dA &d@ From the above analysis, we can see that &dDthe next level of&d@ &dA &d@ &dDorganization in the set array is by general location&d@. In particular, &dA &d@ grace notes will tend fall into one or more groups, each having a &dA &d@ separate general location. All cue-size and regular notes (and &dA &d@ rests will have the same general location. &dA &dA &d@ Finally &dDthe lowest level of organization in the set array is by&d@ &dA &d@ &dDactual object&d@. Only notes of the same chord will share the same &dA &d@ object. &dA &dA &d@ We are currently inside a big loop, which begins under the title &dA &d@ "&dLProcessing loop (loop ends at ZZZ)&d@". The loop itself is initiated &dA &d@ by the instruction "&dNloop for a1 = 1 to sct&d@". The variable "spn", &dA &d@ which is the space node number, is retrieved from storage at the top &dA &d@ of this loop. It is based on division number. We do not need to &dA &d@ process all notes and rests on a particular division at one time; we &dA &d@ may proceed down to the next level of organization within the set &dA &d@ array, which is the general location. The key variable in &dA &d@ determining this grouping is the space parameter "&dLSPACING&d@". The &dA &d@ first ts(.,.) ROW element of a general location group will have a &dA &d@ non-zero space parameter, and any other element in such a group will &dA &d@ have a space parameter = 0. &dA &dA &d@ In typesetting a group of notes at a general location, the &dA &d@ following information is required. &dA &dA &d@ (1) The number of passes (chords or single notes) in the group &dA &d@ (2) The number of set array elements in each of these passes &dA &d@ (3) a4 = the spacing parameter for this group &dA &d@ (4) a2 = index to last element in group &dA &d@ &dA &d@ END OF COMMENT &dA &d@ &dA &d@ ================================================================= &dA &d@ &dA &dA &d@ E. Notes/Rests &dA a4 = ts(a1,SPACING) if ts(a1,NODE_SHIFT) > 0 &dK &d@ dputc shifting division number ~ts(a1,DIV) by the amount = ~ts(a1,NODE_SHIFT) autop += ts(a1,NODE_SHIFT) end npasses = 1 a3 = 1 loop for a2 = a1+1 to sct if ts(a2,SPACING) <> 0 --a2 pitchcnt(npasses) = a3 goto XX1 end if ts(a2,TYPE) > NOTE_OR_REST --a2 pitchcnt(npasses) = a3 goto XX1 end if nodtype = GR_NOTE if ts(a2,TYPE) = XGR_NOTE ++a3 else pitchcnt(npasses) = a3 a3 = 1 ++npasses end else if ts(a2,TYPE) = XNOTE or ts(a2,TYPE) = XCUE_NOTE ++a3 else pitchcnt(npasses) = a3 a3 = 1 ++npasses end end repeat XX1: &dA &dA &d@ Create objects for this node &dA &dA &d@ a1 = index to first element in node &dA &d@ a2 = index to last element in node &dA &d@ npasses = number of passes (separate chords) in this node &dA &d@ pitchcnt(.) = size of chord for each pass &dA &d@ a4 = space parameter (space following this node) &dA &dA &dA &d@ I. Typeset objects in this node &dA c2 = a1 - 1 loop for a14 = 1 to npasses obx = autop c1 = c2 + 1 /* top of chord c2 = c1 + pitchcnt(a14) - 1 /* bottom of chord a3 = ts(c1,STAFF_NUM) + 1 /* staff number passnum = ts(c1,PASSNUM) oby = ts(c1,OBY) ntype = ts(c1,NTYPE) nodtype = ts(c1,TYPE) &dA &dA &dA &d@ I. Construct Text Sub-Object (new to this position &dA06-26-94&d@ ) &dA if nodtype = NOTE c5 = ts(c1,TEXT_INDEX) if c5 > 0 ttext = tsdata(c5) // pad(1) else ttext = pad(1) end if ttext{1} in ['A'..'Z','a'..'z','!'..'(','\','='] c5 = mtfont perform spacepar temp2 = ttext if temp2 con "$$$$" ttext = temp2{1,mpt-1} c4 = int(temp2{mpt+4..}) /* x offset (calculated earlier) else dputc Program Error end temp2 = ttext // "| " ttextcnt = 0 CCCD: if temp2 con "|" ttext = temp2{1,mpt-1} temp2 = temp2{mpt+1..} ++ttextcnt ttextarr(ttextcnt) = trm(ttext) goto CCCD end loop for a7 = 1 to ttextcnt ttext = ttextarr(a7) &dA &dA &d@ determine values of xbytearr &dA a6 = len(ttext) xbytearr(a7) = "* " if "-_" con ttext{a6} ttext = ttext{1,a6-1} xbytearr(a7) = "-_"{mpt} // " " if mpt = 2 a6 = len(ttext) if ",.;:!?" con ttext{a6} ttext = ttext{1,a6-1} xbytearr(a7) = ",.;:!?"{mpt} // " " end end end ttextarr(a7) = ttext repeat &dA &dA &d@ determine length of ttext &dA a5 = 0 loop for a7 = 1 to ttextcnt c5 = 0 ttext = ttextarr(a7) loop for c14 = 1 to len(ttext) * adjust for backslash (\) sequence if ttext{c14} = "\" a6 = ors(ttext{c14+2}) if ttext{c14+1} = "0" a6 += 128 end c14 += 2 else a6 = ors(ttext{c14}) end c5 += spc(a6) repeat if c5 > a5 a5 = c5 end repeat &dA &dA &d@ determine relative position of ttext &dA * x = autop - c4 sobx = x - obx loop for a8 = 1 to ttextcnt ttext = ttextarr(a8) ++sobcnt temp3 = "T " // chs(sobx) // " " // chs(a8) // " " if ttext con "=" ttext{mpt} = "-" end temp3 = temp3 // ttext // " " sobl(sobcnt) = temp3 // xbytearr(a8) // chs(a5) repeat end end &dA &dA &dA note_dur = ts(c1,NOTE_DUR) /* Added &dA11-11-93&d@ if nodtype <= REST passtype = REG passsize = FULLSIZE if bit(16,ts(c1,SUBFLAG_1)) = 1 passsize = CUESIZE /* EXPERIMENT &dA06-24-94&d@ end else passsize = CUESIZE if nodtype <= CUE_REST passtype = CUE else passtype = GRACE end end &dA &dA &d@ a) rests &dA if nodtype = REST or nodtype = CUE_REST c3 = ts(c1,STAFF_NUM) * 1000 s2rec = ts(c1,XTABLE_POINT) perform setrest (c9) /* OK 6-23-93 goto ZZZZ end &dA &dA &d@ b) notes &dA &dA &d@ leger lines hpar(82) = width of black note (for typesetting) &dA &d@ hpar(83) = width of whole note (for typesetting) &dA c7 = c2 c8 = c1 c9 = 0 stem = bit(1,ts(c1,STEM_FLAGS)) if stem = UP chord_spread = ts(c2,STAFFLOC) - ts(c1,STAFFLOC) else chord_spread = ts(c1,STAFFLOC) - ts(c2,STAFFLOC) end super_flag = 0 slur_flag = 0 loop for c3 = c1 to c2 super_flag |= ts(c3,SUPER_FLAG) slur_flag |= ts(c3,SLUR_FLAG) repeat s2rec = ts(c1,XTABLE_POINT) c4 = c2 - c1 + 1 if c4 > 1 s2rec = c4 << 16 + s2rec end if ntype > HALF c9 = hpar(83) - hpar(82) + 1 end perform setleger /* looks O.K. 6-24-93 &dA &dA &d@ accidentals &dA loop for c3 = c1 to c2 c4 = ts(c3,AX) if c4 > 0 y = ts(c3,STAFFLOC) perform setax /* looks O.K. 6-24-93 end repeat &dA &dA &d@ note heads and dots &dA z1 = 50 - ntype /* music font if z1 > 43 /* music font z1 = 43 /* music font end if passsize = CUESIZE z1 += 128 /* music font end loop for c3 = c1 to c2 if c3 = c1 obx = ts(c1,GLOBAL_XOFF) + autop end x = obx + ts(c3,LOCAL_XOFF) y = ts(c3,STAFFLOC) z = z1 perform subj c10 = y / notesize c10 = rem if y <= 0 - notesize if c10 <> 0 y += vpar(1) end perform wideleger /* looks O.K. 6-24-93 end if y >= vpar(10) if c10 <> 0 y -= vpar(1) end perform wideleger end perform setdots /* looks O.K. 6-24-93 repeat &dA &dA &d@ look for forward tie, slur and tuplet super-objects &dA x = obx y = oby perform superfor /* operates on entire chord &dA &dA &d@ set certain articulations above or below notes or stems &dA perform setart /* operates on entire chord &dA &dA &d@ if there are slurs entering or leaving this chord, adjust virtual &dA &d@ endpoints at this time. &dA c14 = ts(c1,SLUR_X) c8 = 0 /* slur present flag if c14 > 0 c5 = ts(c14,1) c4 = ts(c14,3) if c4 <> c5 c8 = 2 /* slur present above (usually) end if c4 < c5 c5 = c4 /* above end c4 = ts(c14,2) c6 = ts(c14,4) if c4 <> c6 c8 = 1 /* slur present below (usually) end if c6 > c4 c4 = c6 /* below end if stem = DOWN c6 = c4 c4 = c5 c5 = c6 if c8 <> 0 c8 = 3 - c8 end end loop for c6 = c1 to c2 ts(c6,VIRT_STEM) = c5 ts(c6,VIRT_NOTE) = c4 repeat else c5 = ts(c1,VIRT_STEM) c4 = ts(c1,VIRT_NOTE) end &dA &dA &d@ set more indications &dA perform setperf /* operates on entire chord &dA &dA &d@ set forte and piano &dA if and(0x3c00,ts(c1,SUBFLAG_1)) > 0 c7 = stem px = 0 py = 0 pyy = 0 c5 = 15 /* dynamics code = 15 perform getpxpy (c5) if bit(0,pcontrol) = 1 if bit(1,pcontrol) = 1 if bit(2,pcontrol) = 0 c7 = 1 - stem else c7 = stem end end end c5 = ts(c1,VIRT_STEM) c4 = ts(c1,VIRT_NOTE) c13 = 0 perform yadjust if c7 = stem if stem = DOWN y = c5 + vpar(5) else y = c4 + vpar(5) end else if stem = UP y = c5 - vpar(2) else y = c4 - vpar(2) end end x = obx + px if pyy = 1 y = py else y += py end c7 = ts(c1,SUBFLAG_1) >> 10 c7 &= 0x0f if c7 < 5 /* p, pp, ppp, pppp z = 108 loop while c7 > 0 perform subj x += hpar(60) --c7 repeat else if c7 < 9 /* f, ff, fff, ffff z = 110 loop while c7 > 4 perform subj x += hpar(62) --c7 repeat else if c7 < 11 /* mp, mf z = 109 /* music font perform subj x = obx + hpar(61) + px z = c7 * 2 + 90 /* music font perform subj else if c7 = 11 /* fp z = 110 /* music font perform subj x = obx + hpar(62) + px z = 108 /* music font perform subj else if c7 = 12 /* sfp z = 111 /* music font perform subj x = obx + hpar(63) + px z = 110 /* music font perform subj x += hpar(62) z = 108 /* music font perform subj else if c7 > 13 /* sfz, rfz z = c7 * 2 + 83 /* music font perform subj c8 = z - 48 x = obx + hpar(c8) + px end z = 110 /* music font perform subj #if SFZ x += hpar(62) z = 112 /* music font perform subj #endif end end end end end end loop for c3 = c1 to c2 ts(c3,VIRT_NOTE) = c4 ts(c3,VIRT_STEM) = c5 repeat &dA &dA &d@ set stems and beams for this note &dA if stem = UP c3 = c1 else c3 = c2 end perform setstem /* (revised for multiple notes) &dA &dA &d@ determine super-objects &dAwhich end&d@ on this note or which &dA &d@ contain this note (such as beams) &dA &dA &d@ 1) beams &dA if ts(c1,BEAM_FLAG) > 0 ++supcnt supnums(supcnt) = beampar(passtype,passnum,BM_SNUM) end &dA &dA &d@ 2) ties which end on this note &dA loop for c3 = c1 to c2 c7 = ts(c3,BACKTIE) if c7 > 0 if c7 < INT10000 /* c7 = index to ts element which starts the tie c7 = ts(c7,BACKTIE) /* c7 now points to ROW of tiearr else c7 -= INT10000 end ++supcnt supnums(supcnt) = tiearr(c7,TIE_SNUM) end ts(c3,BACKTIE) = c7 /* now set BACKTIE to point directly to ROW of tiearr repeat &dA &dA &d@ 3) slurs (revised for multiple notes) &dA loop for c4 = 1 to 4 c5 = c4 * 2 - 1 if bit(c5,slur_flag) = 1 ++supcnt supnums(supcnt) = slurar(c4,SL_SNUM) end if bit(c5+16,slur_flag) = 1 ++supcnt supnums(supcnt) = slurar(c4+4,SL_SNUM) end repeat &dA &dA &d@ 4) tuplets (revised for multiple notes) &dA if bit(5,super_flag) = 1 ++supcnt supnums(supcnt) = tuar(passtype,passnum,TU_SNUM) end &dA &dA &d@ 5) long trills (revised for multiple notes) &dA if tsnum(passnum) > 0 and bit(3,super_flag) = 1 /* long trill ending ++supcnt supnums(supcnt) = tsnum(passnum) end &dA &dA &d@ New code (&dA11-11-93&d@) Duration attribute of note &dA ++sobcnt sobl(sobcnt) = "A D " // chs(note_dur) // " " // chs(divspq*4) &dA &dA &d@ Write out Object Record and associated Sub-Objects &dA out = chs(supcnt) loop for c4 = 1 to supcnt out = out // " " // chs(supnums(c4)) repeat if nodtype = GR_NOTE or nodtype = XGR_NOTE jtype = "G" else jtype = "N" end jcode = ntype pcode = sobcnt c10 = ts(c1,STAFF_NUM) * 1000 oby += c10 &dA &dA &d@ Now look for print suggestions for this note object &dA putobjpar = 0 c4 = ts(c1,TSR_POINT) pcontrol = ors(tsr(c4){1}) if bit(0,pcontrol) = 1 px = ors(tsr(c4){2}) << 8 py = ors(tsr(c4){4}) << 16 if py > 0 putobjpar = pcontrol + px + py + 0x1000000 else py = ors(tsr(c5){3}) << 16 putobjpar = pcontrol + px + py end end perform putobj oby -= c10 &dA &dA &d@ Write out completed Super-Objects and set up new ones &dA &dA &d@ 1) Tuples &dA if bit(5,super_flag) = 1 /* (revised for multiple notes) &dA &dA &d@ Code added &dA05-31-95&d@ to prevent tuplets over "partial" beams from being &dA &d@ associated with those beams. &dA if beampar(passtype,passnum,BM_TUPLE) > 0 if beampar(passtype,passnum,BM_READY) = 0 beampar(passtype,passnum,BM_TUPLE) = 0 end end c8 = 1 t2 = 0 t1 = (tuar(passtype,passnum,TU_FSTEM) & 0xff) + stem c9 = tuar(passtype,passnum,TU_Y1) c11 = 0 goto TPF(tpflag+1) TPF(1): /* default tuplet placement if beampar(passtype,passnum,BM_TUPLE) > 0 c8 |= 0x08 t2 = beampar(passtype,passnum,BM_SNUM) t1 = oby if ts(c1,MULTI_TRACK) > 0 c8 |= 0x10 else t1 += chord_spread c9 = tuar(passtype,passnum,TU_Y2) end c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket if beampar(passtype,passnum,BM_TUPLE) = 2 c10 |= 0x04 /* tips up end c8 |= c10 end goto TPFEC else if t1 = 0 goto TPFEA else goto TPFEB end end TPF(2): /* place tuplet near note heads if beampar(passtype,passnum,BM_TUPLE) > 0 c8 |= 0x08 t2 = beampar(passtype,passnum,BM_SNUM) t1 = oby + chord_spread c9 = tuar(passtype,passnum,TU_Y2) c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket if beampar(passtype,passnum,BM_TUPLE) = 1 c10 |= 0x04 /* tips up end c8 |= c10 end goto TPFEC else if t1 = 0 goto TPFEA else goto TPFEB end end TPF(3): /* place tuplet near stems if beampar(passtype,passnum,BM_TUPLE) > 0 c8 |= 0x18 t2 = beampar(passtype,passnum,BM_SNUM) t1 = oby c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket if beampar(passtype,passnum,BM_TUPLE) = 2 c10 |= 0x04 /* tips up end c8 |= c10 end goto TPFEC else if t1 > 0 goto TPFEA else c11 = hpar(82) /* shift for stems up goto TPFEB end end TPF(4): /* place all tuplets above notes if beampar(passtype,passnum,BM_TUPLE) > 0 t1 = oby if stem = UP c8 |= 0x18 else c8 |= 0x08 t1 += chord_spread c9 = tuar(passtype,passnum,TU_Y2) end t2 = beampar(passtype,passnum,BM_SNUM) c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket c8 |= c10 end goto TPFEC else if t1 = 0 c11 = hpar(82) end goto TPFEB end TPF(5): /* place all tuplets below notes if beampar(passtype,passnum,BM_TUPLE) > 0 t1 = oby if stem = UP c8 |= 0x08 t1 += chord_spread c9 = tuar(passtype,passnum,TU_Y2) else c8 |= 0x18 end t2 = beampar(passtype,passnum,BM_SNUM) c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket c10 |= 0x04 /* tips up c8 |= c10 end goto TPFEC else if t1 > 0 c11 = hpar(82) end goto TPFEA end TPFEA: c9 = tuar(passtype,passnum,TU_Y2) + notesize c9 += vpar(64) if t1 > 0 c9 += vpar(7) t1 = vpar(7) /* add distance if stem is down else t1 = 0 end c10 = notesize * 6 if c9 < c10 c9 = c10 end t1 += oby + notesize + vpar(64) /* t1 set above if t1 < c10 t1 = c10 end c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket c10 |= 0x04 /* tips up c8 |= c10 end goto TPFEC TPFEB: c9 = tuar(passtype,passnum,TU_Y2) - notesize c10 = 0 - vpar(1) if t1 = 0 c9 -= vpar(7) t1 = 0 - vpar(7) /* subtract distance if stem is up else t1 = 0 end if c9 > c10 c9 = c10 end t1 += oby - notesize /* t1 set above if t1 > c10 t1 = c10 end c10 = tuar(passtype,passnum,TU_FSTEM) & 0xff00 c10 >>= 8 if bit(0,c10) = 1 /* bracket present &dA03-21-97&d@ c10 >>= 1 c10 <<= 5 c10 |= 0x02 /* add bracket c8 |= c10 end TPFEC: c9 -= tuar(passtype,passnum,TU_Y1) t1 -= oby c13 = ts(c1,TUPLE) t3 = tuar(passtype,passnum,TU_SNUM) ++outpnt tput [Y,outpnt] H ~t3 X ~c8 ~c13 0 ~c9 ~c11 ~t1 ~t2 tuar(passtype,passnum,TU_SNUM) = 0 tpflag = global_tpflag end &dA &dA &d@ 2) Beams (O.K. for multiple notes) &dA if beampar(passtype,passnum,BM_READY) > 0 #if SMALL if beampar(passtype,passnum,BM_SIZE) = CUESIZE beamfont = 102 else beamfont = 103 end #else if beampar(passtype,passnum,BM_SIZE) = CUESIZE beamfont = notesize / 2 + 99 else beamfont = notesize / 2 + 101 end #endif c4 = beampar(passtype,passnum,BM_CNT) c5 = 1 c6 = 0 c7 = beampar(passtype,passnum,BM_STEM) << 1 loop for c3 = 1 to c4 c7 >>= 1 if c7 & 0x01 <> 1 c6 = 1 end c5 <<= 1 repeat out = chs(c7) // " " /* first stem direction c8 = beampar(passtype,passnum,BM_STEM) if c6 = 0 or c8 = 0 out = out // "0 " /* consistant stem directions else if c7 = UP c5 -= 1 /* c5 = 111 ... for number of notes c8 = not(c8) & c5 end out = out // chs(c8) // " " end out = out // chs(beamfont) // " " out = out // chs(beampar(passtype,passnum,BM_READY)) loop for c4 = 1 to beampar(passtype,passnum,BM_READY) out = out // " " out = out // chs(beamdata(passtype,passnum,c4)) repeat ++outpnt tput [Y,outpnt] H ~beampar(passtype,passnum,BM_SNUM) B ~out beampar(passtype,passnum,BM_READY) = 0 beampar(passtype,passnum,BM_TUPLE) = 0 end &dA &dA &d@ 3) Ties (revised for multiple notes) &dA tiecnt = 0 loop for c3 = c1 to c2 c7 = ts(c3,BACKTIE) if c7 > 0 &dA &dA &d@ compute sitf (situation flag) &dA &dA &d@ Description of sitf: range 1 to 16 &dA &d@ &dA &d@ If the range were from 0 to 15, then bits 3 to 0 &dA &d@ would have the following meanings: &dA &d@ &dA &d@ zero | one &dA &d@ -------------------------------------------- &dA &d@ bit 3: tips down | tips up &dA &d@ bit 2: note on space | note on line &dA &d@ bit 1: no stem interfenence | stem interference &dA &d@ bit 0: staff interference | no staff interference &dA c9 = tiearr(c7,TIE_VLOC) c10 = tiearr(c7,TIE_FHDIS) /* local x-offset for first note c11 = ts(c3,LOCAL_XOFF) /* local x-offset for second note c12 = tiearr(c7,TIE_FORCE) /* force flag if c12 = 3 c12 = 9 end c8 = ts(c3,MULTI_TRACK) c6 = c8 >> 2 /* multi-track flag c8 &= 0x03 /* mcat flag &dA &dA &d@ Modify multi-track flag under certain conditions &dA &d@ &dAADDED 9-10-93&d@ &dA if c6 > 0 if ts(c3,PASSNUM) = 1 and bit(1,ts(c3,STEM_FLAGS)) = DOWN c6 = 0 end end if c6 = 0 if c8 < 2 &dA &dA &d@ Rules for single note (or chord) of single part &dA if bit(2,ts(c3,STEM_FLAGS)) = 0 /* &dAsingle note&d@ c5 = tiearr(c7,TIE_FSTEM) + stem if c5 = 0 sitf = 9 /* both stems up else sitf = 1 end if c12 > 0 sitf = c12 /* forced situation end if tiearr(c7,TIE_FSTEM) = UP and sitf < 9 sitf += 2 /* stem interference end else /* &dAchord&d@ if c3 < c2 sitf = 1 else sitf = 9 end if c12 > 0 sitf = c12 /* forced situation end if sitf = 1 if tiearr(c7,TIE_FSTEM) = UP if c10 = 0 sitf += 2 /* stem interference end else if stem = DOWN and c3 <> c1 if c11 = 0 sitf += 2 /* stem interference end end end else if stem = DOWN if c11 = 0 sitf += 2 /* stem interference end end end end else &dA &dA &d@ Rules for chords representing multiple parts &dA if c3 = c2 /* bottom note of chord sitf = 9 else sitf = 1 end if c12 > 0 sitf = c12 /* forced situation end if c3 = c2 if stem = DOWN sitf += 2 /* stem interference end else if c3 = c1 if tiearr(c7,TIE_FSTEM) = UP sitf += 2 /* stem interference end else if tiearr(c7,TIE_FSTEM) = UP or stem = DOWN sitf += 2 /* stem interference end end end end else &dA &dA &d@ Rules for multiple passes on a staff &dA if c6 = 1 sitf = 3 if c12 = 9 sitf = 11 end else if c6 = 2 sitf = 11 if c12 = 1 sitf = 3 end else if c6 = 3 if stem = UP sitf = 1 if c12 > 0 sitf = c12 /* forced situation end if tiearr(c7,TIE_FSTEM) = UP sitf += 2 end else sitf = 11 if c12 = 1 sitf = 3 end end end end end end c5 = c9 / notesize if rem = 0 sitf += 4 /* note on line end &dA &dA &d@ Note: you won't know if there is staff interference until &dA &d@ you know the final length of the tie &dA c9 += tiearr(c7,TIE_STAFF) * 1000 ++outpnt tput [Y,outpnt] H ~tiearr(c7,TIE_SNUM) T ~c9 ~c10 ~c11 0 0 0 ~sitf 0 tiearr(c7,TIE_SNUM) = 0 ts(c3,BACKTIE) = 0 end &dA &dA &d@ If there is a tie leaving this note, build &dA &d@ up a new ROW element of tiearr &dA if bit(0,ts(c3,SUPER_FLAG)) = 1 * identify free slice of tiearr loop for c7 = 1 to MAX_TIES if tiearr(c7,TIE_SNUM) = 0 goto X2 end repeat &dA &dA &d@ Here is where tiearr is built &dA X2: ++tiecnt tiearr(c7,TIE_SNUM) = tv4(tiecnt) tiearr(c7,TIE_NTYPE) = ts(c3,TYPE) tiearr(c7,TIE_VLOC) = ts(c3,STAFFLOC) tiearr(c7,TIE_FHDIS) = ts(c3,LOCAL_XOFF) tiearr(c7,TIE_FSTEM) = bit(1,ts(c3,STEM_FLAGS)) tiearr(c7,TIE_NDX) = c3 tiearr(c7,TIE_STAFF) = ts(c3,STAFF_NUM) tiearr(c7,TIE_FOUND) = 0 tiearr(c7,TIE_FORCE) = ts(c3,SLUR_FLAG) >> 24 ts(c3,BACKTIE) = c7 /* not used here as a back pointer end repeat &dA &dA &d@ 4) Slurs (revised for multiple notes) &dA loop for c4 = 1 to 8 c5 = c4 * 2 - 1 if c4 > 4 c5 += 8 end &dA &dA &d@ end-slurs &dA &d@ &dA &d@ odd numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ bit 27: start/end flag (0 = start, 1 = end) &dA &d@ bits 24-26: slur number - 1 (0 to 7) &dA &d@ bits 17-23: curvature information (end only) &dA &d@ bit 16: up/down flag (0 = tips up, 1 = tips down) (end only) &dA &d@ bits 0-15: x-offset + 1000 (always a positive number) &dA &d@ even numbered element &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &d@ y position relative to the staff &dA &d@ if bit(c5,slur_flag) = 1 c14 = ts(c1,SLUR_X) loop for c13 = 7 to 31 step 2 c12 = ts(c14,c13) c11 = c12 >> 24 if c11 = c4 + 0x0f /* c4 - 1 + 0x10 (end of slur) c11 = c12 & 0xffff - 1000 /* x-offset c10 = bit(16,c12) /* up/down flag c9 = c12 & 0x000e0000 >> 17 /* curvature (1 to 4) c8 = ts(c14,c13+1) - ts(c1,OBY) /* y-offset c13 = 100 /* end of loop end repeat if c13 < 100 putc Program error at slur recovery putc &dAType /e &d@ to terminate examine return 10 end sitf = 0 if c4 > 4 sitf = 1 /* dotted slur end if c10 = UP sitf += 12 end c10 = slurar(c4,SL_SNUM) /* slur number c7 = slurar(c4,SL_YSHIFT) /* starting y-shift c6 = slurar(c4,SL_XSHIFT) /* starting x-shift c9 -= 1 c13 = slurar(c4,SL_BEAMF) /* 0 = slur doesn't start on a beam /* 1 = slur starts on a stem up beam /* 2 = slur starts on a stem down beam c12 = 0 if c13 > 0 if bit(1,ts(c1,BEAM_FLAG)) = 1 if stem = UP and c8 < 0 - vpar(6) c12 = 1 end if stem = DOWN and c8 > vpar(6) c12 = 2 end end if c12 <> c13 c12 = 0 end end ++outpnt tput [Y,outpnt] H ~c10 S ~sitf ~c6 ~c7 ~c11 ~c8 ~c9 ~c12 0 end &dA &dA &d@ beginning-slurs &dA --c5 if bit(c5,slur_flag) = 1 c14 = ts(c1,SLUR_X) loop for c13 = 7 to 31 step 2 c12 = ts(c14,c13) c11 = c12 >> 24 if c11 = c4 - 1 /* c4 - 1 (beginning of slur) c11 = c12 & 0xffff - 1000 /* x-offset c8 = ts(c14,c13+1) - ts(c1,OBY) /* y-offset c13 = 100 /* end of loop end repeat if c13 < 100 putc Problem finding the end of a slur putc Possible causes: putc 1. A slur has not been closed properly putc 2. Overlapping slurs using the same code putc putc &dAType /e &d@ to terminate examine return 10 end c12 = 0 if ts(c1,BEAM_FLAG) > 1 if stem = UP and c8 < 0 - vpar(6) c12 = 1 end if stem = DOWN and c8 > vpar(6) c12 = 2 end end slurar(c4,SL_SNUM) = slurar(c4,SL_NEXTSNUM) slurar(c4,SL_YSHIFT) = c8 slurar(c4,SL_XSHIFT) = c11 slurar(c4,SL_BEAMF) = c12 /* 0 = slur doesn't start on a beam /* 1 = slur starts on a stem up beam /* 2 = slur starts on a stem down beam end repeat &dA &dA &d@ 5) Long Trills &dA if bit(3,super_flag) = 1 and tsnum(passnum) > 0 out = "H " // chs(tsnum(passnum)) // " R " // chs(ctrarrf(passnum)) out = out // " 0" ++outpnt if nodtype = GR_NOTE or nodtype = XGR_NOTE tput [Y,outpnt] ~out 0 ~try(passnum) else tput [Y,outpnt] ~out -~hpar(42) ~try(passnum) end tsnum(passnum) = 0 ctrarrf(passnum) = 0 end if pre_tsnum(passnum) > 0 /* substitute preliminary values tsnum(passnum) = pre_tsnum(passnum) ctrarrf(passnum) = pre_ctrarrf(passnum) try(passnum) = pre_try(passnum) pre_tsnum(passnum) = 0 end ZZZZ: repeat autop += a4 &dA &dA &d@ Now that you are all done with the notes and rests of &dA &d@ this node, you may set the new inctype &dA if ts(a1,DINC_FLAG) > 0 inctype = ts(a1,DINC_FLAG) end a1 = a2 ZZZ: repeat &dA &dA &d@ End of processing loop &dA &d@************************************************************* &dA &dA &dA &d@ Check for outstanding super-objects (except slurs) &dA &dA &dA &d@ Endings &dA if esnum > 0 goto ZXT end &dA &dA &d@ ~~~Trills &dA loop for k = 1 to MAX_PASS if tsnum(k) > 0 goto ZXT end repeat &dA &dA &d@ Fig continuation lines &dA loop for k = 1 to MAX_FIG if figarr(k,FIG_SNUM) > 0 goto ZXT end repeat &dA &dA &d@ Beams and Tuples &dA loop for k = 1 to 4 loop for j = 1 to MAX_PASS if beampar(k,j,BM_READY) > 0 goto ZXT end if tuar(k,j,TU_SNUM) > 0 goto ZXT end repeat repeat &dA &dA &d@ Ties &dA loop for k = 1 to MAX_TIES if tiearr(k,TIE_SNUM) > 0 goto ZXT end repeat &dA &dA &d@ Wedges, Dashes, Octave Transpositions &dA loop for k = 1 to 30 if smusdir(k,1) > 0 goto ZXT end repeat display_flag = 2 ZXT: return &dA &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³ 2a. getpxpy (code) ³ &dA &d@³ ³ &dA &d@³ Purpose: Save space; get values of px, py, pyy for ³ &dA &d@³ position modification ³ &dA &d@³ ³ &dA &d@³ Inputs: code = type of subobject referred to ³ &dA &d@³ ³ &dA &d@³ Outputs: pcontrol ³ &dA &d@³ px ³ &dA &d@³ py ³ &dA &d@³ pyy ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA procedure getpxpy (code) int t2 int code getvalue code code <<= 2 px = 0 py = 0 pyy = 0 t2 = ts(c1,TSR_POINT) pcontrol = ors(tsr(t2){code-3}) if bit(0,pcontrol) = 1 px = ors(tsr(t2){code-2}) py = ors(tsr(t2){code}) if py > 0 pyy = 1 else py = ors(tsr(t2){code-1}) end if px > 0 px = px - 128 * notesize / 10 end if py > 0 py = py - 128 * notesize / 10 end end return &dA &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 3. setstem ³ &dA &d@³ ³ &dA &d@³ Purpose: Generate subobjects for note stem, or construct ³ &dA &d@³ beamdata parameters for setting beam. When beam ³ &dA &d@³ is complete, this procedure will call setbeam. ³ &dA &d@³ ³ &dA &d@³ Inputs: ntype = type of note ³ &dA &d@³ passtype = type of pass (reg,cue,grace,cuegrace) ³ &dA &d@³ passsize = size of notes (full size vs. cue-size) ³ &dA &d@³ passnum = pass number ³ &dA &d@³ obx = x co-ordinate of object ³ &dA &d@³ oby = y co-ordinate of object ³ &dA &d@³ c1 = pointer to top note head in array ³ &dA &d@³ c2 = pointer to bottom note head in array ³ &dA &d@³ c3 = pointer to note head at top of stem ³ &dA &d@³ super_flag = composite of SUPER_FLAGs for this chord ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ &dA procedure setstem int t2,t3,t4,t5,t11,t12,t13,t14,t15 int bcount &dA &dA &d@ Determine number of repeaters in "single note" case &dA t11 = 0 if ts(c1,BEAM_FLAG) = NO_BEAM and ts(c1,BEAM_CODE) > 0 t12 = ts(c1,BEAM_CODE) loop t12 /= 10 ++t11 repeat while t12 > 0 end if ntype >= WHOLE if t11 > 0 y = ts(c1,STAFFLOC) - vpar(3) z = 127 loop for t12 = 1 to t11 perform subj y -= vpar(2) repeat end else x = obx z = 59 + stem /* music font if passsize = CUESIZE z += 128 /* music font end &dA &dA &d@ Connect notes of chord &dA if c1 <> c2 if stem = UP y = ts(c2,STAFFLOC) loop while y > ts(c1,STAFFLOC) perform subj y -= vpar(4) repeat else y = ts(c1,STAFFLOC) loop while y < ts(c2,STAFFLOC) perform subj y += vpar(4) repeat end end y = ts(c3,STAFFLOC) if ntype > EIGHTH &dA &dA &d@ Quarter notes and larger &dA t3 = y / vpar(1) + 2 if stem = UP if t11 = 0 t2 = 8 if t3 <= 0 t2 = t3 - 3 else if t3 < 7 t2 = t3 - 4 else if t3 < 13 t2 = t3 - 5 end end if passsize = CUESIZE ++t2 end end t2 *= vpar(1) else t13 = y / notesize t14 = rem if t14 = 0 t15 = 3 /* tricky code else t15 = 2 end t2 = y - vpar(t15) - vpar(79) loop for t13 = t15 to t11 t2 -= vpar(2) repeat t12 = vpar(77) + vpar(6) if t2 > t12 t2 = t12 end if t14 <> 0 and t11 = 1 t14 = y y = t2 - vpar(80) perform subj y = t14 end end loop while y > t2 perform subj y -= vpar(4) repeat y = t2 perform subj if t11 > 0 y -= vpar(81) if ts(c1,TUPLE) > 0 t13 = ts(c1,TUPLE) t14 = x + hpar(102) t15 = y - vpar(82) perform typeset_tuple (t13,t14,t15) end z = 125 /* music font (repeater quarters) loop for t2 = 1 to t11 perform subj y += vpar(2) repeat end else if t11 = 0 t2 = 0 if t3 > 11 t2 = t3 - 1 else if t3 > 6 t2 = t3 else if t3 >= 0 t2 = t3 + 1 end end if passsize = CUESIZE --t2 end end t2 = t2 * notesize / 2 else t13 = y / notesize t14 = rem if t14 = 0 t15 = 3 /* tricky code else t15 = 2 end t2 = y + vpar(t15) + vpar(79) loop for t13 = t15 to t11 t2 += vpar(2) repeat t12 = vpar(78) - vpar(4) if t2 < t12 t2 = t12 end if t14 <> 0 and t11 = 1 t14 = y y = t2 + vpar(80) perform subj y = t14 end end loop while y < t2 perform subj y += vpar(4) repeat y = t2 perform subj if t11 > 0 if ts(c1,TUPLE) > 0 t13 = ts(c1,TUPLE) t14 = x + hpar(103) t15 = ts(c1,STAFFLOC) - vpar(82) perform typeset_tuple (t13,t14,t15) end y += vpar(81) z = 125 /* music font (repeater quarters) x -= hpar(101) loop for t2 = 1 to t11 perform subj y -= vpar(2) repeat x += hpar(101) end end else &dA &dA &d@ Eighth notes or smaller &dA if ts(c1,BEAM_FLAG) = NO_BEAM * 1) Flags if passtype = GRACE and ntype = SLASH8 if stem = UP z = 179 /* music font else z = 180 /* music font end y = ts(c3,STAFFLOC) perform subj else if stem = UP if ntype = EIGHTH t3 = 53 /* music font (eighth flag) if y <= vpar(4) and passtype = REG and t11 = 0 t3 = 51 /* music font (shortened eighth flag) end t2 = 10 * notesize / 2 else t3 = 55 /* music font (sixteenth flag) t2 = 0 - ntype * 2 + 20 * notesize / 2 end z = 59 /* music font (standard up stem) t4 = notesize t5 = 57 /* music font (extra flag: 32nds, etc) if passsize = CUESIZE t2 -= hpar(1) t3 = 181 /* music font z = 187 /* music font t4 = vpar(36) t5 = 185 /* music font end loop while y > t2 perform subj y -= vpar(4) repeat t2 += vpar(1) y = ts(c3,STAFFLOC) if t11 = 0 /* no repeaters z = t3 /* music font (flag character) if y > t2 y = t2 end perform subj if ntype < 5 z = t5 /* music font (extra flag) loop for t3 = 1 to 5-ntype y -= t4 perform subj repeat end else t12 = y / notesize t2 += t11 - 1 * notesize if y > t2 or rem <> 0 /* note on space t13 = t11 - 1 * notesize + vpar(67) t14 = vpar(69) else /* note on line t13 = t11 - 1 * notesize + vpar(68) t14 = vpar(70) end &dA &dA &d@ t13 = amount to "lengthen" stem &dA &d@ t14 = location of first repeater &dA if y > t2 y = t2 end t15 = y loop perform subj y -= vpar(4) repeat while y > t15 - t13 y = t15 - t13 z = t3 perform subj if ntype < 5 z = t5 /* music font (extra flag) loop for t3 = 1 to 5-ntype y -= t4 perform subj repeat end y = t15 - t14 z = 126 /* music font (repeater for eights) x = x - hpar(99) loop for t12 = 1 to t11 perform subj y -= notesize repeat x = x + hpar(99) if ts(c1,TUPLE) > 0 t13 = ts(c1,TUPLE) t14 = x + hpar(102) t15 = y - vpar(83) perform typeset_tuple (t13,t14,t15) end end else if ntype = EIGHTH t3 = 54 /* music font (eighth flag) if y >= vpar(5) and passtype = REG and t11 = 0 t3 = 52 /* music font (shortened eighth flag) end t2 = 0 - 2 * notesize / 2 else t3 = 56 /* music font (sixteenth flag) t2 = 2 * ntype - 12 * notesize / 2 end z = 60 /* music font (standard down stem) t4 = notesize t5 = 58 /* music font (extra flag) if passsize = CUESIZE t2 += hpar(1) t3 = 182 /* music font z = 188 /* music font t4 = vpar(36) t5 = 186 /* music font end loop while y < t2 perform subj y += vpar(4) repeat t2 -= vpar(1) y = ts(c3,STAFFLOC) if t11 = 0 z = t3 /* music font (flag character) if y < t2 y = t2 end perform subj if ntype < 5 z = t5 /* music font loop for t3 = 1 to 5-ntype y += t4 perform subj repeat end else t12 = y / notesize t2 -= t11 - 1 * notesize if y < t2 or rem <> 0 /* note on space if t11 = 2 t13 = notesize - vpar(71) else t13 = t11 - 1 * notesize - vpar(72) end t14 = vpar(75) else /* note on line if t11 = 2 t13 = notesize - vpar(73) else t13 = t11 - 1 * notesize - vpar(74) end t14 = vpar(76) end &dA &dA &d@ t13 = amount to "lengthen" stem &dA &d@ t14 = location of first repeater &dA if y < t2 y = t2 end t15 = y loop perform subj y += vpar(4) repeat while y < t15 + t13 y = t15 + t13 z = t3 perform subj if ntype < 5 z = t5 /* music font (extra flag) loop for t3 = 1 to 5-ntype y += t4 perform subj repeat end y = t15 + t14 z = 126 /* music font (repeater for eights) x = x - hpar(100) loop for t12 = 1 to t11 perform subj y += notesize repeat x = x + hpar(100) if ts(c1,TUPLE) > 0 t13 = ts(c1,TUPLE) t14 = x + hpar(103) t15 = ts(c1,STAFFLOC) - vpar(82) perform typeset_tuple (t13,t14,t15) end end end end else * 2) Beams if ts(c1,BEAM_FLAG) = START_BEAM bcount = 1 ++snum beampar(passtype,passnum,BM_SNUM) = snum if bit(4,super_flag) = 1 beampar(passtype,passnum,BM_TUPLE) = 1 + stem end beampar(passtype,passnum,BM_STEM) = stem beampar(passtype,passnum,BM_SIZE) = passsize else bcount = beampar(passtype,passnum,BM_CNT) + 1 beampar(passtype,passnum,BM_STEM) <<= 1 beampar(passtype,passnum,BM_STEM) += stem if passsize < beampar(passtype,passnum,BM_SIZE) beampar(passtype,passnum,BM_SIZE) = passsize end end beamdata(passtype,passnum,bcount) = ts(c1,BEAM_CODE) beampar(passtype,passnum,BM_CNT) = bcount if ts(c1,BEAM_FLAG) = END_BEAM beampar(passtype,passnum,BM_READY) = bcount end end end end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 4. setax ³ &dA &d@³ ³ &dA &d@³ Purpose: Set accidental ³ &dA &d@³ ³ &dA &d@³ Inputs: c4 = accident flag ³ &dA &d@³ passsize = note size (full, cue-size) ³ &dA &d@³ obx = x co-ordinate of object ³ &dA &d@³ oby = y co-ordinate of object ³ &dA &d@³ y = y co-ordinate of note head ³ &dA &d@³ ³ &dA &d@³ Internal: x,y,z sent to subj ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setax int t1,t2 t2 = c4 >> 4 /* x-offset (to the left) t1 = c4 & 0x0f /* accidental only x = obx - t2 if bit(2,t1) = 1 /* case: flat-flat or natural-(flat/sharp) z = bit(3,t1) + 64 /* flat or natural t2 = hpar(40) if passsize = CUESIZE z += 128 /* cue size t2 = t2 * 8 / 10 end perform subj x += t2 end if t1 & 0x03 = 2 if bit(3,t1) = 1 z = 66 /* double sharp else z = 63 /* regular sharp end else z = bit(1,t1) + 64 /* flat or natural end if passsize = CUESIZE z += 128 /* cue size end perform subj return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 5. superfor (operates on an entire chord at once) ³ &dA &d@³ ³ &dA &d@³ Purpose: Get new snums for forward tie, forward slurs and ³ &dA &d@³ forward tuplet ³ &dA &d@³ ³ &dA &d@³ Inputs: c1 = pointer to top of chord ³ &dA &d@³ c2 = pointer to bottom of chord ³ &dA &d@³ passtype = type of pass (reg,cue,grace,cuegrace) ³ &dA &d@³ passnum = pass number ³ &dA &d@³ x = x co-ordinate of object ³ &dA &d@³ y = y co-ordinate of object ³ &dA &d@³ super_flag = composite of SUPER_FLAGs for this chord ³ &dA &d@³ slur_flag = composite of SLUR_FLAGs for this chord ³ &dA &d@³ stem = stem direction ³ &dA &d@³ ³ &dA &d@³ Function: If there is a forward tie, this procedure increments ³ &dA &d@³ snum and puts result in tv4(). If there are ³ &dA &d@³ forward slurs, this procedure increments snum and ³ &dA &d@³ stores results in the appropriate ³ &dA &d@³ slurar(.,SL_NEXTSNUM). If there is a forward ³ &dA &d@³ tuplet, this procedure increments snum and ³ &dA &d@³ constructs the tuar for this tuplet. For all ³ &dA &d@³ cases, the procedure increments supcnt and adds ³ &dA &d@³ the new super-object number to supnums(.) for later ³ &dA &d@³ output in the object record. ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure superfor int t1,t2 tiecnt = 0 loop for c3 = c1 to c2 if bit(0,ts(c3,SUPER_FLAG)) = 1 /* if tie starts ++snum ++supcnt supnums(supcnt) = snum ++tiecnt tv4(tiecnt) = snum end repeat loop for t1 = 1 to 8 t2 = t1 * 2 - 2 if t1 > 4 t2 += 8 end if bit(t2,slur_flag) = 1 /* if slur starts ++snum ++supcnt supnums(supcnt) = snum slurar(t1,SL_NEXTSNUM) = snum else slurar(t1,SL_NEXTSNUM) = 0 end repeat if bit(4,super_flag) = 1 ++snum ++supcnt supnums(supcnt) = snum tuar(passtype,passnum,TU_SNUM) = snum tuar(passtype,passnum,TU_Y1) = y if stem = UP tuar(passtype,passnum,TU_Y2) = y else tuar(passtype,passnum,TU_Y2) = ts(c1,STAFFLOC) end tuar(passtype,passnum,TU_FSTEM) = stem t1 = super_flag & 0x3c0 /* bits 6,7,8,9 &dA03-21-97&d@ t1 <<= 2 tuar(passtype,passnum,TU_FSTEM) |= t1 /* tuplet flags &dA03-21-97&d@ end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 6. setart (operates on an entire chord at once) ³ &dA &d@³ ³ &dA &d@³ Purpose: create sub-objects for dots, spiccato and legato. ³ &dA &d@³ ³ &dA &d@³ Inputs: obx = x-position of object ³ &dA &d@³ oby = y-position of object ³ &dA &d@³ c1 = pointer to top note of chord ³ &dA &d@³ c2 = pointer to bottom note of chord ³ &dA &d@³ stem = stem direction (UP or DOWN) ³ &dA &d@³ ³ &dA &d@³ Outputs: Program may modify virtual endpoints in the ts ³ &dA &d@³ array. ³ &dA &d@³ ³ &dA &d@³ Operation: There are two rules that can be followed ³ &dA &d@³ Rule 1: (chord = single note, or dot on middle note ³ &dA &d@³ of chord, or more than one dot) ³ &dA &d@³ If there is a slur, and slur starts (ends) near ³ &dA &d@³ the dot, put dot under (over) slur; ³ &dA &d@³ otherwise, if multi-track > 0, put dot on stem; ³ &dA &d@³ otherwise put dot on note head. ³ &dA &d@³ ³ &dA &d@³ Rule 2: (all other situations) ³ &dA &d@³ If dot on note at stem end, put dot on stem; ³ &dA &d@³ otherwise, put dot at head end of chord. ³ &dA &d@³ ³ &dA &d@³ If there is a slur into or out of this chord, then ³ &dA &d@³ information on the placement of dot/legato or ³ &dA &d@³ spiccato has already been compiled and is stored ³ &dA &d@³ in the SLUR_X ROW element. Otherwise, the place- ³ &dA &d@³ ment needs to be computed here. ³ &dA &d@³ ³ &dA &d@³ Virtual endpoints are modified in all cases. ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setart int t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13 t2 = 0 t9 = 0 loop for t1 = c1 to c2 t10 = ts(t1,SUBFLAG_2) & 0x3c if t10 > 0 ++t2 t3 = t1 t9 |= t10 /* composite flag for chord end repeat if t2 = 0 return end &dA &dA &d@ Step 1: determine starting position for dot/legatos or spaccatos &dA t13 = 0 /* &dA03/24/97&d@ potential modification to x position of articulation if c1 = c2 or (t3 <> c1 and t3 <> c2) or t2 > 1 /* follow rule 1 t4 = ts(c1,SLUR_X) if t4 > 0 and ts(t4,6) > 0 /* there is a slur effecting dot y = ts(t4,5) t5 = ts(t4,6) /* above/below flag t8 = 0 /* no adjustment to virtual end points else t10 = ts(c1,MULTI_TRACK) >> 2 if t10 > 0 /* &dACHANGED&d@ from = 3 on &dA03/24/97 if ts(c1,PASSNUM) = 1 and stem = DOWN t10 = 0 end if ts(c1,PASSNUM) = 2 and stem = UP t10 = 0 end end &dA &dA &d@ Code added &dA03/24/97&d@ to check for print suggestions for articulations &dA t12 = 2 /* articulation code = 2 perform getpxpy (t12) if pcontrol & 0x03 = 0x03 /* major location change flag if bit(2,pcontrol) = 1 /* place below t5 = BELOW if stem = UP y = ts(c1,VIRT_NOTE) t8 = notesize else y = ts(c1,VIRT_STEM) t8 = vpar(1) if ts(c1,BEAM_FLAG) > NO_BEAM t8 = vpar(2) end end else t5 = ABOVE if stem = UP y = ts(c1,VIRT_STEM) t8 = vpar(1) if ts(c1,BEAM_FLAG) > NO_BEAM t8 = vpar(2) end else y = ts(c1,VIRT_NOTE) t8 = notesize end end else &dA &dA &d@ End of &dA03/24/97&d@ addition &dA if t10 > 0 y = ts(c1,VIRT_STEM) if stem = UP t5 = ABOVE else t5 = BELOW end t8 = vpar(1) if ts(c1,BEAM_FLAG) > NO_BEAM t8 += vpar(1) end else y = ts(c1,VIRT_NOTE) if stem = UP t5 = BELOW else t5 = ABOVE end t8 = notesize end end if bit(0,pcontrol) = 1 if pyy > 0 y = py else y += py end t13 = px end end else /* follow rule 2 &dA &dA &d@ Code added &dA03/24/97&d@ to check for print suggestions for articulations &dA t12 = 2 /* articulation code = 2 perform getpxpy (t12) if pcontrol & 0x03 = 0x03 /* major location change flag if bit(2,pcontrol) = 1 /* place below t5 = BELOW if stem = UP y = ts(c1,VIRT_NOTE) t8 = notesize else y = ts(c1,VIRT_STEM) t8 = vpar(1) end else t5 = ABOVE if stem = UP y = ts(c1,VIRT_STEM) t8 = vpar(1) else y = ts(c1,VIRT_NOTE) t8 = notesize end end else &dA &dA &d@ End of &dA03/24/97&d@ addition &dA if stem = UP if t3 = c1 /* top note t5 = ABOVE y = ts(c1,VIRT_STEM) t8 = vpar(1) else t5 = BELOW y = ts(c1,VIRT_NOTE) t8 = notesize end else if t3 = c1 /* top note t5 = ABOVE y = ts(c1,VIRT_NOTE) t8 = notesize else t5 = BELOW y = ts(c1,VIRT_STEM) t8 = vpar(1) end end end if bit(0,pcontrol) = 1 if pyy > 0 y = py else y += py end t13 = px end end &dA &dA &d@ check for interference in cases where y is based on VIRT_ &dA if t8 <> 0 if (stem = DOWN and t5 = ABOVE) or (stem = UP and t5 = BELOW) t11 = HEAD else t11 = TAIL end if t9 & 0x04 > 0 /* spiccato is special case if stem = DOWN if t5 = ABOVE /* note if y > vpar(1) y = vpar(1) end y -= 5 * notesize / 4 else if y < vpar(8) y = vpar(8) end y += vpar(1) + vpar(50) end else /* UP if t5 = ABOVE if y > 0 y = 0 end y -= vpar(1) else /* note if y < vpar(7) y = vpar(7) end y += 5 * notesize / 4 + vpar(50) end end else t6 = 1 if t5 = ABOVE y -= t8 if y >= 0 t6 = y / notesize t6 = rem else y = 0 - notesize / 4 + y end t7 = -1 else y += t8 if y <= vpar(8) t6 = y / notesize t6 = rem else y = notesize / 4 + y end t7 = 1 end &dA &dA &d@ adjust for interference with staff &dA if t6 = 0 y = vpar(1) * t7 + y end end end &dA &dA &d@ Step 2: write out articulations &dA x = obx + t13 if t9 & 0x18 > 0 /* staccato z = 96 /* music font perform subj y = notesize * t7 + y end if t9 & 0x30 > 0 /* legato z = 99 /* music font perform subj y = notesize * t7 + y end if t9 & 0x04 > 0 /* spiccato z = 98 /* music font if t5 = ABOVE --z /* music font end perform subj if t5 = BELOW y -= vpar(50) end y = y / vpar(1) * vpar(1) else y -= notesize * t7 end &dA &dA &d@ Step 3: adjust virtual end points &dA if t8 <> 0 if t11 = HEAD loop for t8 = c1 to c2 ts(t8,VIRT_NOTE) = y repeat else loop for t8 = c1 to c2 ts(t8,VIRT_STEM) = y repeat end end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 7. setperf (operates on an entire chord at once) ³ &dA &d@³ ³ &dA &d@³ Purpose: create sub-objects for turns, trills, shakes, ³ &dA &d@³ mordents, horizontal accents, thumb positions, ³ &dA &d@³ open string, numbers, harmonics, down-bows, ³ &dA &d@³ up-bows, fermatas. ³ &dA &d@³ ³ &dA &d@³ Inputs: obx = x-position of object ³ &dA &d@³ oby = y-position of object ³ &dA &d@³ c1 = pointer to top of chord ³ &dA &d@³ c2 = pointer bottom of chord ³ &dA &d@³ c4 = virtual vertical position of controlling ³ &dA &d@³ note head ³ &dA &d@³ c5 = virtual vertical position of end of stem ³ &dA &d@³ c8 = slur present flag ³ &dA &d@³ 0 = not present (usually) ³ &dA &d@³ 1 = present at head ³ &dA &d@³ 2 = present at stem ³ &dA &d@³ stem = stem direction 0 = up ³ &dA &d@³ 1 = down ³ &dA &d@³ super_flag = composite of SUPER_FLAGs for this chord ³ &dA &d@³ ³ &dA &d@³ Operation: If multi-track > 0, put indications at the stem ³ &dA &d@³ end of the chord; ³ &dA &d@³ else, put indications above the chord ³ &dA &d@³ ³ &dA &d@³ Internal: c4,c5,c7,c9,c13 used to communicate with yadjust ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setperf int t1,t2,t3,t4,t5,t7 bstr bs.600,bt.600 &dA &dA &d@ 1. Determine placement: c7 = situation flag: 0 = place on note head &dA &d@ 1 = place on stem &dA if ts(c1,MULTI_TRACK) >> 2 > 0 c7 = 1 else c7 = 1 - stem end &dA &dA &d@ 2. Construct composite subflag_1 and subflag_2 &dA subflag_1 = ts(c1,SUBFLAG_1) subflag_2 = ts(c1,SUBFLAG_2) if c2 > c1 t5 = ts(c1,TSR_POINT) bs = cbi(tsr(t5)) loop for t3 = c1+1 to c2 subflag_1 |= ts(t3,SUBFLAG_1) subflag_2 |= ts(t3,SUBFLAG_2) t4 = ts(t3,TSR_POINT) bt = cbi(tsr(t4)) bs = bor(bs,bt) repeat tsr(t5) = cby(bs) end &dA &dA &d@ 3. Long trill &dA if super_flag & 0x06 > 0 /* if begin ~~~~~ t5 = ts(c1,PASSNUM) ++snum pre_tsnum(t5) = snum ++supcnt supnums(supcnt) = snum c13 = vpar(53) pre_ctrarrf(t5) = bit(2,super_flag) /* tr. trill if pre_ctrarrf(t5) = 0 c13 = vpar(51) end if pre_ctrarrf(t5) = 1 /* tr. present t3 = subflag_1 & 0x70 >> 4 /* t3 = 0 to 7 t3 = int("01312311"{t3+1}) pre_ctrarrf(t5) += t3 end ++pre_ctrarrf(t5) perform yadjust pre_try(t5) = y - oby else &dA &dA &d@ 4+5. Ornaments and their accidentals need to be handled together &dA t5 = subflag_1 & 0x0f /* turn,tr,shake,mordent, etc. if t5 > 0 and t5 < 6 /* &dA5 ornaments at the moment&d@ &dA &dA &d@ Raise (lower) turn, if slur and turn are present on note head &dA if c7 = 0 and c8 = 1 if t5 = 1 /* turn if stem = UP c4 += vpar(1) else c4 -= vpar(1) end end end &dA &dA &d@ a. We must know definitively whether ornament goes above or below notes, &dA &d@ and we must determine whether there is an "intervening" accidental. &dA t7 = c7 /* save c7 t2 = 5 /* ornament code = 5 perform getpxpy (t2) if bit(0,pcontrol) = 1 if bit(1,pcontrol) = 1 if bit(2,pcontrol) = 0 c7 = 1 - stem else c7 = stem end end end t1 = c7 + stem /* t1 = 1 means ornament goes above t2 = 0 t3 = subflag_1 & 0x3f0 >> 4 if t3 > 0 if t1 = 1 if t3 > 7 /* ax under on ornament above t2 = 1 end else if t3 < 8 /* ax over on ornament below t2 = 2 end end end if t2 > 0 /* put accidental first if t2 = 1 t4 = t3 >> 3 else t4 = t3 end c13 = vpar(56) perform yadjust if c9 <> 1 y -= vpar(1) end z = int("39389"{t4}) /* music font z += 210 /* music font x = obx if t2 = 1 and (t5 = 1 or t5 = 5) x += hpar(70) end x += px if pyy > 0 py -= y pyy = 0 end y += py perform subj if t4 < 3 z = int("39"{t4}) /* music font x = obx + hpar(z+67) /* hpar(70) or hpar(76) z += 210 /* music font if t2 = 1 and (t5 = 1 or t5 = 5) x += hpar(70) end x += px perform subj end end &dA &dA &d@ b. Now put out turn, tr., shake, mordent, delayed turn &dA t3 = t5 z = int("71437"{t3}) /* music font z += 235 /* music font if c3 = 5 c3 = 1 end c13 = 51 + t3 c13 = vpar(c13) perform yadjust if c9 <> 1 y -= vpar(1) end x = obx x += px if pyy > 0 py -= y pyy = 0 end y += py perform subj &dA &dA &d@ c. Put out remaining accidentals above or below notes. &dA /* t1 = 1 means ornament goes above t2 = 0 t3 = subflag_1 & 0x3f0 >> 4 if t3 > 0 if t1 = 1 if t3 < 8 /* ax over on ornament above t2 = 1 end else if t3 > 7 /* ax under on ornament below t2 = 2 end end end if t2 > 0 /* put accidental if t2 = 1 t4 = t3 else t4 = t3 >> 3 end c13 = vpar(56) perform yadjust if c9 <> 1 y -= vpar(1) end z = int("39389"{t4}) /* music font z += 210 /* music font x = obx if t2 = 2 and (t5 = 1 or t5 = 5) x += hpar(70) end x += px if pyy > 0 py -= y pyy = 0 end y += py perform subj if t4 < 3 z = int("39"{t4}) /* music font x = obx + hpar(z+67) /* hpar(70) or hpar(76) z += 210 /* music font if t2 = 2 and (t5 = 1 or t5 = 5) x += hpar(70) end x += px if pyy > 0 py -= y pyy = 0 end y += py perform subj end end c7 = t7 /* restore "real" c7 end end &dA &dA &d@ 6. Horizontal and vertical accents &dA if subflag_2 & 0x01c0 > 0 &dA &dA &d@ Lower (raise) horizontal accent, if it and slur are present on note head &dA if c7 = 0 and c8 = 1 if bit(6,subflag_2) = 1 /* horizontal accent if stem = UP c4 -= vpar(1) else c4 += vpar(1) end end end t7 = c7 t2 = 4 /* accent code = 4 perform getpxpy (t2) if bit(0,pcontrol) = 1 if bit(1,pcontrol) = 1 if bit(2,pcontrol) = 0 c7 = 1 - stem else c7 = stem end end end x = obx + px if bit(6,subflag_2) = 1 c13 = vpar(57) z = 93 /* music font end if bit(7,subflag_2) = 1 c13 = vpar(58) z = 94 /* music font end if bit(8,subflag_2) = 1 c13 = vpar(58) z = 95 /* music font end perform yadjust if c9 <> 1 y -= vpar(1) end if pyy > 0 y = py else y += py end perform subj c7 = t7 end &dA &dA &d@ 7. harmonics &dA if subflag_2 & 0x0200 > 0 t2 = 8 /* harmonics code = 8 perform getpxpy (t2) x = obx + px z = 123 /* music font c13 = vpar(59) t7 = c7 if stem = 0 c7 = 1 else c7 = 0 end perform yadjust /* c9 set by yadjust c7 = t7 if pyy > 0 y = py else y += py end perform subj end &dA &dA &d@ 8. thumb positions, open string &dA c9 = subflag_2 & 0x0c00 if c9 > 0 t2 = 9 /* thumb-open code = 9 perform getpxpy (t2) x = obx + px if bit(10,subflag_2) = 1 z = 124 /* music font c13 = vpar(60) else z = 199 /* music font c13 = vpar(48) end t7 = c7 if stem = 0 c7 = 1 else c7 = 0 end perform yadjust /* c9 set by yadjust c7 = t7 if pyy > 0 y = py else y += py end perform subj end &dA &dA &d@ 9. fingerings (above staff for the moment) &dA c9 = subflag_2 >> 12 if c9 > 0 &dA &dA &d@ If above the staff, reverse the flags &dA t4 = 0 VVV2: t1 = 0x0f t3 = 4 VVV1: t2 = c9 & t1 if t2 > t1 >> 1 t1 = t1 << 4 + t1 t3 += 4 goto VVV1 end t4 <<= t3 t4 += t2 c9 >>= t3 if c9 > 0 goto VVV2 end t5 = t4 VVV4: t1 = 0x0f t3 = 4 VVV3: t2 = t5 & t1 if t2 > t1 >> 1 t1 = t1 << 4 + t1 t3 += 4 goto VVV3 end &dA &dA &d@ Typeset t2 &dA c13 = vpar(48) perform yadjust /* c9 set by yadjust t4 = t3 - 1 >> 2 * (hpar(73) / 2) x = obx - t4 VVV5: t4 = t2 & 0x0f z = t4 & 0x07 + 199 /* music font perform subj if t4 > 7 x += hpar(73) &dK &d@ z = 220 /* music font &dK &d@ perform subj &dK &d@ x += hpar(73) t2 >>= 4 goto VVV5 end t5 >>= t3 if t5 > 0 goto VVV4 end end &dA &dA &d@ 10. up-bows, down-bows &dA if subflag_2 & 0x03 > 0 t2 = 7 /* bowing code = 7 perform getpxpy (t2) x = obx + px if bit(0,subflag_2) = 1 c13 = vpar(61) z = 117 /* music font else c13 = vpar(62) z = 116 /* music font end t7 = c7 if stem = 0 c7 = 1 else c7 = 0 end perform yadjust c7 = t7 if c9 <> 1 y -= vpar(1) end if pyy > 0 y = py else y += py end perform subj end &dA &dA &d@ 11. fermatas &dA if bit(14,subflag_1) = 1 t2 = 16 /* upright fermata code = 16 perform getpxpy (t2) x = obx + px c13 = vpar(63) z = 101 /* music font perform yadjust if pyy > 0 y = py else y += py end perform subj end if bit(15,subflag_1) = 1 t2 = 17 /* inverted fermata code = 17 perform getpxpy (t2) x = obx + px c13 = vpar(63) z = 102 /* music font t7 = c7 if stem = 0 c7 = 0 else c7 = 1 end perform yadjust c7 = t7 y -= vpar(63) if pyy > 0 y = py else y += py end perform subj end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 9. yadjust (operates on an entire chord at once) ³ &dA &d@³ ³ &dA &d@³ Purpose: to work in conjunction with setperf to adjust ³ &dA &d@³ the y position so that the indication will ³ &dA &d@³ fall on c4/c5 or above/below the staff line, ³ &dA &d@³ whichever is higher/lower. Procedure also ³ &dA &d@³ determines a new value of the virtual endpoints, ³ &dA &d@³ c4/c5 based on the y position and the vertical ³ &dA &d@³ space parameter, c13, which is passed to the ³ &dA &d@³ procedure. ³ &dA &d@³ ³ &dA &d@³ Inputs: c4 = virtual vertical position of controlling ³ &dA &d@³ note head ³ &dA &d@³ c5 = virtual vertical position of end of stem ³ &dA &d@³ stem = stem direction 0 = up ³ &dA &d@³ 1 = down ³ &dA &d@³ c7 = situation flag 0 = place on note head ³ &dA &d@³ 1 = place on stem ³ &dA &d@³ c13 = vertical space of next character to set ³ &dA &d@³ ³ &dA &d@³ Outputs: c4 = updated vertical position of controlling ³ &dA &d@³ note head ³ &dA &d@³ c5 = updataed vertical position of end of stem ³ &dA &d@³ c9 = position flag (1 = place on top of staff) ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure yadjust int t1 if c7 = 0 if stem = DOWN if c4 > vpar(1) c4 = vpar(1) end else if c4 < vpar(7) c4 = vpar(7) end end else if stem = DOWN if c5 < vpar(8) c5 = vpar(8) end else if c5 > 0 c5 = 0 end end end * determine y location c9 = stem + c7 t1 = 1 if c9 = 1 t1 = -1 end if c7 = 0 y = 5 * notesize / 4 * t1 + c4 if stem = UP y += c13 end else y = vpar(2) * t1 + c5 /* &dAwas vpar(1)&d@ if stem = DOWN y += c13 end end * compute new vertual endpoints if c7 = 1 c5 += c13 * t1 else c4 += c13 * t1 end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 10. setleger ³ &dA &d@³ ³ &dA &d@³ Purpose, set leger lines for a chord (object) ³ &dA &d@³ ³ &dA &d@³ Inputs: obx = x-position of object ³ &dA &d@³ passsize = note size (full, cue-size) ³ &dA &d@³ c7 = pointer to lowest note in chord ³ &dA &d@³ c8 = pointer to highest note in chord ³ &dA &d@³ c9 = extra width of leger lines ³ &dA &d@³ stem = stem direction 0 = up, 1 = down ³ &dA &d@³ ³ &dA &d@³ Internal: x,y,z sent to subj ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setleger z = passsize * 128 + 45 /* music font x = obx if stem = UP ++x end if ts(c8,STAFFLOC) < 0 y = 0 - notesize loop while y >= ts(c8,STAFFLOC) perform subj if c9 > 0 x += c9 perform subj x -= c9 end y -= notesize repeat end if ts(c7,STAFFLOC) > vpar(9) y = vpar(10) loop while y <= ts(c7,STAFFLOC) perform subj if c9 > 0 x += c9 perform subj x -= c9 end y += notesize repeat end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 11. wideleger ³ &dA &d@³ ³ &dA &d@³ Purpose: set wide a leger line for a note head located on, ³ &dA &d@³ above, or below a leger line ³ &dA &d@³ ³ &dA &d@³ Inputs: obx = x-position of object ³ &dA &d@³ oby = y-position of object ³ &dA &d@³ x = x-position of note head ³ &dA &d@³ y = y-position of note head ³ &dA &d@³ passsize = note size (full size, cue size) ³ &dA &d@³ c10 = note-on-line flag: 0 = on line, 1 = on space ³ &dA &d@³ ³ &dA &d@³ Internal: x,y,z sent to subj ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure wideleger int t1 z = passsize * 128 + 45 /* music font t1 = x if c10 = 0 --x end perform subj if c10 = 0 x += 3 else ++x end perform subj x = t1 return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 12. number ³ &dA &d@³ ³ &dA &d@³ Purpose: Create subobject for number ³ &dA &d@³ ³ &dA &d@³ Inputs: a = number ³ &dA &d@³ dv2 = center position for number ³ &dA &d@³ ³ &dA &d@³ Outputs: dv3 = right boundary of number ³ &dA &d@³ ³ &dA &d@³ x,z sent to subj ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure number x = dv2 - hpar(21) if a > 99 x = dv2 + hpar(21) else if a > 9 x = dv2 end end dv3 = x + hpar(20) NU1: a /= 10 z = rem + 71 /* music font perform subj if a = 0 return end x -= hpar(20) goto NU1 &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 13. setdots ³ &dA &d@³ ³ &dA &d@³ Purpose: typeset sub-object dot(s) ³ &dA &d@³ ³ &dA &d@³ Inputs: c3 = pointer into set array for this note ³ &dA &d@³ obx = horizontal position of object ³ &dA &d@³ oby = vertical position of object ³ &dA &d@³ passsize = note size (full size, cue size) ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setdots int t1,t2,t3,t4 t4 = ts(c3,DOT) if t4 > 0 t1 = t4 >> 4 /* code modified &dA12-24-96&d@ t1 /= INT10000 t2 = rem if t2 > 5000 t2 -= INT10000 ++t1 end x = obx + t1 y = oby + t2 z = 128 * passsize + 44 /* music font perform subj /* first dot if t4 & 0x03 = 3 t3 = hpar(91) if passsize = CUESIZE t3 = t3 * 8 / 10 end x += t3 perform subj /* second dot end &dA &d@ added code &dA12-24-96&d@ if t4 & 0x04 = 4 t3 = hpar(91) if passsize = CUESIZE t3 = t3 * 8 / 10 end x += t3 perform subj /* third dot end if t4 & 0x08 = 8 t3 = hpar(91) if passsize = CUESIZE t3 = t3 * 8 / 10 end x += t3 perform subj /* fourth dot end end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 14. setrest (t6) ³ &dA &d@³ ³ &dA &d@³ Purpose: write object rest ³ &dA &d@³ ³ &dA &d@³ Inputs: c1 = pointer into set array for this rest ³ &dA &d@³ obx = horizontal position of rest ³ &dA &d@³ oby = vertical position of rest ³ &dA &d@³ c3 = oby offset (for grand staff) ³ &dA &d@³ ntype = type of note (e.g. sixteenth) ³ &dA &d@³ passsize = rest type (full size, cue size) ³ &dA &d@³ passtype = type of pass (reg,cue,grace,cuegrace) ³ &dA &d@³ passnum = pass number for this rest ³ &dA &d@³ ³ &dA &d@³ Output: t6 = amount of space taken up ³ &dA &d@³ ³ &dA &d@³ Operation: In addition to writing the object rest, this ³ &dA &d@³ procedure must also check to see of the rest is ³ &dA &d@³ the beginning or end of a tuplet group. In the ³ &dA &d@³ former case, the tuplet array, tuar, must be ³ &dA &d@³ constructed; in the latter case, the tuplet ³ &dA &d@³ super-object must be compiled and written out. ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setrest (t6) int t1,t2,t3,t4,t5,t6,t7,t8,t9 x = obx y = oby t1 = 0 if ntype > QUARTER t6 = hpar(87) /* total horizontal space taken else t6 = hpar(88) /* total horizontal space taken end if ntype > SIXTEENTH z = 128 * passsize + 55 - ntype /* music font perform subj else y += notesize if ntype < THIRTY_SECOND y = 4 - ntype * notesize + y end z = 128 * passsize + 49 /* music font perform subj ++z if passsize = FULLSIZE t3 = notesize t4 = hpar(54) else t3 = vpar(65) t4 = hpar(89) end t2 = ntype loop while t2 < EIGHTH y -= t3 x += t4 t6 += t4 /* total horizontal space taken ++t1 perform subj ++t2 repeat end if ts(c1,DOT) > 0 t3 = ts(c1,DOT) t8 = t3 & 0x0f /* actual DOT code (modified &dA12-24-96&d@) t3 >>= 4 /* code modified &dA12-24-96&d@ t3 /= INT10000 t7 = rem if t7 > 5000 t7 -= INT10000 ++t3 end y = oby + t7 x += t3 t6 = vpar(1) if passsize = CUESIZE t6 = t6 * 8 / 10 /* space for dot end t6 += t3 z = 128 * passsize + 44 /* music font perform subj /* first dot if t8 & 0x02 = 2 t5 = hpar(91) &dA &d@ if passsize = CUESIZE &dA &d@ t5 = t5 * 8 / 10 &dA &d@ end x += t5 perform subj /* second dot t6 += t5 end &dA &d@ code added &dA12-24-96&d@ if t8 & 0x04 = 4 t5 = hpar(91) &dA &d@ if passsize = CUESIZE &dA &d@ t5 = t5 * 8 / 10 &dA &d@ end x += t5 perform subj /* third dot t6 += t5 end if t8 & 0x08 = 8 t5 = hpar(91) &dA &d@ if passsize = CUESIZE &dA &d@ t5 = t5 * 8 / 10 &dA &d@ end x += t5 perform subj /* fourth dot t6 += t5 end end passback t6 /* total horizontal space taken jtype = "R" jcode = ntype out = "0" if bit(4,ts(c1,SUPER_FLAG)) = 1 /* if begin tuplet ++snum tuar(passtype,passnum,TU_SNUM) = snum tuar(passtype,passnum,TU_Y1) = y tuar(passtype,passnum,TU_Y2) = y tuar(passtype,passnum,TU_FSTEM) = DOWN /* (default) t7 = 0 if bit(6,ts(c1,SUPER_FLAG)) = 1 /* tuplet has a bracket t7 = ts(c1,SUPER_FLAG) & 0x3c0 /* bits 6,7,8,9 &dA03-21-97&d@ t7 <<= 2 end tuar(passtype,passnum,TU_FSTEM) += t7 /* tuplet flags &dA03-21-97&d@ out = "1 " // chs(snum) end if bit(5,ts(c1,SUPER_FLAG)) = 1 /* if end tuplet t7 = tuar(passtype,passnum,TU_FSTEM) & 0xff goto TPFF(tpflag+1) TPFF(1): /* default tuplet placement TPFF(2): /* place tuplet near note heads if t7 = UP goto TPFFA else goto TPFFB end TPFF(3): /* place tuplet near stems if t7 = UP goto TPFFB else goto TPFFA end TPFF(4): /* place all tuplets above notes goto TPFFB TPFF(5): /* place all tuplets below notes goto TPFFA TPFFA: t3 = tuar(passtype,passnum,TU_Y2) + notesize + vpar(64) t4 = notesize * 6 if t7 <> UP t3 += vpar(7) end if t3 < t4 t3 = t4 end t9 = 4 /* tips up &dA03-21-97&d@ goto TPFFC TPFFB: t3 = tuar(passtype,passnum,TU_Y2) - notesize t4 = 0 - vpar(1) if t7 = UP t3 -= vpar(7) end if t3 > t4 t3 = t4 end t9 = 0 /* tips down &dA03-21-97&d@ TPFFC: t3 -= tuar(passtype,passnum,TU_Y1) t5 = t4 - oby out = "1 " // chs(tuar(passtype,passnum,TU_SNUM)) end &dA &dA &d@ fermata over rest &dA if bit(14,ts(c1,SUBFLAG_1)) = 1 t2 = 16 /* upright fermata code = 16 perform getpxpy (t2) x = obx + px if pyy > 0 y = py else y = py - vpar(1) end z = 101 /* music font perform subj end if bit(15,ts(c1,SUBFLAG_1)) = 1 t2 = 17 /* inverted fermata code = 17 perform getpxpy (t2) x = obx + px z = 102 /* music font y = py + vpar(10) if pyy > 0 y = py else y += py end perform subj end &dA &dA &d@ New code (&dA11-11-93&d@) Duration attribute of rest &dA ++sobcnt sobl(sobcnt) = "A D " // chs(note_dur) // " " // chs(divspq*4) if sobcnt = 1 pcode = z else pcode = sobcnt end t7 = inctype if ts(c1,CLAVE) = 101 /* if movable rest inctype = 10000 end oby += c3 &dA &dA &d@ Now look for print suggestions for this note object &dA putobjpar = 0 t4 = ts(c1,TSR_POINT) pcontrol = ors(tsr(t4){1}) if bit(0,pcontrol) = 1 px = ors(tsr(t4){2}) << 8 py = ors(tsr(t4){4}) << 16 if py > 0 putobjpar = pcontrol + px + py + 0x1000000 else py = ors(tsr(c5){3}) << 16 putobjpar = pcontrol + px + py end end perform putobj inctype = t7 if bit(5,ts(c1,SUPER_FLAG)) = 1 /* if end tuplet t1 = tuar(passtype,passnum,TU_FSTEM) >> 8 /* tuplets flags &dA03-21-97 if t1 > 0 t1 >>= 1 /* remove bracket present flag t1 <<= 5 t9 |= t1 t9 |= 0x02 /* bracket present flag else t9 = 1 end ++outpnt tput [Y,outpnt] H ~tuar(passtype,passnum,TU_SNUM) X ~t9 ~ts(c1,TUPLE) 0 ~t3 0 ~t5 0 tuar(passtype,passnum,TU_SNUM) = 0 tpflag = global_tpflag end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 15. putobj ³ &dA &d@³ ³ &dA &d@³ Purpose: write object and sub-objects to intermediate list ³ &dA &d@³ ³ &dA &d@³ Inputs: jtype = object type (field 2) ³ &dA &d@³ jcode = object code (field 3) ³ &dA &d@³ obx = object offset from staff x-position (field 4) ³ &dA &d@³ oby = object offset form staff y-position (field 5) ³ &dA &d@³ pcode = print code (field 6) (or sobl counter) ³ &dA &d@³ spn = space node (field 7) ³ &dA &d@³ inctype = increment type for next node with a new spn ³ &dA &d@³ out = fields 9 -- ³ &dA &d@³ temp3 = ? ³ &dA &d@³ sobl() = subobject line ³ &dA &d@³ ³ &dA &d@³ putobjpar = parameters modifying operation of putobj ³ &dA &d@³ ³ &dA &d@³ putobjpar & 0x01 = control 0 = no modifications ³ &dA &d@³ 1 = possible mods ³ &dA &d@³ ³ &dA &d@³ putobjpar & 0x06 = blank flag 0 = no blanking ³ &dA &d@³ 1 = blank all sub-obj ³ &dA &d@³ 2 = blank all but ³ &dA &d@³ extension dots ³ &dA &d@³ ³ &dA &d@³ putobjpar & 0x00ff00 = x modification + 128 ³ &dA &d@³ (in tenths of notesize) ³ &dA &d@³ ³ &dA &d@³ if putobjpar & 0x1000000 > 0 ³ &dA &d@³ ³ &dA &d@³ putobjpar & 0xff0000 y location on staff + 128 ³ &dA &d@³ (in tenths of notesize) ³ &dA &d@³ (positive is down) ³ &dA &d@³ else ³ &dA &d@³ ³ &dA &d@³ putobjpar & 0xff0000 = y modification + 128 ³ &dA &d@³ (in tenths of notesize) ³ &dA &d@³ (positive is down) ³ &dA &d@³ ³ &dA &d@³ Outputs: sobcnt set to 0 ³ &dA &d@³ supcnt set to 0 ³ &dA &d@³ ³ &dA &d@³ Internal variable: oldspn = spn from previous object ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure putobj str temp.80,super.80,temp2.80 int oldspn,t,c1,c2,c3 int t1,t2,t3,t4,t5,t6,t7,t8,t9 int s1,s2,s3,s4,s5,s6,s7,s8,s9 t = inctype if t <> 10000 if spn = oldspn t = 0 end if spn = 1 t = 0 end end if (bit(0,putobjpar)) = 1 px = putobjpar >> 8 & 0xff py = putobjpar >> 16 & 0xff if px > 0 px = px - 128 * notesize / 10 end if py > 0 py = py - 128 * notesize / 10 end t1 = obx + px if putobjpar & 0x1000000 > 0 t2 = py if oby > 700 t2 += 1000 end else t2 = oby + py end putobjpar &= 0xff t3 = pcode t4 = putobjpar >> 1 if t4 = 1 or t4 = 2 if t3 > 0 and t3 < 32 if sobl(1) = "" t3 = 0 else t6 = 0 if t4 = 2 ++t6 t8 = t2 / vpar(1) t8 /= 2 t8 = rem - 1 * vpar(1) t9 = DOT_CHAR sobl(t6) = "K 0 " // chs(t8) // " " // chs(t9) end loop for t5 = 1 to t3 if sobl(t5){1} = "A" ++t6 sobl(t6) = sobl(t5) end repeat t3 = t6 end end end else t1 = obx t2 = oby t3 = pcode end ++outpnt tput [Y,outpnt] J ~jtype ~jcode ~t1 ~t2 ~t3 ~spn ~t ~out if s2rec < 0x10000 s2_to_ifile(s2rec) = outpnt ifile_to_s2(outpnt) = s2rec c1 = 0 else c1 = s2rec >> 16 - 1 /* c1 is one less than the number of notes in a chord s2rec &= 0xffff ifile_to_s2(outpnt) = s2rec s2_to_ifile(s2rec) = outpnt c3 = s2rec loop for c2 = 1 to c1 &dK &d@ ++c3 loop c3 = list_order(c3,2) if c3 = BOTTOM_FLAG dputc Error return 12 end repeat while list_order(c3,3) = IGNORE_REC tget [X,c3] temp2 if temp2{1} = " " or temp2{2} = " " s2_to_ifile(c3) = outpnt else if "PS" con temp2{1} /* at the moment only P and S records can /* intervene between chord tones &dA06/28/95 --c2 /* tricky code. Counter decremented because record was not a chord. end end repeat end &dA &dA &d@ Look for marks that could be incorporated with this object &dA super = "" if jtype = "N" if outpnt < 3 putc dputc Error in the setting of outpnt. Current value = ~outpnt putc return 10 end tget [Y,outpnt-1] temp .t5 s1 s2 s3 s4 s5 s6 s7 s8 if temp{1} = "H" super = temp tget [Y,outpnt-2] temp .t5 s1 s2 s3 s4 s5 s6 s7 s8 end if temp{1,3} = "J M" and s2 = t1 and s5 = spn and s7 = 1 ifile_to_s2(outpnt) = 0 if super = "" --outpnt else outpnt -= 2 end ifile_to_s2(outpnt) = s2rec s2_to_ifile(s2rec) = outpnt c3 = s2rec loop for c2 = 1 to c1 &dK &d@ ++c3 loop c3 = list_order(c3,2) if c3 = BOTTOM_FLAG dputc Error return 12 end repeat while list_order(c3,3) = IGNORE_REC tget [X,c3] temp2 if temp2{1} = " " or temp2{2} = " " s2_to_ifile(c3) = outpnt else --c2 end repeat out = trm(out) out = out // " " s9 = int(out) ++s9 out = chs(s9) // out{sub..} // chs(s8) t = s6 tput [Y,outpnt] J ~jtype ~jcode ~t1 ~t2 ~t3 ~spn ~t ~out else super = "" end end oldspn = spn if t3 > 0 and t3 < 32 if sobl(1) = "" ++outpnt tput [Y,outpnt] ~temp3 else loop for sobcnt = 1 to t3 ++outpnt tput [Y,outpnt] ~sobl(sobcnt) repeat end end sobcnt = 0 supcnt = 0 if super <> "" ++outpnt tput [Y,outpnt] ~super end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 16. subj ³ &dA &d@³ ³ &dA &d@³ Purpose: write sub-object to intermediate list ³ &dA &d@³ ³ &dA &d@³ Inputs: x = horizontal position of sub-object ³ &dA &d@³ y = vertical position of sub-object ³ &dA &d@³ z = character number ³ &dA &d@³ obx = object offset from staff x-position ³ &dA &d@³ oby = object offset from staff y-position ³ &dA &d@³ sobcnt = counter in intermediate list ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure subj ++sobcnt sobx = x - obx soby = y - oby sobl(sobcnt) = "K " // chs(sobx) // " " // chs(soby) // " " sobl(sobcnt) = sobl(sobcnt) // chs(z) return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 17. cancelsig (m, j, h, klave) ³ &dA &d@³ ³ &dA &d@³ Purpose: Write out cancellation of sharps or flats ³ &dA &d@³ ³ &dA &d@³ Inputs: obx = object location ³ &dA &d@³ oby = " " ³ &dA &d@³ x = x starting point ³ &dA &d@³ h = number of sharps or flats to cancel ³ &dA &d@³ j = one less than starting point in zak(.,.) ³ &dA &d@³ m = selection 1 = sharps ³ &dA &d@³ 2 = flats ³ &dA &d@³ klave = line on which to start calcellations ³ &dA &d@³ (from which y is computed) ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure cancelsig (m, j, h, klave) int m,j,h,klave getvalue m, j, h, klave z = 64 loop for g = 1 to h y = klave + 20 * notesize / 2 - vpar20 perform subj ++j &dK &d@ y += zak(m,j) klave += zak(m,j) x += hpar(11) repeat passback klave return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 18. setmrest ³ &dA &d@³ ³ &dA &d@³ Purpose: Set multiple rests and terminating bar line ³ &dA &d@³ ³ &dA &d@³ Inputs: p = horizontal starting point ³ &dA &d@³ mrest = number of rests to set ³ &dA &d@³ measnum = measure number for terminating bar lne ³ &dA &d@³ ³ &dA &d@³ Outputs:autop = new horizontal point ³ &dA &d@³ mrest = 0 ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure setmrest int i,j int p1,p2 #if SMALL p1 = 10 p2 = 25 #else p1 = 30 p2 = 45 #endif putobjpar = 0 if mrest > 1 autop += hpar(22) obx = autop oby = vpar(3) x = obx y = oby z = 62 perform subj y = oby + vpar(11) perform subj z = 92 x = obx y = vpar(4) loop for i = 1 to 3 perform subj x += p1 autop += p1 repeat y = oby z = 62 perform subj y = oby + vpar(11) perform subj dv2 = autop - p2 a = mrest y = vpar(4) perform number jtype = "S" jcode = 4 out = "0" pcode = sobcnt spn = mrest perform putobj autop += hpar(23) else obx = autop + hpar(24) oby = vpar(4) ++outpnt tput [Y,outpnt] J S 6 ~obx ~oby 46 0 0 0 autop += hpar(25) end obx = autop + hpar(36) ifile_to_s2(outpnt) = s2rec ++outpnt tput [Y,outpnt] J B ~measnum ~obx 1 82 6913 1 0 ifile_to_s2(outpnt) = s2rec s2_to_ifile(s2rec) = outpnt autop = obx + hpar(37) loop for i = 1 to MAX_STAFF loop for j = 1 to 45 emptyspace(i,j) = hpar(37) repeat repeat mrest = 0 return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 19. getspace ³ &dA &d@³ ³ &dA &d@³ Purpose: Determine space parameter for particular note value ³ &dA &d@³ ³ &dA &d@³ Inputs: a5 = pointer into set array ³ &dA &d@³ ³ &dA &d@³ Outputs: a6 = space parameter ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure getspace int t1, t2, t3 * get space for movable rest if ts(a5,CLAVE) = 101 /* movable rest a6 = hpar(24) + hpar(25) - hpar(37) return end a6 = ts(a5,NTYPE) * 3 if a6 = 0 a6 = 3 end --a6 if ts(a5,DOT) > 0 ++a6 else if ts(a5,TUPLE) > 2 --a6 end end if a6 > 33 putc Problem with duration. Please check the stage2 file for putc possible errors. putc return 10 end a6 = nsp(a6) * make extra space for up-flags if ts(a5,TYPE) = NOTE and bit(1,ts(a5,STEM_FLAGS)) = UP if ts(a5,BEAM_FLAG) = NO_BEAM and ts(a5,NTYPE) < QUARTER a6 += hpar(28) t3 = hpar(26) + hpar(28) + hpar(82) if a6 < t3 loop for t1 = a5+1 to sct if ts(t1,DIV) > ts(a5,DIV) loop for t2 = t1 to sct if ts(t2,DIV) = ts(t1,DIV) if ts(t2,TYPE) <= NOTE_OR_REST if ts(t2,STAFF_NUM) = ts(a5,STAFF_NUM) if ts(t2,CLAVE) >= ts(a5,CLAVE) a6 = t3 t2 = sct end end end else t2 = sct end repeat t1 = sct end repeat end end end * allow mininum extra space if next note on staff has stem-down repeaters * make extra space for sixteenth and smaller rests if ts(a5,TYPE) = REST and ts(a5,NTYPE) < EIGHTH a6 = 6 - ts(a5,NTYPE) * hpar(54) + a6 end * shrink space if cue-size flag is set if bit(16,ts(a5,SUBFLAG_1)) = CUESIZE a6 = a6 * 8 / 10 end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 20. wordspace ³ &dA &d@³ ³ &dA &d@³ Purpose: Calculate length of word ³ &dA &d@³ ³ &dA &d@³ Inputs: ttext = word ³ &dA &d@³ c5 = font number ³ &dA &d@³ curfont = currently active font ³ &dA &d@³ ³ &dA &d@³ Outputs: a5 = space taken up by word ³ &dA &d@³ ³ &dA &d@³ curfont possibly modified ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure wordspace int t1,t2 a5 = 0 * get new spacing parameters, if needed perform spacepar loop for t2 = 1 to len(ttext) * adjust for backslash (\) sequence if ttext{t2} = "\" if t2 + 2 > len(ttext) return 5 end ++t2 &dA &d@ if ttext{t2} in ['0'..'9'] or ttext{t2+1} in ['0'..'9'] if ttext{t2,2} con ['0'..'9'] if ttext{t2} in ['0'..'9'] t1 = ors(ttext{t2+1}) if ttext{t2} = "0" t1 += 128 end else t1 = ors(ttext{t2}) if ttext{t2+1} = "0" t1 += 128 end end ++t2 else return 5 end else t1 = ors(ttext{t2}) end a5 += spc(t1) if t1 = 171 a5 -= hpar(57) end repeat return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 21. spacepar ³ &dA &d@³ ³ &dA &d@³ Purpose: Be sure that proper space paramters are loaded ³ &dA &d@³ ³ &dA &d@³ Inputs: c5 = font number ³ &dA &d@³ ³ &dA &d@³ Outputs: valid spc(.) array for this font ³ &dA &d@³ updated value of curfont ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure spacepar str line.80 int bfont(4,4),bspc(4,255),time int t1,t2,t3,t4 str file.100 if c5 <> curfont t2 = 1000000 loop for t1 = 1 to 4 if c5 = bfont(t1,1) /* font found in reserve ++time bfont(t1,2) = time loop for t3 = 1 to 255 spc(t3) = bspc(t1,t3) repeat curfont = c5 return end if bfont(t1,2) < t2 t2 = bfont(t1,2) t4 = t1 /* t4 is the oldest block end repeat #if SMALL file = "c:\musprint\param06\fontspac" #else file = "c:\musprint\param\fontspac" #endif &dA &d@ file = "c:\wbh\res\mus\prnt\xmus\progs\newph2\fontspac" open [4,1] file t2 = c5 - 1 * 10 loop for t1 = 1 to t2 getf [4] repeat t3 = 61 loop for t2 = 1 to 31 spc(t2) = 0 repeat loop for t2 = 32 to 127 if t3 = 61 t3 = 1 getf [4] line end spc(t2) = int(line{t3,2}) t3 += 3 repeat loop for t2 = 128 to 159 spc(t2) = 0 repeat t3 = 61 loop for t2 = 160 to 255 if t3 = 61 t3 = 1 getf [4] line end spc(t2) = int(line{t3,2}) t3 += 3 repeat close [4] loop for t1 = 1 to 255 bspc(t4,t1) = spc(t1) repeat bfont(t4,1) = c5 ++time bfont(t4,2) = time curfont = c5 end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 22. newnsp ³ &dA &d@³ ³ &dA &d@³ Purpose: Calculate new nsp array ³ &dA &d@³ ³ &dA &d@³ Inputs: scnt = next logical record in input table ³ &dA &d@³ divspq = number of divisions per quarter note ³ &dA &d@³ mindist = minimum distance between notes ³ &dA &d@³ ³ &dA &d@³ Outputs: new nsp array for this section ³ &dA &d@³ ³ &dA &d@³ Internal variables: t1,t2,t3,t4,t5,t6 ³ &dA &d@³ mtot ³ &dA &d@³ ³ &dA &d@³ Strategy: (1) read through file until the next time ³ &dA &d@³ signature change or until the end ³ &dA &d@³ (2) count number of measures where shortest ³ &dA &d@³ duration occurs ³ &dA &d@³ (3) if this represents more than xx% of the ³ &dA &d@³ outstanding measures, then this is ³ &dA &d@³ the shortest note ³ &dA &d@³ (4) otherwise, the shortest note is the ³ &dA &d@³ next one up; i.e. ³ &dA &d@³ triplets --> regular ³ &dA &d@³ regular --> double regular ³ &dA &d@³ ³ &dA &d@³ nsp(32) will be space for longa ³ &dA &d@³ nsp(29) will be space for breve ³ &dA &d@³ nsp(26) will be space for whole ³ &dA &d@³ ... ³ &dA &d@³ nsp(5) will be space for 128th note ³ &dA &d@³ nsp(2) will be space for 256th note ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure newnsp int t1,t2,t3,t4,t5,t6,t7 int mtot str line.120 t6 = scnt /* temporary counter in input loop for t1 = 1 to 33 nsp(t1) = mindist repeat if minshort <> 0 t1 = minshort rem = 0 goto NOCALC end t2 = 100 mtot = 0 t7 = 0 /* "durations found" flag (initialize at 0) loop t1 = 0 tget [X,t6] line .t6 t1 &dK &d@ ++t6 /* increment temporary counter loop t6 = list_order(t6,2) /* increment temporary counter repeat while t6 <> BOTTOM_FLAG and list_order(t6,3) = IGNORE_REC line = line // pad(4) if line{1,4} = "/END" or line{1,4} = "/FIN" goto NW1 end if line{1} = "$" and line con "T:" and t7 = 1 goto NW1 end if line{1,3} = "mea" ++mtot t4 = 0 end * if line{1} in ['A'..'G','r'] and t1 > 0 /* positive dur t7 = 1 if t1 < t2 t2 = t1 /* new shortest note t3 = 0 t4 = 0 end if t1 = t2 and t4 = 0 t4 = 1 ++t3 /* inc number of measures end end repeat &dA &dA &d@ t2 = shortest note value &dA &d@ t3 = number of measures where this note occurs &dA NW1: if t7 = 0 /* No durations found (unusual case) mtot = 1 t2 = 1 t3 = 1 end t5 = divspq * 16 / t2 if t5 > 96 t4 = 0 /* case 1: always double shortest note else if t5 > 48 t4 = 5 /* case 2: double if less than 16% else if t5 > 24 t4 = 8 /* case 3: double if less than 11% else t4 = 10 /* case 4: double if less than 9% end end end * t1 = mtot / t3 if t1 > t4 t1 = divspq / 3 if rem = 0 t1 = t2 / 2 if rem = 0 t2 = t1 * 3 else t2 *= 2 end else t2 *= 2 end end * t1 = divspq * 16 / t2 &dA &d@ if t1 = 1, shortest note is longa &dA &d@ if t1 = 2, shortest note is breve &dA &d@ if t1 = 4, shortest note is whole &dA &d@ if t1 = 8, shortest note is half, etc t2 = t1 / 3 if rem = 0 t1 = t2 * 2 end NOCALC: t5 = 32 /* 32 = code for longa t4 = 160 * &dK &d@ t1 >>= 1 t1 <<= 1 loop while t1 > 0 /* i.e., if t1 started as 16, loop 6 times t5 -= 3 t4 -= 20 t1 >>= 1 repeat * if rem = 0 nsp(t5) = mindist * 10 / 9 end if t4 > 100 nsp(t5) = nsp(t5) * t4 / 100 end nsp(t5+1) = nsp(t5) * 12 / 10 t1 = 13 * loop while t5 < 31 t4 = t5 + 3 nsp(t4) = nsp(t5) * t1 / 10 ++t1 t5 = t4 nsp(t5-1) = nsp(t5) * 9 / 10 nsp(t5+1) = 2 * nsp(t5) - nsp(t5-3) repeat return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 23. settime (t1) ³ &dA &d@³ ³ &dA &d@³ Purpose: Set time signature ³ &dA &d@³ ³ &dA &d@³ Inputs: tnum = time numerator ³ &dA &d@³ tden = time denominator ³ &dA &d@³ autop = current x position ³ &dA &d@³ oby = 0 or 1000 (staff 0 or 1) ³ &dA &d@³ ³ &dA &d@³ Outputs: autop = new x position ³ &dA &d@³ t1 = amount of empty space ³ &dA &d@³ ³ &dA &d@³ Internal variables: @e,a,dv2,dv3,dv4 ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure settime (t1) int t1 jcode = tnum * 100 + tden putobjpar = 0 @e = 0 if tnum = 1 and tden = 1 @e = 1 end if tnum = 0 and tden = 0 @e = 2 end * &dK &d@ putc Time = ~tnum :~tden * set time signature jtype = "T" out = "0" if @e > 0 obx = autop oby += vpar(6) pcode = 1 a = 36 + @e sobl(1) = "K 0 0 " // chs(a) perform putobj autop += hpar(14) t1 = hpar(14) - hpar(92) oby -= vpar(6) else dv2 = autop + hpar(16) if tden < 10 and tnum < 10 dv2 = autop + hpar(17) end * obx = dv2 * y = vpar(4) + oby a = tnum perform number dv4 = dv3 y = vpar(8) + oby a = tden perform number pcode = sobcnt perform putobj if dv3 > dv4 dv3 = dv4 end autop = dv3 + hpar(18) t1 = hpar(18) end passback t1 return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 24. process_section ³ &dA &d@³ ³ &dA &d@³ Purpose: Set parameters for new section ³ &dA &d@³ ³ &dA &d@³ Inputs: @b = new key ³ &dA &d@³ divspq = divisions per quarter ³ &dA &d@³ @e = time signature flag ³ &dA &d@³ tnum = time numerator ³ &dA &d@³ tden = time denominator ³ &dA &d@³ @n = set array counter (for ³ &dA &d@³ changes within measure) ³ &dA &d@³ ³ &dA &d@³ Outputs: autop = new x position ³ &dA &d@³ ³ &dA &d@³ Internal variables: @e,a,dv2,dv3,dv4 ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure process_section int h, hh, pp, qq int t1,t2,t3,t4 str temp2.100 &dA &d@ &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA &d@ &dA³ BEGINNING OF SECTION PROCESSING ³&d@ &dA &d@ &dAÀÄÄ-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ if @n > 0 &dA &dA &d@ examine &dA if line con "I:" vflag = int(line{mpt+2..}) if vflag < 1 vflag = 1 end if vflag > 3 vflag = 3 end end if line con "S:" nstaves = int(line{mpt+2..}) if nstaves < 1 nstaves = 1 end if nstaves > 2 nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end end if line con "C:" or line con "C1:" ++@n tv1(@n) = CLEF_CHG if line{mpt+2} = ":" ++mpt end tv2(@n) = int(line{mpt+2..}) tv3(@n) = 0 /* staff number tv5(@n) = scnt - 1 if line con "D:" or line con "D1:" tcode(@n) = "0" /* music font else tcode(@n) = "128" /* music font end end if line con "C2:" ++@n tv1(@n) = CLEF_CHG tv2(@n) = int(line{mpt+3..}) tv3(@n) = 1 /* staff number tv5(@n) = scnt - 1 if line con "D2:" tcode(@n) = "0" /* music font else tcode(@n) = "128" /* music font end nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end if line con "D:" or line con "D1:" ++@n tv1(@n) = DESIGNATION tv2(@n) = 0 tv3(@n) = 0 /* staff number tv5(@n) = scnt - 1 tcode(@n) = "" if line{mpt+1} <> ":" ++mpt end line2 = trm(line{mpt+2..}) tdata(@n) = mrt(line2) end if line con "D2:" ++@n tv1(@n) = DESIGNATION tv2(@n) = 0 tv3(@n) = 1 /* staff number tv5(@n) = scnt - 1 tcode(@n) = "" line2 = trm(line{mpt+3..}) tdata(@n) = mrt(line2) nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end if line con "T:" ++@n tv1(@n) = METER_CHG tnum = int(line{mpt+2..}) if line con "/" tden = int(line{mpt+1..}) else return 6 end tv2(@n) = 100 * tnum + tden tv3(@n) = nstaves tv5(@n) = scnt - 1 tcode(@n) = "" end if line con "Q:" ++@n tv1(@n) = DIV_CHG tv2(@n) = int(line{mpt+2..}) tv3(@n) = 0 tv5(@n) = scnt - 1 tcode(@n) = "" end if line con "K:" ++@n tv1(@n) = AX_CHG tv2(@n) = int(line{mpt+2..}) tv3(@n) = nstaves tv5(@n) = scnt - 1 tcode(@n) = "" end &dA &dA &d@ /* old system; better to use print suggestions &dA if line con "P:" mindist = int(line{mpt+2..}) * notesize / 16 * STRETCH end return end * spn = 6913 &dA &dA &d@ "P:" is the old system; it's actually better to use the &dA &d@ new system of print suggestions to change note spacing &dA if line con "P:" mindist = int(line{mpt+2..}) * notesize / 16 * STRETCH end if line con "I:" vflag = int(line{mpt+2..}) if vflag < 1 vflag = 1 end if vflag > 3 vflag = 3 end end if line con "S:" nstaves = int(line{mpt+2..}) if nstaves < 1 nstaves = 1 end if nstaves > 2 nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end end if line con "D2:" nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end &dA &dA &d@ (1) clef &dA if line con "C:" or line con "C1:" or line con "C2:" i = 0 h = 0 if line con "C:" or line con "C1:" if line{mpt+1} = ":" i = mpt + 2 else i = mpt + 3 end end if line con "C2:" h = mpt + 3 nstaves = 2 tget [Y,1] temp2 .t3 t1 t2 if temp2 con "!" temp2 = temp2{mpt..} end tput [Y,1] L ~granddist ~t2 ~temp2 end if i*h = 0 /* Case1: only one clef designator if i > 0 k = 1 else i = h k = 2 end clef(k) = int(line{i..}) active_clef = clef(k) perform zjcline (k) if autop > 0 autop -= hpar(37) end autop += hpar(5) * print clef obx = autop oby = 5 - j * notesize oby = (k - 1) * 1000 + oby perform putclef (k) else /* Case2: two clef designators k = 1 clef(k) = int(line{i..}) active_clef = clef(k) perform zjcline (k) if autop > 0 autop -= hpar(37) end autop += hpar(5) * print clef on staff 1 obx = autop oby = 5 - j * notesize perform putclef (k) k = 2 clef(k) = int(line{h..}) active_clef = clef(k) perform zjcline (k) * print clef on staff 2 obx = autop oby = 5 - j * notesize oby += 1000 perform putclef (k) end * advance horizontal pointer autop += hpar(8) pp = hpar(8) - hpar(86) loop for h = 1 to MAX_STAFF loop for hh = 1 to 45 emptyspace(h,hh) = pp repeat repeat end &dA &dA &d@ (2) key signature &dA if line con "K:" @b = int(line{mpt+2..}) hh = 1 perform key_change (@b, key, nstaves, hh) /* this sets key = @b and resets claveax(.), emptyspace(.,.) etc. end &dA &dA &d@ (3) divisions per quarter &dA if line con "Q:" olddivspq = int(line{mpt+2..}) end &dA &dA &d@ (4) time word &dA if line con "D:" or line con "D1:" or line con "D2:" a1 = 6913 if line not_con "T:" a1 = 1 &dA &dA &d@ f4 is set when a directive is placed with spn = 1. This &dA &d@ directive takes its position from the next controlling &dA &d@ object in the part. Therefore, it must not be followed &dA &d@ by a multiple rest. &dA f4 = 1 end if line con "D:" temp3 = trm(line{mpt+2..}) temp3 = mrt(temp3) oby = 0 - tword_height * vpar(1) ++outpnt tput [Y,outpnt] J D 5 ~autop ~oby 1 ~a1 0 0 ifile_to_s2(outpnt) = s2rec &dK &d@ s2_to_ifile(s2rec) = outpnt (not valid) ++outpnt tput [Y,outpnt] W 0 0 37 ~temp3 end if line con "D1:" temp3 = trm(line{mpt+2..}) temp3 = mrt(temp3) oby = 0 - tword_height * vpar(1) ++outpnt tput [Y,outpnt] J D 5 ~autop ~oby 1 ~a1 0 0 ifile_to_s2(outpnt) = s2rec &dK &d@ s2_to_ifile(s2rec) = outpnt (not valid) ++outpnt tput [Y,outpnt] W 0 0 37 ~temp3 end if line con "D2:" temp3 = trm(line{mpt+2..}) temp3 = mrt(temp3) oby = 0 - tword_height * vpar(1) oby += 1000 ++outpnt tput [Y,outpnt] J D 5 ~autop ~oby 1 ~a1 0 0 ifile_to_s2(outpnt) = s2rec &dK &d@ s2_to_ifile(s2rec) = outpnt (not valid) ++outpnt tput [Y,outpnt] W 0 0 37 ~temp3 end end &dA &dA &d@ (5) time signature (also new note spacing calculations) &dA if line con "T:" tnum = int(line{mpt+2..}) if line con "/" tden = int(line{mpt+1..}) else return 6 end oby = 0 pp = autop loop for hh = 1 to nstaves autop = pp perform settime (h) &dA &dA &d@ Actually, we will set emptyspace to hpar(29), the mimimum space &dA &d@ space allowed before an accidental. This way, no note-type &dA &d@ objects will be able to crowd the time signature. If this &dA &d@ works, we can remove the code that returns the value (h) from &dA &d@ settime. (We actually shouldn't be interested in this value &dA &d@ anyway, because we do NOT want to get too close to the time &dA &d@ signature.) &dA loop for qq = 1 to 45 emptyspace(hh,qq) = hpar(29) repeat oby += 1000 repeat if tnum = 1 and tden = 1 tnum = 4 tden = 4 end if tnum = 0 and tden = 0 tnum = abflg tden = 2 end &dA &dA &d@ determine note spacing &dA &d@ ---------------------- &dA divspq = olddivspq perform newnsp end return &dA &d@ &dAÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿&d@ &dA &d@ &dA³ END OF SECTION PROCESSING ³&d@ &dA &d@ &dAÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ&d@ &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 25. key_change (newkey, oldkey, nstaves, t1 ³ &dA &d@³ ³ &dA &d@³ Purpose: Typeset a key change ³ &dA &d@³ ³ &dA &d@³ Inputs: int newkey new key ³ &dA &d@³ int oldkey old key ³ &dA &d@³ int nstaves number of staves ³ &dA &d@³ int t1 operation code ³ &dA &d@³ 1 = change emptyspace ³ &dA &d@³ 0 = don't do it ³ &dA &d@³ ³ &dA &d@³ Global variables: ³ &dA &d@³ ³ &dA &d@³ sobcnt subobject counter ³ &dA &d@³ autop x position pointer ³ &dA &d@³ x actual x-coordinate ³ &dA &d@³ y actual y-coordinate ³ &dA &d@³ z font number ³ &dA &d@³ obx object x-coordinate ³ &dA &d@³ oby object y-coordinate ³ &dA &d@³ clef(.) current clef ³ &dA &d@³ measax(.,.) current measure ax array ³ &dA &d@³ claveax(.) global ax array ³ &dA &d@³ jtype object type ³ &dA &d@³ jcode object code ³ &dA &d@³ pcode number of sub objects ³ &dA &d@³ out ASCII string ³ &dA &d@³ ³ &dA &d@³ Outputs: autop = new x position ³ &dA &d@³ emptyspace(.,.) changed (if t1 = 1) ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure key_change (newkey, oldkey, nstaves, t1) int newkey, oldkey, nstaves int sy int a, m, h, i, j, k int hh int t1 int klave,sklave getvalue newkey, oldkey, nstaves, t1 if newkey = oldkey return end putobjpar = 0 loop for hh = 1 to nstaves sobcnt = 0 oby = 0 i = clef(hh) / 10 &dK &d@ y = rem - 1 * notesize klave = rem - 1 * 2 i /= 3 &dK &d@ k = 2 - rem * vpar(3) &dK &d@ y -= k k = 2 - rem * 3 klave -= k obx = autop x = obx * sharps if newkey > 0 * cancellations? &dK &d@ sy = y sklave = klave if oldkey > newkey loop for j = 1 to newkey &dK &d@ y += zak(1,j) klave += zak(1,j) repeat h = oldkey - newkey m = 1 perform cancelsig (m,j,h,klave) end if oldkey < 0 h = 0 - oldkey &dK &d@ y += vpar(4) klave += 4 j = 0 m = 2 perform cancelsig (m,j,h,klave) end &dK &d@ y = sy klave = sklave * set new key loop for j = 1 to newkey z = 63 y = klave + 20 * notesize / 2 - vpar20 perform subj &dK &d@ y += zak(1,j) klave += zak(1,j) x += hpar(9) repeat end * no sharps or flats if newkey = 0 * cancellations? j = 0 if oldkey > 0 h = oldkey m = 1 perform cancelsig (m,j,h,klave) end if oldkey < 0 h = 0 - oldkey m = 2 &dK &d@ y += vpar(4) klave += 4 perform cancelsig (m,j,h,klave) end end * flats if newkey < 0 * cancellations? &dK &d@ sy = y sklave = klave if oldkey < newkey h = 0 - newkey &dK &d@ y += vpar(4) klave += 4 loop for j = 1 to h &dK &d@ y += zak(2,j) klave += zak(2,j) repeat h = newkey - oldkey m = 2 perform cancelsig (m,j,h,klave) end if oldkey > 0 h = oldkey j = 0 m = 1 perform cancelsig (m,j,h,klave) end &dK &d@ y = sy + vpar(4) klave = sklave + 4 * set new key h = 0 - newkey loop for j = 1 to h z = 65 y = klave + 20 * notesize / 2 - vpar20 perform subj &dK &d@ y += zak(2,j) klave += zak(2,j) x += hpar(11) repeat end * Write out object and subobjects jtype = "K" jcode = newkey pcode = sobcnt out = "0" oby = (hh - 1) * 1000 perform putobj * if newkey = 0 and oldkey = 0 i = hpar(13) if t1 = 1 loop for j = 1 to 45 emptyspace(hh,j) += i repeat end else i = hpar(12) if t1 = 1 loop for j = 1 to 45 emptyspace(hh,j) = i repeat end end if hh = nstaves autop = x + i end * set up new global accidentals for claveax oldkey = newkey loop for i = 1 to 50 claveax(i) = 0 repeat h = newkey if h > 0 k = 4 loop for i = 1 to h loop for a = k to 50 step 7 claveax(a) = 2 repeat k += 4 if k > 7 k -= 7 end repeat end if h < 0 h = 0 - h k = 7 loop for i = 1 to h loop for a = k to 50 step 7 claveax(a) = 3 repeat k -= 4 if k < 1 k += 7 end repeat end repeat loop for i = 1 to 50 loop for h = 1 to 3 measax(h,i) = claveax(i) repeat repeat passback oldkey return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 26. display_ts ³ &dA &d@³ ³ &dA &d@³ Purpose: Display parameters in ts(.,.) array ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure display_ts int t1,t2 putc TYPE DIV CLAV AX NTYP DOT TPLE VLOC SPAC STEM BMFG BMCD ... putc SUPF SLUR SUB1 SUB2 YSH SRT2 TEXT PASS BTIE NDUR DINC MULT loop for t2 = 1 to TS_SIZE putc .t2w4 ~t2 ... repeat putc putc ... loop for t2 = 1 to 5 putc ==== ==== ==== ==== ==== ==== ... repeat putc loop for t1 = 1 to sct loop for t2 = 1 to TS_SIZE putc .t2w4 ~ts(t1,t2) ... repeat putc repeat getc return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 27. zjcline (staff) ³ &dA &d@³ ³ &dA &d@³ Purpose: Compute values of z, j, and cline from clef ³ &dA &d@³ ³ &dA &d@³ Inputs: staff = staff number (1 or 2) ³ &dA &d@³ clef(.) = clef flag ³ &dA &d@³ ³ &dA &d@³ Outputs: z = clef font ³ &dA &d@³ j = vertical postion of clef ³ &dA &d@³ cline(.) = location of middle C ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure zjcline (staff) int g,h,i,k,m int staff getvalue staff i = clef(staff) / 10 j = 6 - rem k = i / 3 h = rem if rem = 0 z = 33 else z = 34 + h end m = j * 2 + 20 g = 0 if k > 0 if k = 1 g = 7 else g = -7 end end cline(staff) = h - 1 * 4 + m + g return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 28. putclef (staff) ³ &dA &d@³ ³ &dA &d@³ Purpose: write clef sign to intermediate file ³ &dA &d@³ ³ &dA &d@³ Inputs: staff = staff number (1 or 2) ³ &dA &d@³ clef(.) = clef code ³ &dA &d@³ obx = x offset ³ &dA &d@³ oby = y offset ³ &dA &d@³ z = clef font ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure putclef (staff) int staff int g,h,i,k,m getvalue staff i = clef(staff) / 10 k = i / 3 h = rem jtype = "C" jcode = clef(staff) out = "0" if h = 0 x = obx y = oby perform subj ++z perform subj if k = 1 x = obx + hpar(52) y = oby + vpar(23) z = 234 perform subj end pcode = sobcnt else pcode = z end putobjpar = 0 perform putobj return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 29. rotate_array (t1,t2) ³ &dA &d@³ ³ &dA &d@³ Purpose: Move ts array elements at t2 to t1 position. ³ &dA &d@³ Rotate all other elements down one ³ &dA &d@³ ³ &dA &d@³ Inputs: t1 = top of rotation ³ &dA &d@³ t2 = bottom of rotation (t2 > t1) ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure rotate_array (t1,t2) int temp(TS_SIZE) int t1,t2,t3,t4 getvalue t1,t2 if t2 = t1 return end if t2 < t1 putc Program error at rotate putc &dAType /e &d@ to terminate examine return 10 end loop for t3 = 1 to TS_SIZE temp(t3) = ts(t2,t3) /* create hole at the bottom (save bottom) repeat loop for t4 = t2 to t1+1 step -1 /* loop in backwards order loop for t3 = 1 to TS_SIZE ts(t4,t3) = ts(t4-1,t3) /* copy each row from the one above it repeat repeat loop for t3 = 1 to TS_SIZE ts(t1,t3) = temp(t3) /* store bottem piece at top repeat return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 30. get_topbottom (t1,t2,t3) ³ &dA &d@³ ³ &dA &d@³ Purpose: If t1 points to an ts row element which is a note ³ &dA &d@³ head, then t2 will point to the tw row element ³ &dA &d@³ which is the top of the chord, and t3 will point ³ &dA &d@³ to the ts row element which is the bottom of the ³ &dA &d@³ chord ³ &dA &d@³ ³ &dA &d@³ Inputs: t1 = index to ts row element ³ &dA &d@³ ³ &dA &d@³ Outputs: t2 = index to top of chord ³ &dA &d@³ t3 = index to bottom of chord ³ &dA &d@³ ³ &dA &d@³ Note: Do not call this procedure before GLOBAL_XOFF is set ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure get_topbottom (t1,t2,t3) int t1,t2,t3,t4 getvalue t1 t4 = ts(t1,GLOBAL_XOFF) if t4 > INT10000 t2 = t4 / INT10000 t3 = rem else t4 = ts(t1+1,GLOBAL_XOFF) if t4 > INT10000 t2 = t4 / INT10000 t3 = rem else t2 = t1 t3 = t1 end end passback t2,t3 return &dA &dA &dA &d@ &dA &dA &d@ &dA PROCEDURES FOR PSEUDO-TYPESETTING &dA &d@ &dA &dA &dA &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 31. ps_setchord (p1,p2,p3) ³ &dA &d@³ ³ &dA &d@³ Purpose: Add a chord to the simultaneity ³ &dA &d@³ ³ &dA &d@³ Inputs: p1 = pass number (chord number) ³ &dA &d@³ p2 = second chord number (for unisons) or 100 ³ &dA &d@³ p3 = initialize parameter (0 = initialize) ³ &dA &d@³ ³ &dA &d@³ Outputs: p3 = initialize parameter (1 = don't initialize) ³ &dA &d@³ printpos(.) = print position for this chord ³ &dA &d@³ ³ &dA &d@³ Method: construct the left boundary of the new chord. ³ &dA &d@³ Move the chord to the right until it bumps ³ &dA &d@³ with previous chords. ³ &dA &d@³ ³ &dA &d@³ Output: when a note for a chord is set, ndata(*,PASS) ³ &dA &d@³ for that note is set to zero. ³ &dA &d@³ ³ &dA &d@³ printpos(p1) and maybe printpos(p2) ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure ps_setchord (p1,p2,p3) int a,b,c,d,e,x int aa,bb,cc,dd int tr(2,45),tl(2,45) int pseudo_tr(2,45) int pseudo_tl(2,45) int f,g,h,i,j,k int ff,gg,hh int p1, p2, p3 int ps_width int stem_up_flag int stem_down_flag getvalue p1,p2,p3 if p3 = 0 p3 = 1 x = 10000 else x = 0 end passback p3 &dA &dA &d@ putc Calling ps_setchord pass = ~p1 pass2 = ~p2 &dA &d@ putc &dA ff = 0 hh = 0 loop for j = 1 to 45 tl(1,j) = 200 tr(1,j) = -200 pseudo_tr(1,j) = -200 pseudo_tl(1,j) = 200 tl(2,j) = 200 tr(2,j) = -200 pseudo_tr(2,j) = -200 pseudo_tl(2,j) = 200 repeat stem_up_flag = 0 stem_down_flag = 0 repeater_case = 0 c = 100 loop for i = 1 to pcnt if ndata(i,PS_PASS) = p1 or ndata(i,PS_PASS) = p2 b = ndata(i,PS_XPOS) a = ndata(i,PS_PITCH) &dA &dA &d@ putc set note ~i pitch = ~ndata(i,PS_PITCH) ... &dA &d@ putc shift = ~ndata(i,PS_XPOS) &dA if a = 100 ndata(i,PS_PASS) = 0 return end if c = 100 c = ndata(i,PS_STAFF) + 1 /* staff number d = ndata(i,PS_COLOR) if d < 3 ps_width = hpar(82) else if d = 3 ps_width = hpar(83) else ps_width = hpar(84) end end if ndata(i,PS_NSIZE) = CUESIZE ps_width = ps_width * 8 / 10 end end if bit(0,ndata(i,PS_STEM)) = UP /* stem up if b = 0 if tl(c,a) > 0 tl(c,a) = 0 end if tl(c,a+1) > hpar(95) tl(c,a+1) = hpar(95) end if pseudo_tl(c,a) > 0 pseudo_tl(c,a) = 0 end if pseudo_tl(c,a+1) > 0 pseudo_tl(c,a+1) = 0 end if tr(c,a) < ps_width - hpar(95) tr(c,a) = ps_width - hpar(95) end if tr(c,a+1) < ps_width tr(c,a+1) = ps_width end if pseudo_tr(c,a) < ps_width pseudo_tr(c,a) = ps_width end if pseudo_tr(c,a+1) < ps_width pseudo_tr(c,a+1) = ps_width end else dd = ps_width << 1 - hpar(90) if tr(c,a) < dd - hpar(95) tr(c,a) = dd - hpar(95) end if tr(c,a+1) < dd tr(c,a+1) = dd end if pseudo_tr(c,a) < dd + hpar(49) pseudo_tr(c,a) = dd + hpar(49) end if pseudo_tr(c,a+1) < dd + hpar(49) pseudo_tr(c,a+1) = dd + hpar(49) end end if ff = 0 ff = a + 8 /* 8 = length of stem end stem_up_flag |= ndata(i,PS_STEM) >> 2 else if b = 0 if tr(c,a) < ps_width - hpar(95) tr(c,a) = ps_width - hpar(95) end if tr(c,a+1) < ps_width tr(c,a+1) = ps_width end if pseudo_tr(c,a) < ps_width pseudo_tr(c,a) = ps_width end if pseudo_tr(c,a+1) < ps_width pseudo_tr(c,a+1) = ps_width end if tl(c,a) > 0 tl(c,a) = 0 end if tl(c,a+1) > hpar(95) tl(c,a+1) = hpar(95) end if pseudo_tl(c,a) > 0 pseudo_tl(c,a) = 0 end if pseudo_tl(c,a+1) > 0 pseudo_tl(c,a+1) = 0 end else if tl(c,a) > hpar(90) - ps_width tl(c,a) = hpar(90) - ps_width end if tl(c,a+1) > hpar(90) - ps_width + hpar(95) tl(c,a+1) = hpar(90) - ps_width + hpar(95) end if pseudo_tl(c,a) > hpar(90) - ps_width - hpar(49) pseudo_tl(c,a) = hpar(90) - ps_width - hpar(49) end if pseudo_tl(c,a+1) > hpar(90) - ps_width - hpar(49) pseudo_tl(c,a+1) = hpar(90) - ps_width - hpar(49) end end if hh = 0 hh = a - 1 end stem_down_flag |= ndata(i,PS_STEM) >> 2 end repeater_case |= bit(1,ndata(i,PS_STEM)) if ndata(i,PS_PASS) = p1 ndata(i,PS_PASS) = 0 end if ndata(i,PS_PASS) = p2 ndata(i,PS_PASS) = 0 end end repeat if hh > 45 hh = 45 end if ff > 0 /* put in stem up restraints e = ps_width - hpar(90) /* &dAOLD&d@ ps_width - hpar(85) d = ps_width /* &dAOLD&d@ ps_width + hpar(85) if repeater_case = 1 aa = e - hpar(98) bb = d + hpar(98) else aa = e bb = d end if stem_up_flag > 0 if stem_up_flag > 2 ff += stem_up_flag - 2 << 1 end dd = d + hpar(26) else dd = d end if ff > 45 ff = 45 end loop for i = ff - 6 to ff if tl(c,i) > aa tl(c,i) = aa end if tr(c,i) < bb tr(c,i) = bb end if pseudo_tr(c,i) < dd pseudo_tr(c,i) = dd end repeat loop for i = a + 2 to ff - 7 if tl(c,i) > e tl(c,i) = e end if tr(c,i) < d tr(c,i) = d end repeat end if hh > 0 /* put in stem down restraints a = a - 7 if stem_down_flag > 0 if stem_down_flag > 2 a -= stem_down_flag - 2 << 1 end dd = hpar(90) + hpar(26) else dd = hpar(90) end if a < 1 a = 1 end if repeater_case = 1 aa = 0 - hpar(98) bb = hpar(90) + hpar(98) else aa = 0 bb = hpar(90) end loop for i = a to hh if tl(c,i) > aa tl(c,i) = aa end if tr(c,i) < bb tr(c,i) = bb end if pseudo_tr(c,i) < dd pseudo_tr(c,i) = dd end repeat end if x = 10000 loop for i = 1 to 45 gr(c,i) = tr(c,i) gl(c,i) = tl(c,i) pseudo_gr(c,i) = pseudo_tr(c,i) repeat x = 0 /* amount shifted to the right else ff = 1000 loop for i = 1 to 45 gg = 1000 - gr(c,i) + tl(c,i) - 5 if gg < ff ff = gg end repeat x = 1000 - ff /* amount shifted to the right loop for i = 1 to 45 gg = x + tr(c,i) if gg > gr(c,i) and tr(c,i) <> -200 gr(c,i) = gg end gg = x + pseudo_tr(c,i) if gg > pseudo_gr(c,i) and pseudo_tr(c,i) <> -200 pseudo_gr(c,i) = gg end gg = x + tl(c,i) if gg < gl(c,i) gl(c,i) = gg end repeat end loop for j = 1 to 45 if pseudo_gl(1,j) > pseudo_tl(1,j) pseudo_gl(1,j) = pseudo_tl(1,j) end if pseudo_gl(2,j) > pseudo_tl(2,j) pseudo_gl(2,j) = pseudo_tl(2,j) end repeat &dK &d@ loop for j = 1 to 1 &dK &d@ putc Left Right Pseudo Left Pseudo Right &dK &d@ loop for i = 45 to 1 step -1 &dK &d@ putc .w5 ~gl(j,i) ~gr(j,i) ~pseudo_gl(j,i) ~pseudo_gr(j,i) &dK &d@ repeat &dK &d@ putc ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ &dK &d@ repeat &dK &d@ getc printpos(p1) = x if p2 <> 100 printpos(p2) = x end &dA &d@ putc print position equals ~x &dA &d@ putc return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 32. guessbeam (slope, t12) ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Purpose: Make a guess about the position of a beam ³ &dA &d@³ ³ &dA &d@³ Inputs: int c6 = number of notes under beam ³ &dA &d@³ int mf(.) = y-position of note ³ &dA &d@³ int beamcode(.) = beam code ³ &dA &d@³ int stem = stem direction (UP/DOWN) ³ &dA &d@³ int c5 = size: 0 = regular; 1 = small ³ &dA &d@³ ³ &dA &d@³ Outputs: int slope = BHPAR1 * slope of beam ³ &dA &d@³ int t12 = end point of first stem (relative to top of staff) ³ &dA &d@³ ³ &dA &d@³ Internal variables: beamfy = y coordinate of first note under beam ³ &dA &d@³ vrange = vertical range of note set ³ &dA &d@³ zstaff = top of staff line ³ &dA &d@³ slope = slope of beam ³ &dA &d@³ ypiv = temporary variable ³ &dA &d@³ (x1,y1) = temporary coordinates ³ &dA &d@³ (x2,y2) = temporary coordinates ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure guessbeam (slope, t12) int t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12 int zstaff,ypiv,slope int x1,x2,y1,y2,vrange,beamfy int xf(100) int beamh,beamt,bthick int beamtype int loopcnt * if c5 = 0 beamh = bvpar(16) beamt = bvpar(32) bthick = vpar(1) * 6 / 7 else beamh = bvpar(16) * 4 / 5 beamt = bvpar(32) * 4 + 3 / 5 bthick = vpar(1) * 5 / 7 end t6 = 0 loop for t5 = 1 to c6 xf(t5) = t6 t6 += vpar(6) /* average x increment (a guess) repeat beamfy = mf(1) * reverse if stem down t3 = 0 if stem = DOWN t3 = 300 * vpar(1) - vpar(8) loop for t6 = 1 to c6 mf(t6) = 300 * vpar(1) - mf(t6) repeat end zstaff = t3 * determine slope and pivot of beam t9 = 0 x1 = 5000 y1 = 5000 t11 = 6 t1 = 0 t4 = 0 /* changes in absolute height t2 = 0 t5 = mf(1) &dA &dA &d@ identify: t9 = 6 - smallest note type under beam &dA &d@ (x1,y1) = position of note closest to beam &dA &d@ (x2,y2) = position of note next closest to beam &dA &d@ t1 = y coordinate of note furthest from beam &dA loop for t6 = 1 to c6 * also compute sum of absolute changes in vertical height t8 = t5 - mf(t6) testfor t8 < 0 if t2 = 0 t2 = -1 end if t2 = 1 t2 = 2 end t8 = 0 - t8 else (>) if t2 = 0 t2 = 1 end if t2 = -1 t2 = 2 end end t5 = mf(t6) t4 += t8 * t8 = 0 /* number of additional beams on this note loop while beamcode(t6) > 9 ++t8 beamcode(t6) /= 10 repeat if t8 > t9 t9 = t8 /* max number of additional beams end if t8 < t11 t11 = t8 /* min number of additional beams end t8 = mf(t6) if t8 > t1 t1 = t8 /* lowest y co-ord of notes in beam set end if t8 < y1 y2 = y1 x2 = x1 y1 = t8 /* nearest y co-ord x1 = xf(t6) else if t8 < y2 y2 = t8 x2 = xf(t6) end end repeat &dA &dA &d@ Check point one: (x1,y1); (x2,y2); t1 set &dA vrange = t1 - y1 &dA &dA &d@ Formula for initial stem length &dA &dA &d@ note t9 y1-t8 &dA &d@ ÄÄÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄ &dA &d@ 8th: 0 beamh &dA &d@ 16th: 1 beamh + (1 * notesize / 4) &dA &d@ 32th: 2 beamh + (4 * notesize / 4) &dA &d@ 64th: 3 beamh + (7 * notesize / 4) &dA &d@ 128th: 4 beamh + (10 * notesize / 4) &dA &d@ 256th: 5 beamh + (13 * notesize / 4) &dA beamtype = t9 if t9 = 0 t8 = y1 - beamh else t8 = t9 * 3 - 2 t8 = 0 - notesize * t8 / 4 - beamh + y1 end t1 = x1 * deal with case of severe up-down pattern if t2 = 2 t4 /= c6 if t4 > bvpar(18) slope = 0 goto GSB1 end end * slope = y1 - y2 * 2 * BHPAR1 t7 = x1 - x2 slope /= t7 &dA &dA &d@ Comment: slope is (2*BHPAR1) times slope between two notes &dA &d@ nearest the beam &dA t7 = mf(c6) - mf(1) * 2 * BHPAR1 t6 = xf(c6) if t6 < vpar(5) t6 = vpar(5) end t7 /= t6 &dA &dA &d@ Comment: t7 is (2*BHPAR1) times slope between outside notes &dA &dA &d@ Formula: slope = (slope + t7) / 6 provided &dA &dA &d@ |slope| must be equal to or less than |t7| &dA t6 = abs(slope) - abs(t7) if t6 > 0 if slope > 0 slope -= t6 else slope += t6 end end * slope = slope + t7 / 6 GSB1: t7 = abs(slope) if t7 > BHPAR1 / 2 t7 = BHPAR1 / 2 end * Soften slant for thirty-seconds and smaller if t9 > 2 and t7 > 5 t7 = 0 - t9 / 2 + t7 end if t7 < 0 t7 = 0 end &dA &dA &d@ set reduce slant if end note are closer than vpar(6) &dA t4 = xf(c6) if t4 <= vpar(6) and t7 > bvpar(35) t7 = bvpar(35) end &dA &dA &d@ shorten shortest stem, if gradual slope and large vertical range &dA &d@ and relatively high note &dA if vrange > vpar(3) t4 = t9 * beamt + t8 - zstaff t4 = 0 - t4 if t4 > vpar(3) if t7 < 6 if x1 > 0 and x1 < xf(c6) t8 += bvpar(17) end if c6 = 2 t8 += bvpar(17) end end end end * if slope < 0 slope = 0 - t7 else slope = t7 end &dA &dA &d@ slope = BHPAR1 * slope of beam &dA &d@ t8 = y coordinate of pivot point (on highest note) of first beam &dA &d@ t7 = absolute value of @m &dA &d@ t3 = y coordinate of top of staff line &dA &d@ (x1,y1) = coordinate of note closest to beam (highest note) &dA &d@ (x2,y2) = coordinate of second closest note to beam (2nd highest note) &dA &d@ t9 = 6 - smallest note type number (number of beams - 1 &dA &d@ t11 = 6 - largest note type number &dA ypiv = t8 ++t9 &dA &dA &d@ Check point two: t9 = number of beams, current slope = slope &dA &dA &d@ Adjust slope and t8 so that beams will fall properly on staff lines &dA &dA &d@ Case I: slope = 0 &dA GCSI: if slope = 0 t2 = t9 - 1 * notesize + t8 if t2 >= t3 &dA &dA &d@ Adjust flat beam height &dA t5 = t2 - t3 / notesize if t9 = 1 and rem <= bvpar(20) rem += bvpar(20) end if t9 = 2 if rem <= bvpar(20) rem += bvpar(34) else rem = rem - notesize + bvpar(20) end end if t9 = 3 rem += bvpar(34) end if t9 = 4 if t5 = 3 beamt = bvpar(33) end if t5 < 3 t5 = rem t5 -= vpar(1) / 2 rem = t5 end end t8 -= rem * (*) extremely low notes if t9 = 1 t2 = vpar(4) + zstaff else t2 = 4 - t9 * vpar(2) + zstaff end if t8 > t2 t8 = t2 if t9 > 3 and c5 = 0 beamt = bvpar(33) end end end else &dA &dA &d@ Case II: slope <> 0 &dA loopcnt = 0 GCSII: ++loopcnt t6 = 0 - x1 * slope / BHPAR1 + t8 t5 = xf(c6) * slope / BHPAR1 + t6 t2 = t5 + t6 / 2 if t9 > 1 if t11 > 0 t2 += beamt if t9 = 2 t2 += 2 end end t10 = bvpar(22) else t10 = bvpar(23) end &dA &d@ t6 = starting point of top beam &dA &d@ t5 = stopping point of top beam &dA &d@ t2 = average height of beam (second beam if always 2 or more) &dA &d@ t10 = fudge factor t4 = t3 t3 -= notesize if t9 > 2 t3 -= notesize end if t2 > t3 &dA &dA &d@ Adjust slanted beam height &dA if t9 > 2 if t2 > t4 beamt = bvpar(33) else t2 -= 2 end end t4 = abs(t5 - t6) t5 = t2 - t3 / notesize t5 = rem &dA &d@ t4 = rise/fall of beam &dA &d@ t5 = amount by which the average beam height lies below a line if t4 < bvpar(24) if t5 >= t10 t5 -= notesize if t9 = 1 ++t5 end else if t9 = 1 --t5 end end t8 -= t5 goto GCV end if t4 < beamt if loopcnt > 4 goto GCV end if t7 > 1 goto GCSJJ end ++t7 if slope < 0 slope = 0 - t7 else slope = t7 end goto GCSII end if t4 < bvpar(25) t5 += vpar(1) if t5 > t10 t5 -= notesize end t8 -= t5 goto GCV end if t4 > bvpar(26) if t5 > t10 t5 -= notesize end t8 -= t5 goto GCV end if t7 = 2 t5 += vpar(1) if t5 > t10 t5 -= notesize end t8 -= t5 goto GCV end if loopcnt > 4 goto GCV end GCSJJ: --t7 if slope < 0 slope = 0 - t7 else slope = t7 end goto GCSII else if t9 < 4 t8 = notesize / 3 + t8 end end * Check for extra low notes GCV: t4 = 0 - x1 * slope / BHPAR1 + t8 t6 = xf(c6) - x1 * slope / BHPAR1 + t8 t5 = 0 if t9 = 1 t2 = vpar(4) + zstaff - 2 else t2 = 4 - t9 * notesize + zstaff - 2 end if slope > 0 if t4 > t2 t5 = 1 t4 = t2 + 1 end else if t6 > t2 t5 = 1 t6 = t2 + 1 end end t2 = t2 + bvpar(20) + 2 if slope > 0 if t6 > t2 t5 = 1 t6 = t2 end else if t4 > t2 t5 = 1 t4 = t2 end end if t5 = 1 * Correction necessary t7 = xf(c6) slope = t6 - t4 * BHPAR1 / t7 t8 = x1 * slope / BHPAR1 + t4 t7 = abs(slope) end t8 -= vpar(1) / 2 end * t12 = slope * t1 t12 = t8 * BHPAR1 - t12 &dA &dA &d@ Check point three: beam slope = slope; &dA &d@ y intercept (times BHPAR1) = t12 &dA &dA &d@ Post adjustment: sometimes the stems of sixteenths are too &dA &d@ short. This will be the case when (y2-t8) - ((t9-1)*beamt) < xxx &dA &d@ where xxx is some number. In this case, we should raise the &dA &d@ beam by some small amount, yyy. &dA t6 = 0 - (t9 - 1) * beamt + y2 - t8 if t6 < bvpar(29) t12 -= bvpar(30) * BHPAR1 end &dA &dA &d@ In the case where c6 = 4, compare sum of the first two notes &dA &d@ verses the last two notes. If the direction is different from &dA &d@ the slope, then the slope should be zero. &dA if c6 = 4 t2 = mf(1) + mf(2) t3 = mf(3) + mf(4) if t2 > t3 if slope > 0 goto GSB2 end end t2 = t2 - t3 * slope if t2 > 0 goto GSB2 end goto GSB3 GSB2: slope = 0 t3 = zstaff t8 = ypiv goto GCSI end GSB3: &dA &dA &d@ slope = BHPAR1 * slope of beam &dA &d@ t12 = y-intercept of beam (times BHPAR1) &dA t8 = vpar(6) / 7 if beamtype > 0 t8 = vpar(5) / 4 end t12 /= BHPAR1 if stem = DOWN t12 = 300 * vpar(1) - t12 + bthick - t8 slope = 0 - slope else t12 += t8 end passback slope, t12 return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 33. display_array ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Purpose: Print out the current state of the ts array ³ &dA &d@³ Used for debugging ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure display_array g = measnum - 1 if bit(2,pmode) = 1 and g >= debug_point putc Set Array at procedure call: measure ~g putc Look? getc jtype if jtype = "y" perform display_ts end end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 34. rest_occupy_space (t1,t2) ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Purpose: For a given location on the staff line and ³ &dA &d@³ a given type of rest, set the gr(.,.) and ³ &dA &d@³ gl(.,.) arrays to reflect the placement ³ &dA &d@³ of the rest in this spot ³ &dA &d@³ ³ &dA &d@³ Inputs: ntype = type of rest ³ &dA &d@³ t1 = position on staff (0 = top line) ³ &dA &d@³ (i.e.,STAFF_LOC) ³ &dA &d@³ t2 = staff number ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure rest_occupy_space (t1,t2) int t1,t2,t3,t4,t5,t6,t7,t8 getvalue t1,t2 t1 = 0 - t1 / vpar(1) + 23 t5 = ntype << 1 - 1 t3 = int("1008060402020402030303"{t5,2}) t4 = int("0505050505030301000101"{t5,2}) if ntype > WHOLE t6 = hpar(87) * 4 / 3 else if ntype > QUARTER t6 = hpar(87) else if ntype > EIGHTH t6 = hpar(88) else t6 = EIGHTH - ntype * hpar(54) + hpar(88) end end end &dA &d@ t6 += hpar(85) t7 = t1 - t4 if t7 < 1 t7 = 1 end t8 = t1 + t3 if t8 > 45 t8 = 45 end loop for t5 = t7 to t8 gr(t2,t5) = t6 gl(t2,t5) = 0 repeat return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 35. place_accidental (t1,t2,t3,t4) ³ &dA &d@³ ³ &dA &d@³ ³ &dA &d@³ Purpose: Determine the absolute x-location of an ³ &dA &d@³ accidental, given gl(.,.) and the imputs: ³ &dA &d@³ ³ &dA &d@³ Inputs: t1 = staff number ³ &dA &d@³ t2 = position on staff (23 = top line) ³ &dA &d@³ t3 = accidental code ³ &dA &d@³ t4 = note size (full size vs. cue size) ³ &dA &d@³ ³ &dA &d@³ Output: t4 = absolute x location ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure place_accidental (t1,t2,t3,t4) int t1,t2,t3,t4,t5,t6,t7,t8,t9 getvalue t1, t2, t3, t4 if t2 > 42 or t2 < 3 or t3 = 10 /* use old system t5 = t2 - int("221002200100001"{t3}) /* lower limit t6 = t2 + int("333003300200003"{t3}) /* upper limit t8 = 200 loop for t7 = t5 to t6 if t7 > 0 and t7 <= 45 if gl(t1,t7) < t8 t8 = gl(t1,t7) end end repeat t9 = hpar(t3) if t4 = CUESIZE t9 = t9 * 8 / 10 /* cue or grace size end t4 = t8 - t9 /* absolute x position loop for t7 = t5 to t6 if t7 > 0 and t7 <= 45 gl(t1,t7) = t4 /* new global left boundary end repeat passback t4 return end &dA &d@ hpar(1) = shift following accidental natural &dA &d@ hpar(2) = shift following accidental sharp &dA &d@ hpar(3) = shift following accidental flat &dA &d@ hpar(6) = shift following accidental natural-sharp &dA &d@ hpar(7) = shift following accidental natural-flat &dA &d@ hpar(10) = shift following accidental double sharp &dA &d@ hpar(15) = shift following accidental double flat &dA &dA &d@ (1) determine absolute x location &dA if chr(t3) in [3,7,15] t5 = hpar(3) * 7 / 10 t6 = gl(t1,t2+3) + t5 loop for t7 = t2 - 1 to t2 + 2 if gl(t1,t7) < t6 t6 = gl(t1,t7) end repeat if t3 = 7 and gl(t1,t2-2) + hpar(3) < t6 t6 = gl(t1,t2-2) + hpar(3) end else if chr(t3) in [2,6] t5 = hpar(2) * 2 / 10 t6 = gl(t1,t2+3) + t5 loop for t7 = t2 - 1 to t2 + 2 if gl(t1,t7) < t6 t6 = gl(t1,t7) end repeat if t6 > gl(t1,t2-2) + t5 t6 = gl(t1,t2-2) + t5 end else t5 = hpar(3) * 6 / 10 t6 = gl(t1,t2+3) + t5 loop for t7 = t2 - 2 to t2 + 2 if gl(t1,t7) < t6 t6 = gl(t1,t7) end repeat end end t5 = hpar(t3) if t4 = CUESIZE t5 = t5 * 8 / 10 /* cue or grace size end t4 = t6 - t5 /* absolute x position passback t4 &dA &dA &d@ (2) determine new values for gl(.,.) &dA if chr(t3) in [1,6,7] loop for t7 = t2 - 1 to t2 + 3 gl(t1,t7) = t4 /* new global left boundary repeat gl(t1,t2-2) = hpar(1) / 2 + t4 else if chr(t3) in [3,15] loop for t7 = t2 - 1 to t2 + 3 gl(t1,t7) = t4 /* new global left boundary repeat else t5 = hpar(2) / 10 gl(t1,t2+3) = t4 + t5 loop for t7 = t2 - 1 to t2 + 2 gl(t1,t7) = t4 /* new global left boundary repeat gl(t1,t2-2) = t4 + t5 end end return &dA &d@ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ &dA &d@³P 36. typeset_tuple (t1,t2,t3) ³ &dA &d@³ ³ &dA &d@³ Purpose: Typeset tuple companion to repeater ³ &dA &d@³ ³ &dA &d@³ Inputs: t1 = tuple number ³ &dA &d@³ t2 = centered x-location to place tuple ³ &dA &d@³ t3 = y-location to place tuple ³ &dA &d@³ ³ &dA &d@ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ procedure typeset_tuple (t1,t2,t3) int t1,t2,t3 int savex,savey,savez getvalue t1,t2,t3 savex = x savey = y savez = z x = t2 y = t3 if t1 > 9 x -= hpar(104) z = t1 / 10 + 221 t1 = rem perform subj x += hpar(105) z = t1 + 221 perform subj else z = t1 + 221 perform subj end x = savex y = savey z = savez return &dA &dA &d@ &dA &dA &d@ &dA DISPLAY AND EDITING PROCEDURES &dA &d@ &dA &dA procedure pan str cbyte.1,line.180,line2.180,line3.180,line4.180,twk.10 str line5.180,line6.180 str trackcode.1,staffcode.1 str oldnote.4 int k,h,j int hh int x,y int flag int px,py int t1,t2 int font,color,scflag int first_rec,last_rec int markcnt2 int loc_start_s2rec int loc_s2rec int a,b,c,d,e,f int aa,bb int cc,jj int aaa int savec,savecc int supflag(3) int nextk int xpos1,xpos2,xpos3 int ypos1,ypos2,ypos3,ypos4 oldnote = "" loc_start_s2rec = start_s2rec loc_s2rec = s2rec markcnt2 = markcnt nextk = 0 PPX: j = s2_to_ifile(loc_start_s2rec) if j < 1 putc dputc Error in the cross-over from the s2 table [X] to the i-file table [Y] putc s2 location = ~loc_start_s2rec putc return 10 end tget [Y,j] temp2 .t5 a d if temp2{3} = "B" horiz_shift = d else horiz_shift = d - 5 end firstx = horiz_shift j = s2_to_ifile(loc_s2rec) if j < 1 putc dputc Error in the cross-over from the s2 table [X] to the i-file table [Y] putc s2 location = ~loc_s2rec putc return 10 end tget [Y,j] temp2 .t5 a d lastx = d syslen = lastx - firstx PPY1: if j < outpnt tget [Y,j+1] temp2 if "KTWA" con temp2{1} ++j goto PPY1 end end PPY2: if j < outpnt tget [Y,j+1] temp2 if temp2{1} = "H" ++j goto PPY2 end end first_rec = s2_to_ifile(loc_start_s2rec) last_rec = j last_Y_point = j con3 = 1 /* use setb perform construct (first_rec,last_rec) x = 0 y = 0 font = 137 color = 1 scflag = 1 #if SMALL xpos1 = MSGTAB2X xpos2 = MSGTAB2AX xpos3 = MSGTAB2BX ypos1 = SOUROW1X ypos2 = SOUROW2X ypos3 = SOUROW3X ypos4 = SOUROW4X #else xpos1 = MSGTAB2 xpos2 = MSGTAB2A xpos3 = MSGTAB2B ypos1 = SOUROW1 ypos2 = SOUROW2 ypos3 = SOUROW3 ypos4 = SOUROW4 #endif scx = xpos1 scy = ypos1 out = messages(1) perform msgout2 (out,font,color,scflag) scx = xpos1 scy = ypos2 out = messages(2) perform msgout2 (out,font,color,scflag) scx = xpos1 scy = ypos3 out = messages(3) perform msgout2 (out,font,color,scflag) scx = xpos1 scy = ypos4 out = messages(4) perform msgout2 (out,font,color,scflag) perform msgout3 newcmode = cmode perform change_cmode Y_point = s2_to_ifile(loc_start_s2rec) start_Y_point = Y_point save_Y_point = Y_point save_X_point = loc_start_s2rec perform setcurloc (Y_point) h = 0 perform display_source (h) PPP: px = x py = y activate gstr,px,py,1 #if SMALL if nstaves = 1 activate genmsgstr,1,440,1 activate msgstr,0,180,1 activate redmsgstr,0,180,4 activate bluemsgstr,0,180,3 activate msgstr2,38,180,1 activate redmsgstr2,38,180,4 else activate msgstr,0,230,1 activate redmsgstr,0,230,4 activate bluemsgstr,0,230,3 activate msgstr2,38,230,1 activate redmsgstr2,38,230,4 end #else if nstaves = 1 activate genmsgstr,4,900,1 activate msgstr,0,400,1 activate redmsgstr,0,400,4 activate bluemsgstr,0,400,3 activate msgstr2,77,400,1 activate redmsgstr2,77,400,4 else activate msgstr,0,500,1 activate redmsgstr,0,500,4 activate bluemsgstr,0,500,3 activate msgstr2,77,500,1 activate redmsgstr2,77,500,4 end #endif if pan_resume > 0 loop while backup_pan_resume > 0 pan_resume = list_order(pan_resume,1) --backup_pan_resume repeat save_Y_point = s2_to_ifile(pan_resume) save_X_point = pan_resume Y_point = save_Y_point perform setcurloc (Y_point) h = 0 perform display_source (h) pan_resume = 0 end PPQ: x2cur = 8 * px + xcur y2cur = py + ycur if x2cur < LMARG h = LMARG - x2cur + 7 / 8 + 9 / 10 * 10 x += h goto PPP end if x2cur > rmarg h = x2cur - rmarg + 7 / 8 + 9 / 10 * 10 x -= h goto PPP end clearb curstr, CURSOR, acur, bcur, 1, 1 #if SMALL x2cur -= 20 y2cur -= 10 #else x2cur -= 30 y2cur -= 10 #endif x2cur = x2cur / 8 acur = rem bcur = 0 setb curstr, CURSOR, acur, bcur, 1, 1 activate curstr, x2cur, y2cur, 3 &dA &dA &d@ Display current i-file line &dA if Y_point < 1 putc dputc Error in the setting of the pointer into the i-file table [Y] putc pointer value = ~Y_point putc return 10 end tget [Y,Y_point] new_iline .t3 jtype .t3 g g g .t3 temp font = 200 color = 4 scflag = 0 scx = xpos3 scy = ypos4 perform msgout2 (current_iline,font,color,scflag) scflag = 1 scx = xpos3 scy = ypos4 perform msgout2 (new_iline,font,color,scflag) current_iline = new_iline &dA &dA &d@ Display current definition &dA new_def = "" if current_iline{1} = "K" new_def = sub_def(g) // " sub-object" end if current_iline{1} = "J" if "BCKTDSNRGQFIM" con jtype new_def = obj_def(mpt) // " object" end end if current_iline{1} = "H" mpt = 1 line = txt(temp,[' ']) line = txt(temp,[' ']) if "BTSXWDERVFN" con line{1} new_def = super_def(mpt) // " super-object" end end if current_iline{1} = "W" new_def = "Word(s) sub-object" end if current_iline{1} = "T" new_def = "Text sub-object" end if current_iline{1} = "L" new_def = "Lines (musical staff)" end font = 137 color = 4 scflag = 0 scx = xpos2 scy = ypos3 perform msgout2 (current_def,font,color,scflag) scflag = 1 scx = xpos2 scy = ypos3 perform msgout2 (new_def,font,color,scflag) current_def = new_def if chr(helpscreen) not_in [0,15,16] activate helpmsgstr,hlpxpos,hlpypos,5 end if current_iline{1} = "J" &dA &d@ a = ifile_to_s2(save_Y_point) &dA &d@ tget [X,a] line tget [X,save_X_point] line line = line // pad(44) if "ABCDEFG cg" con line{1} if mpt < 9 or "ABCDFEG " con line{2} helpscrnum = 15 helprows = 15 perform printhelp goto KLOOP end end if "ricg" con line{1} if mpt < 3 or "r" = line{2} helpscrnum = 16 helprows = 12 perform printhelp goto KLOOP end end if line{1} = "*" if line{17,2} not_con " " helpscrnum = 19 helprows = 8 perform printhelp goto KLOOP end if "EFHJUVW" con line{17} or "EFHJUVW" con line{18} helpscrnum = 20 helprows = 7 perform printhelp goto KLOOP end if "ABCDGPQ" con line{17} or "ABCDGPQ" con line{18} helpscrnum = 21 helprows = 7 perform printhelp goto KLOOP end end end activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 KLOOP: if newk = 0 perform pgetk (k) &dA &d@ getk k else k = newk newk = 0 end NEWK: &dA &dA &d@ Save Work in Temporary File &dA kk = k & 0xff prek = k & 0xffff00 if k = 0x031011 /* shift-F2 (save current state of [X] table) i = 1 open [7,2] "s2save" TSV01: if list_order(i,3) = USE_REC tget [X,i] line line = trm(line) putf [7] ~line end i = list_order(i,2) if i <> BOTTOM_FLAG goto TSV01 end close [7] goto KLOOP end &dA &dA &d@ Page Change &dA if k = 0x03040a /* activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 if markcnt2 > 1 --markcnt2 loc_start_s2rec = s2marks(markcnt2,1) loc_s2rec = s2marks(markcnt2,2) end #if SMALL setup curstr,5,32,1,0,0,80,180 setup gstr,1500,250,1,0,0,80,230 #else setup curstr,5,32,1,0,0,160,400 setup gstr,3000,500,1,0,0,160,500 #endif goto PPX end if k = 0x030810 /* activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 goto PPX end if k = 0x030811 /* Shift activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 scnt = s2marks(markcnt2,1) s2rec = scnt loop scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error return 12 end repeat while list_order(scnt,3) = IGNORE_REC outpnt = s2marks(markcnt2,3) autop = s2marks(markcnt2,4) markcnt = markcnt2 - 1 jump_mnum = 0 return end if k = 0x031001 /* F2 (redraw and resume pan) activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 scnt = s2marks(markcnt2,1) &dA &dA &d@ Deal with case where we have just come off of an mrest &dA if markcnt2 > 1 DMR01: tget [X,scnt] line line = line // pad(1) if line{1} <> "m" loop scnt = list_order(scnt,1) if scnt = TOP_FLAG dputc Error return 12 end repeat while list_order(scnt,3) = IGNORE_REC goto DMR01 end end s2rec = scnt loop scnt = list_order(scnt,2) if scnt = BOTTOM_FLAG dputc Error return 12 end repeat while list_order(scnt,3) = IGNORE_REC outpnt = s2marks(markcnt2,3) autop = s2marks(markcnt2,4) markcnt = markcnt2 - 1 pan_resume = ifile_to_s2(save_Y_point) jump_mnum = 0 return end if k = 0x031002 /* (jump to measure number) &dK &d@ if markcnt2 <> markcnt &dK &d@ ++markcnt2 &dK &d@ loc_start_s2rec = s2marks(markcnt2,1) &dK &d@ loc_s2rec = s2marks(markcnt2,2) &dK &d@ setup curstr,5,32,1,0,0,160,904 &dK &d@ setup gstr,3000,500,1,0,0,160,500 &dK &d@ goto PPX &dK &d@ end hlpx(22,5) = hlpx(22,5){1,11} // pad(25) helpscrnum = 22 helprows = 7 perform printhelp b = 0 j = 0 EDC041: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 b = 1 k &= 0xff k -= 0x30 j *= 10 j += k hlpx(22,5) = hlpx(22,5){1,11} // chs(j) // pad(25) out = hlpx(22,5) scx = 0 scy = (4 * helpinc + helptop) perform helpmsgout (out,font,scflag) activate helpmsgstr,hlpxpos,hlpypos,1 goto EDC041 end if k = 0x01001b /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPP end if k = 0x03080c /* scy = (8 * helpinc + helptop) out = hlpx(22,8) scx = 0 perform helpmsgout (out,font,scflag) activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 jump_mnum = j + 1 if jump_mnum < measnum scnt = scnt_start end return end goto EDC041 end if k = 0x031003 /* (Delete all new records beyond this point) if addrec = ssize goto KLOOP end a = save_X_point j = s2_to_ifile(a) if j = 0 a = ifile_to_s2(save_Y_point) end &dA &dA &d@ Step 1: Be sure a points to a record in the original list (a <= ssize) &dA loop while a > ssize EDC042: if a <> loc_start_s2rec loop a = list_order(a,1) if a = TOP_FLAG dputc Error return 12 end repeat while list_order(a,3) = IGNORE_REC end j = s2_to_ifile(a) if j = 0 if a = loc_start_s2rec perform setcurloc (Y_point) goto EDC043 end goto EDC042 end save_Y_point = j save_X_point = a Y_point = j repeat perform setcurloc (Y_point) h = 0 perform display_source (h) helpscrnum = 24 helprows = 5 perform printhelp &dA &dA &d@ Step 2: Remove all records beyond ssize which &dAdo not&d@ terminate a super object &dA supflag(1) = 0 supflag(2) = 0 supflag(3) = 0 EDC044: if a <> ssize a = list_order(a,2) if a > ssize /* this is an added record tget [X,a] line line = line // pad(44) if line{1} = "*" loop for c = 17 to 18 if "EHUV" con line{c} if mpt = 4 mpt = 3 end supflag(mpt) = 1 end if "FJW" con line{c} if supflag(mpt) = 0 goto EDC044 end end repeat end if "ABCDEFGgc " con line{1} if line{32..44} con ['-','(',')','[',']','{','}'] goto EDC044 end if line{26,6} con ['[','=',']'] goto EDC044 end end perform remove_record (a) /* tricky code above end goto EDC044 end EDC043: activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 h = 0 perform display_source (h) goto PPQ end if k = 0x03080c /* activate gstr,0,0,5 activate gstr,0,0,0 clearb curstr, CURSOR, acur, bcur, 1, 1 if markcnt2 <> markcnt ++markcnt2 loc_start_s2rec = s2marks(markcnt2,1) loc_s2rec = s2marks(markcnt2,2) #if SMALL setup curstr,5,32,1,0,0,80,180 setup gstr,1500,250,1,0,0,80,230 #else setup curstr,5,32,1,0,0,160,400 setup gstr,3000,500,1,0,0,160,500 #endif goto PPX end jump_mnum = 0 return end if k = 0x01001b /* return 11 end &dA &dA &d@ Horizontal Scrolling &dA &dA &dA &d@ ctrl &dI  &dA if k = 0x03010b if x < 40 x += 10 end goto PPP end &dA &dA &d@ ctrl &dI  &dA if k = 0x030109 if x > xze - 3340 x -= 10 end goto PPP end &dA &dA &d@ Mode Change &dA if k = 0x01006a /* j newcmode = "j" perform change_cmode goto PPP end if k = 0x010078 /* x newcmode = "x" perform change_cmode goto PPP end &dA &dA &d@ Cursor Movement &dA if (k >= 0x030101 and k <= 0x030104) or (k >= 0x030120 and k <= 0x030123) or k = 0x030106 or k = 0x030108 &dA &dA &d@ &dIHOME&d@ &dA if k = 0x030122 Y_point = start_Y_point save_Y_point = Y_point save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end &dA &dA &d@ &dIEND&d@ &dA if k = 0x030123 if Y_point < 1 putc dputc Error in the setting of the pointer into the i-file table [Y] putc pointer value = ~Y_point putc return 10 end a = 0 loop save_Y_point = Y_point cbyte = " " FWJP: if Y_point < last_Y_point ++Y_point tget [Y,Y_point] cbyte if cbyte <> "J" goto FWJP end else if cbyte <> "J" Y_point = save_Y_point end a = 1 end save_Y_point = Y_point repeat while a = 0 save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end &dA &dA &d@ &dI  &d@ or &dIPAGE-UP&d@ &dA if k = 0x030101 or k = 0x030120 if k = 0x030101 a = 1 else a = 10 end if cmode = "j" loop for b = 1 to a BWJP: if Y_point > start_Y_point --Y_point tget [Y,Y_point] cbyte if cbyte <> "J" goto BWJP end end save_Y_point = Y_point repeat save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end if cmode = "x" loop for b = 1 to a if Y_point > start_Y_point BWXP2: --Y_point tget [Y,Y_point] cbyte if cbyte = "A" goto BWXP2 end if cbyte <> "J" h = Y_point - 1 BWXP: tget [Y,h] cbyte if cbyte = "J" save_Y_point = h else --h goto BWXP end else save_Y_point = Y_point end end repeat save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end end &dA &dA &d@ &dI  &d@ or &dIPAGE-DOWN&d@ &dA if k = 0x030103 or k = 0x030121 if k = 0x030103 a = 1 else a = 10 end if cmode = "j" loop for b = 1 to a save_Y_point = Y_point cbyte = " " FWJPA: if Y_point < last_Y_point ++Y_point tget [Y,Y_point] cbyte if cbyte <> "J" goto FWJPA end else if cbyte <> "J" Y_point = save_Y_point end end save_Y_point = Y_point repeat save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end if cmode = "x" loop for b = 1 to a h = Y_point if Y_point < last_Y_point FWXP: ++Y_point tget [Y,Y_point] cbyte if cbyte = "J" save_Y_point = Y_point end if cbyte = "A" if Y_point = last_Y_point Y_point = h else goto FWXP end end end repeat save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end end &dA &dA &d@ shift &dI  &d@ &dA if k = 0x030106 if Y_point > start_Y_point SBWP2: --Y_point tget [Y,Y_point] cbyte c c c if "LSWTAH" con cbyte and Y_point > start_Y_point goto SBWP2 end if cbyte = "K" if chr(c) not_in [93..102,108..113,116,117,199..204,236,238,239,242] goto SBWP2 end end if cbyte <> "J" h = Y_point - 1 SBWP: tget [Y,h] cbyte if cbyte = "J" save_Y_point = h else --h goto SBWP end else save_Y_point = Y_point end end save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end &dA &dA &d@ shift &dI  &dA if k = 0x030108 h = Y_point if Y_point < last_Y_point SFWP: ++Y_point tget [Y,Y_point] cbyte c c c if cbyte = "J" save_Y_point = Y_point end if "LSWTAH" con cbyte if Y_point = last_Y_point Y_point = h else goto SFWP end end if cbyte = "K" if chr(c) not_in [93..102,108..113,116,117,199..204,236,238,239,242] goto SFWP end end end save_X_point = ifile_to_s2(save_Y_point) goto SETCUR end &dA &dA &d@ &dI  &dA if k = 0x030102 a = save_X_point j = s2_to_ifile(a) if j = 0 a = ifile_to_s2(save_Y_point) end UPX: if a <> loc_start_s2rec loop a = list_order(a,1) if a = TOP_FLAG dputc Error return 12 end repeat while list_order(a,3) = IGNORE_REC end j = s2_to_ifile(a) if j = 0 if a = loc_start_s2rec goto SETCUR end goto UPX end save_Y_point = j save_X_point = a Y_point = j goto SETCUR end &dA &dA &d@ &dI  &dA if k = 0x030104 a = save_X_point j = s2_to_ifile(a) if j = 0 a = ifile_to_s2(save_Y_point) end DNX: if a <> loc_s2rec loop a = list_order(a,2) if a = BOTTOM_FLAG dputc Error return 12 end repeat while list_order(a,3) = IGNORE_REC end j = s2_to_ifile(a) if j = 0 if a = loc_s2rec goto SETCUR end goto DNX end save_Y_point = j save_X_point = a Y_point = j goto SETCUR end SETCUR: perform setcurloc (Y_point) h = 0 perform display_source (h) goto PPQ end &dA &dA &d@ &dA EDITING COMMANDS &dA &dA &dA &d@ &dA EDIT 1. Add figure records(s)&d@ &dA if k = 0x010066 /* f = add figure records(s) a = save_X_point j = s2_to_ifile(a) if j = 0 a = ifile_to_s2(save_Y_point) end tget [X,a] line line = line // pad(44) &dA &dA &d@ &dA1. Check to make sure this is a note&d@ &dA if "ABCDEFG" con line{1} trackcode = line{15} staffcode = line{24} else goto KLOOP end &dA &dA &d@ &dA2. Add record for figure (before the note record) &dA b = list_order(a,1) perform add_a_record_after (b) /* Different pattern here! if a = loc_start_s2rec loc_start_s2rec = addrec s2marks(markcnt2,1) = loc_start_s2rec end EDC050: line = "f" // "1 " // trackcode // " " // staffcode // pad(80) s2_to_ifile(addrec) = 0 tput [X,addrec] ~line f = 17 /* initialize pointer to figure fields e = 17 /* initialize pointer to first figure field &dA &dA &d@ &dA3. Display record&d@ &dA h = 1 perform display_source (h) &dA &dA &d@ &dA4. State initial options&d@ &dA helpscrnum = 29 helprows = 9 perform printhelp &dA &d@ getk k perform pgetk (k) if k = 0x01001b /* perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end &dA &dA &d@ &dA5. If offset is required, get that number now&d@ &dA if k = 0x010064 /* k = "d" line3 = line helpscrnum = 2 helprows = 6 perform printhelp EDC051: /* Step 2: get optional offset line = line3 tput [X,addrec] ~line h = 1 perform display_source (h) i = 0 EDC052: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 if i = 3 helpscrnum = 30 helprows = 15 perform printhelp goto EDC053 end k &= 0xff line{5,3} = line{6,3} line{8} = chr(k) tput [X,addrec] ~line h = 1 perform display_source (h) ++i goto EDC052 end if k = 0x010020 helpscrnum = 30 helprows = 15 perform printhelp goto EDC053 end if k = 0x01001b if i = 0 goto EDC050 end goto EDC051 end goto EDC052 else goto EDC053a end EDC053: perform pgetk (k) EDC053a: helpscrnum = 30 helprows = 15 perform printhelp &dA &dA &d@ &dASpace Bar advances figure counter&d@ &dA if k = 0x010020 if f = e /* no figure entered goto EDC053 end ++f e = f i = int(line{2}) ++i line{2} = chs(i) tput [X,addrec] ~line h = 1 perform display_source (h) goto EDC053 end &dA &dA &d@ &dA (or  or ) completes operation&d@ &dA if (k >= 0x030101 and k <= 0x030104) or k = 0x031001 /*  or if f = e /* no (latest) figure entered i = int(line{2}) if i = 1 perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end --i line{2} = chs(i) end tput [X,addrec] ~line activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end if k = 0x03080c /* if f = e /* no (latest) figure entered i = int(line{2}) if i = 1 perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end --i line{2} = chs(i) end tput [X,addrec] ~line activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end &dA &dA &d@ &dA cancels operation&d@ &dA if k = 0x01001b /* perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end &dA &dA &d@ &dAValid keystrokes: 0 to 9, #, s, n, f, x, b, -, _, +, \, / &dA if k >= 0x010020 and k <= 0x0100ff k &= 0xff else goto EDC053 end if chr(k) in ['0'..'9','#','-','+','_','/','\','b','f','n','s','x'] if f = e and chr(k) in ['0','+','/','\'] goto EDC053 end if f > e and "b-_" con line{e} goto EDC053 end if k = 's' k = '#' end line{f} = chr(k) ++f tput [X,addrec] ~line h = 1 perform display_source (h) goto EDC053 end &dA &dA &d@ &dASpin on all other keystrokes&d@ &dA goto EDC053 end &dA &dA &d@ &dA EDIT 2. Add a grace note &dA if k = 0x010067 /* g = add grace note activate helpmsgstr,hlpxpos,hlpypos,5 setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = (2 * helpinc + helptop) helpscreen = 5 out = hlpx(5,5) scx = 0 perform helpmsgout (out,font,scflag) activate helpmsgstr,hlpxpos,hlpypos,1 KLOOP01: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010036 k &= 0x0f else goto KLOOP01 end activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 a = ifile_to_s2(save_Y_point) tget [X,a] line line = line // pad(44) if line{1} = "m" if a = loc_start_s2rec /* no-op goto KLOOP end loop b = list_order(b,1) if b = TOP_FLAG dputc Error return 12 end repeat while list_order(b,3) = IGNORE_REC EDC001: if b = loc_start_s2rec /* no-op goto KLOOP end tget [X,b] line2 line2 = line2 // pad(44) if "ABCDEFG" not_con line2{1} loop b = list_order(b,1) if b = TOP_FLAG dputc Error return 12 end repeat while list_order(b,3) = IGNORE_REC goto EDC001 end notecode = line2{1,4} trackcode = line2{15} staffcode = line2{24} else if "ABCDEFG" con line{1} notecode = line{1,4} trackcode = line{15} staffcode = line{24} else if "gc" con line{1} if line{2} = " " goto KLOOP end notecode = line{2,4} trackcode = line{15} staffcode = line{24} else goto KLOOP end end end b = list_order(a,1) perform add_a_record_after (b) /* Different pattern if a = loc_start_s2rec loc_start_s2rec = addrec s2marks(markcnt2,1) = loc_start_s2rec end line = "g" // notecode // " " // chs(k) // " " // trackcode // " " line = line // "ezyxtse"{k+1} // " u" // staffcode // pad(44) tput [X,addrec] ~line s2_to_ifile(addrec) = 0 helpscrnum = 5 helprows = 4 perform printhelp EDC002: h = 1 perform display_source (h) &dA &d@ getk k perform pgetk (k) if k = 0x03010e or k = 0x030110 or k = 0x030119 or k = 0x03011a if k = 0x03010e or k = 0x030110 h = 1 else h = 5 end if k = 0x03010e or k = 0x030119 k = 1 else k = 0 end tget [X,addrec] line line = line // pad(44) notecode = line{2,4} loop for i = 1 to h perform vadjnote (k) repeat line = line{1} // notecode{1,4} // line{6..} tput [X,addrec] ~line goto EDC002 end if k = 0x01001b /* perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end activate helpmsgstr,hlpxpos,hlpypos,5 newk = k helpscreen = 0 goto PPQ end &dA &dA &d@ &dAEditing tasks (3) through (10) all require the same code in the &dA &d@ &dAbeginning, namely, getting the current source line. This code &dA &d@ &dAhas been extracted and put here. &dA a = save_X_point j = s2_to_ifile(a) if j = 0 a = ifile_to_s2(save_Y_point) end tget [X,a] line line = line // pad(44) if line{1} = "*" if k = 0x010070 /* change "p" to "P" for * records k = 0x010050 end if k >= 0x010036 and k <= 0x010038 nextk = k k = 0x010050 end end &dA &dA &d@ &dA EDIT 3. Raise or lower a pitch, rest, musical direction &d@ /* alt   = raise/lower &dA &d@ &dA or figure &dA &dA &d@ &dAOr, raise or lower a specified sub-object of a pitch or rest &dA if k = 0x03010e or k = 0x030110 or k = 0x030119 or k = 0x03011a if " ABCDEFGcgr*f" not_con line{1} goto KLOOP end if k = 0x03010e or k = 0x030110 h = 1 else h = 5 end if k = 0x03010e or k = 0x030119 k = 1 else k = 0 end if line{1} = "f" f = vpar(49) * 10 / vpar(2) b = list_order(a,2) tget [X,b] line line = line // pad(1) if line{1} = "P" line = line // " " if line con "C1:" c = mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "Y" // chs(e) else e = f if k = 1 e -= h else e += h end line2 = line2 // "Y" // chs(e) end line{c,d} = line2 else e = f if k = 1 e -= h else e += h end line = line // "C1:Y" // chs(e) end line = trm(line) tput [X,b] ~line else e = f if k = 1 e -= h else e += h end line = "P C1:Y" // chs(e) perform add_a_record_after (a) tput [X,addrec] ~line end h = 0 perform display_source (h) goto KLOOP end if line{1} = "*" if line{17,2} not_con " " /* we can work on two at once! goto KLOOP end line4 = line if line4{17,2} con ['U','V'] if line4{17,2} con "U" f = vpar(47) else f = 0 - vpar(46) end else if line4{19} = "+" f = 0 - vpar(44) else f = vpar(45) end end f = f * 10 / vpar(2) b = list_order(a,2) tget [X,b] line line = line // pad(1) if line{1} = "P" line = line // " " loop for x = 17 to 18 twk = "C" // chs(x) // ":" if line con twk c = mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "Y" // chs(e) else e = f if k = 1 e -= h else e += h end line2 = line2 // "Y" // chs(e) end line{c,d} = line2 else if line4{x} <> " " e = f if k = 1 e -= h else e += h end line = line // twk // "Y" // chs(e) end end repeat line = trm(line) tput [X,b] ~line else e = f if k = 1 e -= h else e += h end line = "P" if line4{17} <> " " line = line // " C17:Y" // chs(e) end if line4{18} <> " " line = line // " C18:Y" // chs(e) end perform add_a_record_after (a) tput [X,addrec] ~line end h = 0 perform display_source (h) goto KLOOP goto PPQ end if "cg " con line{1} if line{2} = " " b = 3 else b = 2 end else b = 1 end tget [Y,Y_point] line2 .t3 a2 a2 c if line2{1} = "J" /* this is a note or rest object notecode = line{b,4} if notecode = "rest" b = list_order(a,2) tget [X,b] line if line{1} = "P" line = line // " " if line con "C1:" c = mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) perform newrestheight (e,k) line2{mpt..sub-1} = "Y" // chs(e) else perform getrestheight (save_Y_point,e) perform newrestheight (e,k) line2 = line2 // "Y" // chs(e) end line{c,d} = line2 else perform getrestheight (save_Y_point,e) perform newrestheight (e,k) line = line // "C1:Y" // chs(e) end line = trm(line) tput [X,b] ~line else perform getrestheight (save_Y_point,e) perform newrestheight (e,k) line = "P C1:Y" // chs(e) perform add_a_record_after (a) tput [X,addrec] ~line end else loop for i = 1 to h perform vadjnote (k) repeat line{b,4} = notecode tput [X,a] ~line end h = 0 perform display_source (h) goto PPQ end &dA &dA &d@ Sub-objects which can be moved &dA &dA &d@ I. Column 32..40 indications &dA &dA &dK &d@ t = tr. 236 tr. &dA &dI &d@ ~ = wavy line (trill) 237 ~~ &dA &dK &d@ M = mordent 238 mordent &dA &dK &d@ w = shake 239 shake &dA &dK &d@ r = turn 242 turn from above &dA &dK &d@ k = delayed turn " " " &dA &d@ j = slide (no character) &dA &dK &d@ > = horizontal accent 93 horizontal accent &dA &dK &d@ A = vertical accent (/\) 94 ^ accent &dA &dK &d@ V = vertical accent (\/) 95 v accent &dA &dI &d@ . = staccato 96 staccato dot &dA &dI &d@ i = spiccato 97 v stricht or 98 ^ stricht &dA &dI &d@ _ = legato 99 - legato &dA &dI &d@ = = line with dot under it (99 or 96) &dA &dK &d@ , = breath mark 100 , breath &dA &dI &d@ F = upright fermata 101 fermata up &dA &dI &d@ E = inverted fermata 102 fermata down &dA &dK &d@ v = up bow 116 up bow &dA &dK &d@ n = down bow 117 down bow &dA &d@ o = harmonic (no character) &dA &d@ Q = thumb position (cello) 124 thumb position &dA &dK &d@ 0 = open string 199 0 &dA &dK &d@ 1 = fingering 200 1 &dA &dK &d@ 2 = fingering 201 2 &dA &dK &d@ 3 = fingering 202 3 &dA &dK &d@ 4 = fingering 203 4 &dA &dK &d@ 5 = fingering 204 5 &dA &dI &d@ p = piano (pp, ppp, etc.) 108 p &dA &dI &d@ f = forte (ff, fff, etc., fp) 109 m &dA &dI &d@ m = mezzo (mp, mf) 110 f &dA &dI &d@ Z = sfz 111 s &dA &dI &d@ Zp = sfp 112 z &dA &dI &d@ R = rfz 113 r &dA &dA &d@ II. Column 18 indications (not yet implemented in print suggestions) &dA &dA &d@ time dot 44 dot 172 dot &dA &dA &d@ III. Column 2 (by definition) indications (not yet implemented in print suggestions) &dA &dA &d@ sharp 63 sharp 191 sharp &dA &d@ natural 64 natural 192 natural &dA &d@ flat 65 flat 193 flat &dA &d@ double sharp 66 double sharp 194 double sharp &dA &dA if line2{1} = "K" line = line // pad(40) if chr(c) in [108..113] /* dynamics if line{32..40} con ['p','f','m','Z','R'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if chr(c) in [96..99] /* note length articulations if line{32..40} con ['.','i','_','='] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if chr(c) in [93..95] /* accent type articulations if line{32..40} con ['>','A','V'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if c = 101 or c = 102 /* fermatas if line{32..40} con ['F','E'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if c = 100 /* breath if line{32..40} con [','] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if chr(c) in [236,238,239,242] /* ornaments if line{32..40} con ['t','M','w','r','k'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if c = 237 /* wavy line trill ~~~ if line{32..40} con ['~'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if chr(c) in [199..204] /* fingering if line{32..40} con chr(c-151) a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end if c = 116 or c = 117 /* up bow down bow if line{32..40} con ['v','n'] a1 = mpt + 31 /* column goto EDC030 end goto KLOOP end goto KLOOP /* for the time being EDC030: &dA &dA &d@ Get x,y position of object &dA b = Y_point loop --b tget [Y,b] line .t5 c c c repeat while "JI" not_con line{1} a2 += c /* position relative to staff a2 = a2 * 10 / vpar(2) b = list_order(a,2) tget [X,b] line if line{1} = "P" line = line // " " twk = "C" // chs(a1) // ":" if line con twk c = mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "Y" // chs(e) else e = a2 if k = 1 e -= h else e += h end line2 = line2 // "Y" // chs(e) end line{c,d} = line2 else e = a2 if k = 1 e -= h else e += h end line = line // twk // "Y" // chs(e) end line = trm(line) tput [X,b] ~line else e = a2 if k = 1 e -= h else e += h end line = "P C" // chs(a1) // ":Y" // chs(e) perform add_a_record_after (a) tput [X,addrec] ~line end h = 0 perform display_source (h) goto PPQ end goto PPQ end &dA &dA &d@ &dA EDIT 4. Shift musical direction to the left or right &d@ /* alt   = left/right &dA if k = 0x03010d or k = 0x03010f or k = 0x030111 or k = 0x030112 if "*" not_con line{1} goto KLOOP end if line{17,2} not_con " " /* we can work on two at once! goto KLOOP end if k = 0x03010d or k = 0x03010f h = 1 else h = 5 end if k = 0x03010d or k = 0x030111 k = 1 else k = 0 end if line{1} = "*" line4 = line b = list_order(a,2) tget [X,b] line if line{1} = "P" line = line // " " loop for x = 17 to 18 twk = "C" // chs(x) // ":" if line con twk c = mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "x" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "x" // chs(e) else if k = 1 e = 0 - h else e = h end line2 = line2 // "x" // chs(e) end line{c,d} = line2 else if line4{x} <> " " if k = 1 e = 0 - h else e = h end line = line // twk // "x" // chs(e) end end repeat line = trm(line) tput [X,b] ~line else if k = 1 e = 0 - h else e = h end line = "P" if line4{17} <> " " line = line // " C17:x" // chs(e) end if line4{18} <> " " line = line // " C18:x" // chs(e) end perform add_a_record_after (a) tput [X,addrec] ~line end h = 0 perform display_source (h) goto KLOOP goto PPQ end end &dA &dA &d@ &dA EDIT 5. Add a star (*) type record &d@ /* 8 = "*" in this case &dA if k = 0x010038 if line{1} = "m" if a = loc_start_s2rec /* no-op goto KLOOP end loop b = list_order(b,1) if b = TOP_FLAG dputc Error return 12 end repeat while list_order(b,3) = IGNORE_REC EDC003: if b = loc_start_s2rec /* no-op goto KLOOP end tget [X,b] line2 line2 = line2 // pad(44) if "ABCDEFG" not_con line2{1} loop b = list_order(b,1) if b = TOP_FLAG dputc Error return 12 end repeat while list_order(b,3) = IGNORE_REC goto EDC003 end line2 = line2 // pad(30) trackcode = line2{15} staffcode = line2{24} else if "ABCDEFGgcr*f " con line{1} trackcode = line{15} staffcode = line{24} else goto KLOOP end end b = list_order(a,1) perform add_a_record_after (b) /* Different pattern here! if a = loc_start_s2rec loc_start_s2rec = addrec s2marks(markcnt2,1) = loc_start_s2rec end line = "*" // " " // trackcode // " " // staffcode // pad(80) line2 = line helpscrnum = 1 helprows = 16 perform printhelp s2_to_ifile(addrec) = 0 EDC005: /* Step 1: get control letters line = line2 tput [X,addrec] ~line EDC004a: h = 1 perform display_source (h) i = 0 j = 0 EDC004: &dA &d@ getk k perform pgetk (k) if i = 1 and (k = 0x01002c or k = 0x01002e) if "EF" con line{17} tget [X,addrec] line line = line // pad(22) if line{17} = "E" if k = 0x01002c line{21} = "0" else line{21,2} = "15" end list_order(addrec,3) = IGNORE_REC /* disable record h = 4 superignore(h) = addrec j = 1 perform supermsgout (h,j) activate supermsgstr,0,0,3 else if k = 0x01002c line{21} = "15" else line{21,2} = "0" end h = 4 j = superignore(h) & 0xffffff list_order(j,3) = USE_REC c = list_order(j,2) d = 0 backup_pan_resume = 1 if superignore(h) > 0xffffff list_order(j+1,3) = USE_REC c = list_order(j+1,2) d = 1 end &dA &dA &d@ Move to record before beginning of wedge &dA b = s2_to_ifile(c) if b <> 0 save_Y_point = b save_X_point = c Y_point = save_Y_point if d = 1 ++backup_pan_resume end end j = 0 perform supermsgout (h,j) activate supermsgstr,0,0,3 superignore(h) = 0 tput [X,addrec] ~line h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 k = 0x031001 /* automatic redraw goto NEWK end tput [X,addrec] ~line h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ else goto EDC004 end end if k >= 0x010061 and k <= 0x01007a k &= 0xff cbyte = chr(k-32) if "ABCDEFGHJPQUVW" con cbyte line{17+i} = cbyte tput [X,addrec] ~line h = 1 perform display_source (h) j = 1 ++i h = 0 if "EH?UV" con cbyte h = mpt + 3 if h = 7 h = 8 end end if i = 2 and line{17} = line{18} putc You have entered the same letter twice, which will create putc problems for this program. You must enter the letters again. putc putc Type &dA&d@ to continue. getc line{17,2} = " " tput [X,addrec] ~line goto EDC004a end if h > 0 and superignore(h) > 0 putc You have tried to start a super-object of a type which is currently putc outstanding, namely type ~cbyte . While it is true that stage2 putc does support this in certain cases, e.b46 g., wedges, this program putc cannot handle this situation. You need to terminate the existing putc super-object and then go back and enter the new one. putc putc Type &dA&d@ to continue. getc line{17,2} = " " tput [X,addrec] ~line goto EDC004a end if "???FJ??W" con cbyte h = mpt if superignore(h) = 0 putc You have tried to end a super-object of a type which was not putc properly started, ~cbyte . putc putc Type &dA&d@ to continue. getc line{17,2} = " " tput [X,addrec] ~line goto EDC004a end end if i = 2 if line{17,2} in ['E','H','U','V'] putc putc You are trying to start two super-objects in this record, namely, putc ~line{17} , and ~line{18} . While in theory this should be possible, putc this program does not allow it. instead, you must enter separate putc "*" records for each starting super-objects. putc putc Type &dA&d@ to continue. getc line{17,2} = " " tput [X,addrec] ~line goto EDC004a end goto EDC006 end end goto EDC004 end if k = 0x010020 ++i if i < 2 goto EDC004 end if i = 2 and j = 0 goto EDC005 end goto EDC006 end if k = 0x01001b if i = 0 if loc_start_s2rec = addrec loc_start_s2rec = a s2marks(markcnt2,1) = loc_start_s2rec end perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPP end goto EDC005 end if k = 0x010032 /* unshifted @ if line{24} = " " line{24} = "1" else if line{24} = "1" line{24} = "2" else line{24} = "1" end end tput [X,addrec] ~line h = 1 perform display_source (h) goto EDC004 end goto EDC004 EDC006: line3 = line helpscrnum = 2 helprows = 6 perform printhelp EDC007: /* Step 2: get optional offset line = line3 tput [X,addrec] ~line h = 1 perform display_source (h) i = 0 EDC008: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 if i = 3 goto EDC009 end k &= 0xff line{5,3} = line{6,3} line{8} = chr(k) tput [X,addrec] ~line h = 1 perform display_source (h) ++i goto EDC008 end if k = 0x010020 goto EDC009 end if k = 0x01001b if i = 0 goto EDC005 end goto EDC007 end goto EDC008 EDC009: activate helpmsgstr,hlpxpos,hlpypos,5 if line{17,2} in ['P','Q','W',' '] /* skip step 3 goto EDC012 end line3 = line setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = helptop if line{17,2} con ['E','F'] loop for i = 1 to 7 out = hlp03a(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat else if line{17,2} con ['U','V'] loop for i = 1 to 6 out = hlp03b(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat else loop for i = 1 to 6 out = hlp03c(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat end end helpscreen = 3 activate helpmsgstr,hlpxpos,hlpypos,1 EDC010: /* Step 3: numerical parameter and/or "+" line = line3 tput [X,addrec] ~line h = 1 perform display_source (h) i = 0 j = 0 EDC011: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 if i = 2 if j = 1 goto EDC012 end goto EDC011 end if line{17,2} not_con ['E','F','U','V'] goto EDC011 end k &= 0xff line{21+i} = chr(k) tput [X,addrec] ~line h = 1 perform display_source (h) ++i goto EDC011 end if k = 0x010020 goto EDC012 end if k = 0x01003d if j = 1 goto EDC011 end if line{17,2} not_con ['A'..'H','J'] goto EDC011 end line{19} = "+" tput [X,addrec] ~line h = 1 perform display_source (h) ++j if j = 1 and line{17,2} in ['A'..'D','G','H','J',' '] goto EDC012 end if i = 2 goto EDC012 end goto EDC011 end if k = 0x01001b if i = 0 and j = 0 goto EDC005 end goto EDC010 end goto EDC011 EDC012: activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 if line{17,2} in ['A','E','F','H','J','P','Q','U'..'W',' '] /* skip step 4 changecnt = 0 line4 = line goto EDC015 end line3 = line helpscrnum = 4 helprows = 7 perform printhelp EDC013: /* Step 4: get ASCII string line = line3 tput [X,addrec] ~line h = 1 perform display_source (h) line4 = line loop for i = 1 to 10 font_changes(i,1) = 0 font_changes(i,2) = 0 repeat changecnt = 0 if line{17,2} con ['B'..'D'] changecnt = 1 font_changes(changecnt,1) = 25 font_changes(changecnt,2) = 33 end d = -1 i = 25 j = 25 EDC014: &dA &d@ getk k perform pgetk (k) if k = 0x03080c /* goto EDC015 end if k = 0x01001b /* if i = 25 goto EDC005 end goto EDC013 end if k >= 0x010020 and k <= 0x01007e /* ASCII k &= 0xff line{i} = chr(k) tput [X,addrec] ~line h = 1 perform display_source (h) ++i else goto EDC014 end if d >= 0 /* compiling font number if k >= 0x30 and k <= 0x39 k -= 48 if d = 10000 d = k else d *= 10 d += k end goto EDC014 end if d = 10000 d = 33 end ++changecnt font_changes(changecnt,1) = j font_changes(changecnt,2) = d d = -1 end if k = 0x21 /* ! d = 10000 goto EDC014 end line4{j} = chr(k) ++j goto EDC014 EDC015: activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 line = trm(line4) line = line // pad(18) tput [X,addrec] ~line if line{17,2} in ['A'..'D','F','G','P','Q','W',' '] /* i.e. not E,H,U,V backup_pan_resume = 1 end if "???FJ??W" con line{17} h = mpt j = superignore(h) & 0xffffff list_order(j,3) = USE_REC if superignore(h) > 0xffffff list_order(j+1,3) = USE_REC end j = 0 perform supermsgout (h,j) activate supermsgstr,0,0,3 superignore(h) = 0 end if "???FJ??W" con line{18} h = mpt j = superignore(h) & 0xffffff list_order(j,3) = USE_REC if superignore(h) > 0xffffff list_order(j+1,3) = USE_REC end j = 0 perform supermsgout (h,j) activate supermsgstr,0,0,3 superignore(h) = 0 end if line{17,2} con ['H','E','U','V'] if "EH?UV" con line{16+mpt} h = mpt + 3 if h = 7 h = 8 end end list_order(addrec,3) = IGNORE_REC /* disable record superignore(h) = addrec j = 1 perform supermsgout (h,j) activate supermsgstr,0,0,3 else j = 0 end if changecnt > 0 line = "P" loop for i = 1 to changecnt line = line // " C" // chs(font_changes(i,1)) // ":f" // chs(font_changes(i,2)) repeat b = list_order(a,1) perform add_a_record_after (b) /* Different pattern here! if j = 1 list_order(addrec,3) = IGNORE_REC superignore(h) += 0x1000000 end tput [X,addrec] ~line if backup_pan_resume = 1 ++backup_pan_resume end end if backup_pan_resume > 0 k = 0x031001 /* automatic redraw goto NEWK end h = 0 perform display_source (h) goto PPQ end &dA &dA &d@ &dA EDIT 6. Start or End a Slur &d@ 9 = "(" 0 = ")" "[]{}" as is. &dA if k = 0x010039 or k = 0x010030 or k = 0x01005b or k = 0x01005d or k = 0x01007b or k = 0x01007d &dA &dA &d@ Qualify that this is pitch &dA if "ABCDEFG gc" not_con line{1} goto KLOOP end if mpt > 7 if "ABCDEFG " not_con line{2} goto KLOOP end if line{2} = " " and "ABCDEFG" not_con line{3} goto KLOOP end end &dA &dA &d@ Make sure that character is not duplicated in line &dA k &= 0xff if k = 0x39 /* 9 --> ( k = 0x28 end if k = 0x30 /* 0 --> ) k = 0x29 end cbyte = chr(k) if line{32..40} con cbyte hh = sub if "([{" con cbyte j = mpt b = 0 &dA &dA &d@ First check slur_inventory for this slur &dA loop for h = 1 to slur_incnt if slur_inventory(h,1) = a b = slur_inventory(h,2) slur_inventory(h,1) = 0 /* cancel this slur slur_inventory(h,2) = 0 h = slur_incnt end repeat if b <> 0 tget [X,b] line4 line4 = line4 // pad(44) if line4{32..40} con ")]}"{j} line4{sub} = " " /* remove closing slur else putc Program error. This is a bug in the slur section of the program. putc Please try the program again. return 10 end tput [X,b] ~line4 else &dA &dA &d@ You are trying to remove a pre-existing slur &dA &d@ you must look for the termination &dA b = a loop loop b = list_order(b,2) if b = BOTTOM_FLAG goto EDC015a end repeat while list_order(b,3) = IGNORE_REC tget [X,b] line4 line4 = line4 // pad(44) if "ABCDEFGcg " con line4{1} if line4{32..40} con ")]}"{j} line4{sub} = " " /* remove closing slur tput [X,b] ~line4 goto EDC015a end end repeat EDC015a: end line{hh} = " " /* remove opening slur tput [X,a] ~line h = 0 perform display_source (h) end goto KLOOP end &dA &d@ &dA &d@ If starting, make sure that one is not already started &dA &d@ then flag record for future addition of "start-slur" &dA &d@ display character in colume 41,42 or 43 &dA if "([{" con cbyte h = mpt if superignore(h) > 0 hlpx(6,3){23} = cbyte helpscrnum = 6 helprows = 5 perform printhelp &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end j = 1 perform supermsgout (h,j) activate supermsgstr,0,0,3 superignore(h) = a line{40+h} = cbyte tput [X,a] ~line h = 0 perform display_source (h) end &dA &dA &d@ If ending, make sure that one was started earlier &dA &d@ then store terminating character, read record where &dA &d@ slur was started, and move starting character to &dA &d@ location in space 32..40 &dA if ")]}" con cbyte h = mpt if superignore(h) = 0 cbyte = "([{"{h} hlpx(7,3){6} = cbyte helpscrnum = 7 helprows = 5 perform printhelp &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end j = 0 perform supermsgout (h,j) activate supermsgstr,0,0,3 b = superignore(h) superignore(h) = 0 if b = a /* this is a cancellation line{40+h} = " " else if line{32..40} con " " line{sub} = cbyte end tput [X,a] ~line tget [X,b] line line = line // pad(44) cbyte = line{40+h} line{40+h} = " " if line{32..40} con " " line{sub} = cbyte end ++slur_incnt /* this is a new slur slur_inventory(slur_incnt,1) = b slur_inventory(slur_incnt,2) = a end tput [X,b] ~line h = 0 perform display_source (h) end goto PPQ end &dA &dA &d@ &dA EDIT 7. Add a print suggestion &dA if k = 0x010050 /* "P" if nextk <> 0 j = nextk & 0xff - 0x30 + 10 activate helpmsgstr,hlpxpos,hlpypos,0 helpscreen = 0 nextk = 0 goto EDC016a end EDC017: hlpx(8,10) = hlpx(8,10){1,11} // pad(25) helpscrnum = 8 helprows = 11 perform printhelp b = 0 j = 0 EDC016: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 b = 1 k &= 0xff k -= 0x30 j *= 10 j += k if j > 99 goto EDC017 end hlpx(8,10) = hlpx(8,10){1,11} // chs(j) // pad(25) out = hlpx(8,10) scx = 0 scy = (helpinc * 9 + helptop) perform helpmsgout (out,font,scflag) activate helpmsgstr,hlpxpos,hlpypos,1 goto EDC016 end if k = 0x01001b /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 if b = 0 goto PPQ end goto EDC017 end if k = 0x03080c /* activate helpmsgstr,hlpxpos,hlpypos,0 end EDC016a: if chr(j) not_in [0,1,16,17,18,26,27,32..40] hlpx(9,3) = hlpx(9,3){1,55} // chs(j) // pad(65) helpscrnum = 9 helprows = 5 perform printhelp &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end if chr(j) in [1,32..40] if "ABCDEFGr gc" not_con line{1} goto EDC018 end if mpt > 8 if "ABCDEFGr " not_con line{2} goto EDC018 end if line{2} = " " and "ABCDEFG" not_con line{3} goto EDC018 end end end if chr(j) in [26,27] if "ABCDEFGgc" not_con line{1} goto EDC018 end if mpt > 7 if "ABCDEFG" not_con line{2} goto EDC018 end end if "[=]" not_con line{j} goto EDC018 end end if chr(j) in [16,17,18] if line{1} <> "*" goto EDC018 end if j = 16 if "ABCDEFGHJPQUVW" not_con line{17} goto EDC018 end if "ABCDEFGHJPQUVW" not_con line{18} goto EDC018 end else if "ABCDEFGHJPQUVW" not_con line{j} goto EDC018 end end end goto EDC019 EDC018: setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = helptop loop for i = 1 to 5 if i = 3 out = hlp10(3){1..9} // chs(j) // hlp10(3){9..} else out = hlp10(i) end scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat activate helpmsgstr,hlpxpos,hlpypos,1 helpscreen = 10 &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK EDC019: activate helpmsgstr,hlpxpos,hlpypos,0 if chr(j) in [0,26,27] b = list_order(a,1) line = "P C" // chs(j) // ":" perform add_a_record_after (b) /* Different pattern here! tput [X,addrec] ~line h = 1 perform display_source (h) if j = 0 EDC022: helpscrnum = 11 helprows = 8 perform printhelp EDC023: &dA &d@ getk k perform pgetk (k) if k >= 0x010070 and k <= 0x010074 and k <> 0x010072 k = k & 0xff k -= 0x70 if k > 1 --k end cbyte = "pqst"{k+1} k *= 6 activate helpmsgstr,hlpxpos,hlpypos,0 setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = helptop loop for i = 1 to 2 out = hlp12(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat loop for i = 3 to 8 out = hlp12(i+k) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat EDC021: hlp12(28) = hlp12(28){1,11} // pad(25) loop for i = 27 to 29 out = hlp12(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat helpscreen = 12 activate helpmsgstr,hlpxpos,hlpypos,1 b = 0 j = 0 EDC020: &dA &d@ getk k perform pgetk (k) if k >= 0x010030 and k <= 0x010039 b = 1 k &= 0xff k -= 0x30 j *= 10 j += k if j > 999 scy = (helpinc * 8 + helptop) scflag = 0 loop for i = 27 to 29 out = hlp12(i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat scy = (helpinc * 8 + helptop) scflag = 1 goto EDC021 end hlp12(28) = hlp12(28){1,11} // chs(j) // pad(25) out = hlp12(28) scx = 0 scy = (helpinc * 9 + helptop) perform helpmsgout (out,font,scflag) activate helpmsgstr,hlpxpos,hlpypos,1 goto EDC020 end if k = 0x01001b /* activate helpmsgstr,hlpxpos,hlpypos,0 if b = 0 goto EDC022 end scy = (helpinc * 8 + helptop) goto EDC021 end if k = 0x03080c /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto EDC020a end goto EDC020 EDC020a: if cbyte = "t" and j > 4 goto EDC021 end line = line // cbyte // chs(j) tput [X,addrec] ~line h = 0 perform display_source (h) goto PPQ end if k = 0x01001b /* perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,0 goto PPQ end goto EDC023 else &dA &d@ helpscreen = 0 helpscrnum = 13 helprows = 9 perform printhelp EDC024: &dA &d@ getk k perform pgetk (k) if k = 0x010061 or k = 0x010041 or k = 0x010062 k = k & 0xff cbyte = chr(k) line = line // cbyte // chs(j) tput [X,addrec] ~line h = 0 perform display_source (h) goto PPQ end if k = 0x01001b /* perform remove_record (addrec) --addrec h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,0 goto PPQ end goto EDC024 end end if chr(j) in [32..40] b = list_order(a,2) tget [X,b] line2 if line2{1} = "P" line3 = line2 line2 = line2 // " C" // chs(j) // ":" c = b else line3 = "" line2 = "P C" // chs(j) // ":" perform add_a_record_after (a) c = addrec end tput [X,c] ~line2 h = 0 perform display_source (h) if "(){}[]-" con line{j} &dA &d@ helpscreen = 0 helpscrnum = 14 helprows = 8 perform printhelp EDC025: &dA &d@ getk k perform pgetk (k) if k = 0x01006f or k = 0x010075 k = k & 0xff cbyte = chr(k) line2 = line2 // cbyte tput [X,c] ~line2 h = 0 perform display_source (h) goto PPQ end if k = 0x01001b /* if line3 = "" perform remove_record (addrec) --addrec else tput [X,c] ~line3 end h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end goto EDC025 end &dA &dA &d@ At the moment, we do nothing with other types of 32..40 print suggestions &dA if line3 = "" perform remove_record (addrec) --addrec else tput [X,c] ~line3 end h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end if chr(j) in [16..18] jj = j line4 = line if "UV" con line4{j} if line4{j} = "U" f = vpar(47) else f = 0 - vpar(46) end else if line4{19} = "+" f = 0 - vpar(44) else f = vpar(45) end end f = f * 10 / vpar(2) if jj = 16 helpscrnum = 23 helprows = 11 perform printhelp else if "EFHJUVW" con line{j} helpscrnum = 20 helprows = 11 perform printhelp end if "ABCDGPQ" con line{j} helpscrnum = 21 helprows = 11 perform printhelp end end &dA &dA &d@ To save some time, lets see if there is a terminating record &dA &d@ to a super-object started here. If so, and if there is also &dA &d@ a dynamic or a word at the end of the super-object, let us &dA &d@ move its position also. &dA aa = 0 /* use aa as the flag for whether this process operates if "EH" con line{17} or "EH" con line{18} h = mpt aa = a EDC025a: aa = list_order(aa,2) if aa <> BOTTOM_FLAG tget [X,aa] line2 line2 = line2 // pad(18) if line2{1} <> "*" goto EDC025a end if "FJ" con line2{17} or "FJ" con line2{18} if mpt <> h goto EDC025a end else goto EDC025a end if line2{17,2} con ['B','C','D','G'] /* there must also be a word or dynmaic aaa = sub bb = list_order(aa,2) tget [X,bb] line5 if line5{1} = "P" line6 = line5 cc = bb else line6 = "" line5 = "P " perform add_a_record_after (aa) cc = addrec end savecc = cc tput [X,cc] ~line5 else aa = 0 end else aa = 0 end end &dA &dA &d@ First establish whether or not there is already a print suggestion &dA &d@ in place. If so, save it; if not, put one there &dA b = list_order(a,2) tget [X,b] line2 if line2{1} = "P" line3 = line2 c = b else line3 = "" line2 = "P " perform add_a_record_after (a) c = addrec end savec = c tput [X,c] ~line2 h = 0 perform display_source (h) EDC040: &dA &d@ getk k perform pgetk (k) &dA &dA &d@ alt   = raise/lower musical direction &dA if k = 0x03010e or k = 0x030110 or k = 0x030119 or k = 0x03011a if k = 0x03010e or k = 0x030110 h = 1 else h = 5 end if k = 0x03010e or k = 0x030119 k = 1 else k = 0 end b = list_order(a,2) tget [X,b] line line = line // " " c = 0 if jj = 16 c = 1 j = 17 end EDC040a: twk = "C" // chs(j) // ":" if line con twk cc = mpt --mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "Y" // chs(e) else e = f if k = 1 e -= h else e += h end line2 = line2 // "Y" // chs(e) if c = 1 line2 = line2 // " " end end line{cc,d} = line2 else e = f if k = 1 e -= h else e += h end line = line // twk // "Y" // chs(e) if c = 1 line = line // " " end end if c = 1 ++j c = 0 goto EDC040a end line = trm(line) tput [X,b] ~line &dA &dA &d@ Modify position of word or dynamic at end point? &dA if aa > 0 bb = list_order(aa,2) tget [X,bb] line line = line // " " c = aaa twk = "C" // chs(c) // ":" if line con twk cc = mpt --mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "Y" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "Y" // chs(e) else e = f if k = 1 e -= h else e += h end line2 = line2 // "Y" // chs(e) end line{cc,d} = line2 else e = f if k = 1 e -= h else e += h end line = line // twk // "Y" // chs(e) end line = trm(line) tput [X,bb] ~line end h = 0 perform display_source (h) goto EDC040 end &dA &dA &d@ alt   = move musical direction left or right &dA &d@ if k = 0x03010d or k = 0x03010f or k = 0x030111 or k = 0x030112 if k = 0x03010d or k = 0x03010f h = 1 else h = 5 end if k = 0x03010d or k = 0x030111 k = 1 else k = 0 end b = list_order(a,2) tget [X,b] line line = line // " " c = 0 if jj = 16 c = 1 j = 17 end EDC040b: twk = "C" // chs(j) // ":" if line con twk cc = mpt --mpt line2 = txt(line,[' ']) d = len(line2) if line2 con "x" e = int(line2{mpt+1..}) if k = 1 e -= h else e += h end line2{mpt..sub-1} = "x" // chs(e) else if k = 1 e = 0 - h else e = h end line2 = line2 // "x" // chs(e) if c = 1 line2 = line2 // " " end end line{cc,d} = line2 else if k = 1 e = 0 - h else e = h end line = line // twk // "x" // chs(e) if c = 1 line = line // " " end end if c = 1 ++j c = 0 goto EDC040b end line = trm(line) tput [X,b] ~line h = 0 perform display_source (h) goto EDC040 end if k = 0x01001b /* if aa = 0 if line3 = "" perform remove_record (addrec) --addrec else tput [X,savec] ~line3 end else if line6 = "" /* last in, first out perform remove_record (addrec) --addrec else tput [X,savecc] ~line6 end if line3 = "" perform remove_record (addrec) --addrec else tput [X,savec] ~line3 end end h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end &dA &dA &d@ Terminating key strokes &dA if k = 0x03080c or (k >= 0x030101 and k <= 0x030104) or k = 0x031001 tget [X,savec] line3 line3 = trm(line3) if line3 = "P" /* abandon this record perform remove_record (savec) end if aa > 0 tget [X,savecc] line3 line3 = trm(line3) if line3 = "P" /* abandon this record perform remove_record (savecc) end end if k = 0x03080c /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end if k >= 0x030101 and k <= 0x030104 /*  activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end if k = 0x031001 /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end end goto EDC040 end goto PPQ end &dA &dA &d@ &dA EDIT 8. Add articulations, dynamics, fermatas, ornaments, fingerings, bowings &dA if prek = 0x010000 and "apfmzR.i_=>AVtMwrkFE+<" con chr(kk) /* "a" etc. if kk = 'z' kk = 'Z' end if kk = '=' kk = '+' end line4 = line if "ABCDEFGr gc" not_con line{1} goto KLOOP end if mpt > 8 if "ABCDEFGr " not_con line{2} goto KLOOP end if line{2} = " " and "ABCDEFG" not_con line{3} goto KLOOP end end c = 0 if line{1,2} con "r" c = 1 end EDC031: activate helpmsgstr,hlpxpos,hlpypos,5 setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = helptop loop for i = 1 to 15 if (c = 0) or chr(i) in [1,2,6,12,13,14] out = hlpx(17,i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc end repeat helpscreen = 17 activate helpmsgstr,hlpxpos,hlpypos,1 b = 0 if chr(kk) <> "a" goto EDC032a end EDC032: &dA &d@ getk k perform pgetk (k) kk = k EDC032a: if k >= 0x010020 and k <= 0x01007f k &= 0xff if "pfmzR.i_=>AVFE,tMwrk~012345vn+ activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 line = line4 tput [X,a] ~line h = 0 perform display_source (h) if b = 0 goto PPQ end goto EDC031 end if k = 0x03080c /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end if k >= 0x030101 and k <= 0x030104 /*  activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end if k = 0x031001 /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end goto EDC032 end &dA &dA &d@ &dA EDIT 9. Modify beaming or stem direction &dA if k = 0x010062 /* "b" line4 = line if "ABCDEFGgc" con line{1} if mpt < 8 a6 = 1 /* a6 = note type else a6 = mpt - 6 end else goto KLOOP end if mpt > 7 if "ABCDEFG" not_con line{2} goto KLOOP end end &dA &dA &d@ Determine if beams are out-of-the-question &dA if "estxyz654321" not_con line{17} helpscrnum = 28 helprows = 4 perform printhelp EDC035: &dA &d@ getk k perform pgetk (k) if k >= 0x010020 and k <= 0x01007f k &= 0xff if "ud" con chr(k) tget [X,a] line2 line2 = line2 // pad(34) if k = 'u' line2{23} = "u" else line2{23} = "d" end tput [X,a] ~line2 h = 0 perform display_source (h) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 k = 0x031001 goto NEWK end end goto EDC035 end helpscrnum = 18 helprows = 13 perform printhelp b = 0 &dA &dA &d@ Get addresses of first and last records under current beam (if any) &dA &dA &d@ a1 = address of first record under current beam (if any) &dA &d@ a2 = address of last record under current beam (if any) &dA &d@ a3 = number of stems from current note to end of beam &dA &d@ a4 = number of primary pitches to first Q-note or larger &dA &d@ or to "b" or "m" type records or, if type = grace or cue, &dA &d@ to note of reqular type. &dA &d@ a5 = address of last "possible" primary pitch for a beam &dA &d@ c1 = address of first primary beyond current note &dA EDC033: a1 = a a2 = a a3 = 0 if "[]=" con line{26} h = mpt if h <> 1 /* reset a1 b = a loop b = list_order(b,1) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end end repeat while line2{26} <> "[" or a7 <> a6 a1 = b end a3 = 1 if h <> 2 /* reset a2 b = a loop b = list_order(b,2) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end if a7 = a6 and "r " not_con line2{2} ++a3 end end repeat while line2{26} <> "]" or a7 <> a6 a2 = b end end b = a a4 = 0 c1 = 0 loop b = list_order(b,2) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end if a6 > 1 and a7 <> a6 goto EDC034 end if a6 = a7 and "r " not_con line2{2} if "LbwhqBA987" con line{17} goto EDC034 end ++a4 if c1 = 0 c1 = b end a5 = b end end if "bm" con line2{1} goto EDC034 end repeat EDC034: &dA &d@ getk k perform pgetk (k) if k >= 0x010020 and k <= 0x01007f k &= 0xff if "UDud123456789ABC" not_con chr(k) goto EDC034 end if "UDud" con chr(k) if "UD" con chr(k) loop for c = a1 to a2 tget [X,c] line2 line2 = line2 // pad(44) if "ABCDEFG cg" con line2{1} and "ud" con line2{23} if k = 'U' line2{23} = "u" else line2{23} = "d" end tput [X,c] ~line2 end repeat else tget [X,a] line2 line2 = line2 // pad(44) if k = 'u' line2{23} = "u" else line2{23} = "d" end tput [X,a] ~line2 end h = 0 perform display_source (h) if "UD" con chr(k) k = 0x031001 goto NEWK end goto EDC034 end &dA &dA &d@ &dA Beam altering commands: convert k to a number &dA if k < 0x3a k -= 0x30 /* k in 1..9 else k = k - 0x41 + 10 /* k = 10,11, or 12 end &dA &dA &d@ Step 1: worry about terminating existing beams that include the starting note &dA if a1 <> a b = a loop b = list_order(b,1) tget [X,b] line2 line2 = line2 // pad(44) repeat while "=[" not_con line2{26} a8 = b if a8 = a1 line2{26..31} = " " else loop for b = 26 to 31 if line2{b} = "=" line2{b} = "]" end if "[/" con line2{b} line2{b} = "\" end repeat end tput [X,a8] ~line2 end &dA &dA &d@ Step 2: worry about initiating beams on target note &dA tget [X,a] line line = line // pad(44) if k = 1 or a4 = 0 line{26..31} = " " else tget [X,c1] line2 line2 = line2 // pad(44) if "estxyz" con line{17} or "654321" con line{17} a8 = mpt end if "estxyz" con line2{17} or "654321" con line2{17} a9 = mpt end if a1 <> a /* i.e. you are not at the start to begin with loop for b = 26 to 31 if line{b} = "=" line{b} = "[" else if "]\" con line{b} if b - 25 > a9 line{b} = "/" else line{b} = "[" end end end repeat else if a2 = a1 /* there was no beam here; you must start one (of min leng 2) loop for b = 26 to 31 if b - 25 <= a8 if b - 25 > a9 line{b} = "/" else line{b} = "[" if "[/" con line2{b} line2{b} = "=" else line2{b} = "]" if b = 26 a3 = 2 /* this IS a new beam a2 = c1 end end end end repeat tput [X,c1] ~line2 end end end tput [X,a] ~line EDC039: &dA &dA &d@ Step 3: worry about stopping the beam that was initiated &dA &d@ on the target note -- also merge beams if necessary &dA if a3 = k /* do nothing, its already the way you want it h = 0 perform display_source (h) goto EDC033 end if k > a4 + 1 k = a4 + 1 end &dA &dA &d@ Case I: breaking up existing beam &dA &d@ if k < a3 b = a c3 = a loop for c2 = 2 to k + 1 b = list_order(b,2) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end if a6 <> a7 or "r " con line2{2} --c2 end else --c2 end if c2 = k c3 = b end repeat c4 = b &dA &dA &d@ Beam must end at note at address: c3 &dA &d@ next note is at address: c4 &dA tget [X,c3] line2 line2 = line2 // pad(44) tget [X,c4] line3 line3 = line3 // pad(44) if "estxyz" con line3{17} or "654321" con line3{17} a9 = mpt end if k = a3 - 1 /* isolated note line3{26..31} = " " loop for b = 26 to 31 if line2{b} = "=" line2{b} = "]" end if line2{b} = "[" line2{b} = "\" end repeat else loop for b = 26 to 31 if "=[ " con line2{b} line2{b} = "]\ "{mpt} if b - 25 <= a9 if line3{b} = "]" line3{b} = "/" else line3{b} = "[" end end goto EDC037 end if line2{b} = "]" /* do nothing goto EDC037 end if line2{b} = "/" line2{b} = "\" goto EDC037 end if line2{b} = "\" /* do nothing goto EDC037 end EDC037: repeat end tput [X,c3] ~line2 tput [X,c4] ~line3 h = 0 perform display_source (h) goto EDC033 end &dA &dA &d@ Case II; merging beams, possibly many times! (k > a3) &dA &d@ &dA &d@ At this point, a2 = address of end of beam &dA &d@ a5 = address of last "possible" primary pitch for a beam &dA &d@ &dA &d@ Get c6 = address of next "legal" note &dA &d@ if a2 = a5 h = 0 perform display_source (h) goto EDC033 end b = a2 c6 = 0 loop b = list_order(b,2) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end if a6 = a7 and "r " not_con line2{2} c6 = b end end repeat while c6 = 0 tget [X,a2] line2 line2 = line2 // pad(44) tget [X,c6] line3 line3 = line3 // pad(44) if "estxyz" con line3{17} or "654321" con line3{17} a9 = mpt end if line3{26} = " " loop for b = 1 to a9 line3{25+b} = "\" /* create "pseudo beam" repeat end loop for b = 26 to 31 if line2{b} = "[" if line3{b} = "[" line3{b} = "=" end if line3{b} = "/" line3{b} = "]" end if line3{b} = "\" line3{b} = "]" end end if line2{b} = "]" if line3{b} = "[" line2{b} = "=" line3{b} = "=" end if line3{b} = "/" line2{b} = "=" line3{b} = "]" end if line3{b} = "\" line2{b} = "=" line3{b} = "]" end end if line2{b} = "\" if line3{b} = "[" line2{b} = "[" line3{b} = "=" end if line3{b} = "/" line2{b} = "[" line3{b} = "]" end if line3{b} = "\" line2{b} = "[" line3{b} = "]" end end repeat tput [X,a2] ~line2 tput [X,c6] ~line3 h = 0 perform display_source (h) &dA &dA &d@ Here you need to recompute a2 and a3 &dA &dA &d@ a2 = address of last record under current beam (if any) &dA &d@ a3 = number of stems from current note to end of beam &dA tget [X,a] line a3 = 1 b = a loop b = list_order(b,2) tget [X,b] line2 line2 = line2 // pad(44) a7 = 0 if "ABCDEFGgc" con line2{1} if mpt < 8 a7 = 1 /* a7 = note type else a7 = mpt - 6 end if a7 = a6 and "r " not_con line2{2} ++a3 end end repeat while line2{26} <> "]" or a7 <> a6 a2 = b goto EDC039 end if k = 0x03080c /* activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end if k >= 0x030101 and k <= 0x030104 /*  activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end if k = 0x031001 /* F2 (redraw and resume pan) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto NEWK end goto EDC034 end &dA &dA &d@ &dA EDIT 10. Splitting notes and/or rests &dA if k = 0x01002f /* "/" tget [X,a] .t6 h line4 = line if "ABCDEFGrgc" not_con line{1} goto KLOOP end if mpt > 8 and "ABCDEFGr" not_con line{2} goto KLOOP end c = 0 if line{18} = ":" line4{18} = " " line{18} = "." if "LbwhqestxyzzzBA98765432111" con line{17} line4{17} = "LbwhqestxyzzzBA98765432111"{mpt+2} end if "gc" con line{1} if "A987654321000" con line{8} line4{8} = "A987654321000"{mpt+2} end else h = h / 7 * 6 line3 = chs(h) line3 = rev(line3) // pad(3) line3 = rev(line3) line{6..8} = line3 h /= 6 line3 = chs(h) line3 = rev(line3) // pad(3) line3 = rev(line3) line4{6..8} = line3 end loop for b = 0 to 3 if "=[" con line{26+b} line4{26+b,3} = "=\\" end repeat c = 1 else if line{18} = "." line4{18} = " " line{18} = " " if "LbwhqestxyzzzBA98765432111" con line{17} line4{17} = "LbwhqestxyzzzBA98765432111"{mpt+1} end if "gc" con line{1} if "A987654321000" con line{8} line4{8} = "A987654321000"{mpt+1} end else h = h / 3 * 2 line3 = chs(h) line3 = rev(line3) // pad(3) line3 = rev(line3) line{6..8} = line3 h /= 2 line3 = chs(h) line3 = rev(line3) // pad(3) line3 = rev(line3) line4{6..8} = line3 end loop for b = 0 to 3 if "=[" con line{26+b} line4{26+b,2} = "=\" end repeat c = 1 else if "gc" con line{1} if "A987654321000" con line{8} line4{8} = "A987654321000"{mpt+1} line{8} = "A987654321000"{mpt+1} end if "LbwhqestxyzzzBA98765432111" con line{17} line4{17} = "LbwhqestxyzzzBA98765432111"{mpt+1} line{17} = "LbwhqestxyzzzBA98765432111"{mpt+1} end c = 1 else j = h / 2 if rem = 0 if "LbwhqestxyzzzBA98765432111" con line{17} line4{17} = "LbwhqestxyzzzBA98765432111"{mpt+1} line{17} = "LbwhqestxyzzzBA98765432111"{mpt+1} end line3 = chs(j) line3 = rev(line3) // pad(3) line3 = rev(line3) line{6..8} = line3 line4{6..8} = line3 c = 1 end end if c = 1 and line{1,2} not_con "r" and "LbwhqBA987" not_con line{17} if line{26} = " " if "estxyz654321" con line{17} if mpt > 6 mpt -= 6 end loop for b = 1 to mpt line{25+b} = "[" line4{25+b} = "]" repeat end else loop for b = 0 to 5 if "[=" con line{26+b} line4{26+b} = "=" end if "\/" con line{26+b} line{26+b} = "[" line4{26+b} = "]" end if line{26+b} = "]" line{26+b} = "=" line4{26+b} = "]" end if line{26+b} = " " line{26+b} = "[" line4{26+b} = "]" b = 5 end repeat end end end end if c > 0 tput [X,a] ~line perform add_a_record_after (a) tput [X,addrec] ~line4 h = 0 perform display_source (h) end goto PPQ end &dA &dA &d@ &dA EDIT 11. Combining notes and/or rests &dA if k = 0x01007c /* "|" tget [X,a] .t6 h b = list_order(a,2) tget [X,b] line4 .t6 k line4 = line4 // pad(44) if "ABCDEFGrgc" not_con line{1} goto KLOOP end c = mpt - 7 if c < 1 c = 1 end if c > 1 and "ABCDEFGr" not_con line{2} goto KLOOP end if "ABCDEFGrgc" not_con line4{1} goto KLOOP end cc = mpt - 7 if cc < 1 cc = 1 end if cc > 1 and "ABCDEFGr" not_con line4{2} goto KLOOP end if cc <> c goto KLOOP end if line{41,3} con ['(','[','{'] goto KLOOP end if line4{41,3} con ['(','[','{'] goto KLOOP end if "LbwhqestxyzBA987654321" con line{17} c = mpt end if "LbwhqestxyzBA987654321" con line{17} cc = mpt end if (c < 12 and cc > 11) or (c > 11 and cc < 12) goto KLOOP end if line{20} <> line4{20} goto KLOOP end if line{26,6} <> " " or line4{26,6} <> " " helpscrnum = 25 helprows = 7 perform printhelp &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end if " .:" con line{18} aa = mpt - 1 end if " .:" con line4{18} bb = mpt - 1 end if c = cc if aa <> bb goto KLOOP end --c cc = aa else if c = cc - 1 if bb > 0 or aa = 2 goto KLOOP end if aa = 0 cc = 1 else --c cc = 0 end else if c = cc + 1 if aa > 0 or bb = 2 goto KLOOP end if bb = 0 --c cc = 1 else c -= 2 cc = 0 end else if c = cc - 2 if aa <> 1 or bb <> 0 goto KLOOP end cc = 2 else if c = cc + 2 if bb <> 1 or aa <> 0 goto KLOOP end c = cc cc = 2 else goto KLOOP end end end end end &dA &dA &d@ Add second record to first record, and delete second record &dA h += k line{18} = " .:"{cc+1} line{17} = "LbwhqestxyzBA987654321"{c} line4 = chs(h) line4 = rev(line4) // pad(3) line4 = rev(line4) line{6,3} = line4 line = trm(line) tput [X,a] ~line b = list_order(a,2) perform remove_record (b) h = 0 perform display_source (h) goto PPQ end &dA &dA &d@ &dA EDIT 12. Toggle between note and rest &dA if k = 0x010025 /* "%" if "ABCDEFGrgc" not_con line{1} goto KLOOP end if mpt < 9 c = 1 else c = 2 end if c > 1 and "ABCDEFGr" not_con line{2} goto KLOOP end if line{32,12} con ['(','[','{',')',']','}','~','*','!'] /* no super-os allowed goto KLOOP end if line{26,6} <> " " helpscrnum = 26 helprows = 7 perform printhelp &dA &d@ getk k perform pgetk (k) activate helpmsgstr,hlpxpos,hlpypos,5 helpscreen = 0 goto PPQ end line4 = line{c,4} if line4 = "rest" if oldnote = "" line4 = "C4 " else line4 = oldnote end else oldnote = line4 line4 = "rest" end line{c,4} = line4 line{9} = " " /* eliminate tie line{19} = " " /* eliminate accidental flag if line4 = "rest" line{23} = " " /* eliminate stem flag else line{23} = "u" end line = line{1,24} /* clear line above column 24 tput [X,a] ~line h = 0 perform display_source (h) goto PPQ end &dA &dA &d@ &dA EDIT 13. Add or delete a tie &dA if k = 0x01002d /* "-" tget [X,a] .t6 h b = list_order(a,2) tget [X,b] line4 .t6 k line4 = line4 // pad(44) if "ABCDEFGrgc" not_con line{1} goto KLOOP end if line{9} = "-" line{9} = " " if line{32,8} con "-" line{sub} = " " end else line{9} = "-" if line{32,8} not_con "-" if line{32,8} con " " line{sub} = "-" end end end tput [X,a] ~line h = 0 perform display_source (h) end goto PPQ return &dA &dA &d@ procedure pgetk (k) &dA &dA &d@ Purpose: Combine all getk calls. Make possible the &dA &d@ implementation of macros &dA &dA &d@ Operation: The idea is that the user can set up 8 possible &dA &d@ macros, F5 to F12. And if the user types one &dA &d@ of these keys, pgetk will feed the buffer &dA &d@ successively to to user. If the buffer is &dA &d@ empty or is undefined, the normal getk will &dA &d@ be called. &dA &dA &d@ Variables: int macros(8,100) &dA &d@ int macropnt(8) &dA procedure pgetk (k) int i,j,k int macroswitch(8) &dA &dA &d@ First: Look to see if a macro is active &dA loop for i = 1 to 8 if macropnt(i) > 0 j = macropnt(i) /* get next keystroke in macro ++macropnt(i) /* increment pointer k = macros(i,j) if k = 0 /* if k = 0, this is end marker macropnt(i) = 0 goto GETKK /* back to getk end goto RETGETK end repeat GETKK: getk k &dA &dA &d@ Second: Check to see if this is a call to a macro &dA if k >= 0x031004 and k <= 0x03100b i = k & 0x0f - 3 /* 1 to 8 macropnt(i) = 2 k = macros(i,1) /* get first keystroke in macro if k = 0 macropnt(i) = 0 /* no macro stored for this Fx goto GETKK end goto RETGETK end &dA &dA &d@ Third: Look for turning on or off loading of macro &dA if k >= 0x031014 and k <= 0x03101b /* shift Fx = start loading i = k & 0x0f - 3 /* 1 to 8 macroswitch(i) = 1 /* set macro for loading goto GETKK end if k >= 0x031024 and k <= 0x03102b /* ctrl Fx = stop loading i = k & 0x0f - 3 /* 1 to 8 j = macroswitch(i) if j = 0 j = 1 end macros(i,j) = 0 /* store end marker (or clear buffer) macroswitch(i) = 0 /* stop loading goto GETKK end &dA &dA &d@ Fourth: load macro buffer, if appropriate &dA loop for i = 1 to 8 if macroswitch(i) > 0 j = macroswitch(i) if j > 100 macros(i,1) = 0 /* clear entire buffer macroswitch(i) = 0 /* stop loading else macros(i,j) = k ++macroswitch(i) end end repeat &dA &dA &d@ Fifth: Return value of k &dA RETGETK: passback k return &dA &dA &d@ procedure remove_sugg (a,b) &dA &dA &d@ Purpose: remove that part of a print suggestion which &dA &d@ refers to something in column &dA procedure remove_sugg (a,b) str rec.80,temp.80 int a,b,c,d,e getvalue a,b tget [X,a] rec rec = rec // pad(80) if rec{1} <> "P" return end temp = "C" // chs(b) // ":" if rec con temp c = mpt if rec{c..} con " " d = sub end rec = rec{1,c-1} // rec{d..} rec = trm(rec) if rec = "P" perform remove_record (a) else tput [X,a] ~rec end end return &dA &dA &d@ procedure remove_record (a) &dA &dA &d@ Purpose: remove a record at from the source list &dA procedure remove_record (a) int a,b,c getvalue a b = list_order(a,1) c = list_order(a,2) list_order(b,2) = c list_order(c,1) = b return &dA &dA &d@ procedure add_a_record_after (a) &dA &dA &d@ Purpose: add a record after &dA &dA &d@ Operation: increment addrec &dA procedure add_a_record_after (a) int a,b getvalue a b = list_order(a,2) ++addrec list_order(a,2) = addrec list_order(addrec,1) = a list_order(addrec,2) = b list_order(b,1) = addrec return &dA &dA &d@ procedure auto_add_suggestion (a,k,line) &dA &dA &d@ Purpose: add a print suggestion for the placement of a dynamic &dA &dA &d@ Inputs: line = current source line &dA &d@ a = address of current source line &dA &d@ k = letter dynamic code &dA procedure auto_add_suggestion (a,k,line) str line.100,temp1.100,temp2.100,temp3.100 str note.4 int a,b,c,d,e,k int g,h,i,j,m int clef,cline int notepos,dyclass,stem,notetype,beamtype,slur_tie int suggestion,case getvalue a,k,line &dA &dA &d@ 1. Check for chord: we don't add suggestions to chords &dA if line{1} = " " or line{2} = " " return end b = list_order(a,2) AAD002: tget [X,b] temp1 if "SP" con temp1{1} b = list_order(b,2) goto AAD002 end if temp1{1} = " " or ("cg" con temp1{1} and temp1{2} = " ") return end &dA &dA &d@ 2. Get note name: make sure it is valid &dA if "cg" con line{1} i = 2 else i = 1 end if "ABCDEFG" con line{i} note = line{i,4} else return end &dA &dA &d@ 3. Get current operating clef &dA if active_clef_change = 0 clef = active_clef else b = a AAD001: b = list_order(b,1) tget [X,b] temp1 if temp1{1} <> "$" goto AAD001 end if temp1 con "C:" clef = int(temp1{mpt+2..}) else goto AAD001 end end &dA &dA &d@ 4. Determine note position &dA i = clef / 10 j = 6 - rem g = i / 3 h = rem m = j * 2 + 20 cline = h - 1 * 4 + m + g if claves con note{1} g = mpt end loop for i = 2 to 4 if numbers con note{i} j = mpt - 2 * 7 + g i = 4 end repeat notepos = 52 - j - cline &dA &dA &d@ 5. Determine the type of dymanic &dA if "pf" con chr(k) dyclass = mpt /* 1 = p,pp,ppp etc. 2 = f,ff,fff,fp, etc. else dyclass = 3 /* 3 = mf,mp,sfz,rfz,sfp, etc. end &dA &dA &d@ 6. Determine the stem direction &dA if "ud" con line{23} stem = mpt /* 1 = up 2 = down end &dA &dA &d@ 7. Determine note type &dA if "wb" con line{17} notetype = 0 /* no stem else notetype = 1 /* stem end &dA &dA &d@ 8. Determine existance of beam and number of levels &dA if line{26} <> " " beamtype = 1 if "[]=" con line{27} ++beamtype end if "[]=" con line{28} ++beamtype end if "[]=" con line{29} ++beamtype end else beamtype = 0 end &dA &dA &d@ 9. Determine presence of slur or tie &dA if line{32..43} con ['-','(',')','[',']','{','}'] slur_tie = 1 else slur_tie = 0 end &dA &dA &d@ 10. Get automatic suggestion for vertical height &dA if slur_tie = 0 if notetype = 0 case = 3 goto AAD004 end if stem = 1 case = 1 goto AAD004 end end if stem = 1 case = 4 else if beamtype = 0 if notetype = 0 case = 3 else case = 2 end else case = 5 end end AAD004: if notepos < -4 suggestion = vsugg(case,dyclass,1) else if notepos < 11 suggestion = vsugg(case,dyclass,notepos+5) else suggestion = notepos * 5 + vsugg(case,dyclass,16) end end if case = 5 and beamtype > 1 if dyclass = 1 &dA &dA &d@ if note position > -4 add 3 for each extra beam &dA if notepos > 1 suggestion += beamtype - 1 * 3 end else &dA &dA &d@ if note position > 0 add 3 for each extra beam &dA if notepos > 1 suggestion += beamtype - 1 * 3 end end end if line{33..40} con "." if stem = 1 /* stem up if notepos > 5 if notepos < 8 /* 6 or 7 suggestion += 6 else suggestion += 8 end end end end &dA &dA &d@ 11. Check for print record: if not there, add one &dA if line{33..40} con " " h = sub end b = list_order(a,2) tget [X,b] temp1 if temp1{1} = "P" temp1 = trm(temp1) temp1 = temp1 // " C" // chs(h) // ":Y" // chs(suggestion) else perform add_a_record_after (a) b = addrec temp1 = "P C" // chs(h) // ":Y" // chs(suggestion) end tput [X,b] ~temp1 return &dA &dA &d@ getrestheight (a,e) &dA &dA &d@ Input: a = index in table Y of rest record &dA &dA &d@ Output: e = rest height (measured in dots) &dA procedure getrestheight (a,e) int a,b,c,d,e getvalue a tget [Y,a] .t5 c d e if e > 700 e -= 1000 end e *= 10 e /= dvpar(2) passback e return &dA &dA &d@ newrestheight (e,k) &dA &dA &d@ Input: e = current rest height (measured in dots) &dA &d@ k = operation: 1 = raise &dA &d@ 0 = lower &dA &d@ Output: e = new rest height (measured in dots) &dA procedure newrestheight (e,k) int e,k getvalue e,k if k = 1 if e <= 0 or e > dvpar(8) e -= 5 else e -= 10 end else if e < 0 or e >= dvpar(8) e += 5 else e += 10 end end passback e return &dA &dA &d@ vadjnote (a) &dA &dA &d@ Input: a = operation 1 = raise pitch &dA &d@ 2 = lower pitch &dA &d@ notecode = current pitch &dA &dA &d@ Output: notecode = adjusted pitch &dA procedure vadjnote (a) int a,b getvalue a str tnotecode.8 tnotecode = notecode if a = 1 if tnotecode{2} = "f" /* case "ff" and "f" tnotecode = tnotecode{1} // tnotecode{3..} else if tnotecode con "##" /* case "##" if "CDEFGA" con tnotecode{1} tnotecode = "DEFGAB"{mpt} // "ff" // tnotecode{4} else b = int(tnotecode{4}) ++b tnotecode = "Cff" // chs(b) end else tnotecode = tnotecode{1} // "#" // tnotecode{2..} /* case "" and "#" end end else if tnotecode{2} = "#" /* case "##" and "#" tnotecode = tnotecode{1} // tnotecode{3..} else if tnotecode con "ff" /* case "ff" if "DEFGAB" con tnotecode{1} tnotecode = "CDEFGA"{mpt} // "##" // tnotecode{4} else b = int(tnotecode{4}) --b tnotecode = "B##" // chs(b) end else tnotecode = tnotecode{1} // "f" // tnotecode{2..} /* case "" and "f" end end end notecode = trm(tnotecode) notecode = notecode // pad(4) return &dA &dA &d@ setcurloc (a) &dA &dA &d@ Input: a = address in table for this object &dA &dA &d@ Other outputs: xcur = x coordinate of cursor &dA &d@ ycur = y coordinate of cursor &dA &dA procedure setcurloc (a) str line.100,jtype.1,byte.1 int a,g,d,h int x,y int ntype,obx,oby,z,nodenum,i,supcnt,o(8) getvalue a if a = 0 return end tget [Y,a] byte if "HJKWT" not_con byte return end xcur = sp ycur = sysy if byte = "J" tget [Y,a] .t3 jtype g x y if jtype = "B" y = 0 end if y > 800 y = y - 1000 + vst end xcur += x ycur += y return end if "KWT" con byte h = Y_point KAC1: /* attempt to set obcursor correctly --h tget [Y,h] line .t3 jtype g x y if line{1} <> "J" goto KAC1 end if jtype = "B" y = 0 end if y > 800 y = y - 1000 + vst end xcur += x ycur += y tget [Y,Y_point] byte x y xcur += x if byte = "T" tget [Y,1] .t3 y y end ycur += y return end if byte = "H" tget [Y,Y_point] byte x h = start_Y_point HAC1: tget [Y,h] byte .t3 jtype ntype obx oby z nodenum i supcnt o(1) o(2) o(3) o(4) o(5) o(6) o(7) o(8) if byte = "J" if supcnt > 0 loop for i = 1 to supcnt if o(i) = x goto HAC2 end repeat end end ++h goto HAC1 HAC2: if jtype = "B" oby = 0 end if oby > 800 oby = oby - 1000 + vst end xcur += obx ycur += oby return end return &dA &dA &d@ change_cmode &dA &dA &d@ Input: newcmode new movement mode &dA &d@ cmode old movement mode &dA &dA &d@ Outputs: cmode new movement mode &dA procedure change_cmode int a,b,c,d,e,font,color,scflag str out.80 int pos1 font = 137 color = 4 scflag = 0 #if SMALL pos1 = MSGTAB2X #else pos1 = MSGTAB2 #endif scx = pos1 if "jx" con cmode out = messages(mpt) scy = message_row(mpt) end perform msgout2 (out,font,color,scflag) scflag = 1 scx = pos1 if "jx" con newcmode out = messages(mpt) scy = message_row(mpt) end perform msgout2 (out,font,color,scflag) cmode = newcmode return &dA &dA &d@ display_source (opflag) &dA &dA &d@ Input: opflag 0: use red on current line and black on all else &dA &d@ 1: use red on current line. blue on line above &dA &d@ and black on all else &dA &d@ save_Y_point pointer to last referenced object in i-file &dA &d@ save_X_point pointer to last referenced line in source file &dA &d@ current_line(16) contents of last display &dA &dA &d@ Outputs: current_line(16) contents of current display &dA &dA &d@ Procedures called: msgout &dA procedure display_source (opflag) str out.80 int a,b,c,font,color,scflag int opflag int pos1 getvalue opflag if save_Y_point = 0 &dA &dA &d@ Try to recover &dA if save_X_point <> 0 a = save_X_point DSP001: if a > ssize a = list_order(a,1) goto DSP001 end b = s2_to_ifile(a) if b = 0 a = list_order(a,1) goto DSP001 end save_X_point = a save_Y_point = b Y_point = b else putc Failure in program logic. There is a bug here that is not putc not easy to fix. Please try program again. putc return 10 end end c = save_X_point j = s2_to_ifile(c) if j = 0 c = ifile_to_s2(save_Y_point) end a = c tget [X,a] new_line(6) loop for b = 5 to 1 step -1 a = list_order(a,1) &dK &d@ loop while list_order(a,3) = IGNORE_REC &dK &d@ a = list_order(a,1) &dK &d@ repeat tget [X,a] new_line(b) if list_order(a,3) = IGNORE_REC new_line(b) = new_line(b) // pad(16) new_line(b){13,4} = "@@@@" end repeat a = c loop for b = 7 to 16 if a <> s2rec a = list_order(a,2) &dK &d@ loop while list_order(a,3) = IGNORE_REC &dK &d@ a = list_order(a,2) &dK &d@ repeat tget [X,a] new_line(b) if list_order(a,3) = IGNORE_REC new_line(b) = new_line(b) // pad(16) new_line(b){13,4} = "@@@@" end else new_line(b) = "" end repeat font = 200 color = 3 scflag = 0 #if SMALL pos1 = SOURCETABX #else pos1 = SOURCETAB #endif scx = pos1 scy = source_row(5) out = current_line(5) perform msgout (out,font,color,scflag) color = 1 scflag = 0 scx = pos1 scy = source_row(5) out = current_line(5) perform msgout (out,font,color,scflag) loop for b = 1 to 16 if b = 6 color = 4 else color = 1 end if opflag = 1 and b = 5 color = 3 end scflag = 0 scx = pos1 scy = source_row(b) out = current_line(b) perform msgout (out,font,color,scflag) scflag = 1 scx = pos1 scy = source_row(b) out = new_line(b) perform msgout (out,font,color,scflag) current_line(b) = new_line(b) repeat return &dA &dA &d@ msgout &dA &dA &d@ Input: out line to display &dA &d@ fnum font number &dA &d@ color color plane to write to &dA &d@ scflag bits on/bits off flag &dA &dA procedure msgout (out,fnum,color,scflag) str out.100 int font,i,k,fnum,color,scflag,plane getvalue out,fnum,color,scflag plane = 1 font = revmap(fnum) font = font - 1 * 256 if color = 1 if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb msgstr,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb msgstr,FA,scx,scy,k,plane repeat end else if color = 4 if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb redmsgstr,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb redmsgstr,FA,scx,scy,k,plane repeat end else if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb bluemsgstr,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb bluemsgstr,FA,scx,scy,k,plane repeat end end end return &dA &dA &d@ msgout2 &dA &dA &d@ Input: out line to display &dA &d@ fnum font number &dA &d@ color color plane to write to &dA &d@ scflag bits on/bits off flag &dA &dA procedure msgout2 (out,fnum,color,scflag) str out.100 int font,i,k,fnum,color,scflag,plane getvalue out,fnum,color,scflag plane = 1 font = revmap(fnum) font = font - 1 * 256 if color = 1 if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb msgstr2,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb msgstr2,FA,scx,scy,k,plane repeat end else if color = 4 if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb redmsgstr2,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb redmsgstr2,FA,scx,scy,k,plane repeat end end end return &dA &dA &d@ msgout3 &dA &dA &d@ Purpose: display instructions for general Functions &dA procedure msgout3 str out.100 int font,i,j,k,fnum,plane int scx,scy,scyinc fnum = 137 plane = 1 font = revmap(fnum) font = font - 1 * 256 #if SMALL scy = 8 scyinc = 7 #else scy = 30 scyinc = 25 #endif loop for j = 5 to 7 out = messages(j) loop for i = 1 to len(out) k = ors(out{i}) + font setb genmsgstr,FA,scx,scy,k,plane repeat scy += scyinc scx = 0 repeat return &dA &dA &d@ supermsgout &dA &dA &d@ Input: supermsgnum number of message to display (1 to 8) &dA &d@ scflag bits on/bits off flag &dA &dA procedure supermsgout (num,scflag) str out.100 int font,i,k,fnum,scflag,plane int num,scx,scy getvalue num,scflag plane = 1 fnum = 137 font = revmap(fnum) font = font - 1 * 256 out = supermsg(num) i = num - 1 & 0x01 + 1 scy = supermsgrow(i) i = num + 1 / 2 scx = supermsgcol(i) if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb supermsgstr,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb supermsgstr,FA,scx,scy,k,plane repeat end return &dA &dA &d@ helpmsgout &dA &dA &d@ Input: out line to display &dA &d@ fnum font number &dA &d@ scflag bits on/bits off flag &dA &dA procedure helpmsgout (out,fnum,scflag) str out.100 int font,i,k,fnum,scflag,plane getvalue out,fnum,scflag plane = 1 font = revmap(fnum) font = font - 1 * 256 if scflag = 1 loop for i = 1 to len(out) k = ors(out{i}) + font setb helpmsgstr,FA,scx,scy,k,plane repeat else loop for i = 1 to len(out) k = ors(out{i}) + font clearb helpmsgstr,FA,scx,scy,k,plane repeat end return &dA &dA &d@ Procedure construct (first_rec,last_rec) &dA &dA &d@ Purpose: construct or erase sections of music &dA &dA &d@ Inputs: first_rec = starting record in table Y &dA &d@ last_rec = ending record in table Y &dA &dA &d@ con3 = turn on/off &dA &d@ 1 = use setb &dA &d@ 0 = use clearb &dA procedure construct (first_rec,last_rec) str tline.80,jtype.1,htype.1,xbyte.1 int rec,saverec,trec,trec2 int a,b,c,d,e,g,h,i,j,k,n int @k,@m int supcnt,textlen int ntype int oby,sobx,soby,supernum int sysh,sysflag int obx int lpt str quote.1 label LTY(11) int first_rec,last_rec getvalue first_rec,last_rec loop for k = 1 to SUPERMAX supermap(k) = 0 repeat sp = sysx - horiz_shift rec = first_rec scf = notesize tget [Y,1] line line = trm(line) goto FIRST_TOP TOP: if rec > last_rec return end tget [Y,rec] line line = trm(line) ++rec FIRST_TOP: if "LJKAWTH" con line{1} goto LTY(mpt) end &dA &dA &d@ L I N E S &dA &d@ ÄÄÄÄÄÄÄÄÄ &dA LTY(1): /* line{1} = "L" lpt = 3 tline = txt(line,[' '],lpt) vst = int(tline) sq = sysy tline = txt(line,[' '],lpt) f9 = int(tline) if lpt > len(line) putc Possible Error in Musical Direction record (*) putc Program will continue, but make a note of this putc possible error. Also it would be a good idea putc to save your work at this point. putc Type to return to program. getc line = "" else line = line{lpt..} line = mrt(line) end y = sq perform staff if vst > 0 y = sq + vst perform staff end buxstop = 1000000 goto TOP &dA &dA &d@ O B J E C T S &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA LTY(2): /* line{1} = "J" trec = rec - 1 tget [Y,trec] line .t3 jtype ntype obx oby z k i supcnt * if jtype = "I" trec2 = trec - 1 LTY201: tget [Y,trec2] tline .t5 j j i i i if tline{1} <> "J" or i <> 1 --trec2 goto LTY201 end trec2 = rec LTY202: tget [Y,trec2] tline .t5 i i i i i if tline{1} <> "J" ++trec2 goto LTY202 end --k --i h = 1000 * k / i /* h = 1000 times fraction k = obx - j /* k = delta x k *= h k /= 1000 /* k = add distance to j obx = j + k end if jtype = "N" uxstop = sp + obx + dhpar(7) buxstop = 1000000 end * if jtype = "D" /* steve's version: if jtype in ['D','F'] if ntype = 0 goto CZ3 end if bit(1,ntype) = 1 goto CZ3 end if bit(2,ntype) = 1 goto CZ3 end if bit(3,ntype) = 1 goto CZ3 end /* skip over directives SKD2: tget [Y,rec] line2 if line2{1} = "W" /* steve's version: if line2{1} in ['K','W'] ++rec goto SKD2 end goto TOP end &dA &dA &d@ Collect super-object information &dA CZ3: if supcnt > 0 perform strip8 if int(line) <> supcnt /* TEMP putc strip error return 10 end lpt = 0 tline = txt(line,[' '],lpt) loop for i = 1 to supcnt tline = txt(line,[' '],lpt) j = int(tline) * look for previous reference to this superobject loop for k = 1 to SUPERMAX if supermap(k) = j goto WA end repeat h = 0 loop for k = 1 to SUPERMAX if supermap(k) = 0 h = k k = SUPERMAX end repeat if h = 0 putc No more superobject capacity return 10 end &dA &dA &d@ if not found, then set up reference to this superobject. &dA k = h supermap(k) = j superpnt(k) = 1 * k (value 1 to SUPERMAX) = pointer into superdata for this superobject WA: h = superpnt(k) * store object information in superdata and increment superpnt superpnt(k) = h + 2 superdata(k,h) = obx superdata(k,h+1) = oby repeat end &dA &dA &d@ if no sub-objects, then typeset object &dA if vst > 0 and oby > 700 oby -= 1000 oby += vst end if z > 32 x = sp + obx if jtype <> "B" y = sq + oby perform setmus else y = sq perform setmus if nstaves = 2 loop for y = y + vpar(8) to y + vst - vpar(8) perform setmus repeat y = sq + vst perform setmus end end end &dA &dA &d@ typeset underline (if unset) &dA saverec = rec if jtype = "R" if "_,.;:!?" con xbyte &dA &dA &d@ check next note for new syllable &dA YR4: tget [Y,rec] line ++rec if rec = last_rec goto YR3 end if line{1} = "J" and line{3} = "N" YR1: tget [Y,rec] line ++rec if "KA" con line{1} /* Added &dA11-11-93&d@ goto YR1 end if line{1} = "T" goto YR2 end goto YR3 end goto YR4 * YR2: y = sq + f9 underflag = 1 if mpt > 1 uxstop -= dhpar(20) end if buxstop < uxstop uxstop = buxstop end perform setunder (xbyte) xbyte = "*" buxstop = 1000000 end end YR3: rec = saverec if jtype = "B" oby = 0 buxstop = sp + obx - dhpar(57) end goto TOP &dA &dA &d@ S U B - O B J E C T S &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA LTY(3): /* line{1} = "K" trec = rec - 1 tget [Y,trec] .t3 sobx soby z x = sp + obx + sobx y = sq + oby + soby perform setmus goto TOP &dA &dA &d@ A T T R I B U T E S &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA LTY(4): /* line{1} = "A" goto TOP &dA &dA &d@ W O R D S &dA &d@ ÄÄÄÄÄÄÄÄÄ &dA LTY(5): /* line{1} = "W" lpt = 3 tline = txt(line,[' '],lpt) * line structure = sobx soby font# text sobx = int(tline) tline = txt(line,[' '],lpt) soby = int(tline) tline = txt(line,[' '],lpt) z = int(tline) if len(line) > lpt line = line{lpt+1..} x = sp + obx + sobx y = sq + oby + soby perform setwords end goto TOP &dA &dA &d@ T E X T &dA &d@ ÄÄÄÄÄÄÄ &dA LTY(6): /* line{1} = "T" lpt = 3 tline = txt(line,[' '],lpt) * line structure = sobx soby ttext xbyte textlen sobx = int(tline) tline = txt(line,[' '],lpt) soby = int(tline) &dA &dA &d@ typeset back hyphons or underlines (if they exist) &dA if xbyte = "-" y = sq + f9 x = sp + obx + sobx perform sethyph end if "_,.;:!?" con xbyte x = sp + obx + sobx - dhpar(20) if mpt > 1 x -= dhpar(20) end if uxstop > x uxstop = x end y = sq + f9 underflag = 1 perform setunder (xbyte) end * ttext = txt(line,[' '],lpt) ttext = trm(ttext) sub = 1 loop while ttext con "_" ttext{mpt} = " " repeat xbyte = txt(line,[' '],lpt) tline = txt(line,[' '],lpt) textlen = int(tline) x = sp + obx + sobx if soby < 11 /* added &dA09-13-94&d@ y = soby - 1 * dvpar(41) y += sq + f9 else y = sq + soby - 1000 end backloc = x + textlen uxstart = x + textlen + dhpar(19) * print text perform settext goto TOP &dA &dA &d@ S U P E R - O B J E C T S &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA LTY(7): /* line{1} = "H" lpt = 3 tline = txt(line,[' '],lpt) * line structure = supernum htype . . . supernum = int(tline) * get superdata for this superobject loop for k = 1 to SUPERMAX if supermap(k) = supernum goto WB end repeat putc Error: No refererce to superobject ~supernum in previous objects return 10 * k = index into superdata WB: htype = txt(line,[' '],lpt) &dA &dA &d@ compensate for out-of-order objects &dA if superdata(k,1) > superdata(k,3) x1 = superdata(k,3) y1 = superdata(k,4) superdata(k,3) = superdata(k,1) superdata(k,4) = superdata(k,2) superdata(k,1) = x1 superdata(k,2) = y1 end if htype = "T" &dA &dA &d@ structure of &dDtie superobject&d@: 4. vertical position of tied note &dA &d@ 5. horiz. displacement from 1st note &dA &d@ 6. horiz. displacement from 2nd note &dA &d@ 7. vacent &dA &d@ 8. vacent &dA &d@ 9. vacent &dA &d@ 10. sitflag &dA &d@ 11. recalc flag &dA tline = txt(line,[' '],lpt) y1 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) line = line{lpt+1..} perform strip3 sitflag = int(line) tspan = superdata(k,3) + x2 - x1 perform settie supermap(k) = 0 goto TOP end if htype = "B" &dA &dA &d@ structure of &dDbeam superobject&d@: slope vertoff font# #obs bc(1) ... &dA tline = txt(line,[' '],lpt) @k = int(tline) tline = txt(line,[' '],lpt) @m = int(tline) tline = txt(line,[' '],lpt) beamfont = int(tline) #if SMALL i = 103 #else i = notesize / 2 + 101 #endif if beamfont = i stemchar = 59 beamh = dvpar(16) beamt = dvpar(32) qwid = dhpar(3) else stemchar = 187 beamh = dvpar(16) * 4 / 5 beamt = dvpar(32) * 4 + 3 / 5 qwid = dhpar(5) end tline = txt(line,[' '],lpt) bcount = int(tline) j = 1 loop for i = 1 to bcount dbeamdata(i,1) = superdata(k,j) + sp dbeamdata(i,2) = superdata(k,j+1) + sq temp = txt(line,[' '],lpt) temp = rev(temp) e = 6 - len(temp) sbeamcode(i) = temp // "00000"{1,e} j += 2 repeat * print beam tbflag = 0 perform fixmk (@k,@m) if tupldata(1) > 0 and tupldata(5) = supernum tbflag = bit(4,tupldata(1)) ++tbflag end perform setbeam (@k,@m) tupldata(1) = 0 supermap(k) = 0 goto TOP end if htype = "S" &dA &dA &d@ structure of &dDslur superobject&d@: 4. sitflag &dA &d@ 5. extra horiz. displ. from obj-1 &dA &d@ 6. extra vert. displ. from obj-1 &dA &d@ 7. extra horiz. displ. from obj-2 &dA &d@ 8. extra vert. displ. from obj-2 &dA &d@ 9. extra curvature (new 6-30-93) &dA &d@ 9. post horiz. displ. (old) &dA &d@ 10. post vert. displ. &dA &d@ 11. stock slur number &dA tline = txt(line,[' '],lpt) sitflag = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) y1 = int(tline) + superdata(k,2) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) tline = txt(line,[' '],lpt) y2 = int(tline) + superdata(k,4) if y1 > 700 y1 -= 1000 y1 += vst end if y2 > 700 y2 -= 1000 y2 += vst end tline = txt(line,[' '],lpt) addcurve = int(tline) tline = txt(line,[' '],lpt) j = int(tline) postx = 0 posty = 0 if lpt < len(line) tline = txt(line,[' '],lpt) postx = int(tline) end if lpt < len(line) tline = txt(line,[' '],lpt) posty = int(tline) end perform putslur supermap(k) = 0 goto TOP end if htype = "F" &dA &dA &d@ structure of figcon super-object: 4. figure level &dA &d@ 5. horiz. disp. from obj1 &dA &d@ 6. horiz. disp. from obj2 &dA tline = txt(line,[' '],lpt) aa3 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) perform putfigcon supermap(k) = 0 goto TOP end if htype = "X" &dA &dA &d@ structure of tuplet super-object: 4. situation flag &dA &d@ 5. tuplet number &dA &d@ 6. horiz. disp. from obj1 &dA &d@ 7. vert. disp. from obj1 &dA &d@ 8. horiz. disp. from obj2 &dA &d@ 9. vert. disp. from obj2 &dA &d@ 10. associated beam super-number &dA tline = txt(line,[' '],lpt) sitflag = int(tline) tline = txt(line,[' '],lpt) aa1 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) tline = txt(line,[' '],lpt) y1 = int(tline) tline = txt(line,[' '],lpt) x2 = int(tline) tline = txt(line,[' '],lpt) y2 = int(tline) tline = txt(line,[' '],lpt) aa2 = int(tline) if bit(3,sitflag) = 1 tupldata(1) = sitflag tupldata(2) = aa1 tupldata(3) = x1 tupldata(4) = x2 tupldata(5) = aa2 tupldata(6) = y1 tupldata(7) = y2 else x1 += superdata(k,1) y1 += superdata(k,2) x2 += superdata(k,3) y2 += superdata(k,4) if y1 > 700 y1 -= 1000 y1 += vst end if y2 > 700 y2 -= 1000 y2 += vst end perform puttuplet end supermap(k) = 0 goto TOP end if htype = "V" &dA &dA &d@ structure of transp super-object: 4. situation: 0=8av up, 1=8av down &dA &d@ 5. horiz. disp. from obj1 &dA &d@ 6. horiz. disp. from obj2 &dA &d@ 7. vert. disp. from obj1 &dA &d@ 8. length of right vertical hook &dA tline = txt(line,[' '],lpt) aa3 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) tline = txt(line,[' '],lpt) y1 = int(tline) /* + superdata(k,2) if y1 > 700 y1 -= 1000 y1 += vst end tline = txt(line,[' '],lpt) aa1 = int(tline) perform puttrans supermap(k) = 0 goto TOP end if htype = "E" &dA &dA &d@ structure of ending super-object: 4. ending number (0 = none) &dA &d@ 5. horiz. disp. from obj1 &dA &d@ 6. horiz. disp. from obj2 &dA &d@ 7. vert. disp. from staff lines &dA &d@ 8. length of left vertical hook &dA &d@ 9. length of right vertical hook &dA tline = txt(line,[' '],lpt) aa3 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) tline = txt(line,[' '],lpt) y1 = int(tline) tline = txt(line,[' '],lpt) aa1 = int(tline) tline = txt(line,[' '],lpt) aa2 = int(tline) perform putending supermap(k) = 0 goto TOP end if htype = "D" &dA &dA &d@ structure of dashes super-object: 4. horiz. disp. from obj1 &dA &d@ 5. horiz. disp. from obj2 &dA &d@ 6. vert. disp. from staff lines &dA &d@ 7. spacing parameter &dA &d@ 8. font designator &dA tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) tline = txt(line,[' '],lpt) y1 = superdata(k,2) if y1 > 700 y1 = vst else y1 = 0 end y1 += int(tline) tline = txt(line,[' '],lpt) aa1 = int(tline) tline = txt(line,[' '],lpt) aa2 = int(tline) perform putdashes supermap(k) = 0 goto TOP end if htype = "R" &dA &dA &d@ structure of trill super-object: 4. situation: 1=no trill, 2=trill &dA &d@ 5. horiz. disp. from obj1 &dA &d@ 6. horiz. disp. from obj2 &dA &d@ 7. vert. disp. from obj1 &dA tline = txt(line,[' '],lpt) aa1 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) tline = txt(line,[' '],lpt) y1 = int(tline) + superdata(k,2) if y1 > 700 y1 -= 1000 y1 += vst end perform puttrill supermap(k) = 0 goto TOP end if htype = "W" &dA &dA &d@ structure of wedge super-object: 4. left spread &dA &d@ 5. right spread &dA &d@ 6. horiz. disp. from obj1 &dA &d@ 7. beg. vert. disp. from staff &dA &d@ 8. horiz. disp. from obj2 &dA &d@ 9. end. vert. disp. from staff &dA tline = txt(line,[' '],lpt) cc1 = int(tline) tline = txt(line,[' '],lpt) cc2 = int(tline) tline = txt(line,[' '],lpt) x1 = int(tline) + superdata(k,1) tline = txt(line,[' '],lpt) cc3 = superdata(k,2) if cc3 > 700 cc3 = vst else cc3 = 0 end y1 = int(tline) + cc3 tline = txt(line,[' '],lpt) x2 = int(tline) + superdata(k,3) aa1 = x2 - x1 if aa1 < dhpar(39) x2 = x1 + dhpar(39) end tline = txt(line,[' '],lpt) y2 = int(tline) + cc3 perform putwedge supermap(k) = 0 goto TOP end supermap(k) = 0 goto TOP &dA &dA &d@ End of processing music data &dA return &dAÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»&d@ &dAº º&d@ &dAº P R O C E D U R E S º&d@ &dAº º&d@ &dAÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ&d@ &dA &d@ &dA &dA &d@*P&dA 1. setbeam (@k,@m) &dA &d@ &dA &dA &d@ Purpose: Typeset beams and accompanying notes and &dA &d@ stems. Also typeset accompanying tuplet, if present &dA &dA &d@ Note: There are two possible calling situations for this &dA &d@ procedure: (1) the slope and location of the beam &dA &d@ have already been determined, and (2) the slope and &dA &d@ location of the beam have not yet been determined. &dA &d@ The distinction can be made by looking at the value &dA &d@ of the @k calling variable. &dA &dA &d@ Inputs: @k = distance from first object (oby of &dA &d@ note group) to top of top beam (for &dA &d@ stems up) or bottom of bottom beam &dA &d@ (for stems down). @k > 0 means &dA &d@ stem up. &dA &d@ @m = number of dots the beam falls &dA &d@ (rises = negative) in a distance &dA &d@ of 30 horizontal dots. (i.e. &dA &d@ slope * 30) &dA &dA &d@ bcount = number of notes under beam &dA &d@ dbeamdata(.,1) = x-position of note &dA &d@ dbeamdata(.,2) = y-position of note &dA &d@ sbeamcode(.) = beam code &dA &dA &d@ beam code = 6 digit number (string) &dA &dA &d@ 0 = no beam &dA &d@ 1 = continue beam &dA &d@ 2 = begin beam &dA &d@ 3 = end beam &dA &d@ 4 = forward hook &dA &d@ 5 = backward hook &dA &d@ 6 = single stem repeater &dA &d@ 7 = begin repeated beam &dA &d@ 8 = end repeated beam &dA &dA &d@ 100000's digit = eighth level beams &dA &d@ 10000's digit = 16th level beams &dA &d@ 1000's digit = 32nd level beams &dA &d@ 100's digit = 64th level beams &dA &d@ 10's digit = 128th level beams &dA &d@ 1's digit = 256th level beams &dA &dA &dA &d@ beamfont = font for printing beam &dA &d@ stemchar = character number for stem &dA &d@ beamh = height parameter for beams &dA &d@ beamt = vertical space between beams (normally dvpar(32)) &dA &d@ qwid = width of quarter note (normally dhpar(3)) &dA &d@ tupldata(1) = tuplet situation flag &dA &d@ tupldata(2) = tuplet number &dA &d@ tupldata(3) = x1 offset &dA &d@ tupldata(4) = x2 offset &dA &d@ tupldata(6) = y1 offset / For case where tuple goes over &dA &d@ tupldata(7) = y2 offset \ note heads &dAand&d@ there are chords. &dA &d@ tbflag = print tuplet flag &dA &dA &d@ Outputs: prints out beams, stems and notes by means of &dA &d@ procedures, printbeam, hook and revset. &dA &dA &d@ Internal variables: beamfy = y coordinate of first note under beam &dA &d@ @b = y-intercept of beam &dA &d@ @f = temporary variable &dA &d@ @g = temporary variable (related to @@g) &dA &d@ @h = temporary variable &dA &d@ @i = temporary variable &dA &d@ @j = temporary counter &dA &d@ @k = |@m| &dA &d@ @n = temporary variable &dA &d@ @q = temporary counter &dA &d@ @s = temporary variable &dA &d@ @t = temporary variable &dA &d@ @@b = vertical range of note set &dA &d@ @@g = top of staff line &dA &d@ @@n = temporary variable &dA &d@ @@q = temporary variable &dA &d@ bthick = thickness of beam - 1 &dA &d@ (x1,y1) = temporary coordinates &dA &d@ (x2,y2) = temporary coordinates &dA &d@ z1,z2,z3 = temporary character numbers &dA &d@ stemdir(80) = stem directions for mixed direction case &dA &d@ stemends(80) = stem endpoints for mixed direction case &dA &d@ beampos(8) = position of beam (mixed stem dir) &dA &d@ beamlevel = index into beampos(one for each note belonging to beam) &dA &d@ procedure setbeam (@k,@m) int @b,@f,@g,@h,@i,@j,@k,@m,@n,@q,@s,@t int @@b,@@g,@@n,@@q int z2,mixflag int stemends(80),stemdir(80),beampos(8),beamlevel(MAX_BNOTES) int savex1 int staff_height int t1 int beamfy getvalue @k,@m &dA &dA &d@ check for errors in beam repeaters &dA loop for @j = 1 to bcount if sbeamcode(@j) con "7" or sbeamcode(@j) con "8" if bcount <> 2 putc Improper use of beam repeaters goto BERR end loop for @j = 1 to 6 if "270" con sbeamcode(1){@j} if sbeamcode(1){@j} = "2" if sbeamcode(2){@j} <> "3" putc Mismatching sbeamcodes goto BERR end end if sbeamcode(1){@j} = "7" if sbeamcode(2){@j} <> "8" putc Mismatching sbeamcodes goto BERR end end if sbeamcode(1){@j} = "0" if sbeamcode(2){@j} <> "0" putc Mismatching sbeamcodes goto BERR end end else putc Improper use of beam repeaters goto BERR end repeat @j = 10000 end repeat &dA &dA &d@ Determine direction of first stem &dA if @k = 0 or @k = 1 putc Old format for beams. This code has been disabled. putc Please run mskpage on data to get current format. putc return 10 end if @k > 0 dstem = UP else dstem = DOWN end &dA &dA &d@ Check for situation where notes span two staves (grand staff) &dA staff_height = 0 if vst > 0 @g = dbeamdata(1,2) loop for @j = 2 to bcount if abs(dbeamdata(@j,2) - @g) > 500 staff_height = 10000 @j = 10000 end repeat end &dA &dA &d@ Adjust all y coordinates be relative to the top staff &dA loop for @j = 1 to bcount if dbeamdata(@j,2) - sq > 700 dbeamdata(@j,2) -= 1000 dbeamdata(@j,2) += vst if staff_height <> 10000 staff_height = vst end end repeat &dA &dA &d@ Check for mixed stem directions &dA mixflag = 0 loop for @j = 2 to bcount @h = dbeamdata(@j,1) - dbeamdata(1,1) * @m / 30 @h = @h + dbeamdata(1,2) - @k - dbeamdata(@j,2) if @h < 0 if dstem = DOWN mixflag = 1 @j = 10000 end else if dstem = UP mixflag = 1 @j = 10000 end end repeat &dA &dA &d@ Deal with tuplets attached to &dAnote heads&d@ &dA if tbflag = 1 @f = dbeamdata(bcount,1) - dbeamdata(1,1) @g = dbeamdata(bcount,2) - dbeamdata(1,2) * 30 @t = @g / @f @s = 0 @n = bcount - 1 loop for @i = 2 to @n @h = dbeamdata(@i,1) - dbeamdata(1,1) * @t / 30 + dbeamdata(1,2) @q = dbeamdata(@i,2) - @h if dstem = DOWN @q = 0 - @q end if @q > @s @s = @q end repeat if dstem = DOWN @j = dvpar(39) + @s + sq y1 = dbeamdata(1,2) - @j y2 = dbeamdata(bcount,2) - @j if staff_height <> 10000 @h = 0 - notesize * 2 / 3 + staff_height if y1 > @h y1 = @h end if y2 > @h y2 = @h end end else @j = dvpar(39) + dvpar(38) + @s - sq y1 = dbeamdata(1,2) + @j y2 = dbeamdata(bcount,2) + @j if staff_height <> 10000 @h = 11 * notesize / 2 + staff_height if y1 < @h y1 = @h end if y2 < @h y2 = @h end end end sitflag = tupldata(1) aa1 = tupldata(2) x1 = tupldata(3) + dbeamdata(1,1) - sp x2 = tupldata(4) + dbeamdata(bcount,1) - sp y1 += tupldata(6) y2 += tupldata(7) perform puttuplet end bthick = beamfont - 101 beamfy = dbeamdata(1,2) &dA &dA &d@ Reverse all y co-ordinates if first stem is down &dA @g = sq if dstem = DOWN @g = dvpar(1) * 1000 - dvpar(8) - @g loop for @j = 1 to bcount dbeamdata(@j,2) = dvpar(1) * 1000 - dbeamdata(@j,2) repeat end @@g = @g &dA &dA &d@ Situation II: slope and location already determined &dA if dstem = 1 @m = 0 - @m @k = 0 - @k end dv3 = @m * dbeamdata(1,1) dv3 = dbeamdata(1,2) - @k * dhpar(1) - dv3 @k = abs(@m) @@q = 0 loop for @j = 1 to bcount @n = 5 if sbeamcode(@j) con "0" @n = mpt - 2 /* number of additional beams on this note end if @n > @@q @@q = @n /* max number of additional beams end repeat ++@@q if @@q > 3 beamt = dvpar(33) end &dA &dA &d@ End of situation II. &dA &dA &dA &d@ &dA &dA &d@ This is the printout portion of the procedure &dA &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA &dA &d@ @m = dhpar(1) * slope of beam &dA &dA &d@ @k = |@m| &dA &dA &d@ dv3 = y-intercept of top of beam (times dhpar(1)) &dA &dA &d@ &dA &dA &dA &dA &d@ identify beam characters &dA z1 = @k + 33 if @m > 0 z1 += 128 end z2 = @k + 49 if @m > 0 z2 += 128 end &dA &dA &d@ check for tuplet over beam &dA if tbflag = 2 sitflag = tupldata(1) if bit(7,sitflag) = 1 /* curved bracket &dA03/15/97&d@ aa4 = 0 - 2 * qwid / 3 if stem = UP aa4 = qwid / 3 end else aa4 = 0 - qwid / 3 if stem = UP aa4 = 2 * qwid / 3 end end aa1 = tupldata(2) x1 = dbeamdata(1,1) + aa4 - sp + tupldata(3) x2 = dbeamdata(bcount,1) + aa4 - sp + tupldata(4) y1 = @m * dbeamdata(1,1) + dv3 / dhpar(1) y2 = @m * dbeamdata(bcount,1) + dv3 / dhpar(1) if dstem = DOWN y1 = dvpar(1) * 1000 - y1 - bthick - sq + dvpar(39) + dvpar(38) y2 = dvpar(1) * 1000 - y2 - bthick - sq + dvpar(39) + dvpar(38) else y1 = y1 - dvpar(39) - sq y2 = y2 - dvpar(39) - sq end y1 += tupldata(6) y2 += tupldata(7) perform puttuplet end &dA &dA &d@ Here the situation diverges &dA &dA &d@ Case I: all stems go in the same direction &dA &d@ Case II: stem directions are mixed &dA &dA &dA &d@ Case I: all stems go in the same direction &dA if mixflag = 0 &dA &dA &d@ put in first beam &dA x1 = dbeamdata(1,1) x2 = dbeamdata(bcount,1) if sbeamcode(1){1} = "7" x1 += dhpar(59) x2 -= dhpar(59) end perform printbeam (@k,@m) &dA &dA &d@ put in vertical stems &dA loop for @j = 1 to bcount x1 = dbeamdata(@j,1) y1 = @m * x1 + dv3 / dhpar(1) + dvpar(42) y1 += dvpar(4) y2 = dbeamdata(@j,2) z3 = stemchar if y1 >= y2 z3 += 2 y1 -= dvpar(2) loop while y1 < y2 perform revset y1 += dvpar(2) repeat else loop while y1 < y2 perform revset y1 += dvpar(4) repeat end y1 = y2 perform revset repeat &dA &d@ &dA &d@ put in other beams &dA loop for @q = 2 to @@q if sbeamcode(1){@q} = "6" dv3 = dvpar(2) * dhpar(1) + dv3 else dv3 = beamt * dhpar(1) + dv3 end loop for @j = 1 to bcount if "123456780" con sbeamcode(@j){@q} if mpt = 2 @i = @j BB1: ++@j if @j > bcount goto BERR end if "1234560" con sbeamcode(@j){@q} if mpt = 1 goto BB1 else if mpt = 3 * // print beam x1 = dbeamdata(@i,1) x2 = dbeamdata(@j,1) perform printbeam (@k,@m) goto BBR * \\ else goto BERR end end end end if mpt = 7 * // print beam x1 = dbeamdata(1,1) + dhpar(59) x2 = dbeamdata(2,1) - dhpar(59) perform printbeam (@k,@m) goto BBR * \\ end if mpt = 1 goto BERR end if mpt = 3 goto BERR end t1 = dhpar(1) >> 1 if mpt = 4 * // print forward hook x1 = dbeamdata(@j,1) + dhpar(29) y = @m * x1 + dv3 + t1 / dhpar(1) z = z2 + 16 perform hook * \\ end if mpt = 5 * // print backward hook x1 = dbeamdata(@j,1) y = @m * x1 + dv3 + t1 / dhpar(1) x1 -= dhpar(30) z = z2 perform hook * \\ end if mpt = 6 * // print forward and backward hooks to make cross piece x1 = dbeamdata(@j,1) y1 = @m * x1 + dv3 + t1 / dhpar(1) x1 -= 5 y = y1 if @m > 0 y -= int("111111222222233"{@m}) end if @m < 0 y += int("111111222222233"{0-@m}) end z = z2 + 16 perform hook x1 -= dhpar(30) - dhpar(29) - 10 /* = 7 y = y1 if @m > 0 y += int("000111111222222"{@m}) end if @m < 0 y -= int("000111111222222"{0-@m}) end z = z2 perform hook * \\ end end BBR: repeat repeat else &dA &dA &d@ Case II: stem directions are mixed &dA &dA &dA &d@ 1. Determine definitive stem directions and end points &dA &d@ on main staff. &dA loop for @j = 1 to bcount x1 = dbeamdata(@j,1) y1 = @m * x1 + dv3 / dhpar(1) + 4 /* middle of main beam y2 = dbeamdata(@j,2) /* oby of note if y1 < y2 stemdir(@j) = UP else stemdir(@j) = DOWN /* different x intersection if dstem = UP /* direction of &dAfirst&d@ stem x1 -= qwid else x1 += qwid end y1 = @m * x1 + dv3 / dhpar(1) + 4 end stemends(@j) = y1 repeat &dA &dA &d@ 2. Put in first beam &dA x1 = dbeamdata(1,1) /* stemdir(1) is always UP x2 = dbeamdata(bcount,1) if stemdir(bcount) = DOWN if dstem = UP x2 -= qwid else x2 += qwid end end perform printbeam (@k,@m) beampos(1) = dv3 &dA &dA &d@ 2a. Set beamlevel = 1 for all notes. beamlevel for notes will change &dA &d@ as we move through the beam. Basically, if notes A and B start &dA &d@ and end a beam respectively, then beamlevel will be given the &dA &d@ same value for all of these notes and any that might be in between. &dA &d@ If another beam extends between notes C and B, then beamlevel &dA &d@ for these notes will be increased. In the end, beamlevel for each &dA &d@ note will be the number of beams connecting or going through the &dA &d@ stem for that note. &dA loop for @j = 1 to bcount beamlevel(@j) = 1 repeat &dA &dA &d@ 3. Loop through notes, one at a time &dA loop for @j = 1 to bcount &dA &dA &d@ a. put in stem &dA x1 = dbeamdata(@j,1) if stemdir(@j) = DOWN if dstem = UP x1 -= qwid else x1 += qwid end end savex1 = x1 if stemdir(@j) = UP y1 = stemends(@j) y2 = dbeamdata(@j,2) else y2 = stemends(@j) y1 = dbeamdata(@j,2) + 2 /* I think this is needed end y1 += dvpar(4) z3 = stemchar if y1 >= y2 z3 += 2 y1 -= dvpar(2) loop while y1 < y2 perform revset y1 += dvpar(2) repeat else loop while y1 < y2 perform revset y1 += dvpar(4) repeat end y1 = y2 perform revset &dA &dA &d@ b. add &dAall&d@ extra beams starting at this note (and increase beamlevel accordingly) &dA &dA loop for @h = beamlevel(@j) + 1 to 6 if sbeamcode(@j){@h} = "2" /* begin beam ++beamlevel(@j) /* increment beamlevel for starting point loop for @g = @j + 1 to bcount if sbeamcode(@g){@h} = "3" /* end beam x1 = savex1 /* x1 needs to be reset for each beam x2 = dbeamdata(@g,1) if stemdir(bcount) = DOWN if dstem = UP x2 -= qwid else x2 += qwid end end dv3 = beampos(1) loop for @f = 1 to beamlevel(@g) if stemdir(@j) = UP if beampos(@f) > dv3 dv3 = beampos(@f) end else if beampos(@f) < dv3 dv3 = beampos(@f) end end repeat ++beamlevel(@g) /* increment beamlevel for endpoint if stemdir(@j) = UP dv3 += (beamt * dhpar(1)) else dv3 -= (beamt * dhpar(1)) end beampos(beamlevel(@g)) = dv3 * // print beam perform printbeam (@k,@m) &dA &dA &d@ c. adjust stem ends for notes under (over) this beam &dA loop for @f = @j + 1 to @g if stemdir(@j) = UP if stemdir(@f) = DOWN stemends(@f) += beamt end else if stemdir(@f) = UP stemends(@f) -= beamt end end repeat @g = 10000 else &dA &dA &d@ Increment beamlevel for all notes between endpoints of this beam &dA ++beamlevel(@g) end repeat if @g <> 10000 putc No termination found for beam goto BERR end else @h = 6 end repeat &dA &dA &d@ d. put in any hooks that might go with this note &dA loop for @h = beamlevel(@j) + 1 to 6 if "456" con sbeamcode(@j){@h} /* begin beam @g = mpt loop for @f = 1 to beamlevel(@j) if stemdir(@j) = UP if beampos(@f) > dv3 dv3 = beampos(@f) end else if beampos(@f) < dv3 dv3 = beampos(@f) end end repeat if @g = 3 t1 = dvpar(2) * dhpar(1) else t1 = beamt * dhpar(1) end if stemdir(@j) = UP dv3 += t1 else dv3 -= t1 end t1 = dhpar(1) >> 1 if @g = 1 * // print forward hook x1 = savex1 + dhpar(29) y = @m * x1 + dv3 + t1 / dhpar(1) z = z2 + 16 perform hook end if @g = 2 * // print backward hook x1 = savex1 y = @m * x1 + dv3 + t1 / dhpar(1) x1 -= dhpar(30) z = z2 perform hook end if @g = 3 * // print forward and backward hooks to make cross piece x1 = savex1 y1 = @m * x1 + dv3 + t1 / dhpar(1) x1 -= 5 y = y1 if @m > 0 y -= int("111111222222233"{@m}) end if @m < 0 y += int("111111222222233"{0-@m}) end z = z2 + 16 perform hook x1 -= dhpar(30) - dhpar(29) - 10 /* = 7 y = y1 if @m > 0 y += int("000111111222222"{@m}) end if @m < 0 y -= int("000111111222222"{0-@m}) end z = z2 perform hook end else @h = 6 end repeat repeat end return BERR: putc Beam format error, printbeam aborted return &dA &d@ &dA &dA &d@*P&dA 1a. fixmk (@k,@m) &dA &d@ &dA &dA &d@ &dA &d@ Purpose: Determine the first stem length and slope of &dA &d@ the beam. &dA &dA &d@ Inputs: @k = stem direction for first note under beam &dA &d@ @m = stem direction flags for notes under beam (or 0 or 1 = all same as @k) &dA &dA &d@ bcount = number of notes under beam &dA &d@ dbeamdata(.,1) = x-position of note &dA &d@ dbeamdata(.,2) = y-position of note &dA &d@ sbeamcode(.) = beam code &dA &dA &d@ beam code = 6 digit number (string) &dA &dA &d@ 0 = no beam &dA &d@ 1 = continue beam &dA &d@ 2 = begin beam &dA &d@ 3 = end beam &dA &d@ 4 = forward hook &dA &d@ 5 = backward hook &dA &d@ 6 = repeater &dA &d@ 7 = begin repeated beam &dA &d@ 8 = end repeated beam &dA &dA &d@ 100000's digit = eighth level beams &dA &d@ 10000's digit = 16th level beams &dA &d@ 1000's digit = 32nd level beams &dA &d@ 100's digit = 64th level beams &dA &d@ 10's digit = 128th level beams &dA &d@ 1's digit = 256th level beams &dA &dA &d@ beamfont = font for printing beam &dA &d@ stemchar = character number for stem &dA &d@ beamh = height parameter for beams &dA &d@ beamt = vertical space between beams (normally dvpar(32)) &dA &dA &d@ Outputs: @k = length of first stem (positive = stem up) &dA &d@ @m = slope of beam &dA &dA &d@ Internal variables: @b = y-intercept of beam &dA &d@ @f = temporary variable &dA &d@ @g = temporary variable (related to @@g) &dA &d@ @h = temporary variable &dA &d@ @i = temporary variable &dA &d@ @j = temporary counter &dA &d@ @k = |@m| &dA &d@ @n = temporary variable &dA &d@ @p = temporary variable &dA &d@ @q = temporary counter &dA &d@ @r = temporary variable &dA &d@ @s = temporary variable &dA &d@ @t = temporary variable &dA &d@ @u = temporary variable &dA &d@ @@b = vertical range of note set &dA &d@ @@g = top of staff line &dA &d@ @@n = temporary variable &dA &d@ @@q = temporary variable &dA &d@ (x1,y1) = temporary coordinates &dA &d@ (x2,y2) = temporary coordinates &dA &d@ xbeam(6) = temporary flags concerning whether a secondary &dA &d@ beam is above or below the "backbone" &dA &d@ bstem(.,2) = stem flags for notes under a beam &dA &d@ 1 = stem direction &dA &d@ 2 = mimumum stem length to top of "backbone" &dA &d@ beam &dA &dA procedure fixmk (@k,@m) int @b,@f,@g,@h,@i,@j,@k,@m,@n,@p,@q,@r,@s,@t,@u int @@b,@@g,@@n,@@q,@@t int old@k int m1,m2,tm,fm,sum,minsum,leng,minleng int xminsum,ffm int xbeam(6) int bstem(MAX_BNOTES,2) int tdbeamdata(MAX_BNOTES,2) getvalue @k,@m loop for @t = 1 to bcount tdbeamdata(@t,1) = dbeamdata(@t,1) tdbeamdata(@t,2) = dbeamdata(@t,2) - sq repeat dstem = @k &dA &dA &d@ Deal with situation where stems go up and down &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ &dA if @m > 1 &dA &dA &d@ Get stem directions &dA loop for @j = bcount - 1 to 0 step -1 @g = bit(@j,@m) if dstem = 0 ++@g @g &= 0x01 end bstem(bcount - @j,1) = @g repeat &dA &dA &d@ Determine number of "backbone" beams &dA @b = 7 loop for @j = 1 to bcount if sbeamcode(@j) con "0" if mpt < @b @b = mpt end end repeat --@b /* @b = number of "backbone" beams &dA &dA &d@ Determine "thickness" of backbone &dA @t = 0 if @b > 1 if @b < 4 @t = @b - 1 * dvpar(32) else @t = @b - 1 * dvpar(33) end end @@t = @t + dvpar(31) /* @@t = thickness of backbone (for mixed stems) @t += dvpar(31) >> 1 /* @t = thickness of backbone &dA &dA &d@ Determine minimum length of stem (to top of backbone) &dA loop for @j = 1 to 6 if @j <= @b xbeam(@j) = 1 else xbeam(@j) = 0 end repeat @@b = @b @q = 0 @p = 0 loop for @j = 1 to bcount PT1: if @b < 6 if sbeamcode(@j){@b+1} = "2" or sbeamcode(@j){@b+1} = "7" ++@b if bstem(@j,1) = DOWN ++@p xbeam(@b) = 2 else ++@q xbeam(@b) = 3 end goto PT1 end if "456" con sbeamcode(@j){@b+1} ++@b if bstem(@j,1) = DOWN ++@p xbeam(@b) = 4 else ++@q xbeam(@b) = 5 end goto PT1 end end &dA &dA &d@ compute minimum "free" length &dA if @b < 4 bstem(@j,2) = dvpar(10 - @b) / 2 else bstem(@j,2) = dvpar(3) end &dA &dA &d@ add length running thought extra beams &dA if bstem(@j,1) = DOWN bstem(@j,2) += @p * dvpar(32) else bstem(@j,2) += @q * dvpar(32) bstem(@j,2) += dvpar(31) >> 1 + @t end PT2: if xbeam(@b) = 4 xbeam(@b) = 0 --@b --@p goto PT2 end if xbeam(@b) = 5 xbeam(@b) = 0 --@b --@q goto PT2 end PT3: if @b > @@b if sbeamcode(@j){@b} = "3" or sbeamcode(@j){@b} = "8" if xbeam(@b) = 2 --@b --@p goto PT3 end if xbeam(@b) = 3 --@b --@q goto PT3 end end end repeat PT4: &dA &dA &d@ Determine number of staves involved &dA @j = 0 if vst > 0 @g = tdbeamdata(1,2) loop for @j = 2 to bcount if abs(tdbeamdata(@j,2) - @g) > 500 @j = 10000 end repeat end if @j = 10000 &dA &dA &d@ Case 1: notes span two staves (grand staff) &dA @h = vst - 1000 /* correction to bottom staff y-coordinage @@g = 0 loop for @j = 1 to bcount if tdbeamdata(@j,2) > 700 if bstem(@j,1) = DOWN if @@g = 0 or @@g = 2 @@g = 2 /* mixed stems on bottom staff else @@g = 3 end end else if bstem(@j,1) = UP if @@g = 0 or @@g = 1 @@g = 1 /* mixed stems on top staff else @@g = 3 end end end repeat if @@g = 0 goto TWO_STAFF_NORMAL end if @@g = 3 putc Mixed stem directions on two separate staves. This case is putc almost always impossible to draw and is therefore not handled putc by this program! putc return 10 end putc &dAAbnormal case&d@ putc Mixed stem directions on a single staff for a beam with notes putc two staves. In this case, we will try to set a horizontal beam. &dA &d@ &dA &d@ Find "level" for backbone &dA @s = 100000 @u = -100000 loop for @j = 1 to bcount if @@g = 2 /* mixed on bottom staff if tdbeamdata(@j,2) > 700 if bstem(@j,1) = DOWN if tdbeamdata(@j,2) > @u @u = tdbeamdata(@j,2) end else if tdbeamdata(@j,2) < @s @s = tdbeamdata(@j,2) end end end else /* mixed on top staff if tdbeamdata(@j,2) < 700 if bstem(@j,1) = DOWN if tdbeamdata(@j,2) > @u @u = tdbeamdata(@j,2) end else if tdbeamdata(@j,2) < @s @s = tdbeamdata(@j,2) end end end end if tdbeamdata(@j,2) > 700 tdbeamdata(@j,2) = tdbeamdata(@j,2) + @h end repeat if @@g = 2 @s = @s + @h @u = @u + @h end &dA &dA &d@ @s = "highest" note below the beam (stem up) &dA &d@ @u = "lowest" note above the beam (stem down) &dA @n = @u / dvpar(2) @n = rem @h = dvpar(31) >> 1 @i = dvpar(31) - mkpvpar41 if @b = 1 @j = @s - @u if @j < dvpar(6) putc Notes on the staff with mixed stem directions are not sufficiently putc far apart to set a horizontal beam. putc return 10 end if @j = dvpar(6) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @h end else if @j = dvpar(7) if @n = 0 @u += dvpar(4) else @u += dvpar(3) + @i end else if @j = dvpar(8) and @n <> 0 @u += dvpar(5) else @j = @s - @u - @@t @u += @j >> 1 @u -= dvpar(1) + 1 >> 1 if @@g = 2 @u -= vst end @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) if @@g = 2 @u += vst end @u += @h end end end else if @b = 2 @j = @s - @u if @j < dvpar(7) putc Notes on the staff with mixed stem directions are not sufficiently putc far apart to set a horizontal beam. putc return 10 end if @j = dvpar(7) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @h end else if @j = dvpar(8) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @i end else if @j = dvpar(9) and @n <> 0 @u += dvpar(3) + @i else @j = @s - @u - @@t @u += @j >> 1 @u -= dvpar(1) + 1 >> 1 if @@g = 2 @u -= vst end @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) if @@g = 2 @u += vst end @u += @h - mkpvpar41 end end end @u += dvpar(32) else @j = @s - @u - @@t if @j < dvpar(4) putc Notes on the staff with mixed stem directions are not sufficiently putc far apart to set a horizontal beam. putc return 10 end @u += @j >> 1 @u -= dvpar(1) if @@g = 2 @u -= vst end @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) if @@g = 2 @u += vst end @u += @@t - mkpvpar41 end end leng = tdbeamdata(1,2) - @u if leng > 0 leng += @@t - mkpvpar41 end @k = leng @m = 0 passback @k,@m return TWO_STAFF_NORMAL: loop for @j = 1 to bcount if tdbeamdata(@j,2) > 700 tdbeamdata(@j,2) = tdbeamdata(@j,2) + @h end repeat &dA &dA &d@ I am going to try a different technique for setting mixed beams. &dA &d@ They don't happen very often, so I am going to try "brute force", &dA &d@ which will take longer, but should yield more accurate results. &dA &d@ Basically, I will test every slope from -8 to +8 and all legal &dA &d@ levels. &dA &dA &d@ 1. Determine "highest" pivot point &dA @@g = -10000 loop for @j = 1 to bcount if tdbeamdata(@j,2) > @@g and bstem(@j,1) = DOWN @@g = tdbeamdata(@j,2) @g = @j end repeat @@g += bstem(@g,2) xminsum = 1000000000 @h = 10000 &dA &dA &d@ 2. For each "vertical" position, try all slopes; find the "best" one &dA NEXT_VERT_POS: fm = 1000000 minsum = 1000000 loop for tm = -8 to 8 sum = 0 loop for @j = 1 to bcount leng = tdbeamdata(@j,1) - tdbeamdata(@g,1) * tm / dhpar(1) + @@g - tdbeamdata(@j,2) leng = abs(leng) if leng < bstem(@j,2) @j = 10000 else if bstem(@j,1) = DOWN /* For down stems we are interested leng -= @t /* only in length to top of backbone end sum += leng * leng end repeat @r = bcount - 1 * tm sum = abs(@r) * abs(@r) * abs(tm) / 96 + 120 * sum sum /= 1600 if sum < minsum and @j < 10000 fm = tm minsum = sum end repeat if minsum = 1000000 if ffm = 1000000 loop for @j = 1 to bcount bstem(@j,2) -= dvpar(1) if bstem(@j,2) < dvpar(2) putc Unable to find a slope to mixed stem beam putc Try setting more distance between staves of the grand staff putc &dAType /e &d@ to terminate examine return 10 end repeat goto PT4 else goto PARS_FOUND end end &dA &dA &d@ 3. Now evaluate the control function for the lengths in this "vertical" position &dA if minsum < xminsum xminsum = minsum @h = @@g ffm = fm end ++@@g goto NEXT_VERT_POS &dA &dA &d@ 4. Check to see of vertical position has been found &dA PARS_FOUND: if @h = 10000 putc Program error in finding position of beam with mixed stems putc This is probably caused by the distance between the the two putc staves of the grand staff being too small. Try increasing putc this distance with print suggestion at the beginning, and putc running the program again (after transferring your saved putc work to the source file) putc putc &dAType /e &d@ to terminate examine return 10 end fm = ffm leng = tdbeamdata(1,1) - tdbeamdata(@g,1) * fm / dhpar(1) + @h - tdbeamdata(1,2) if bstem(1,1) = DOWN leng += @t end leng = 0 - leng @k = leng @m = fm passback @k,@m return else &dA &dA &d@ Case 2: notes are on one stave &dA if tdbeamdata(1,2) > 700 loop for @j = 1 to bcount tdbeamdata(@j,2) -= 1000 repeat end &dA &dA &d@ Check to see if "up-down" distribution of notes allows beam to be drawn &dA putc Beam with &dAmixed stem directions&d@ on a single staff. &dA &dA &d@ I am going to try including the situations: 1-up/many-down and &dA &d@ many-up/1-down in the case. &dA start_beam(1) = 100000 if bcount = 2 start_beam(1) = tdbeamdata(1,1) start_beam(2) = tdbeamdata(1,2) stop_beam(1) = tdbeamdata(2,1) stop_beam(2) = tdbeamdata(2,2) else if bstem(1,1) = DOWN loop for @j = 2 to bcount if bstem(@j,1) = DOWN goto DUAL_MIXED_FLAT end repeat else loop for @j = 2 to bcount if bstem(@j,1) = UP goto DUAL_MIXED_FLAT end repeat end start_beam(1) = tdbeamdata(1,1) start_beam(2) = tdbeamdata(1,2) stop_beam(1) = tdbeamdata(bcount,1) stop_beam(2) = tdbeamdata(bcount,2) end if start_beam(1) <> 100000 &dA &d@ examine if dstem = UP if start_beam(2) < stop_beam(2) + dvpar(2) putc Unable to draw mixed stem directions on beam putc &dAType /e &d@ to terminate examine return 10 end else if start_beam(2) > stop_beam(2) - dvpar(2) putc Unable to draw mixed stem directions on beam putc &dAType /e &d@ to terminate examine return 10 end end @j = abs(start_beam(2) - stop_beam(2)) / dvpar(1) @h = @b - 1 << 1 if @b < 3 if dstem = UP if @j + @h > 11 /* 9 goto DUAL_MIXED_FLAT end else if @j + @h > 13 /* 13 goto DUAL_MIXED_FLAT end end else if @j + @h > 14 /* 14 goto DUAL_MIXED_FLAT end end @n = stop_beam(1) - start_beam(1) if dstem = UP @n -= dhpar(3) else @n += dhpar(3) end @s = dvpar(4) * 30 / @n if @s < 15 and @j + @h < 14 @j += 2 @m = @s else @s = dvpar(2) * 30 / @n if @s < 20 @u = @s + 1 * @n / 30 if @b < 3 if @u <= dvpar(2) * 12 / 11 ++@s end else if @u <= dvpar(3) ++@s end end if @s > 15 @s = 15 end @m = @s else goto DUAL_MIXED_FLAT end end @n = start_beam(2) / dvpar(2) @n = rem @p = dvpar(31) >> 1 @q = dvpar(31) - mkpvpar41 if @b = 1 if @n <> 0 if @j < 4 @k = dvpar(3) else if @j < 6 @k = dvpar(3) + @p else if @j < 8 @k = dvpar(4) @m >>= 1 else if @j < 10 @k = dvpar(5) + @p else @k = dvpar(6) @m >>= 1 end end end end else if @j < 4 @k = dvpar(3) else if @j < 6 @m >>= 1 @k = dvpar(3) else if @j < 8 @k = dvpar(4) + @p else if @j < 10 @k = dvpar(5) @m >>= 1 else @k = dvpar(6) + @p end end end end end else if @b = 2 if @n <> 0 if @j < 4 @k = dvpar(3) + @p else if @j < 5 @k = dvpar(3) + @p + mkpvpar41 @m >>= 1 else if @j < 6 @k = dvpar(5) else if @j < 8 @k = dvpar(5) + mkpvpar41 else @k = dvpar(5) + @p @m = @m + 1 / 3 end end end end else if @j < 4 @k = dvpar(4) else if @j < 6 @k = dvpar(4) + @p else if @j < 8 @k = dvpar(4) + @p @m = @m + 1 / 3 else if @j < 10 @k = dvpar(6) + @p else @k = dvpar(6) + @p @m >>= 1 end end end end end else if @b = 3 if @n <> 0 if @j < 5 @k = dvpar(5) else if @j < 6 @k = dvpar(5) + @p else if @j < 7 @k = dvpar(6) else @k = dvpar(7) end end end else if @j < 5 @k = dvpar(5) else if @j < 6 @k = dvpar(5) + @p else if @j < 8 @k = dvpar(6) else @k = dvpar(6) + @p end end end end else @k = dvpar(7) end end end if dstem = DOWN @m = 0 - @m @k = 0 - @k end passback @k,@m return end DUAL_MIXED_FLAT: putc There are ~bcount notes on the beam; attempting to set a horizontal beam. &dA &dA &d@ Find "level" for backbone &dA @s = 100000 @u = -100000 loop for @j = 1 to bcount if bstem(@j,1) = DOWN if tdbeamdata(@j,2) > @u @u = tdbeamdata(@j,2) end else if tdbeamdata(@j,2) < @s @s = tdbeamdata(@j,2) end end repeat &dA &dA &d@ @s = "highest" note below the beam (stem up) &dA &d@ @u = "lowest" note above the beam (stem down) &dA @n = @u / dvpar(2) @n = rem @h = dvpar(31) >> 1 @i = dvpar(31) - mkpvpar41 if @b = 1 @j = @s - @u if @j < dvpar(6) putc Stem up notes are not sufficiently higher that stem down notes putc to allow space for a horizontal beam. putc return 10 end if @j = dvpar(6) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @h end else if @j = dvpar(7) if @n = 0 @u += dvpar(4) else @u += dvpar(3) + @i end else if @j = dvpar(8) and @n <> 0 @u += dvpar(5) else @j = @s - @u - @@t @u += @j >> 1 @u -= dvpar(1) + 1 >> 1 @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) @u += @h end end end else if @b = 2 @j = @s - @u if @j < dvpar(7) putc Stem up notes are not sufficiently higher that stem down notes putc to allow space for a horizontal beam. putc return 10 end if @j = dvpar(7) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @h end else if @j = dvpar(8) if @n = 0 @u += dvpar(2) + @i else @u += dvpar(3) + @i end else if @j = dvpar(9) and @n <> 0 @u += dvpar(3) + @i else @j = @s - @u - @@t @u += @j >> 1 @u -= dvpar(1) + 1 >> 1 @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) @u += @h - mkpvpar41 end end end @u += dvpar(32) else @j = @s - @u - @@t if @j < dvpar(4) putc putc Stem up notes are not sufficiently higher that stem down notes putc putc to allow space for a horizontal beam. putc return 10 end @u += @j >> 1 @u -= dvpar(1) @u = @u + dvpar(8) / dvpar(2) * dvpar(2) - dvpar(6) @u += @@t - mkpvpar41 end end leng = tdbeamdata(1,2) - @u if leng > 0 leng += @@t - mkpvpar41 end @k = leng @m = 0 passback @k,@m return end end &dA &dA &d@ End of situation where stems go up and down &dA &dA &dA &d@ Check for situation where notes span two staves (grand staff) &dA if vst > 0 @g = tdbeamdata(1,2) loop for @j = 2 to bcount if abs(tdbeamdata(@j,2) - @g) > 500 @j = 10000 end repeat &dA &dA &d@ If @j = 10000 and stem = 0 (up), then beam will be relative to top staff &dA &d@ if stem = 1 (down), then beam will be relative to bottom staff &dA &dA &d@ Otherwise, beam will be relative to staff that notes are on &dA if @j = 10000 if dstem = 0 /* make no adjustments loop for @j = 1 to bcount if tdbeamdata(@j,2) > 700 tdbeamdata(@j,2) -= 1000 tdbeamdata(@j,2) += vst end repeat else loop for @j = 1 to bcount if tdbeamdata(@j,2) < 700 tdbeamdata(@j,2) -= vst else tdbeamdata(@j,2) -= 1000 end repeat end else if tdbeamdata(1,2) > 700 loop for @j = 1 to bcount tdbeamdata(@j,2) -= 1000 repeat end end end &dA &dA &d@ Reverse if stem down &dA @g = 0 if dstem = 1 @g = dvpar(1) * 1000 - dvpar(8) loop for @j = 1 to bcount tdbeamdata(@j,2) = dvpar(1) * 1000 - tdbeamdata(@j,2) repeat end @@g = @g * determine slope and pivot of beam @q = 0 x1 = 50000 y1 = 50000 @t = 6 @b = 0 @h = 0 /* changes in absolute height @f = 0 @i = tdbeamdata(1,2) &dA &dA &d@ identify: @q = 6 - smallest note type under beam &dA &d@ (x1,y1) = position of note closest to beam &dA &d@ (x2,y2) = position of note next closest to beam &dA &d@ @b = y coordinate of note furthest from beam &dA loop for @j = 1 to bcount * also compute sum of absolute changes in vertical height @n = @i - tdbeamdata(@j,2) testfor @n < 0 if @f = 0 @f = -1 end if @f = 1 @f = 2 end @n = 0 - @n else (>) if @f = 0 @f = 1 end if @f = -1 @f = 2 end end @i = tdbeamdata(@j,2) @h += @n * @n = 5 if sbeamcode(@j) con "0" @n = mpt - 2 /* number of additional beams on this note end if @n > @q @q = @n /* max number of additional beams end if @n < @t @t = @n /* min number of additional beams end @n = tdbeamdata(@j,2) if @n > @b @b = @n /* lowest y co-ord of notes in beam set end if @n < y1 y2 = y1 x2 = x1 y1 = @n /* nearest y co-ord x1 = tdbeamdata(@j,1) else if @n < y2 y2 = @n x2 = tdbeamdata(@j,1) end end repeat &dA &dA &d@ Check point one: (x1,y1); (x2,y2); @b set &dA @@b = @b - y1 &dA &dA &d@ Formula for initial stem length &dA &dA &d@ note @q y1-@n &dA &d@ ÄÄÄÄÄÄÄ ÄÄÄÄÄÄ ÄÄÄÄÄÄÄ &dA &d@ 8th: 0 beamh &dA &d@ 16th: 1 beamh + (1 * notesize / 4) &dA &d@ 32th: 2 beamh + (4 * notesize / 4) &dA &d@ 64th: 3 beamh + (7 * notesize / 4) &dA &d@ 128th: 4 beamh + (10 * notesize / 4) &dA &d@ 256th: 5 beamh + (13 * notesize / 4) &dA if @q = 0 @n = y1 - beamh else @n = @q * 3 - 2 @n = 0 - notesize * @n / 4 - beamh + y1 end @b = x1 * deal with case of severe up-down pattern if @f = 2 @h /= bcount if @h > dvpar(18) @m = 0 goto SB1 end end * @m = y1 - y2 * 2 * dhpar(1) @k = x1 - x2 if @k = 0 putc putc Problem in figuring out beams putc examine return 10 end @m /= @k &dA &dA &d@ Comment: @m is (2*dhpar(1)) times slope between two notes &dA &d@ nearest the beam &dA @k = tdbeamdata(bcount,2) - tdbeamdata(1,2) * 2 * dhpar(1) @j = tdbeamdata(bcount,1) - tdbeamdata(1,1) if @j < dvpar(5) @j = dvpar(5) end @k /= @j &dA &dA &d@ Comment: @k is (2*dhpar(1)) times slope between outside notes &dA &dA &d@ Formula: slope = (@m + @k) / 6 provided &dA &dA &d@ |@m| must be equal to or less than |@k| &dA @j = abs(@m) - abs(@k) if @j > 0 if @m > 0 @m -= @j else @m += @j end end * @m = @m + @k / 6 SB1: @k = abs(@m) if @k > dvpar(19) @k = dvpar(19) end * Soften slant for thirty-seconds and smaller if @q > 2 and @k > 5 @k = 0 - @q / 2 + @k end if @k < 0 @k = 0 end &dA &dA &d@ set reduce slant if end note are closer than dvpar(6) &dA @h = tdbeamdata(bcount,1) - tdbeamdata(1,1) if @h <= dvpar(6) and @k > dvpar(35) @k = dvpar(35) end &dA &dA &d@ shorten shortest stem, if gradual slope and large vertical range &dA &d@ and relatively high note &dA &dA &d@ @h = bcount + 1 &dA &d@ if @h > 5 &dA &d@ @h = 5 &dA &d@ end @h = 3 if @@b > dvpar(@h) @h = @q * beamt + @n - @@g @h = 0 - @h if @h > dvpar(3) if @k < 6 if x1 > tdbeamdata(1,1) and x1 < tdbeamdata(bcount,1) @n += dvpar(17) end if bcount = 2 @n += dvpar(17) end end end end * if @m < 0 @m = 0 - @k else @m = @k end &dA &dA &d@ @m = dhpar(1) * slope of beam &dA &d@ @n = y coordinate of pivot point (on highest note) of first beam &dA &d@ @k = absolute value of @m &dA &d@ @g = y coordinate of top of staff line &dA &d@ (x1,y1) = coordinate of note closest to beam (highest note) &dA &d@ (x2,y2) = coordinate of second closest note to beam (2nd highest note) &dA &d@ @q = 6 - smallest note type number (number of beams - 1) &dA &d@ @t = 6 - largest note type number &dA @@n = @n ++@q @@q = @q &dA &dA &d@ Check point two: @q = number of beams, current slope = @m &dA &dA &d@ Adjust @m and @n so that beams will fall properly on staff lines &dA &dA &d@ Case I: @m = 0 &dA CSI: if @m = 0 @f = @q - 1 * notesize + @n if @f >= @g &dA &dA &d@ Adjust flat beam height &dA @i = @f - @g / notesize if @q = 1 and rem <= dvpar(20) rem += dvpar(20) end if @q = 2 if rem <= dvpar(20) rem += dvpar(34) else rem = rem - notesize + dvpar(20) end end if @q = 3 rem += dvpar(34) end if @q = 4 if @i = 3 beamt = dvpar(33) end if @i < 3 @i = rem @i -= dvpar(1) / 2 rem = @i end end @n -= rem * (*) extremely low notes if @q = 1 @f = dvpar(4) + @@g else @f = 4 - @q * dvpar(2) + @@g end if @n > @f @n = @f if @q > 3 and stemchar = 59 beamt = dvpar(33) end end end else &dA &dA &d@ Case II: @m <> 0 &dA old@k = @k CSII: @j = tdbeamdata(1,1) - x1 * @m / dhpar(1) + @n @i = tdbeamdata(bcount,1) - tdbeamdata(1,1) * @m / dhpar(1) + @j @f = @i + @j / 2 if @q > 1 if @t > 0 @f += beamt if @q = 2 @f += 2 end end @s = dvpar(22) else @s = dvpar(23) end &dA &d@ @j = starting point of top beam &dA &d@ @i = stopping point of top beam &dA &d@ @f = average height of beam (second beam if always 2 or more) &dA &d@ @s = fudge factor @g = @@g @h = @g @g -= notesize if @q > 2 @g -= notesize end if @f > @g &dA &dA &d@ Adjust slanted beam height &dA if @q > 2 if @f > @h beamt = dvpar(33) else @f -= 2 end end @h = abs(@i - @j) @i = @f - @g / notesize @i = rem &dA &d@ @h = rise/fall of beam &dA &d@ @i = amount by which the average beam height lies below a line if @h < dvpar(24) if @i >= @s @i -= notesize if @q = 1 ++@i end else if @q = 1 --@i end end @n -= @i goto CV end if @h < beamt and old@k <> 10000 if @k > 1 goto CSJJ end ++@k if @k = old@k old@k = 10000 /* to prevent looping end if @m < 0 @m = 0 - @k else @m = @k end goto CSII end if @h < dvpar(25) @i += dvpar(1) if @i > @s @i -= notesize end @n -= @i goto CV end if @h > dvpar(26) if @i > @s @i -= notesize end @n -= @i goto CV end if @k = 2 @i += dvpar(1) if @i > @s @i -= notesize end @n -= @i goto CV end CSJJ: --@k if @k = old@k old@k = 10000 /* to prevent looping end if @m < 0 @m = 0 - @k else @m = @k end goto CSII else if @q < 4 @n = notesize / 3 + @n end end * Check for extra low notes CV: @h = tdbeamdata(1,1) - x1 * @m / dhpar(1) + @n @j = tdbeamdata(bcount,1) - x1 * @m / dhpar(1) + @n @i = 0 if @q = 1 @f = dvpar(4) + @@g - 2 else @f = 4 - @q * notesize + @@g - 2 end if @m > 0 if @h > @f @i = 1 @h = @f + 1 end else if @j > @f @i = 1 @j = @f + 1 end end @f = @f + dvpar(20) + 2 if @m > 0 if @j > @f @i = 1 @j = @f end else if @h > @f @i = 1 @h = @f end end if @i = 1 * Correction necessary @k = tdbeamdata(bcount,1) - tdbeamdata(1,1) @m = @j - @h * dhpar(1) / @k @n = x1 - tdbeamdata(1,1) * @m / dhpar(1) + @h @k = abs(@m) end &dA &dA &d@ Deal with special case of two note beam &dA &dA &d@ compute sum of stem lengths and increase if too short &dA &d@ if bcount = 2 &dA &d@ @f = @q - 1 * beamt + y1 - @n + y2 - @n - @h &dA &d@ if @f < dvpar(27) &dA &d@ @n -= dvpar(28) &dA &d@ end &dA &d@ end &dA &dA &d@ Adjust so that middle of beam falls on/between staff lines &dA @n = 100 - beamfont / 2 + @n end * CSIII: dv3 = @m * @b dv3 = @n * dhpar(1) - dv3 &dA &dA &d@ Check point three: beam slope = @m; &dA &d@ y intercept (times dhpar(1)) = dv3 &dA &dA &d@ Post adjustment: sometimes the stems of sixteenths are too &dA &d@ short. This will be the case when (y2-@n) - ((@q-1)*beamt) < xxx &dA &d@ where xxx is some number. In this case, we should raise the &dA &d@ beam by some small amount, yyy. &dA --@q @j = 0 - @q * beamt + y2 - @n if @j < dvpar(29) dv3 -= dvpar(30) * dhpar(1) end &dA &dA &d@ In the case where bcount = 4, compare sum of the first two notes &dA &d@ verses the last two notes. If the direction is different from &dA &d@ the slope, then the slope should be zero. &dA if bcount = 4 @f = tdbeamdata(1,2) + tdbeamdata(2,2) @g = tdbeamdata(3,2) + tdbeamdata(4,2) if @f > @g if @m > 0 goto SB2 end end @f = @f - @g * @m if @f > 0 goto SB2 end goto SB3 SB2: @m = 0 @q = @@q @g = @@g @n = @@n goto CSI end SB3: &dA &dA &d@ @m = dhpar(1) * slope of beam &dA &d@ dv3 = y-intercept of top of beam (times dhpar(1)) &dA y1 = @m * tdbeamdata(1,1) + dv3 / dhpar(1) y2 = tdbeamdata(1,2) @k = abs(y2 - y1) if dstem = 1 @m = 0 - @m /* reverse slope if stem down @k = 0 - @k end passback @k,@m return &dA &d@ &dA &dA &d@*P&dA 2. hook &dA &d@ &dA &dA &d@ Purpose: Typeset hook beam &dA &dA &d@ x1 = horizontal position of note &dA &d@ y = vertical position of hook attachment &dA &d@ dstem = stem direction &dA &d@ z = hook character &dA &d@ beamfont = type of font for beam &dA procedure hook x = x1 if dstem = 1 y = dvpar(1) * 1000 - y - bthick z += 128 z &= 0xff else x += qwid end scf = beamfont scx = x scy = y scb = z perform charout scf = notesize return &dA &d@ &dA &dA &d@*P&dA 3. printbeam (@k,@m) &dA &d@ &dA &dA &d@ Purpose: Typeset beam &dA &dA &d@ Inputs: @k = &dA &d@ @m = slope * dhpar(1) &dA &d@ x1 = starting point of beam &dA &d@ x2 = end point of beam &dA &d@ dv3 = y intercept of beam (times dhpar(1)) &dA &d@ dstem = stem direction &dA &d@ z1 = beam character number for this slop &dA &dA procedure printbeam (@k,@m) int x3,@k,@m getvalue @k,@m x = x1 if dstem = UP x += qwid end scf = beamfont scx = x x2 = x2 + dhpar(29) - dhpar(1) y1 = @m * x1 + dv3 / dhpar(1) if x2 < x1 and @k = 0 x2 = dhpar(1) - dhpar(2) + x2 /* no beam shorter than a "hook" y = y1 /* put out "overlapping" hooks if dstem = DOWN y = dvpar(1) * 1000 - y - bthick else x2 += qwid end PBEAM01: scy = y scb = 65 perform charout x += dhpar(2) if x < x2 goto PBEAM01 end scx = x2 scb = 65 perform charout scf = notesize return end z = z1 if dstem = DOWN z += 128 z &= 0xff end loop while x1 <= x2 y = y1 if dstem = DOWN y = dvpar(1) * 1000 - y - bthick end scy = y scb = z perform charout x1 += dhpar(1) y1 += @m repeat y2 = x2 + dhpar(1) - x1 &dA &dA &d@ print fraction of beam &dA &d@ y2 = extra length needed to complete beam &dA if y2 = 0 scf = notesize return end y = y1 if dstem = DOWN y = dvpar(1) * 1000 - y - bthick end &dA &d@ y = starting point if @k = 0 x = x1 - 30 + y2 if dstem = UP x += qwid end scx = x scy = y scb = 33 perform charout scf = notesize return end scy = y x3 = @k - 1 * 29 + y2 if x3 < 1 or x3 > 435 return 13 end x2 = beamext(x3,1) y1 = 2 loop for y2 = 1 to x2 z = beamext(x3,y1) if @m > 0 z += 128 z &= 0xff end if dstem = 1 z += 128 z &= 0xff end scb = z perform charout if y2 < x2 ++y1 x1 = beamext(x3,y1) if dstem = 1 x1 = 0 - x1 end if @m > 0 x1 = 0 - x1 end y -= x1 scy = y ++y1 end repeat scf = notesize return &dA &d@ &dA &dA &d@*P&dA 4. revset &dA &d@ &dA &dA &d@ Purpose: Check for reversal of page and correct x y and z &dA &dA &d@ Inputs: x1 = horizontal position of note &dA &d@ y1 = vertical position of note &dA &d@ z3 = character to typeset &dA &d@ dstem = stem direction &dA procedure revset x = x1 y = y1 z = z3 if dstem = DOWN if z = 59 or z = 61 or z = 187 or z = 189 ++z end y = dvpar(1) * 1000 - y end perform setmus return &dA &d@ &dA &dA &d@*P&dA 5. setmus &dA &d@ &dA &dA &d@ Purpose: Typeset character &dA &dA &d@ Inputs: x = horizontal position of note &dA &d@ y = vertical position of note &dA &d@ z = character to typeset &dA procedure setmus int sy sy = y - pos(z-32) scx = x scy = sy scb = z perform charout return &dA &d@ &dA &dA &d@*P&dA 6. setwords &dA &d@ &dA &dA &d@ Purpose: Typeset words &dA &dA &d@ Inputs: x = horizontal position of words &dA &d@ y = vertical position of words &dA &d@ z = font number for words &dA &d@ line = words to set &dA &dA procedure setwords str textline.300 int t1,d1,d2 scx = x scy = y scf = z textline = line // " " A11: if textline con "\" if mpt > 1 t1 = mpt line2 = textline{1,mpt-1} perform lineout textline = textline{t1..} end if textline{2,2} in ['0'..'9'] if "123456789" con textline{3} t1 = mpt else if "123456789" con textline{2} t1 = mpt else t1 = 0 end end t1 += 176 line2 = chr(t1) else if textline{2} in ['0'..'9'] d1 = ors(textline{3}) if textline{2} = "0" d1 += 128 line2 = "" if d1 = 171 scx -= dhpar(4) end line2 = line2 // chr(d1) else if textline{2,2} = "2s" line2 = chr(175) else d2 = int(textline{2}) d1 += wak(d2) line2 = chr(d1) // textline{3} end end else d1 = ors(textline{2}) if textline{3} = "0" d1 += 128 line2 = "" if d1 = 171 scx -= dhpar(4) end line2 = line2 // chr(d1) else if textline{2,2} = "s2" line2 = chr(175) else d2 = int(textline{3}) d1 += wak(d2) line2 = chr(d1) // textline{2} end end end end perform lineout textline = textline{4..} goto A11 else line2 = textline perform lineout end scf = notesize return &dA &d@ &dA &dA &d@*P&dA 6a. lineout &dA &d@ &dA &dA &d@ Purpose: Send a line of text to output device &dA &dA &d@ Inputs: line2 &dA &d@ z = font number for words &dA &dA &d@ Side effects: value of z may be changed &dA &d@ value of scf may be changed &dA procedure lineout int t1, t2, t3 str textline.300 AAA111: if line2 con "!" t1 = mpt if t1 > 1 if z <> notesize textline = line2{1,t1-1} else textline = "" loop for t2 = 1 to t1 - 1 t3 = ors(line2{t2}) t3 = music_con(t3) textline = textline // chr(t3) repeat end perform stringout (textline) line2 = line2{t1..} end if len(line2) > 1 if "0123456789" con line2{2} z = int(line2{2..}) if z > 100 or z < 1 putc Illegal font number ~z return 10 end z = fontmap(z) scf = z if sub <= len(line2) line2 = line2{sub..} goto AAA111 else return end else if z <> notesize textline = "!" else t3 = ors("!") t3 = music_con(t3) textline = textline // chr(t3) end perform stringout (textline) line2 = line2{2..} goto AAA111 end end end if z <> notesize textline = line2 else textline = "" loop for t2 = 1 to len(line2) t3 = ors(line2{t2}) t3 = music_con(t3) textline = textline // chr(t3) repeat end perform stringout (textline) return &dA &d@ &dA &dA &d@*P&dA 7. settext &dA &d@ &dA &dA &d@ Purpose: Typeset text &dA &dA &d@ Inputs: x = horizontal position of note &dA &d@ y = vertical position of note &dA &d@ ttext = text to typeset &dA &dA &d@ Internal varibles: d1 = temporary variable &dA &d@ d2 = temporary variable &dA &d@ textline = working text string &dA &d@ line2 = text out string &dA &d@ out = command string &dA &dA procedure settext str textline.300 int t1 int d1,d2 scx = x scy = y scf = mtfont textline = ttext // " " A1: if textline con "\" if mpt > 1 t1 = mpt line2 = textline{1,mpt-1} perform stringout (line2) textline = textline{t1..} end if textline{2,2} in ['0'..'9'] if "123456789" con textline{3} t1 = mpt else if "123456789" con textline{2} t1 = mpt else t1 = 0 end end t1 += 176 line2 = chr(t1) else if textline{2} in ['0'..'9'] d1 = ors(textline{3}) if textline{2} = "0" d1 += 128 line2 = "" if d1 = 171 scx -= dhpar(4) end line2 = line2 // chr(d1) else if textline{2,2} = "2s" line2 = chr(175) else d2 = int(textline{2}) d1 += wak(d2) line2 = chr(d1) // textline{3} end end else d1 = ors(textline{2}) if textline{3} = "0" d1 += 128 line2 = "" if d1 = 171 scx -= dhpar(4) end line2 = line2 // chr(d1) else if textline{2,2} = "s2" line2 = chr(175) else d2 = int(textline{3}) d1 += wak(d2) line2 = chr(d1) // textline{2} end end end end perform stringout (line2) textline = textline{4..} goto A1 else perform stringout (textline) end scf = notesize return &dA &d@ &dA &dA &d@*P&dA 8. staff &dA &d@ &dA &dA &d@ Purpose: Typeset staff &dA &dA &d@ Inputs: y = absolute vertical location &dA &d@ sp = starting point of staff lines &dA &d@ syslen = length of staff lines &dA procedure staff int d1,d2 int slen #if SMALL slen = 32 #else slen = 64 #endif d1 = sp + horiz_shift d2 = d1 + syslen - slen z = 81 loop for x = d1 to d2 step slen perform setmus repeat x = d2 perform setmus return &dA &d@ &dA &dA &d@*P&dA 9. settie &dA &d@ &dA &dA &d@ Purpose: Typeset typeset tie &dA &dA &d@ Inputs: x1 = x-object coordinate of first note &dA &d@ y1 = y-object coordinate of first note (+1000 if on virtual staff) &dA &d@ tspan = distance spanned by tie &dA &d@ sitflag = situation flag &dA &dA &d@ Internal varibles: d1 = temporary variable &dA &d@ d2 = temporary variable &dA &d@ tiechar = first tie character &dA &d@ textend = tie extention character &dA &d@ hd = horizontal displacement &dA &d@ vd = vertical displacement &dA &d@ tcnt = counter &dA procedure settie int d1,d2,d3,d4,d5 int virtoff,tcnt int tiechar,textend,hd,vd label STL(4) &dA &dA &d@ 1) decode y-object coordinate of first note &dA virtoff = 0 if y1 > 700 y1 -= 1000 virtoff = vst end &dA &dA &d@ 2) complete sitflag &dA #if SMALL d5 = 110 #else d5 = 254 #endif d1 = sitflag - 1 & 0x0c >> 2 + 1 goto STL(d1) STL(1): /* tips down, space if y1 < dvpar(2) ++sitflag else if y1 = dvpar(3) and tspan > d5 ++sitflag end end goto STLE STL(2): /* tips down, line if y1 < dvpar(1) ++sitflag else if y1 = dvpar(2) and tspan > d5 ++sitflag end end goto STLE STL(3): /* tips up, space if y1 > dvpar(6) ++sitflag else if y1 = dvpar(7) and tspan > d5 ++sitflag end end goto STLE STL(4): /* tips up, line if y1 > dvpar(5) ++sitflag else if y1 = dvpar(6) and tspan > d5 ++sitflag end end STLE: &dA &dA &d@ 3) from sitflag and tspan, get tiechar, hd and vd &dA * putc SETTIE, x1 = ~x1 y1 = ~y1 tspan = ~tspan sitf = ~sitflag #if SMALL if tspan < 10 putc Error: Tie too short to print putc SETTIE, x1 = ~x1 y1 = ~y1 tspan = ~tspan sitf = ~sitflag getc return end #else if tspan < 20 putc Error: Tie too short to print putc SETTIE, x1 = ~x1 y1 = ~y1 tspan = ~tspan sitf = ~sitflag getc return end #endif d1 = sitflag + 3 / 4 d3 = rem * 3 + 1 d2 = 1 #if SMALL if tspan < 170 d2 = tspan - 8 end #else if tspan < 340 d2 = tspan / 2 - 8 end #endif tiechar = dtiearr(d1,d2,d3) hd = dtiearr(d1,d2,d3+1) vd = dtiearr(d1,d2,d3+2) if sitflag > 8 vd = 0 - vd end &dA &dA &d@ 4) typeset tie &dA &d@ x = x1 + hd + sp y = y1 - vd + sq + virtoff scf = 300 scx = x scy = y scb = tiechar perform charout d1 = tiechar & 0x7f if d1 = 109 textend = tiechar + 5 ++tiechar goto EXT end if d1 = 111 textend = tiechar + 1 tiechar += 2 goto EXT end if d1 > 90 ++tiechar scb = tiechar perform charout end goto EXTa * EXT: vd = sitflag - 1 / 8 sitflag = rem + 1 hd = tspan vd = hd - expar(sitflag) + 8 / 8 scb = textend loop for tcnt = 1 to vd perform charout repeat vd = hd - expar(sitflag) + 16 / 8 vd = 16 - rem scx -= vd scb = tiechar perform charout * EXTa: scf = notesize return &dA &d@ &dA &dA &d@*P&dA 10. sethyph &dA &d@ &dA &dA &d@ Purpose: Typeset hyphons &dA &dA &d@ Inputs: x = absolute coordinate of terminating syllable &dA &d@ y = absolute coordinate text line &dA &d@ backloc = location first space beyond last syllable &dA &d@ or location of first hyphon on next line &dA &dA &d@ Internal varibles: a,b,c,d &dA procedure sethyph int a,b,c,d scf = mtfont scy = y a = x - backloc * a = distance over which to set hyphons b = 3 * dhpar(6) if a < b if a >= dhpar(17) if backloc = dhpar(15) scx = backloc scb = ors("-") if a < dhpar(6) perform charout goto CM end end b /= 2 if a > b b = a - dhpar(17) + 3 * 2 / 5 a = b + backloc scx = a scb = ors("-") perform charout a += b else a = a - dhpar(17) + 3 / 2 + backloc end scx = a scb = ors("-") perform charout else if x = dhpar(9) scx = backloc scb = ors("-") perform charout goto CM end end else if backloc = dhpar(15) b = 2 * a / dhpar(6) + 1 c = a / b backloc -= c a += c end b = a / dhpar(6) c = a / b --b backloc += c / 2 scx = backloc scb = ors("-") perform charout loop for d = 1 to b backloc += c scx = backloc scb = ors("-") perform charout repeat end CM: scf = notesize return &dA &d@ &dA &dA &d@*P&dA 11. setunder &dA &d@ &dA &dA &d@ Purpose: Typeset underline &dA &dA &d@ Inputs: uxstop = x-coordinate of end of line &dA &d@ uxstart = x-coord. of first space beyond last syllable &dA &d@ or location of first hyphon on next line &dA &d@ y = y-coordinate for text line &dA &d@ underflag = execution flag, currently set for ties and &dA &d@ melismas &dA &d@ xbyte = ending punctuation &dA &dA &d@ Internal varibles: a,b,c,d &dA procedure setunder (xbyte) int a,b,c,d str xbyte.1 getvalue xbyte if underflag = 0 return end x = uxstart - dhpar(19) scf = mtfont scx = x scy = y a = uxstop - uxstart * a = distance over which to set hyphons if a >= dhpar(18) y -= dvpar(13) scx = uxstart scy = y scb = ors("_") b = uxstop - underspc d = underspc loop for c = uxstart to b step d perform charout repeat scx = b perform charout scx += 5 scy += dvpar(13) end if underflag = 1 and xbyte <> "_" scb = ors(xbyte) perform charout end scf = notesize return &dA &d@ &dA &dA &d@*P&dA 14. putslur &dA &d@ &dA &dA &d@ Purpose: Typeset slur &dA &dA &d@ Inputs: (x1,y1) = starting note head &dA &d@ (x2,y2) = terminating note head &dA &d@ sitflag = situation flag &dA &d@ addcurve = flag indicating the curvature should be added &dA &d@ &dA &d@ Internal variables: aa1,aa2,aa3,aa4,aa5,aa6,aa7,aa8,aa9,aa10,aa11,aa12 &dA &d@ cc1,cc2,cc3,cc4,cc5,cc6,cc7 &dA procedure putslur &dA &dA &d@ determine case &dA aa9 = bit(2,sitflag) aa1 = aa9 * 2 + 1 if y1 < y2 ++aa1 end &dA &dA &d@ determine endpoints &dA aa5 = dvpar(10) - y1 / dvpar(1) /* height par of 1st note aa6 = dvpar(10) - y2 / dvpar(1) /* height par of 2nd note aa7 = abs(aa5-aa6) if aa7 < 11 /* large gaps not supported ??? if aa5 < 1 or aa6 < 1 goto SR1 end if aa5 > 11 or aa6 > 11 goto SR2 end goto SR3 * adjust parameters upward SR1: aa10 = aa5 aa11 = aa6 if aa6 < aa5 aa10 = aa6 aa11 = aa5 end aa10 = 1 - aa10 /* minimum amount to raise pars if aa7 < 10 aa12 = aa10 / 2 if aa9 = 0 /* convex slur aa10 += rem else if aa11 + aa10 > 3 aa10 += rem end end end aa5 += aa10 aa6 += aa10 goto SR3 * adjust parameters downward SR2: aa10 = aa5 aa11 = aa6 if aa6 > aa5 aa10 = aa6 aa11 = aa5 end aa10 -= 11 /* minimum amount to lower pars if aa7 < 10 aa12 = aa10 / 2 if aa9 = 1 /* concave slur aa10 += rem else if aa11 - aa10 < 9 aa10 += rem end end end aa5 -= aa10 aa6 -= aa10 SR3: &dA &dA &d@ get stock slur number and location &dA #if SMALL line2 = "c:\musprint\bitmap06\slurs\c\" #else line2 = "c:\musprint\bitmap\slurs\c\" #endif &dA &d@ line2 = "c:\wbh\res\mus\prnt\bitmap\slurs\protopar\c\" line2 = line2 // chs(aa5) // "\" // chs(aa6) SR4: aa7 = x2 - x1 #if SMALL if aa7 < 5 --x1 ++x2 goto SR4 end aa7 = x2 - x1 - 2 /* aa7 should be less than 399 #else if aa7 < 10 --x1 ++x2 goto SR4 end aa7 = x2 - x1 / 2 - 2 /* aa7 should be less than 399 #endif if aa7 < 399 /* protopar file specific open [3,1] line2 loop for aa8 = 1 to aa7 getf [3] repeat getf [3] cc1 cc2 cc3 cc4 cc5 cc6 cc7 .t1 line2 if aa1 < 3 x1 += cc2 y1 -= cc3 aa3 = cc4 else x1 += cc5 y1 += cc6 aa3 = cc7 end close [3] x = x1 + sp y = y1 + sq x += postx y += posty aa3 += addcurve /* new 6-30-93 &dA &dA &d@ aa1 = case number &dA &d@ aa3 = stock slur number &dA &d@ x = horizontal position &dA &d@ y = vertical position &dA &dA &dA &d@ Enter new code for acquiring and printing slur &dA perform printslur_screen (aa1, aa3, x, y, con3, sitflag) end end return &dA &d@ &dA &dA &d@*P&dA 15. puttuplet &dA &d@ &dA &dA &d@ Purpose: Typeset tuplet and/or bracket &dA &dA &d@ Inputs: x1 = horizontal starting point of tuplet/bracket &dA &d@ x2 = horizontal stopping point of tuplet/bracket &dA &d@ y1 = vertical starting point &dA &d@ y2 = vertical stopping point &dA &d@ aa1 = tuplet number &dA &d@ &dA &d@ sitflag = situation flag bit clear bit set &dA &d@ ÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ &dA &dA &d@ bit 0 no tuplet tuplet &dA &d@ bit 1 no bracket bracket &dA &d@ bit 2 tips down tips up &dA &dA &d@ bit 5 broken bracket continuous bracket /* &dA03/15/97 &dA &d@ bit 6 number outside number inside &dA &d@ bit 7 square bracket curved bracket &dA &d@ &dA &d@ &dA &d@ Calling variables to internal procedures: aa1,aa4,aa5 &dA procedure puttuplet int f,xav,yav,h,k int t1,t2,t3,t4 x2 += notesize if bit(1,sitflag) = 1 x2 = 2 * dvpar(1) / 3 + x2 end aa4 = x2 - x1 aa4 = y2 - y1 * 60 / aa4 xav = x1 + x2 / 2 yav = xav - x1 * aa4 / 60 + y1 if and(3,sitflag) = 3 and yav < dvpar(4) yav -= dvpar(1) end &dA &d@ xav = x at center of tuplet/bracket &dA &d@ aa4 = slope * 60 &dA &d@ yav = y at center of tuplet/bracket &dA &dA &d@ Part I: tuplet present &dA if bit(0,sitflag) = 1 x = xav y = yav + sq h = x - dhpar(45) + (notesize / 3) k = x + dhpar(45) - (notesize / 7) x = 0 - dhpar(45) / 2 + x + sp &dA &dA &d@ New code (12/01/94) to deal with complex tuples &dA t4 = aa1 t1 = t4 / 1000 t2 = rem if t1 > 0 t3 = 2 if t2 > 9 ++t3 end if t1 > 9 ++t3 end t4 = hpar(45) * t3 + 1 >> 1 x -= t4 /* create space for colon + double digits h -= t4 k += t4 else t3 = 0 if t2 > 9 ++t3 end t4 = hpar(45) * t3 + 1 >> 1 x -= t4 /* create space for double digits h -= t4 k += t4 end if bit(5,sitflag) = 1 /* &dA03/15/97&d@ numbers below or above if bit(6,sitflag) = 0 and bit(2,sitflag) = 0 y -= notesize else if bit(6,sitflag) = 1 and bit(2,sitflag) = 1 y -= notesize else y += notesize end end h = xav + 2 k = xav - 2 end scx = x scy = y &dA &dA &d@ Put out numerator of tuple &dA t3 = t2 / 10 t2 = rem if t3 > 0 aa1 = t3 + 221 scb = aa1 perform charout end aa1 = t2 + 221 scb = aa1 perform charout &dA &dA &d@ Put out denominator of tuple (if present) &dA if t1 > 0 aa1 = 249 /* colon scb = aa1 perform charout t3 = t1 / 10 t1 = rem if t3 > 0 aa1 = t3 + 221 scb = aa1 perform charout end aa1 = t1 + 221 scb = aa1 perform charout end end * * Part II: bracket present * if bit(1,sitflag) = 1 &dA &dA &d@ Square brackets &dA if bit(7,sitflag) = 0 * 1) compute slope aa5 = abs(aa4) aa5 = aa5 + 3 / 5 if aa5 > 6 aa5 = 6 end if aa5 = 5 aa5 = 4 end if aa5 = 6 aa5 = 5 end if aa4 > 0 aa4 = aa5 else aa4 = 0 - aa5 end * 2) case 1: tuplet present if bit(0,sitflag) = 1 yav -= dvpar(40) aa1 = h - x1 + 2 / 3 * 3 x1 = h - aa1 f = 6 if aa4 < 0 f = -6 end y1 = x1 - xav * aa4 + 6 / 12 + yav x = x1 + sp y = y1 + sq perform brackethook perform bracketline aa1 = x2 - k + 2 / 3 * 3 y1 = k - x1 * aa4 + f / 12 + y1 x1 = k perform bracketline perform brackethook else * 3) case 2: no tuplet present aa1 = x2 - x1 + 2 / 3 * 3 x1 = 0 - aa1 - 1 / 2 + xav y1 = x1 - xav * aa4 + 6 / 12 + yav x = x1 + sp y = y1 + sq perform brackethook perform bracketline perform brackethook end else &dA &dA &d@ Curved brackets (slurs) /* &dA03/15/97&d@ &dA &dA &d@ Inputs: (x1,y1) = starting note head &dA &d@ (x2,y2) = terminating note head &dA &d@ slur_edit_flag = flag indicating that y1 and/or y2 have been altered &dA &d@ postx = horiz. movement of slur after it has been chosen &dA &d@ posty = vert. movement of slur after it has been chosen &dA &d@ addcurve = flag indicating the curvature should be added &dA &d@ sitflag = situation flag &dA &d@ &dA &d@ bit clear bit set &dA &d@ -------------- ------------- &dA &d@ bit 0: full slur dotted slur &dA &d@ bit 1: stock slur custom slur &dA &d@ bit 2: first tip down first tip up &dA &d@ (*) bit 3: second tip down second tip up &dA &d@ (+) bit 4: compute stock slur hold stock slur &dA &d@ &dA &d@ (*) used on custom slurs only &dA &d@ (+) used on stock slurs only &dA &dA &d@ bit 5: continuous slur broken slur /* &dA03/15/97 &dA &d@ &dA &d@ bits 8-15: size of break (0 to 255 dots, centered) &dA &d@ t1 = sitflag x2 -= notesize if bit(2,t1) = 1 sitflag = 12 posty = 0 - vpar(5) else sitflag = 0 posty = vpar(3) end slur_edit_flag = 1 postx = 0 addcurve = 0 if bit(5,t1) = 0 /* broken slur t2 = k - h << 8 + 0x20 sitflag += t2 end perform putslur end end return * procedure brackethook if bit(2,sitflag) = 1 y = y - notesize + 2 end scx = x scy = y scb = 89 perform charout return &dA &d@ &dA &dA &d@*P&dA 16. bracketline &dA &d@ &dA &dA &d@ Purpose: typeset bracket line &dA &dA &d@ Inputs: aa1 = length &dA &d@ aa4 = slope &dA &d@ aa5 = slope type 0,1,2,3,4,5 &dA &d@ x1 = x starting point &dA &d@ y1 = y starting point &dA &dA &d@ Outputs: x = x coordinate of end of line &dA &d@ y = y coordinate of end of line &dA procedure bracketline int h,i,k if aa1 = 0 return end x = x1 + sp y = y1 + sq scf = 400 scx = x scy = y if aa4 > 0 z = 184 + aa5 end if aa4 < 0 z = 164 + aa5 end if aa4 = 0 z = 161 end h = aa1 / 12 k = rem if aa4 = 0 loop for i = 1 to h x += 12 scb = z perform charout repeat else loop for i = 1 to h scb = z perform charout if aa4 > 0 scy += aa4 else h = 0 - aa4 scy -= h end x += 12 y += aa4 repeat end if k > 0 if k = 9 if aa4 < 0 h = aa4 - 1 * 2 / 3 z += 5 end if aa4 > 0 h = aa4 + 1 * 2 / 3 z += 5 end if aa4 = 0 h = 0 ++z end end if k = 6 if aa4 < 0 h = aa4 - 1 / 2 z += 10 end if aa4 > 0 h = aa4 + 1 / 2 z += 10 end if aa4 = 0 h = 0 z += 2 end end if k = 3 if aa4 < 0 h = aa4 - 1 / 3 z += 15 end if aa4 > 0 h = aa4 + 1 / 3 z += 15 end if aa4 = 0 h = 0 z += 3 end end scb = z perform charout x += k y += h end scf = notesize return &dA &d@ &dA &dA &d@*P&dA 17. putwedge &dA &d@ &dA &dA &d@ Purpose: Typeset wedge &dA &dA &d@ Inputs: x1 = horizontal starting point of wedge &dA &d@ x2 = horizontal stopping point of wedge &dA &d@ y1 = vertical starting point &dA &d@ y2 = vertical stopping point &dA &d@ cc1 = starting spread of wedge &dA &d@ cc2 = stopping spread of wedge &dA &d@ procedure putwedge int tarr(32) int leng,slope,z1,clen,fullcnt int nex,h y1 -= dvpar(1) y2 -= dvpar(1) leng = x2 - x1 x = x1 + sp scf = 400 scx = x * compute slope slope = cc2 - cc1 * 240 / leng slope = abs(slope) if slope < 8 slope = 8 end if cc2 > cc1 slope = slope + 2 / 4 else slope = slope + 3 / 4 end if slope > 20 slope = 20 end z1 = slope if cc2 < cc1 slope = 0 - slope end * compute character if z1 > 12 z1 = z1 - 13 / 2 + 13 end * compute length of character if z1 < 11 clen = 120 / z1 else clen = 128 / z1 end * compute number of full characters fullcnt = leng / clen * compute extension set nex = 0 h = rem - 30 if h > 0 ++nex tarr(nex) = 74 rem = h end h = rem - 20 if h > 0 ++nex tarr(nex) = 75 rem = h end h = rem - 10 if h > 0 ++nex tarr(nex) = 78 rem = h end if rem > 0 ++nex tarr(nex) = 88 - rem end * write out wedge . . . if slope > 0 /* cresc. h = cc1 / 2 y2 += h y1 -= h z = z1 + 31 * -- top y = y1 + sq loop for h = 1 to fullcnt scy = y scb = z perform charout --y repeat loop for h = 1 to nex z = tarr(h) scy = y scb = z perform charout repeat * -- bottom scx = x z = z1 + 51 y = y2 + sq loop for h = 1 to fullcnt scy = y scb = z perform charout ++y repeat loop for h = 1 to nex z = tarr(h) scy = y scb = z perform charout repeat else /* decresc. h = cc2 / 2 y1 = y1 - h - fullcnt y2 = y2 + h + fullcnt * -- top y = y1 + sq loop for h = 1 to nex z = tarr(h) scy = y scb = z perform charout repeat z = z1 + 51 loop for h = 1 to fullcnt scy = y scb = z perform charout ++y repeat scx = x * -- bottom y = y2 + sq loop for h = 1 to nex z = tarr(h) scy = y scb = z perform charout repeat z = z1 + 31 loop for h = 1 to fullcnt scy = y scb = z perform charout --y repeat end scf = notesize return &dA &d@ &dA &dA &d@*P&dA 18. putfigcon &dA &d@ &dA &dA &d@ Purpose: Typeset figure continuation line &dA &dA &d@ Inputs: x1 = horizontal starting point of line &dA &d@ x2 = horizontal stopping point of line &dA &d@ aa3 = vertical level of line &dA &d@ procedure putfigcon int g x = x1 + sp --aa3 y = dvpar(37) * aa3 + dvpar(36) + sq scx = x scy = y g = x2 - dhpar(44) scb = 220 loop while x1 <= g perform charout x1 += dhpar(44) repeat x = g + sp scx = x perform charout return &dA &d@ &dA &dA &d@*P&dA 19. puttrans &dA &d@ &dA &dA &d@ Purpose: Typeset octave transposition &dA &dA &d@ Inputs: x1 = horizontal starting point of transposition &dA &d@ x2 = horizontal stopping point of transposition &dA &d@ y1 = vertical level of transposition &dA &d@ aa1 = length of ending hook &dA &d@ aa3 = situation, 0 = 8av up, 1 = 8av down &dA &d@ procedure puttrans int h,j,k x = x1 + sp y = y1 + sq scx = x scy = y scb = 233 perform charout x += dhpar(42) scx = x x1 += dhpar(42) j = x2 - 20 k = 0 scb = 91 loop while x1 <= j k = 1 perform charout x1 += dhpar(43) repeat h = dhpar(43) / 2 x1 -= h if k = 1 if x1 <= j scx -= h perform charout end if aa1 > 0 j = dhpar(43) - dhpar(1) scx -= j if aa3 = 1 k = dvpar(4) - 2 scy -= k end scb = 89 perform charout scy += notesize perform charout end end return &dA &d@ &dA &dA &d@*P&dA 20. putending &dA &d@ &dA &dA &d@ Purpose: Typeset ending &dA &dA &d@ Inputs: x1 = horizontal starting point of ending &dA &d@ x2 = horizontal stopping point of ending &dA &d@ y1 = vertical level of ending &dA &d@ aa1 = length of start hook &dA &d@ aa2 = length of ending hook &dA &d@ aa3 = ending number, 0 = none &dA &d@ procedure putending int h x = x1 + sp y = y1 + sq scx = x scy = y if aa1 > 0 scb = 89 perform charout scy += notesize perform charout scy = y end if aa3 > 0 scx += dvpar(1) scy += dvpar(4) scf = mtfont out = chs(aa3) perform stringout (out) scb = 46 perform charout scf = notesize scx = x scy = y end h = x2 - dhpar(1) scb = 90 loop while x1 <= h perform charout x1 += dhpar(1) repeat x = h + sp scx = x perform charout if aa2 > 0 scb = 89 perform charout scy += notesize perform charout end return &dA &d@ &dA &dA &d@*P&dA 21. putdashes &dA &d@ &dA &dA &d@ Purpose: Typeset dashes &dA &dA &d@ Inputs: x1 = horizontal starting point of dashes &dA &d@ x2 = horizontal stopping point of dashes &dA &d@ y1 = vertical level of dashes &dA &d@ aa1 = spacing parameter &dA &d@ aa2 = font designator &dA &d@ procedure putdashes int h int a,b,c,d,e x = x1 + sp + hyphspc y = y1 + sq scf = aa2 scx = x scy = y scb = 45 perform charout b = x2 - x1 if aa1 = 0 a = hyphspc * 5 c = b / a if c = 0 aa1 = x2 - x1 c = 2 else if rem > hyphspc * 2 ++c end aa1 = b / c end d = 1 else a = aa1 c = b / a d = 0 end loop for e = 1 to c - 1 x += aa1 scx = x perform charout if d = 1 b -= aa1 --c if c > 0 aa1 = b / c end end repeat scf = notesize return &dA &d@ &dA &dA &d@*P&dA 22. puttrill &dA &d@ &dA &dA &d@ Purpose: Typeset long trill &dA &dA &d@ Inputs: x1 = horizontal starting point of dashes &dA &d@ x2 = horizontal stopping point of dashes &dA &d@ y1 = vertical level of trill &dA &d@ aa1 = situation 1 = no trill &dA &d@ 2 = trill with no accidental &dA &d@ 3 = trill with sharp &dA &d@ 4 = trill with natural &dA &d@ 5 = trill with flat &dA &d@ procedure puttrill int h x = x1 + sp y = y1 + sq h = x1 scx = x scy = y if aa1 > 1 if aa1 > 2 and aa1 < 6 scb = int("..389"{aa1}) + 210 /* music font scy = y + dvpar(45) perform charout scy = y end x += dhpar(41) scb = 236 perform charout scx = x h = x1 + dhpar(41) end scb = 237 loop while h < x2 perform charout h += dhpar(40) repeat return &dA &d@ &dA &dA &d@*P&dA 26. printslur_screen &dA &d@ &dA &dA &d@ Purpose: read slur data from bigslur, compile and &dA &d@ send slur to screen &dA &dA &d@ Input: ori case: 1,2,3 or 4 &dA &d@ snum slur number &dA &d@ x x location &dA &d@ y y location &dA &d@ mode 1 = display, 0 = clear (cancel) &dA &d@ sitflag situation flag &dA &dA &d@ bit 5: continuous slur broken slur &dA &d@ &dA &d@ bits 8-15: size of break (0 to 255 dots, centered) &dA procedure printslur_screen (ori,snum,x,y,mode,sitflag) str file.100,pointer.6,data.500 &dA &d@ bstr bt.800(150) &dAThis variable has been made global int snum,ori int offset,datalen,nrows int slen,srise int bulge int h,i,j,k,n,x,y,t,maxn int dpnt,sdpnt int code,cnt,ndata(2),kdata(2) int mode,sitflag int broksize real rx * getvalue ori,snum,x,y,mode,sitflag if bit(5,sitflag) = 1 /* &dA03/15/97&d@ broksize = sitflag >> 8 else broksize = 0 end sitflag &= 0x01 #if SMALL file = "c:\musprint\bitmap06\slurs\bigslur" #else file = "c:\musprint\bitmap\slurs\bigslur" #endif &dA open [1,5] file i = snum * 6 + 1 len(pointer) = 6 read [1,i] pointer offset = ors(pointer{1,4}) datalen = ors(pointer{5,2}) len(data) = datalen if offset = 0 close [1] return end read [1,offset] data n = ors(data{1,3}) if n <> snum putc wrong header location! putc n = ~n snum = ~snum putc No slur for this length, rise, and type examine close [1] return end nrows = ors(data{4}) slen = ors(data{5,2}) srise = ors(data{7}) bulge = ors(data{8}) slen += bulge /* &dAadded 11-19-92&d@ if bulge > 0 x -= bulge end i = 0 /* look for vert shift if ori = 1 i = nrows - 1 else if ori = 2 i = nrows - 1 - srise else if ori = 3 i = srise end end end y = y - i /* move screen cursor to point scx = x scy = y * if ori = 1 or ori = 2 dpnt = 9 else if slen < 256 dpnt = len(data) - 1 else dpnt = len(data) - 2 end end * maxn = 0 loop for i = 1 to nrows if slen < 256 cnt = 1 code = ors(data{dpnt,2}) if code & 0x8000 <> 0 cnt = 2 if ori > 2 dpnt = dpnt - 2 code = ors(data{dpnt,2}) end end sdpnt = dpnt loop for j = 1 to cnt code = code & 0x7fff rx = -.5 + sqt(flt(code)*2.0+.25) t = fix(rx+.0000001) kdata(j) = 255 - t t = t + 1 * t / 2 ndata(j) = code - t dpnt = dpnt + 2 if j < cnt code = ors(data{dpnt,2}) end repeat if ori > 2 dpnt = sdpnt - 2 end else cnt = 1 code = ors(data{dpnt,3}) if code & 0x800000 <> 0 cnt = 2 if ori > 2 dpnt = dpnt - 3 code = ors(data{dpnt,3}) end end sdpnt = dpnt loop for j = 1 to cnt code = code & 0x7fffff rx = -.5 + sqt(flt(code)*2.0+.25) t = fix(rx+.0000001) kdata(j) = 1000 - t t = t + 1 * t / 2 ndata(j) = code - t dpnt = dpnt + 3 if j < cnt code = ors(data{dpnt,3}) end repeat if ori > 2 dpnt = sdpnt - 3 end end * j = ndata(1) + kdata(1) bt(i) = zpd(ndata(1)) // npd(j) if cnt = 2 j = ndata(2) + kdata(2) bt(i) = bt(i) // zpd(ndata(2)) // npd(j) end if ori = 2 or ori = 3 bt(i) = bt(i) // zpd(slen) bt(i) = rev(bt(i)) bt(i) = trm(bt(i)) end n = bln(bt(i)) if n > maxn maxn = n end repeat * if sitflag = 1 j = maxn / gapsize if bit(0,j) = 0 --j end &dA &dA &d@ xxxxxxxxxxx....xxxx....xxxx....xxxx....xxxx....xxxxxxxxxxx &dA &d@ | odd number | &dA &d@ j = largest odd number of intervals that will fit inside maxn &dA j *= gapsize i = maxn - j i >>= 1 /* initial correction bt(250) = dup("1",i) // dotted{1,j} // dup("1",i+10) /* mask loop for i = 1 to nrows bt(i) = bnd(bt(i),bt(250)) repeat end * if broksize > 0 /* &dA03/15/97&d@ j = maxn - broksize >> 1 if j < 0 j = 0 end i = maxn - j - j bt(250) = dup("1",j) // dup("0",i) // dup("1",j) loop for i = 1 to nrows bt(i) = bnd(bt(i),bt(250)) repeat end close [1] /* display slur contained in bt(nrows) if mode = 1 /* con3 = 1 setb gstr,bt,scx,scy,nrows,maxn,1,1 else clearb gstr,bt,scx,scy,nrows,maxn,1,1 end return * * procedure stringout (out) str out.100 int font,i,k,fontoff getvalue out font = revmap(scf) fontoff = font - 1 * 256 if con3 = 1 loop for i = 1 to len(out) k = ors(out{i}) + fontoff setb gstr,FA,scx,scy,k,1 repeat else loop for i = 1 to len(out) k = ors(out{i}) + fontoff clearb gstr,FA,scx,scy,k,1 repeat end return procedure charout int font,k,i,j font = revmap(scf) k = font - 1 * 256 + scb if scb > 255 putc putc Character number out of range. Possibly a bad figure? putc return 10 end if con3 = 1 setb gstr,FA,scx,scy,k,1 else clearb gstr,FA,scx,scy,k,1 end return &dA &dA &d@ ************************************************** &dA procedure strip3 if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line = line{mpt+1..} else line = "" end return * procedure strip6 if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line = line{mpt+1..} else line = "" end return * procedure strip8 if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line{mpt} = "." end if line con " " line = line{mpt+1..} else line = "" end return * procedure printhelp str out.100 int font,scflag,i if helpscreen <> helpscrnum if helpscreen <> 0 activate helpmsgstr,hlpxpos,hlpypos,5 end setup helpmsgstr,hlpxz,hlpyz,1 font = 137 scflag = 1 scy = helptop loop for i = 1 to helprows out = hlpx(helpscrnum,i) scx = 0 perform helpmsgout (out,font,scflag) scy += helpinc repeat activate helpmsgstr,hlpxpos,hlpypos,1 helpscreen = helpscrnum end return run &dA &d@ refers to something in column