Home » Personal collection » Acorn ADFS disks » Archimedes » RiscOs_Apps_2.ADF » !Maestro/!RunImage

!Maestro/!RunImage

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Archimedes » RiscOs_Apps_2.ADF
Filename: !Maestro/!RunImage
Read OK:
File size: 173C0 bytes
Load address: FFFFFB41
Exec address: 666169DF
File contents
   10REM > Music.Maestxt
   20REM (c) Acorn Computers 1988
   30
   40VersionStr$="1.65 (4-Jan-89)"
   50
   60Task_h%=0
   70MusicFileType%=&AF1
   80INITIALISED%=FALSE
   90DIM ERRBLOCK% 200
  100REM space for an error window
  110SPACE%=HIMEM-END :REM check enough space available
  120IF SPACE%<100000 STOP
  130REMdebug=OPENOUT "debugfile"
  140ON ERROR PROCerror:END
  150REM get name of file to load
  160SYS "OS_GetEnv" TO EnvStr$
  170IF INSTR(EnvStr$," -quit ") THEN
  180  I%=INSTR(EnvStr$,"""")
  190  I%=INSTR(EnvStr$,"""",I%+1)
  200  REPEATI%+=1:UNTILMID$(EnvStr$,I%,1)<>" "
  210  f$=MID$(EnvStr$,I%)
  220  ENDIF
  230INITIALISED%=FNinitialise
  240mask%=0 : REM mask out unwanted reason codes
  250ON ERROR PROCerror
  260REPEAT
  270  IF PLAYING% PROCCheckQ
  280  SYS Poll%,mask%,Window%+handle% TO R%
  290  IF PLAYING% PROCCheckQ: REM recheck since poll might have stayed away for a while
  300  CASE R% OF
  310  WHEN 0
  320   IF AwaitingAck% IFFNCheckOK("Bad Data Transfer, Receiver Dead",3) :AwaitingAck%=FALSE : CHANGED%=wasCHANGED%
  330   IF SCORING% PROCsymbol_pointer
  340   IF f$<>"" PROCload_music(f$) : f$=""
  350   IF SCROLLING% PROCCheckScroll :REM auto-scrolling
  360  WHEN 1:PROCredraw_window_request
  370  WHEN 2:PROCopen_window_request
  380  WHEN 3:PROCclose_window_request
  390  WHEN 4          :REM pointer leaving window
  400   IF Window%!handle%=ScoreWind_h% THEN
  410     PROCrelease
  420     wasSCORING%=SCORING%
  430     SCORING%=FALSE
  440   ELSE
  450     IF Window%!handle%=AbortQuery_h% PROCCloseWindow(AbortQuery_h%)
  460     ENDIF
  470  WHEN 5: IF Window%!handle%=ScoreWind_h% SCORING% = (wasSCORING% AND NOT stopSCORING%)=TRUE
  480  WHEN 6:PROCmouse_button_click
  490  WHEN 7:PROCUserDragBox
  500  WHEN 8:PROCKeyPressed
  510  WHEN 9:PROCMenuSelect
  520  WHEN 10: PROCScrollReq(Window%!(handle%+32), Window%!(handle%+36))
  530  WHEN 17,18:PROCreceive
  540  ENDCASE
  550  UNTIL FALSE
  560END
  570
  580DEF PROCCheckQ
  590B1%=B2%: B2%=BEAT
  600IFB2%<B1% PROCplay_bar
  610ENDPROC
  620
  630DEF PROCreceive
  640LOCAL task%, ref%, block,F$
  650block=Window% :REM temporary buffer
  660ref%=!(Window%+handle%+8)
  670task%=!(Window%+handle%+4)
  680IF task%=Task_h% ENDPROC : REM ignore messages from this task
  690CASE Window%!(handle%+16) OF
  700  WHEN 0
  710   IF NOT CHANGED% THEN
  720    PROCterminate
  730   ELSE
  740    !block=20
  750    block!12=ref%
  760    block!16=0    :REM quit block
  770    SYS SendMessage,19,block :REM acknowledge, and refuse quit request
  780    IF FNCheckOK("Unsaved music. Do you really want to quit?",3) THEN
  790     PROCterminate
  800    ELSE
  810     SYS GetPointerInfo%,,Mouse%
  820     PROCOpenWindow(Save_h%, Mouse%!x0%, Mouse%!y0%)
  830     ENDIF
  840    ENDIF
  850  WHEN 2 : REM save file
  860   IF SAVING% THEN
  870    wasCHANGED%=CHANGED%
  880    PROCsave_music(FNGetStr(Window%+handle%+44))
  890    SAVING%=FALSE
  900    SYS GetPointerInfo%, ,block
  910    block!20=block!12
  920    block!24=block!16
  930    block!28=block!0
  940    block!32=block!4
  950    block!0=44
  960    block!12=ref%
  970    block!16=3 :REM DataLoad application to filer
  980    block!40=MusicFileType%
  990    SYS SendMessage,17,block
 1000    AwaitingAck%=TRUE
 1010    PROCCloseMenu
 1020    ENDIF
 1030 WHEN 3 : REM load file
 1040  PROCload_music(FNGetStr(Window%+handle%+44))
 1050  PROCDataLoadAck(ref%)
 1060 WHEN 4 :AwaitingAck%=FALSE : REM DataLoadAck. End of DataSave protocol
 1070 WHEN 5 : REM open double-clicked file
 1080  IF !(Window%+handle%+40) = MusicFileType% THEN
 1090    PROCload_music(FNGetStr(Window%+handle%+44))
 1100    PROCDataLoadAck(ref%)
 1110    ENDIF
 1120 WHEN &502:PROCHelp(ref%)
 1130 WHEN &400C1:PROCgetmodeinfo(FALSE)
 1140 ENDCASE
 1150ENDPROC
 1160
 1170DEF PROCHelp(ref%)
 1180LOCAL block%,text$
 1190block%=Window%+handle%
 1200block%!12 = ref%
 1210block%!16 = &503 :REM Send help message
 1220text$=""
 1230CASE block%!32 OF
 1240 WHEN -2 : text$="This is the Maestro icon.|MClick SELECT to open score."
 1250 WHEN ScoreWind_h%
 1260  IFSCORING%ANDSCRIBE%(drawn%) THEN
 1270   text$="Click SELECT to place item in score"
 1280  ELSE
 1290   text$="Select an item in a pane to place on the score"
 1300  ENDIF
 1310 WHEN NotesPane_h%
 1320  text$="Click SELECT to select a "
 1330  CASE block%!36 OF
 1340    WHEN 0 : text$=text$+"breve."
 1350    WHEN 1 : text$=text$+"semibreve."
 1360    WHEN 2 : text$=text$+"minim."
 1370    WHEN 3 : text$=text$+"crochet."
 1380    WHEN 4 : text$=text$+"quaver."
 1390    WHEN 5 : text$=text$+"semiquaver."
 1400    WHEN 6 : text$=text$+"demisemiquaver."
 1410    WHEN 7 : text$=text$+"hemidemisemiquaver."
 1420    OTHERWISE text$=""
 1430    ENDCASE
 1440 WHEN SharpsPane_h%
 1450  text$="Click SELECT to select a "
 1460  CASE block%!36 OF
 1470    WHEN 0 : text$=text$+"natural."
 1480    WHEN 1 : text$=text$+"sharp."
 1490    WHEN 2 : text$=text$+"flat."
 1500    WHEN 3 : text$=text$+"double-sharp."
 1510    WHEN 4 : text$=text$+"double-flat."
 1520    WHEN 5 : text$=text$+"naturalised sharp."
 1530    WHEN 6 : text$=text$+"naturalised flat."
 1540    WHEN 7 : text$=text$+"dot."
 1550    WHEN 8 : text$=text$+"double-dot."
 1560    WHEN 9 : text$=text$+"triple-dot."
 1570    WHEN 10 : text$=text$+"tie."
 1580    WHEN 11 : text$=text$+"bar line."
 1590    WHEN 12 : text$=text$+"treble clef."
 1600    WHEN 13 : text$=text$+"bass clef."
 1610    WHEN 14 : text$=text$+"key signature."
 1620    WHEN 15 : text$=text$+"time signature."
 1630    OTHERWISE text$=""
 1640    ENDCASE
 1650 WHEN RestsPane_h%
 1660  text$="Click SELECT to select a "
 1670  CASE block%!36 OF
 1680    WHEN 0 : text$=text$+"breve rest."
 1690    WHEN 1 : text$=text$+"semibreve rest."
 1700    WHEN 2 : text$=text$+"minim rest."
 1710    WHEN 3 : text$=text$+"crochet rest."
 1720    WHEN 4 : text$=text$+"quaver rest."
 1730    WHEN 5 : text$=text$+"semiquaver rest."
 1740    WHEN 6 : text$=text$+"demisemiquaver rest."
 1750    WHEN 7 : text$=text$+"hemidemisemiquaver rest."
 1760    OTHERWISE text$=""
 1770    ENDCASE
 1780 WHEN InstrWind_h%
 1790  IF (block%!36>7) THEN
 1800   IF (block%!36<16) THEN
 1810    text$="Click SELECT or ADJUST to select an instrument for this stave"
 1820    ELSE
 1830    IF (block%!36<24) THEN
 1840     text$="Click SELECT or ADJUST to set the volume of this channel"
 1850     ELSE IF (block%!36<32) text$="Click SELECT or ADJUST to set the stereo position of this channel"
 1860     ENDIF
 1870    ENDIF
 1880   ENDIF
 1890 WHEN Save_h%
 1900  IF block%!36=2 text$="Drag this icon into a directory window to save it in that directory" ELSE text$="Fill in the file name and then drag the icon into a filer directory window to save it"
 1910 WHEN TimeSig_h%
 1920  text$="use SELECT and ADJUST on each field to set a time signature"
 1930 WHEN AbortQuery_h%
 1940  text$="click YES to terminate Maestro"
 1950 ENDCASE
 1960$(block%+20)=text$
 1970block%!0 = (((20+LEN(text$)+1)DIV4)*4)+4
 1980$(block%+21+LEN(text$)) = CHR$(0) :REM null-terminate
 1990SYS SendMessage,17,block% :REM acknowledge message
 2000ENDPROC
 2010
 2020DEF PROCDataLoadAck(ref%)
 2030LOCAL block
 2040block=Window%
 2050block!0 = 20
 2060block!12 = ref%
 2070block!16 = 4 :REM DataLoadAck
 2080SYS SendMessage,17,block :REM acknowledge message
 2090ENDPROC
 2100
 2110DEF PROCredraw_window_request
 2120LOCAL R%
 2130SYS RedrawWindow%,,Window%+handle% TO R%
 2140WHILE R%
 2150  IF Window%!handle% = ScoreWind_h% PROCdraw_staves:IF PLAYING% PROCCheckQ
 2160REM try to avoid interruptions in the music
 2170  SYS GetRectangle%,,Window%+handle% TO R%
 2180  ENDWHILE
 2190ENDPROC
 2200
 2210DEF PROCplace_top_panes(behind)
 2220LOCAL xsize%
 2230xsize%=Window%!x1%-Window%!x0%
 2240RestPBlk%!x1%=Window%!x1%
 2250RestPBlk%!x0%=Window%!x0%+xsize%/2
 2260RestPBlk%!y1%=Window%!y1%
 2270RestPBlk%!y0%=RestPBlk%!y1%-PaneHeight%
 2280RestPBlk%!under%=behind
 2290SYS OpenWindow%, RestsPane_h%, RestPBlk%+handle%
 2300NotePBlk%!x0%=Window%!x0%
 2310NotePBlk%!x1%=RestPBlk%!x0%
 2320NotePBlk%!y1%=Window%!y1%
 2330NotePBlk%!y0%=NotePBlk%!y1%-PaneHeight%
 2340NotePBlk%!under%=RestsPane_h%
 2350SYS OpenWindow%, NotesPane_h%, NotePBlk%+handle%
 2360ENDPROC
 2370
 2380DEF PROCplace_bottom_panes(behind)
 2390LOCAL xsize%
 2400xsize%=Window%!x0%+Window%!x1%
 2410SharpPBlk%!x0%=Window%!x0%
 2420SharpPBlk%!x1%=SharpPBlk%!x0%+xsize%
 2430SharpPBlk%!x1%=Window%!x1%
 2440SharpPBlk%!y0%=Window%!y0%
 2450SharpPBlk%!y1%=SharpPBlk%!y0%+PaneHeight%
 2460SharpPBlk%!under%=behind
 2470SYS OpenWindow%, SharpsPane_h%, SharpPBlk%+handle%
 2480ENDPROC
 2490
 2500DEF PROCremove_panes
 2510PROCCloseWindow(NotesPane_h%)
 2520PROCCloseWindow(SharpsPane_h%)
 2530PROCCloseWindow(RestsPane_h%)
 2540ENDPROC
 2550
 2560DEF PROCopen_window_request
 2570LOCAL bhandle%
 2580bhandle%=Window%!under%
 2590PROCrelease
 2600IF Window%!handle%=ScoreWind_h% THEN
 2610 IF TRANSCRIBE% THEN
 2620REM define window stack as top->bottom sharpspane->restspane->notespane->score
 2630REM open top or bottom panes before score depending on direction of drag
 2640  SYS GetWindowState%,,SharpPBlk%+handle%
 2650  IF SharpPBlk%!under%=bhandle% Window%!under%=NotesPane_h%
 2660  SYS GetWindowState%,,ScoreWBlk%+handle%
 2670  IF Window%!y1%>ScoreWBlk%!y1% THEN
 2680   PROCplace_top_panes(bhandle%)
 2690   ELSE
 2700   PROCplace_bottom_panes(bhandle%)
 2710   ENDIF
 2720  ENDIF
 2730 IF PLAYING% AND Window%!scx%<>ScoreWBlk%!scx% ENDPROC:REM no user-scrolling while playing
 2740 SYS OpenWindow%,,Window%+handle%
 2750 ScoreClosed%=FALSE
 2760 IF TRANSCRIBE% THEN
 2770  IF bhandle%=-2 THEN
 2780   REM find behind handle% if pushed to the back
 2790   SYS GetWindowState%,,ScoreWBlk%+handle%
 2800   bhandle% = ScoreWBlk%!under%
 2810   ENDIF
 2820  REM re-open all panes
 2830  PROCplace_bottom_panes(bhandle%)
 2840  PROCplace_top_panes(SharpsPane_h%)
 2850  IF bhandle%=ScoreWind_h%  SYS OpenWindow%,,Window%+handle% :REM ensure window is behind panes in unusual case
 2860  ENDIF
 2870 LHBAR%=FNFindBar(ScoreWBlk%!scx%) :REM the bar number at the left of the window
 2880 ELSE
 2890 SYS OpenWindow%,,Window%+handle%
 2900 ENDIF
 2910ENDPROC
 2920
 2930DEF PROCclose_window_request
 2940SYS CloseWindow%,,Window%+handle%
 2950IF Window%!handle%=ScoreWind_h% PROCremove_panes : ScoreClosed%=TRUE
 2960ENDPROC
 2970
 2980DEF PROCmouse_button_click
 2990LOCALB%,C%,W%,I%,inc%
 3000W%=Mouse%!window:I%=Mouse%!icon
 3010B%=%111ANDMouse%!buttons
 3020Mouse_X%=Mouse%!x0%:Mouse_Y%=Mouse%!y0%
 3030IF B%=%010 THEN
 3040  PROCCheckInstalledVoices
 3050  PROCStopScoring
 3060  IF W%=-2 PROCOpenMenu(IconMenu%) ELSE PROCOpenMainMenu
 3070ELSE
 3080IF B%=%100 inc%=-1 ELSE IF B%=%001 inc%=1 ELSE inc%=0
 3090CASE W% OF
 3100WHEN -2 : IF ScoreClosed% OR NOT PLAYING% PROCsetup_staves:ENDPROC :REM iconbar
 3110WHEN AbortQuery_h%
 3120  IF I%=2 THEN
 3130    PROCterminate
 3140    ELSE
 3150      PROCCloseMenu
 3160      PROCCloseWindow(AbortQuery_h%)
 3170    ENDIF
 3180WHEN NotesPane_h%
 3190  IF I%>=0 THEN
 3200  PROCrelease
 3210  wasSCORING%=TRUE
 3220  stopSCORING%=FALSE
 3230  PROCUpdateIcon(SelW%, SelI%, 0, 1<<2)
 3240  PROCUpdateIcon(W%, I%, 1<<2, 0)
 3250  SelW%=W%
 3260  SelI%=I%
 3270  PROCattach(note%+I%,%111000)
 3280  ENDIF
 3290WHEN RestsPane_h%
 3300  IF I%>=0 THEN
 3310  PROCrelease
 3320  wasSCORING%=TRUE
 3330  stopSCORING%=FALSE
 3340  PROCUpdateIcon(SelW%, SelI%, 0, 1<<2)
 3350  PROCUpdateIcon(W%, I%, 1<<2, 0)
 3360  SelW%=W%
 3370  SelI%=I%
 3380  PROCattach(rest%+I%,%11000)
 3390  ENDIF
 3400WHEN SharpsPane_h%
 3410  IF I%>=0 THEN
 3420  PROCrelease
 3430  wasSCORING%=TRUE
 3440  stopSCORING%=FALSE
 3450  PROCUpdateIcon(SelW%, SelI%, 0, 1<<2)
 3460  PROCUpdateIcon(W%, I%, 1<<2, 0)
 3470  SelW%=W%
 3480  SelI%=I%
 3490  IF I%<7  PROCattach(accidental%+I%+1,%1100000) ELSEIF I%<11 PROCattach(dot%+I%-6,%1101000)
 3500  IF I%=10 PROCattach(tie%,%1101000)
 3510  IF I%=11 PROCattach(bar%,%10010000)
 3520  IF I%=12 PROCattach(clef%,%100)  :REM Treble clef
 3530  IF I%=13 PROCattach(clef%+3,%100):REM Bass clef
 3540  IF I%=14 PROCattach(key%,%10)    :REM key signature
 3550  IF I%=15 PROCattach(time%,%1)    :REM time signature
 3560  ENDIF
 3570WHEN ScoreWind_h%
 3580  IF B%=%100 IFSCORING%ANDSCRIBE%(drawn%) PROCput_down
 3590WHEN InstrWind_h%
 3600  LOCAL chan%, v%
 3610  PROCCheckInstalledVoices
 3620  PROCStopScoring
 3630  IF I%>=8 THEN
 3640    chan%=I%-8
 3650    IF chan%<8 THEN
 3660      v%=FNAttachVoice(chan%, inc%)
 3670      SYS Sound_AttachVoice, chan%+1, v%
 3680      $(VoiceStr%(chan%))=LEFT$(Voice$(v%), VoiceSize%)
 3690      Instrument%(chan%,1) = v%
 3700      PROCUpdateIcon(W%, I%, 0,0)
 3710    ELSE
 3720    chan%-=8
 3730    IF chan%<8 THEN
 3740      v%=Volumes%(chan%)
 3750      v%+=inc% : IF v%>NVolumes% v%=NVolumes% ELSEIF v%<0 v%=0
 3760      Volumes%(chan%)=v%
 3770      $(VolumeStr%(chan%))=LEFT$(Volume$(Volumes%(chan%)), VolSize%)
 3780      PROCUpdateIcon(W%, I%, 0,0)
 3790    ELSE
 3800    chan%-=8
 3810    IF chan%<8 THEN
 3820      v%=Stereo_Position%(chan%)
 3830      v%+=inc% : IF v%>NStereos% v%=NStereos% ELSEIF v%<0 v%=0: REM no wrap
 3840      Stereo_Position%(chan%)=v%
 3850      SYS Sound_Stereo,chan%+1,Stereo%(Stereo_Position%(chan%))
 3860      $(StereoStr%(chan%)) = LEFT$(Stereo$(Stereo_Position%(chan%), 0), SterSize%)
 3870      PROCUpdateIcon(W%, I%, 0,0)
 3880    ELSE
 3890    IF MIDIpresent% THEN
 3900      chan%-=8
 3910      IF chan%<8 THEN
 3920        v%=MIDIChannel%(chan%)
 3930        v%+=inc% : IF v%>NMIDIChannels% v%=1 ELSEIF v%<1 v%=NMIDIChannels%
 3940        MIDIChannel%(chan%)=v%
 3950        $(MIDIChStr%(chan%)) = STR$(MIDIChannel%(chan%))
 3960        PROCUpdateIcon(W%, I%, 0,0)
 3970        ENDIF
 3980      ENDIF
 3990    ENDIF
 4000    ENDIF
 4010    ENDIF
 4020    ENDIF
 4030WHEN Save_h%
 4040  PROCStopScoring
 4050  IF I%=0 PROCsave_music(FNGetStr(SaveText))       :   REM 0 is OK.
 4060  IF I%=2 THEN
 4070    LOCAL x%, y%                          : REM dragging icon
 4080    Window%!handle%=W%
 4090    SYS GetWindowState%,,Window%+handle%
 4100    ysize%=Window%!y1%-Window%!y0%
 4110    x%=Window%!x0%
 4120    y%=Window%!y0%
 4130    !Window% = W%
 4140    Window%!4 = I%
 4150    SYS GetIconInfo%, ,Window% : REM returns icon box in right place for drag box
 4160    Window%!8  += x%
 4170    Window%!12 += y% + ysize%
 4180    Window%!16 += x%
 4190    Window%!20 += y% + ysize%
 4200REM get size in appropriate part of block: parent box=screen boundary
 4210    Window%!24 = 0
 4220    Window%!28 = 0
 4230    Window%!32 = S_Width%
 4240    Window%!36 = S_Height%
 4250    !Window%=0
 4260    Window%!4=5: REM fixed size drag box
 4270    SAVING%=TRUE
 4280    DRAGGING%=TRUE
 4290    SYS DragBox, ,Window%
 4300  ELSE
 4310    PROCCloseWindow(Save_h%)
 4320    PROCCloseMenu
 4330    ENDIF
 4340WHEN Load_h%
 4350  PROCStopScoring
 4360  IF I%=0 PROCload_music(FNGetStr(LoadText))       :   REM 0 is OK.
 4370  PROCCloseWindow(Load_h%)
 4380  PROCCloseMenu
 4390WHEN TimeSig_h%
 4400  CASE I% OF
 4410   WHEN 0
 4420    TIME_SIG%(0)=1+(TIME_SIG%(0)+inc%+14)MOD15
 4430    $BarLength%=STR$(TIME_SIG%(0)+1)
 4440   WHEN 1
 4450    TIME_SIG%(1)=(TIME_SIG%(1)-inc%)MOD4+2
 4460    $NoteValue%=STR$(1<<(TIME_SIG%(1)-1))
 4470    ENDCASE
 4480  IF I%=0 OR I%=1 PROCUpdateIcon(W%,I%,0,0)
 4490ENDCASE
 4500ENDIF
 4510ENDPROC
 4520
 4530DEF PROCCheckInstalledVoices
 4540LOCAL NewVoice$, NewNVoices%, changedVoices%
 4550changedVoices%=FALSE
 4560SYS Sound_InstallVoice TO I$,NewNVoices%:NewNVoices%-=1
 4570IF FNassert(NVoices%>0,"No sound voices are installed.") STOP
 4580IF MIDIpresent% NewNVoices%+=1:Voice$(NewNVoices%)="":REM allow a NULL voice to permit just MIDI on this channel
 4590IF NewNVoices%<>NVoices% THEN
 4600  changedVoices%=TRUE
 4610  NVoices%=NewNVoices%
 4620  ENDIF
 4630IF NVoices%>MAX_Voices% NVoices%=MAX_Voices%
 4640FORR%=1TONVoices%
 4650IF (MIDIpresent% AND R%=NVoices%) THEN
 4660 Voice$(R%)=""
 4670ELSE
 4680 SYS Sound_InstallVoice,0,R% TO NewVoice$
 4690 IF NewVoice$<>Voice$(R%) THEN
 4700  changedVoices%=TRUE
 4710  Voice$(R%)=NewVoice$
 4720  ENDIF
 4730 ENDIF
 4740NEXT:REM find if instruments have changed
 4750IF NOT changedVoices% ENDPROC
 4760FORR%=0TO7
 4770SYS Sound_AttachVoice,R%+1,0 TO L%,S%
 4780IFS%<1ORS%>NVoices% S%=1:REM Make sure a voice is attached to all channels
 4790SYS Sound_AttachVoice,L%,S%
 4800Instrument%(R%,0)=S_C%(R%)+1:REM Instrument stave
 4810Instrument%(R%,1)=S%:REM Instrument voice
 4820$(VoiceStr%(R%)) = LEFT$(Voice$(S%), VoiceSize%)
 4830PROCUpdateIcon(InstrWind_h%, R%+8, 0,0)
 4840NEXT:REM Get details of each channel
 4850PROCSetDefaultChannels
 4860ENDPROC
 4870
 4880DEF FNAttachVoice(chan%,inc%) :REM inc% is +1 or -1 or 0 to find nearest
 4890LOCAL stop%,v%,perc%
 4900PROCCheckInstalledVoices
 4910IF NVoices%<2 SYS Sound_AttachVoice, chan%+1, 1 : =1
 4920REM attach next voice to channel. Attach percussion voice only on perc line, and not on stave lines
 4930perc%=(INSTR($StaveStr%(chan%),"perc")>0) :REM is it a percussion channel?
 4940SYS Sound_AttachVoice, chan%+1 TO , v%
 4950IF v%=0 v%=1
 4960SYS Sound_AttachVoice, chan%+1, v%  :REM restore it
 4970REM check if current voice is valid for this channel
 4980IF inc%=0 THEN IF (perc% = (INSTR(Voice$(v%),"Perc")>0)) THEN =v%
 4990REM inc or dec until found
 5000IF ABS(inc%)<>1 THEN inc%=1
 5010stop%=v%
 5020REPEAT
 5030 v%+=inc% : IF v%>NVoices% v%=1 ELSEIF v%<1 v%=NVoices%
 5040 IF MIDIpresent% AND Voice$(v%)="" stop%=v% :REM permit NULL voice on any channel if MIDI installed
 5050 UNTIL (perc% = (INSTR(Voice$(v%),"Perc")>0)) OR stop%=v%
 5060=v%
 5070
 5080DEF PROCUpdateIcon(W%, I%, st%, msk%)
 5090Window%!handle%=W%:!Icon%=I%
 5100Icon%!state=st%:Icon%!mask=msk%
 5110SYS SetIconState%,,Window%+handle% : REM update icon text
 5120ENDPROC
 5130
 5140DEF PROCUserDragBox
 5150LOCAL block
 5160DRAGGING%=FALSE
 5170block=Window% :REM temporary buffer
 5180IF SAVING% THEN
 5190  SYS GetPointerInfo%, ,block
 5200  block!32=block!4
 5210  block!28=!block
 5220  block!24=block!16
 5230  block!20=block!12 : REM this is the destination window handle%
 5240  block!16=1        : REM DataSave
 5250  block!12=0
 5260  block!36=0  :REM don't know file size
 5270  block!40=MusicFileType%
 5280  $(block+44)=FNGetLeafName(SaveText)
 5290  !block = 60
 5300  SYS SendMessage, 17, block, block!20
 5310  ENDIF
 5320ENDPROC
 5330
 5340DEF FNSetBit(test, word, bitnum) : REM set or clear bit depending on test
 5350IF test THEN
 5360  = word OR (1<<bitnum)
 5370ELSE
 5380  = word AND NOT (1<<bitnum)
 5390ENDIF
 5400
 5410DEF PROCMenuSelect
 5420LOCAL item%, n, selection, SoundEnable%,F$
 5430selection=Window%+handle%
 5440SYS DecodeMenu, ,CurrentMenu%, selection, MenuString
 5450CASE LEFT$($MenuString,INSTR($MenuString, ".")-1) OF
 5460  WHEN "Save"
 5470   F$=FNGetStr(SaveText)
 5480   IF ( INSTR(F$,".")=0 AND INSTR(F$,":")=0 ) THEN
 5490    PROCOpenWindow(Save_h%, Mouse_X%, Mouse_Y%)
 5500   ELSE
 5510    PROCsave_music(F$)
 5520   ENDIF
 5530  WHEN "Staves"
 5540   SYS "Hourglass_On"
 5550   IF LEFT$($StaveNum%,1)="" $StaveNum%="1"
 5560   STAVE%=VAL(LEFT$($StaveNum%,1))-1
 5570   IF INSTR($MenuString,"+perc",6) THEN
 5580    IF PERC%=1 PERC%=0 ELSE PERC%=1
 5590    ENDIF
 5600   item% = FNFindMenuItem("+percussion", StaveMenu%)
 5610   IF (item%>=0) !item% = FNSetBit(PERC%=1, !item%, 0):REM set or clear tick
 5620   PROCsetup_score
 5630   PROCstart_music
 5640   PROCrescore(0)
 5650   SYS "Hourglass_Off"
 5660  WHEN "Instruments" : PROCOpenWindow(InstrWind_h%,Mouse_X%,Mouse_Y%)
 5670  WHEN "Volume"
 5680    IF selection!4>=0 THEN
 5690      PROCSetVolume(selection!4)
 5700      PROCSetMenuTick(VolumeMenu%, selection!4)
 5710      ENDIF
 5720  WHEN "Tempo"
 5730    IF selection!4>=0 THEN
 5740      PROCSetTempo(selection!4)
 5750      PROCSetMenuTick(TempoMenu%, selection!4)
 5760      ENDIF
 5770  WHEN "Time sig" : TIME_SIG%(0)=VAL($BarLength%)-1
 5780  WHEN "Key sig"
 5790    IF selection!4>=0 THEN
 5800     KEY_SIG%(0) = ((selection!8)>=7)+1
 5810     KEY_SIG%(1) = ABS((selection!8)-7)
 5820     PROCSetMenuTick(MajorMenu%, selection!8)
 5830     PROCSetMenuTick(MinorMenu%, selection!8)
 5840     IF KEY_SIG%(1) n=accidental%+2+KEY_SIG%(0) : X%(key%)=(x%(n)+X%(n))*KEY_SIG%(1) ELSE X%(key%)=x%(accidental%+2)+X%(accidental%+2)
 5850     ENDIF
 5860  WHEN "Play"
 5870    SYS Sound_Enable,0 TO SoundEnable%:REM dont pretend to be able to play if the sound system is disabled
 5880    IF SoundEnable%=2 THEN
 5890     SCORING%=FALSE
 5900     PLAYING%=NOT PLAYING%
 5910     SCROLLING%=PLAYING%
 5920     IF PLAYING% PROCplay_start ELSE PROCplay_stop
 5930    ELSE n=FNCheckOK("Sound is not enabled. You cannot play", 1)
 5940     ENDIF
 5950  WHEN "Clear"
 5960    IF CHANGED% IF NOT FNCheckOK("Are you sure? Current music is unsaved",3) ENDPROC
 5970    PROCClearAllMusic
 5980    Window%!handle%=ScoreWind_h%
 5990    SYS GetWindowState%,,Window%+handle%
 6000    Window%!scx%=0
 6010    LHBAR%=0
 6020    SYS OpenWindow%,,Window%+handle%
 6030    SYS GetWindowState%,,ScoreWBlk%+handle%
 6040  WHEN "Info" : PROCOpenWindow(ProgInfo_h%, Mouse_X%, Mouse_Y%)
 6050  WHEN "Quit" : IF CHANGED% PROCOpenAbortQuery(Mouse_X%, Mouse_Y%) ELSE PROCterminate
 6060  WHEN "Goto"
 6070    Window%!handle%=ScoreWind_h%
 6080    SYS GetWindowState%,,Window%+handle%
 6090    Window%!scx%=0
 6100    SYS OpenWindow%,,Window%+handle% : REM set scroll to 0
 6110    SYS GetWindowState%,,ScoreWBlk%+handle%
 6120    LHBAR%=0 :REM the bar number at the left of the window
 6130  ENDCASE
 6140  IF (CurrentMenu%=MenuStart) THEN
 6150   SYS GetPointerInfo%,,Mouse%
 6160   IF %001 AND Mouse%!buttons PROCOpenMainMenu :REM persistent menu
 6170   ENDIF
 6180ENDPROC
 6190
 6200DEF PROCSetMenuTick(menu%, this%)
 6210REM set 1 tick in menu and clear all others
 6220LOCAL n, item%
 6230n = 0
 6240item%=menu%+28
 6250!item% = FNSetBit(n=this%, !item%, 0)  :REM set or clear tick
 6260REPEAT
 6270 item% += 24
 6280 n += 1
 6290 !item% = FNSetBit(n=this%, !item%, 0)  :REM set or clear tick
 6300 UNTIL (!item% AND &80)
 6310ENDPROC
 6320
 6330DEF PROCKeyPressed
 6340LOCAL ThisWindow%
 6350IF !(Window%+handle%+24)=13 THEN
 6360  ThisWindow%=Window%!handle%
 6370  CASE (ThisWindow%) OF
 6380    WHEN Save_h% : PROCsave_music(FNGetStr(SaveText)) : REM c/r in save window
 6390    WHEN Load_h% : PROCload_music(FNGetStr(LoadText)) : REM c/r in load window
 6400    WHEN Bar_h%
 6410     BAR%=VAL($BarNum%)
 6420     IF BAR%>NBars% BAR%=NBars% ELSEIF BAR%<0 BAR%=0
 6430     Window%!handle%=ScoreWind_h%
 6440     SYS GetWindowState%,,Window%+handle%
 6450     Window%!scx%=PX%(PXn%(BAR%))
 6460     SYS OpenWindow%,,Window%+handle% : REM set scroll to requested bar number
 6470     SYS GetWindowState%,,ScoreWBlk%+handle%
 6480     LHBAR%=FNFindBar(ScoreWBlk%!scx%) :REM the bar number at the left of the window
 6490   OTHERWISE : SYS "Wimp_ProcessKey",!(Window%+handle%+24) : REM  ie. pass on key code in R0
 6500   ENDCASE
 6510  PROCCloseWindow(ThisWindow%)
 6520  PROCCloseMenu
 6530  ELSE
 6540  SYS "Wimp_ProcessKey",!(Window%+handle%+24) : REM ie. pass on key code in R0
 6550  ENDIF
 6560ENDPROC
 6570
 6580DEF PROCScrollReq(x_scroll%, y_scroll%)
 6590REM if bad mode disallow scroll to prevent mode warning being garbled
 6600IF BADMODE% ENDPROC
 6610IF Window%!handle%=ScoreWind_h% THEN
 6620  IF PLAYING%AND(x_scroll%<>0) ENDPROC
 6630  CASE ABS(x_scroll%) OF
 6640    WHEN 1:Window%!scx%+=x_scroll%*4*Pgap%
 6650    WHEN 2:Window%!scx%+=(x_scroll%/2)*(Window%!x1%-Window%!x0%)
 6660    ENDCASE
 6670  CASE ABS(y_scroll%) OF
 6680    WHEN 1:Window%!scy%+=y_scroll%*C_Height%
 6690    WHEN 2:Window%!scy%+=(y_scroll%/2)*(Window%!y1%-Window%!y0%)
 6700    ENDCASE
 6710  SYS OpenWindow%, ,Window%+handle%
 6720  SYS GetWindowState%,,ScoreWBlk%+handle%
 6730  ScoreClosed%=FALSE
 6740  LHBAR%=FNFindBar(ScoreWBlk%!scx%) :REM the bar number at the left of the window
 6750  ENDIF
 6760ENDPROC
 6770
 6780DEF PROCOpenMainMenu
 6790LOCAL item%
 6800item% = FNFindMenuItem("Play", MenuStart)
 6810IF (item%>=0) !item% = FNSetBit(PLAYING%, !item%, 0)
 6820REM set or clear tick
 6830item% = FNFindMenuItem("Goto", MenuStart)
 6840IF (item%>=0) item%!8 = FNSetBit(PLAYING%, item%!8, 22)
 6850REM shaded bit. disable Goto when playing
 6860SYS CreateMenu, ,MenuStart, Mouse_X%-C_Width%*4, Mouse_Y%+C_Height%*4
 6870CurrentMenu%=MenuStart
 6880PROCCloseWindow(Save_h%)
 6890PROCCloseWindow(Load_h%)
 6900ENDPROC
 6910
 6920DEF PROCOpenMenu(Menu%)
 6930IF (Menu%=IconMenu%) THEN
 6940  SYS CreateMenu, ,IconMenu%, Mouse_X%-C_Width%*4, 112+C_Height%*2:REM y adjusted to line up
 6950ELSE
 6960  SYS CreateMenu, ,Menu%, Mouse_X%-C_Width%*4, Mouse_Y%+C_Height%
 6970ENDIF
 6980CurrentMenu%=Menu%
 6990PROCCloseWindow(Save_h%)
 7000PROCCloseWindow(Load_h%)
 7010ENDPROC
 7020
 7030DEF PROCCloseMenu
 7040SYS CreateMenu, ,-1
 7050PROCCloseWindow(Save_h%)
 7060PROCCloseWindow(Load_h%)
 7070ENDPROC
 7080
 7090DEF PROCsymbol_pointer
 7100SYS GetPointerInfo%,,Mouse%
 7110IF (Mouse%!window=ScoreWind_h%) PROCscribe(Mouse%!x0%,Mouse%!y0%)
 7120ENDPROC
 7130
 7140DEF PROCStopScoring
 7150stopSCORING%=TRUE
 7160PROCrelease
 7170PROCUpdateIcon(SelW%, SelI%, 0, 1<<2) :REM remove highlight on icon in pane
 7180ENDPROC
 7190
 7200DEF PROCUpdateTitle(T$)
 7210LOCAL a,b,c,d
 7220$ScoreTitle%=T$+CHR$(0)
 7230Window%!handle%=ScoreWind_h%
 7240SYS GetWindowState%,,Window%+handle%
 7250a=Window%!x0% : b=Window%!y1% : c=Window%!x1% :REM get title area and force redraw
 7260SYS GetWindowOutline,,Window%+handle%
 7270d=Window%!y1%
 7280SYS ForceRedraw,-1,a+Hi%,b+Vi%,c-Hi%,d+Vi%
 7290ENDPROC
 7300
 7310DEF PROCOpenWindow(h%, x%, y%)
 7320LOCAL xsize%, ysize%
 7330Window%!handle% = h%
 7340SYS GetWindowState%, ,Window%+handle%
 7350xsize%=Window%!x1%-Window%!x0%
 7360ysize%=Window%!y1%-Window%!y0%
 7370Window%!under%=-1
 7380Window%!x0%=x%
 7390Window%!x1%=Window%!x0%+xsize%
 7400Window%!y0%=y%
 7410Window%!y1%=Window%!y0%+ysize%
 7420SYS OpenWindow%, ,Window%+handle%
 7430ENDPROC
 7440
 7450DEF PROCCloseWindow(h%)
 7460Window%!handle%=h%
 7470SYS CloseWindow%, ,Window%+handle%
 7480ENDPROC
 7490
 7500DEF PROCSetExtent(W%)
 7510Score_Width%=W%
 7520Window%!x0%=0
 7530Window%!y0%=-Score_Height%-PaneHeight%
 7540Window%!x1%=Score_Width%
 7550Window%!y1%=PaneHeight%
 7560SYS SetExtent,ScoreWind_h%,Window%
 7570ENDPROC
 7580
 7590DEF FNGetLeafName(name%) :REM returns leaf name
 7600LOCAL ch$,n%,name$
 7610name$=FNGetStr(name%)
 7620IF ( (INSTR(name$,".")=0) AND (INSTR(name$,":")=0) ) THEN=name$
 7630n%=LEN(name$)
 7640REM scan string to find leaf name of file
 7650REPEAT
 7660  ch$= MID$(name$, n%, 1)
 7670  n%-=1
 7680  UNTIL (n%<=0 OR ch$="." OR ch$=":")
 7690IF n%>0 THEN =RIGHT$(name$, LEN(name$)-n%-1)
 7700
 7710DEF FNGetStr(s%) : REM get string
 7720LOCAL n$
 7730WHILE?s%:n$+=CHR$?s%:s%+=1:ENDWHILE
 7740=n$
 7750
 7760DEF PROCSetVolume(R%)
 7770SYS Sound_Volume,Volume%(R%)
 7780ENDPROC
 7790
 7800DEF PROCSetDefaultChannels
 7810LOCALS%,P%
 7820REM only 1 percussion channel permitted now
 7830FORS%=0TO7:S_C%(S%)=Stave_Channels%(STAVE%,S%):NEXT:REM Channel assignment changes if staves change
 7840IF PERC% S_C%(7)=STAVE%+1:REM Steal channel for percussion lines
 7850FORS%=0TO7
 7860Instrument%(S%,0)=S_C%(S%)+1
 7870$StaveStr%(S%)=Nth$(Instrument%(S%,0)+(STAVE%-3)*((Instrument%(S%,0)-1)>STAVE%))+";" :REM set up stave names in instrument wimdow
 7880PROCUpdateIcon(InstrWind_h%,S%,0,0) :REM update text in icons
 7890v%=FNAttachVoice(S%,0)
 7900SYS Sound_AttachVoice,S%+1,v%
 7910$(VoiceStr%(S%))=LEFT$(Voice$(v%), VoiceSize%)
 7920Instrument%(S%,1) = v%
 7930PROCUpdateIcon(InstrWind_h%,S%+8, 0,0)
 7940NEXT:REM Instrument allocation
 7950IF PERC% $StaveStr%(7)=Nth$(5)+";" :REM steal 1 channel for percussion
 7960ENDPROC
 7970
 7980DEF PROCsetup_score
 7990LOCALS%,P%
 8000REM only 1 percussion channel permitted now
 8010PROCsetup_staves:REM Calculate new stave positions
 8020PROCSetDefaultChannels
 8030ENDPROC
 8040
 8050DEF FNGetFileInfo(F$)
 8060LOCALT%,L%,A%,M$,time%,FileType$,r2,r3
 8070IF F$<>"" SYSOS_File,5,F$ TO T%,,laddr%,eaddr%,L%,A%
 8080IF (F$="") OR ((T%=1) AND (A% AND 1) AND (L%>8)) = 0 THEN
 8090$ThisFile%="<untitled>"+CHR$(0)
 8100$FileSize%=""
 8110$FileType%=""
 8120$FileDate%=""
 8130=FALSE
 8140ELSE
 8150$ThisFile%=F$
 8160$FileSize%=STR$(L%)
 8170IF ((laddr%>>20)AND&FFF)=&FFF THEN
 8180  IF (laddr%>>8 AND &FFF) = MusicFileType% THEN
 8190    FileType$= "Music  "
 8200  ELSE
 8210    SYS "OS_FSControl",18,,laddr%>>8 AND &FFF TO ,,r2,r3
 8220    FileType$=CHR$(r2 AND &FF) + CHR$((r2>>8) AND &FF) + CHR$((r2>>16) AND &FF) + CHR$((r2>>24) AND &FF)
 8230    FileType$ += CHR$(r3 AND &FF) + CHR$((r3>>8) AND &FF) + CHR$((r3>>16) AND &FF) + CHR$((r3>>24) AND &FF)
 8240    ENDIF
 8250  $FileType%=FileType$+STR$~(laddr%>>8 AND &FFF)
 8260  time%=Window% :REM a convenient buffer
 8270REM load and execution addresses are, in fact, time stamp
 8280  time%?4=laddr% AND &FF
 8290  time%?3=eaddr%>>24 AND &FF
 8300  time%?2=eaddr%>>16 AND &FF
 8310  time%?1=eaddr%>>8  AND &FF
 8320  time%?0=eaddr%     AND &FF
 8330  SYS "OS_ConvertStandardDateAndTime", time%, FileDate%, 28
 8340  REM put timestamp of file into file info window
 8350  ENDIF
 8360ENDIF
 8370=TRUE
 8380
 8390DEF PROCload_music(F$)
 8400LOCAL F%,M$
 8410LOCAL ERROR
 8420IF CHANGED% IF NOT FNCheckOK("Are you sure? Current music is unsaved",3) ENDPROC
 8430SCORING%=FALSE
 8440IF PLAYING% PROCplay_stop
 8450SCROLLING%=FALSE
 8460IF LENF$=0 THEN VDU7 : T%=FNCheckOK("Invalid filename",1) : ENDPROC
 8470SYS "Hourglass_On"
 8480ON ERROR LOCAL VDU7: OSCLI("FX 229,1") : PROCClearAllMusic : SYS "Hourglass_Off" : T%=FNCheckOK(REPORT$,1) : ENDPROC
 8490OSCLI("FX 229,0") :REM enable escape key
 8500FILE%=OPENINF$
 8510M$="":FORR%=1TO7:M$+=CHR$BGET#FILE%:NEXT
 8520B%=BGET#FILE%
 8530IFM$="Maestro" THEN
 8540$LoadText=F$+CHR$(0)
 8550$SaveText=F$+CHR$(0)
 8560IF NOT FNGetFileInfo(F$) THEN VDU7 :OSCLI("FX 229,1") : SYS "Hourglass_Off" :T%=FNCheckOK("Invalid or locked file",1) : ENDPROC
 8570T%=TRUE
 8580NBars%=0
 8590CASE BGET#FILE% OF
 8600WHEN 0:T%=FALSE
 8610WHEN 1
 8620PROClTempo:PROClInstruments:PROClStaves:PROClMusic
 8630OTHERWISEREM File id version 2 and above
 8640A%=FALSE
 8650REPEAT
 8660ON BGET#FILE% PROClMusic,PROClStaves,PROClInstruments,PROClVolumes,PROClStereos,PROClTempo ELSEA%=TRUE
 8670UNTILEOF#FILE%ORA%
 8680ENDCASE
 8690CLOSE#FILE%:FILE%=FALSE
 8700OSCLI("FX 229,1")
 8710$Updated%="NO"
 8720PROCUpdateTitle(F$)
 8730SYS "Hourglass_Off"
 8740SYS "Hourglass_On"
 8750IFT% THEN
 8760 PROCposition_staves
 8770 PROCstart_music
 8780 PROCset_score(0)
 8790 PROCSetupBarStarts(0)
 8800 PROCsetup_score
 8810 PROCupdate_score(0,-Score_Height%,Score_Width%,0)
 8820 PROCStopScoring
 8830 CHANGED%=FALSE
 8840 ENDIF
 8850ELSE
 8860OSCLI("FX 229,1")
 8870T%=FALSE
 8880ENDIF
 8890IF NOT T% THEN VDU7 : T%=FNCheckOK("Invalid music file",1)
 8900SYS "Hourglass_Off"
 8910ENDPROC
 8920
 8930DEF PROClMusic
 8940LOCALC%,B%
 8950INPUT#FILE%,GATE%:GATE%+=MUSIC%
 8960FORC%=0TO7
 8970INPUT#FILE%,FINE%(C%):FINE%(C%)+=MUSIC%(C%)
 8980NEXT
 8990B%=MUSIC%:WHILEB%<GATE%:?B%=BGET#FILE%:B%+=1:ENDWHILE
 9000FORC%=0TO7
 9010B%=MUSIC%(C%):WHILEB%<FINE%(C%):?B%=BGET#FILE%:B%+=1:ENDWHILE
 9020NEXT
 9030PP%=MUSIC%:P%()=MUSIC%()
 9040ENDPROC
 9050
 9060DEF PROClStaves
 9070LOCAL item%
 9080STAVE%=BGET#FILE%
 9090$StaveNum%=LEFT$(STR$(STAVE%+1),1)
 9100PERC%=BGET#FILE%
 9110item% = FNFindMenuItem("+percussion", StaveMenu%)
 9120IF item%>0 !item%=FNSetBit(PERC%=1, !item%, 0) :REM set or clear tick
 9130ENDPROC
 9140
 9150DEF PROClInstruments
 9160LOCALC%, chan%,v%
 9170FORC%=0TO7
 9180chan%=BGET#FILE%:REM Channel
 9190v%=BGET#FILE%MOD(NVoices%+1):REM Write voice numbers allocated to each channel
 9200IF v%=0 v%=1
 9210SYS Sound_AttachVoice, chan%+1, v%
 9220v%=FNAttachVoice(chan%, 0) :REM check if it is a valid voice
 9230SYS Sound_AttachVoice, chan%+1, v%
 9240Instrument%(chan%,1) = v%
 9250$(VoiceStr%(chan%))=LEFT$(Voice$(v%), VoiceSize%)
 9260PROCUpdateIcon(InstrWind_h%, chan%+8, 0,0)
 9270NEXT
 9280ENDPROC
 9290
 9300DEF PROClVolumes
 9310LOCALC%
 9320FORC%=0TO7
 9330Volumes%(C%)=BGET#FILE%
 9340IFVolumes%(C%)>7 Volumes%(C%)=7
 9350IFVolumes%(C%)<0 Volumes%(C%)=0
 9360$(VolumeStr%(C%))=LEFT$(Volume$(Volumes%(C%)), VolSize%)
 9370PROCUpdateIcon(InstrWind_h%, C%+16, 0,0)   :REM update icon in instrument window
 9380NEXT
 9390ENDPROC
 9400
 9410DEF PROClStereos
 9420LOCALC%
 9430FORC%=0TO7
 9440Stereo_Position%(C%)=BGET#FILE%
 9450SYS Sound_Stereo,C%+1,Stereo%(Stereo_Position%(C%))
 9460$(StereoStr%(C%)) = LEFT$(Stereo$(Stereo_Position%(C%), 0), SterSize%)
 9470PROCUpdateIcon(InstrWind_h%, C%+24, 0,0)
 9480NEXT
 9490ENDPROC
 9500
 9510DEF PROClTempo
 9520LOCAL t
 9530t=BGET#FILE%
 9540PROCSetTempo(t)
 9550PROCSetMenuTick(TempoMenu%, t)
 9560ENDPROC
 9570
 9580DEF PROCsave_music(F$)
 9590LOCAL block,n
 9600LOCAL ERROR
 9610block=Window%
 9620$SaveText=F$+CHR$(0)
 9630$LoadText=F$+CHR$(0)
 9640REM simple check for pathname rather than local name
 9650IF ( INSTR(F$,".")=0 AND INSTR(F$,":")=0 ) THEN
 9660 n=FNCheckOK("To save, drag the icon to a directory viewer.",1)
 9670 ENDPROC
 9680 ENDIF
 9690SYS "Hourglass_On"
 9700ON ERROR LOCAL OSCLI("FX 229,1") : SYS "Hourglass_Off" : T%=FNCheckOK(REPORT$,1) : ENDPROC
 9710OSCLI("FX 229,0") :REM enable escape key
 9720IF CHANGED%  OR (((laddr%>>20)AND&FFF) <> &FFF) THEN
 9730  REM file changed or wasn't timestamped
 9740  REM get current time
 9750  block?0=3:SYS "OS_Word",&0E,block
 9760  laddr%=block?4
 9770  eaddr%=block!0
 9780  ENDIF
 9790REM force music file type, and preserve timestamp
 9800laddr%=(laddr% AND &FF) OR (&FFF<<20) OR (MusicFileType%<<8)
 9810REM I don't know what the length will be, so use zero
 9820SYS "OS_File", &07, F$, laddr%, eaddr%, 0, 0
 9830REM OPENUP, error if directory or not found
 9840SYS "OS_Find", &CC, F$ TO FILE%
 9850REM timestamp is automatically updated on 1st byte write
 9860BPUT#FILE%,"Maestro"
 9870BPUT#FILE%,2
 9880PROCsMusic
 9890PROCsStaves
 9900PROCsInstruments
 9910PROCsVolumes
 9920PROCsStereos
 9930PROCsTempo
 9940CLOSE#FILE%:FILE%=FALSE
 9950IF (NOT CHANGED%)  AND (((laddr%>>20) AND &FFF) = &FFF) THEN
 9960  REM file not changed and was timestamped
 9970  REM preserve original timestamp
 9980  SYS OS_File,2,F$,laddr% :REM re-stamp with old stamp
 9990  SYS OS_File,3,F$,,eaddr% :REM nb eaddr% in r3
10000  ENDIF
10010OSCLI("FX 229,1")
10020F%=FNGetFileInfo(F$)
10030CHANGED%=FALSE
10040$Updated%="NO"
10050PROCUpdateTitle(F$)
10060IF NOT T% THEN VDU7 : T%=FNCheckOK("Invalid music file",1)
10070SYS "Hourglass_Off"
10080ENDPROC
10090
10100DEF PROCsMusic
10110LOCALC%,B%
10120BPUT#FILE%,1
10130PRINT#FILE%,GATE%-MUSIC%
10140FORC%=0TO7
10150PRINT#FILE%,FINE%(C%)-MUSIC%(C%)
10160NEXT
10170B%=MUSIC%:WHILEB%<GATE%:BPUT#FILE%,?B%:B%+=1:ENDWHILE
10180FORC%=0TO7
10190B%=MUSIC%(C%):WHILEB%<FINE%(C%):BPUT#FILE%,?B%:B%+=1:ENDWHILE
10200NEXT
10210ENDPROC
10220
10230DEF PROCsStaves
10240BPUT#FILE%,2
10250BPUT#FILE%,STAVE%
10260BPUT#FILE%,PERC%
10270ENDPROC
10280
10290DEF PROCsInstruments
10300LOCALC%
10310BPUT#FILE%,3
10320FORC%=0TO7
10330BPUT#FILE%,C%
10340BPUT#FILE%,Instrument%(C%,1)
10350NEXT
10360ENDPROC
10370
10380DEF PROCsVolumes
10390LOCALC%
10400BPUT#FILE%,4
10410FORC%=0TO7
10420BPUT#FILE%,Volumes%(C%)
10430NEXT
10440ENDPROC
10450
10460DEF PROCsStereos
10470LOCALC%
10480BPUT#FILE%,5
10490FORC%=0TO7
10500BPUT#FILE%,Stereo_Position%(C%)
10510NEXT
10520ENDPROC
10530
10540DEF PROCsTempo
10550BPUT#FILE%,6
10560BPUT#FILE%,Tempo%
10570ENDPROC
10580
10590DEF PROCsprite(s%,X%,Y%) : REM plot sprite S%(s%) at X%,Y%
10600SYS SpriteOp%, SprPlot%, SprBlk%, S%(s%), X%-x%(s%),Y%-y%(s%), 8, factors%, pixtrans%
10610REM overwrite screen colour, but using sprite mask
10620ENDPROC
10630
10640DEF PROCfloat(s%,X%,Y%)
10650LOCALR%
10660Window%!handle%=ScoreWind_h%
10670Window%!x1%=X%+X%(s%)
10680X%-=x%(s%)
10690Window%!x0%=X%
10700Window%!y1%=Y%+Y%(s%)
10710Y%-=y%(s%)
10720Window%!y0%=Y%
10730SYS UpdateWindow%,,Window%+handle% TO R%
10740X%+=Window%!x0%-Window%!scx%
10750Y%+=Window%!y1%-Window%!scy%
10760ChSprite%=S%(s%)
10770WHILE R%
10780  CASE s%  OF
10790    WHEN key%  : PROCfloat_key_sig(X%,Y%+y%(s%))
10800    WHEN time% : PROCfloat_time_sig(X%,Y%)
10810    OTHERWISE  : pixtrans%?1 = pixtrans%?0 EOR pixtrans%?1
10820                 SYS SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%,Y%, 11, factors%, pixtrans%
10830                 pixtrans%?1 = pixtrans%?0 EOR pixtrans%?1
10840    ENDCASE
10850  SYS GetRectangle%,,Window%+handle% TO R%
10860  ENDWHILE
10870ENDPROC
10880
10890DEF PROCfloat_key_sig(X%,Y%)
10900LOCALI%,A%,C%,W%
10910IFKEY_SIG%(1) THEN
10920C%=SCRIBE%(sclef%)
10930A%=KEY_SIG%(0)
10940I%=accidental%+2+A%
10950W%=x%(I%)+X%(I%):Y%-=y%(I%)
10960ChSprite%=S%(I%)
10970FOR I%=0 TO KEY_SIG%(1)-1
10980SYS SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%, Y%+Li%*Key_Y%(C%,A%,I%), 3, factors%, pixtrans%
10990X%+=W%
11000NEXT
11010ELSE
11020SYS SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%, Y%-y%(s%), 3, factors%, pixtrans%
11030ENDIF
11040ENDPROC
11050
11060DEF PROCfloat_time_sig(X%,Y%)
11070SYS SetColour, 7 OR 3<<4
11080IF LEN($NoteValue%)>1 MOVE X%+C_Width%DIV2, Y%+C_Height% ELSE MOVE X%+C_Width%, Y%+C_Height%
11090PRINT $NoteValue%
11100IF LEN($BarLength%)>1 MOVE X%+C_Width%DIV2, Y%+2*C_Height% ELSE MOVE X%+C_Width%, Y%+2*C_Height%
11110PRINT $BarLength%
11120ENDPROC
11130
11140REM *********************************************************************** REM
11150REM                                                                         REM
11160REM         M U S I C   T R A N S C R I P T I O N   R O U T I N E S         REM
11170REM                                                                         REM
11180REM *********************************************************************** REM
11190::
11200REM   PROCEDURE: start_music
11210REM
11220REM DESCRIPTION: Initialise to start of music
11230:
11240DEF PROCstart_music
11250LOCAL n%
11260BAR%=0 :REM current bar
11270GP%=MUSIC%:REM Set current gate pointer to start of displayed music
11280N%()=MUSIC%()
11290CLEF%()=0:REM Start with base clefs (NOT BASS!)
11300SIG%(0)=%01100111:REM (Default time sig of 4/4 time)
11310SIG%(1)=%00000010:REM (Default of C Major) First displayed signatures attribute byte
11320PX%=0
11330PROCPutBarInfo(0)
11340ENDPROC
11350
11360REM   PROCEDURE: note_type(Channel C%, Type T%)
11370
11380DEF PROCnote_type(C%,T%)
11390N%(C%)?1=N%(C%)?1AND&1F ORT%<<5
11400ENDPROC
11410
11420DEF PROCnote_dots(C%,D%)
11430N%(C%)?1=N%(C%)?1AND&E7 ORD%<<3
11440ENDPROC
11450
11460DEF PROCnote_accidental(C%,A%)
11470N%(C%)?1=N%(C%)?1AND&F8 ORA%
11480ENDPROC
11490
11500REM   PROCEDURE: note_line(Channel C%, Stave line L%)
11510REM
11520REM        NOTE: If a note's position is not defined or specified as -16, it is treated as a rest
11530
11540DEF PROCnote_line(C%,L%)
11550?N%(C%)=?N%(C%)AND7 OR(16+L%)<<3
11560ENDPROC
11570
11580DEF PROCnote_tie(C%,T%)
11590?N%(C%)=?N%(C%)AND&FB OR(T%<>0)AND4
11600ENDPROC
11610
11620DEF PROCnote_join(C%,J%)
11630?N%(C%)=?N%(C%)AND&FD OR(J%<>0)AND2
11640ENDPROC
11650
11660DEF PROCnote_stem(C%,D%)
11670?N%(C%)=?N%(C%)AND&FE OR(D%<>0)AND%1
11680ENDPROC
11690
11700DEF PROCnote_clear(C%)
11710?N%(C%)=0:N%(C%)?1=0
11720ENDPROC
11730
11740REM   PROCEDURE: time_sig(Number of beats-1 N%,Beat type B%)
11750
11760DEF PROCtime_sig(N%,B%)
11770?GP%=0:GP%?1=Time%ORN%<<1ORB%<<5
11780ENDPROC
11790
11800REM   PROCEDURE: key_sig(Key K%)
11810
11820DEF PROCkey_sig(A%,N%)
11830?GP%=0:GP%?1=Key%ORA%<<2ORN%<<3
11840ENDPROC
11850
11860REM   PROCEDURE: clef(Stave S%, Clef C%)
11870
11880DEF PROCclef(S%,C%)
11890?GP%=0:GP%?1=Clef%ORC%<<3ORS%<<6
11900ENDPROC
11910
11920DEF PROCbar
11930?GP%=0:GP%?1=Bar%
11940ENDPROC
11950
11960DEF PROCinsert_gate(W%)
11970LOCALG%
11980IFGP%<GATE% THEN
11990FORG%=GATE%-W%TOGP%STEP-4:G%!W%=!G%:NEXT:REM Shift up by W% from insertion
12000G%+=3:REM Byte before last copied
12010WHILEG%>=GP%:G%?W%=?G%:G%+=TRUE:ENDWHILE:REM Clear up in odd word
12020ENDIF
12030GATE%+=W%:REM Insert gate of size W% into gate queue
12040EP%+=W%:REM This assumes gates will only be inserted below EP%
12050?GP%=0:GP%?(W%-1)=0:REM Zeroise inserted gate
12060ENDPROC
12070
12080DEF PROCinsert_note(C%)
12090LOCALN%
12100IFN%(C%)<FINE%(C%) THEN
12110FORN%=FINE%(C%)-2TON%(C%)STEP-4:N%!2=!N%:NEXT:REM Shift up from insertion
12120N%+=3:REM Last copied word
12130WHILEN%>=N%(C%):N%?2=?N%:N%+=TRUE:ENDWHILE:REM Clear up in odd word
12140ENDIF
12150FINE%(C%)+=2:REM Insert a note word into this queue
12160?GP%=?GP%OR%1<<C%:REM Mark in gate
12170PROCnote_clear(C%)
12180ENDPROC
12190::
12200DEF PROCdelete_gate(W%)
12210LOCALG%
12220GATE%-=W%
12230IFGP%<GATE% FORG%=GP%TOGATE%STEP4:!G%=G%!W%:NEXT
12240EP%-=W%:REM This assumes gates will only be deleted below EP%
12250ENDPROC
12260::
12270DEF PROCdelete_note(C%)
12280LOCALN%
12290FINE%(C%)-=2
12300IFN%(C%)<FINE%(C%) FORN%=N%(C%)TOFINE%(C%)STEP4:!N%=N%!2:NEXT
12310?GP%=?GP%ANDNOT(%1<<C%)
12320ENDPROC
12330
12340DEF FNallocate_channel(S%)
12350LOCALC%,c%,G%
12360G%=?GP%
12370C%=-1:c%=7
12380REPEAT
12390WHILEc%>=0ANDG%AND%1<<c%:c%+=TRUE:ENDWHILE
12400IFc%>=0 IFS_C%(c%)=S% C%=c%
12410c%+=TRUE
12420UNTILc%<0
12430=C%
12440
12450DEF PROCarrange_stave(S%)
12460LOCALC%,B%
12470B%=TRUE:C%=TRUE
12480IF?GP% ELSEREPEATGP%+=2:UNTIL?GP%ORGP%>=GATE%
12490WHILEB%ANDGP%<GATE%
12500C%=C%ORFNsort_gate
12510PROCskip_notes(?GP%):GP%+=1
12520IF?GP% ELSEB%=C%:C%=FALSE:REPEATGP%+=2:UNTIL?GP%ORGP%>=GATE%
12530ENDWHILE
12540ENDPROC
12550
12560DEF FNsort_gate
12570LOCALC%,NC%,NN%,G%,g%,pg%,d%,shortest%,Gchanged%
12580shortest%=255
12590G%=?GP%
12600g%=FNprevious_gate(GP%)
12610pg%=FNpreceding_gate(GP%)
12620NC%=-1
12630NN%=-1
12640FORC%=0TO7
12650IFS_C%(C%)=S% THEN
12660NC%+=1:n%(NC%)=C%:IFG%AND%1<<C% NN%+=1:C%(NN%)=C%
12670IFpg%AND%1<<C% d%=N%(C%)?-1>>3EOR%11100:IFd%<shortest% shortest%=d%
12680ENDIF
12690NEXT
12700shortest%=shortest%EOR%11100
12710IFg%ANDNC%>0ANDNN%>=0 PROCsort
12720=Gchanged%
12730
12740DEF PROCsort
12750LOCALN%,M%
12760c%()=-1
12770FORM%=0TONC%
12780FORN%=0TONN%
12790IFFNsame_pitch(n%(M%),C%(N%)) c%(N%)=n%(M%)
12800NEXT
12810NEXT
12820FORN%=0TONN%
12830IFc%(N%)<0 c%(N%)=FNbest
12840NEXT
12850FORN%=0TONN%
12860IFC%(N%)=c%(N%) ELSEGchanged%=TRUE:M%=FNin(c%(N%),C%()):IFM%>N% PROCswap_notes(N%,M%) ELSEPROCmove_note(N%)
12870NEXT
12880ENDPROC
12890
12900DEF PROCswap_notes(N%,M%)
12910LOCALs%,d%
12920s%=C%(N%):d%=c%(N%)
12930SWAPC%(N%),C%(M%)
12940SWAP?N%(s%),?N%(d%)
12950SWAPN%(s%)?1,N%(d%)?1
12960ENDPROC
12970
12980DEF PROCmove_note(N%)
12990LOCALs%,d%
13000s%=C%(N%):d%=c%(N%)
13010PROCinsert_note(d%)
13020?N%(d%)=?N%(s%)
13030N%(d%)?1=N%(s%)?1
13040PROCdelete_note(s%)
13050ENDPROC
13060
13070DEF FNbest
13080LOCALN%,C%
13090LOCAL short%,free%,rest%,any%,tied%
13100FOR N%=NC%TO0STEP-1
13110C%=n%(N%)
13120IFFNin(C%,c%())<0 THEN
13130IFN%(C%)?-2AND4 THEN
13140tied%=C%+1
13150ELSE
13160IFpg%AND%1<<C% THEN
13170IF(N%(C%)?-1>>3)=shortest% short%=C%+1
13180IFN%(C%)?-2AND&F8 ELSErest%=C%+1
13190ELSE
13200free%=C%+1
13210ENDIF
13220any%=C%+1
13230ENDIF
13240ENDIF
13250NEXT
13260IFshort% C%=short% ELSEIFfree% C%=free% ELSEIFrest% C%=rest% ELSEIFany% C%=any% ELSEC%=tied%
13270=C%-1
13280
13290DEF FNin(U%,U%())
13300LOCALI%:I%=NN%
13310WHILEI%ANDU%<>U%(I%):I%-=1:ENDWHILE
13320=I%+(U%<>U%(I%))
13330
13340DEF FNsame_pitch(c%,C%):LOCALR%,r%:R%=?N%(C%)AND&F8:r%=N%(c%)?-2AND&F8:=N%(c%)-2>=MUSIC%(c%)AND(g%OR(N%(c%)?-2AND4)=4)AND%1<<c%AND(R%EORr%)=FALSE AND(FALSE<>R%EORr%=FALSE)
13350
13360DEF FNpreceding_gate(gp%)
13370LOCALC%,gm%
13380FORC%=0TO7:IFS_C%(C%)=S% gm%=gm%OR%1<<C%
13390NEXT
13400REPEAT
13410gp%-=1
13420UNTILgm%AND?gp%ORgp%<MUSIC%+2ORgp%?-1=FALSE
13430=?gp%ANDgp%>MUSIC%+1ANDgp%?-1<>FALSE
13440
13450DEF FNprevious_gate(gp%)
13460LOCALC%,gm%
13470FORC%=0TO7:IFS_C%(C%)=S% gm%=gm%OR%1<<C%
13480NEXT
13490REPEAT
13500gp%-=1
13510WHILEgp%>MUSIC%ANDgp%?-1=FALSE:gp%-=2:ENDWHILE
13520UNTILgm%AND?gp%ORgp%<MUSIC%+2
13530=?gp%ANDgp%>MUSIC%+1
13540
13550DEF FNconflict(T%,S%,L%)
13560LOCALC%,co%
13570L%+=16
13580C%=7
13590REPEAT
13600co%=?GP%AND%1<<C%ANDS_C%(C%)=S%AND(?N%(C%)>>3)=L%
13610C%+=TRUE
13620UNTILco%ORC%<FALSE
13630=C%-(co%<>0)
13640
13650REM *********************************************************************** REM
13660REM                                                                         REM
13670REM           M U S I C   T Y P E S E T T I N G   R O U T I N E S           REM
13680REM                                                                         REM
13690REM *********************************************************************** REM
13700::
13710REM   PROCEDURE: set_score(Starting position PX%)
13720REM
13730REM DESCRIPTION: Typeset music score from current bar to end of music/screen
13740REM              No drawing is done as only the positions are calculated.
13750REM
13760REM     EFFECTS: Stores gate X positions & types in PX%() & PTYPE%()
13770:
13780DEF PROCset_score(PX%)
13790WHILE GP%<GATE%
13800IF?GP% PROCset_notes(?GP%):GP%+=1 ELSEPROCset_attribute(GP%?1):GP%+=2
13810ENDWHILE:REM Until edge of screen or end of music
13820EP%=GP%:REM Last GP%, pointer to first undrawn gate
13830EX%=PX%:REM Last PX%, index to last position
13840PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%:REM Appendation position after last symbol
13850IF PX%(PX%+1)>S_Width% PROCSetExtent(PX%(PX%+1)+100*Hi%) ELSE PROCSetExtent(S_Width%)
13860PXn%(NBars%)=PX%
13870PTYPE%(PX%+1)=Note%:REM Note type by default
13880ENDPROC
13890::
13900REM NOTE: The key signature is the only attribute that must be kept track of in order to ensure correct setting.
13910REM       This is because a naturalising signature consists of the same number of naturals as accidentals in the previous key signature
13920:
13930DEF PROCset_attribute(A%)
13940IFA%ANDPTYPE%(PX%)+TRUE ELSEIFA%ANDPTYPE%(PX%) ENDPROC
13950LOCALT%:T%=%1:IFA%AND%1 ELSEREPEATT%=T%<<1:UNTILA%ANDT%
13960PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
13970PX%+=1
13980PTYPE%(PX%)=T%
13990CASE T% OF
14000WHENTime%:PW%(PX%)=20*Hi%
14010WHENKey%
14020IFA%AND56 T%=accidental%+(A%>>2AND%1)+2:SIG%(1)=A% ELSET%=accidental%+1:SWAPA%,SIG%(1):IFA%AND56 ELSEA%=8:T%+=1
14030PW%(PX%)=(A%>>3AND7)*(x%(T%)+X%(T%))
14040WHENClef%:PW%(PX%)=x%(clef%+3)+X%(clef%+3)
14050WHENBar%:PW%(PX%)=Hi%*4
14060ENDCASE
14070ENDPROC
14080
14090DEF PROCset_notes(G%)
14100LOCALlx0%,lx1%,ly0%,ly1%
14110LOCALC%,P%,R%,s%:REM Channel, Note prefix & remainder widths, Sprite
14120C%=-1
14130REPEAT
14140REPEATC%-=TRUE:UNTILG%AND%1<<C%
14150PROCbound_note(!N%(C%))
14160IFlx0%>P% P%=lx0%:REM Maximum prefix
14170IFlx1%>R% R%=lx1%:REM Maximum remainder
14180N%(C%)+=2:REM Pull from note queue
14190UNTIL(2<<C%)>G%:REM Until no more notes (1 bits)
14200PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%+P%:REM Next position is previous position + width+gap+prefix of next note
14210PX%+=1:REM next note position index
14220PW%(PX%)=R%:REM Width of new note
14230PTYPE%(PX%)=Note%:REM Note type
14240ENDPROC
14250
14260DEF PROCbound_note(L%)
14270LOCALH%,S%,s%
14280H%=L%>>8AND&FF
14290IFL%AND&F8 S%=H%>>5ORL%<<3AND8 ELSES%=rest%ORH%>>5:REM Note/rest sprite
14300lx0%=x%(S%):REM Prefix width
14310lx1%=X%(S%):REM Suffix width
14320ly0%=y%(S%):REM Decender height
14330ly1%=Y%(S%):REM Ascender height
14340IFH%AND7 THEN
14350s%=accidental%ORH%AND7
14360lx0%+=x%(s%):REM Add accidental width
14370IFy%(s%)>ly0% ly0%=y%(s%):REM Lower ?
14380IFY%(s%)>ly1% ly1%=Y%(s%):REM Higher ?
14390ENDIF
14400IFH%AND24 s%=dot%+(H%>>3AND3):lx1%=x%(S%)+X%(s%):IFy%(s%)>ly0% ly0%=y%(s%):REM Dot adds suffix and may be lower
14410ENDPROC
14420::
14430DEF PROCposition_staves
14440LOCAL Y%,S%
14450Score_Height%=(PERC%+1+3*(STAVE%+1)+1)*Stave_Height%
14460Y%=-Score_Height%-Stave_Height%DIV2
14470IFPERC% FORS%=PERC%TO1STEP-1:Y%+=Stave_Height%:Y_STAVE%(STAVE%+S%)=Y%:NEXT
14480FOR S%=STAVE%TO0STEP-1:Y%+=3*Stave_Height%:Y_STAVE%(S%)=Y%:NEXT
14490ENDPROC
14500
14510DEF PROCsetup_staves
14520LOCAL O%
14530PROCposition_staves
14540ScoreWBlk%!handle%=ScoreWind_h%
14550SYS GetWindowState%,,ScoreWBlk%+handle%
14560ScoreWBlk%!y0%=ScoreWBlk%!y1%-Score_Height%-PaneHeight%
14570ScoreWBlk%!scx%=0:ScoreWBlk%!scy%=PaneHeight%/2
14580ScoreWBlk%!under%=-1
14590SYS OpenWindow%,,ScoreWBlk%+handle%
14600LHBAR%=0
14610ScoreClosed%=FALSE
14620Window%!handle%=ScoreWind_h%
14630SYS GetWindowState%,,Window%+handle%
14640IF TRANSCRIBE% PROCplace_top_panes(-1): PROCplace_bottom_panes(-1)
14650IF PLAYING% PROCCheckScroll
14660ENDPROC
14670
14680DEF PROCupdate_score(Window%!x0%,Window%!y0%,Window%!x1%,Window%!y1%)
14690Window%!handle%=ScoreWind_h%
14700SYS UpdateWindow%,,Window%+handle% TO R%
14710WHILE R%
14720CLG:PROCdraw_staves
14730SYS GetRectangle%,,Window%+handle% TO R%
14740ENDWHILE
14750ENDPROC
14760
14770REM   PROCEDURE: draw_staves
14780REM
14790REM DESCRIPTION: Draw current stave structure
14800REM              1 stave for 1 voice
14810REM              2 staves for keyboard
14820REM              3 staves for 1 voice and keyboard
14830REM              4 staves for 4 voice chorus
14840:
14850DEF PROCdraw_staves
14860LOCAL Y%,T%,B%,S%,L%:REM Y%,T%,B%=Position & Y bounds of each stave, S%=Stave index, L%=Line position
14870LOCAL x%,y%,lx1%:REM Virtual coordinates of bottom left & top right of score window
14880LOCAL c%,t%,b%:REM Left edge of clip window and Y bounds
14890y%=Window%!y1%-Window%!scy%
14900x%=Window%!x0%-Window%!scx%
14910lx1%=x%+Score_Width%:IF lx1%>Clip%!x1% lx1%=Clip%!x1%
14920c%=Clip%!x0%:IFc%<x%+Hi% c%=x%+Hi%
14930b%=Clip%!y0%:t%=Clip%!y1%
14940IFPERC% THEN
14950FOR S%=STAVE%+1TOSTAVE%+PERC%
14960Y%=y%+Y_STAVE%(S%)
14970IFb%<=Y%ANDt%>=Y% LINEc%,Y%,lx1%,Y%
14980NEXT
14990ENDIF
15000FOR S%=0 TO STAVE%
15010Y%=y%+Y_STAVE%(S%):T%=Y%+Stave_Height%DIV2:B%=T%-Stave_Height%
15020IFb%<=T%ANDt%>=B% THEN
15030LINEc%,Y%,lx1%,Y%:REM Plot centre bar line
15040FORL%=Li%*2TOL%*2STEPL%
15050LINEc%,Y%+L%,lx1%,Y%+L%:REM Plot upper line
15060LINEc%,Y%-L%,lx1%,Y%-L%:REM Plot lower line
15070NEXT
15080ENDIF
15090NEXT
15100B%=Score_Width%
15110T%=Clip%!x1%-x%:IFT%<B% B%=T%:REM Right bound
15120T%=Clip%!x0%-x%:IFT%<0 T%=0:REM Left bound
15130IF NOT BADMODE% THEN
15140  PROCdraw_score(x%,y%,T%,B%):REM Draw symbols on stave
15150ELSE
15160  MOVE Window%!x0%, Window%!y1%-100
15170  PRINT "Cannot display score in this (256-colour) mode"
15180  ENDIF
15190ENDPROC
15200::
15210REM   PROCEDURE: draw_score(Based X%,Y%, PX bounds A%,B%)
15220REM
15230REM DESCRIPTION: Write current section of music score that appears between A%
15240REM              and B%
15250:
15260DEF PROCdraw_score(X%,Y%,A%,B%)
15270LOCALPX%
15280BAR%=0
15290REM must be subtle about redrawing last note (or other item) of score to prevent picking up rubbish data after end
15300IF A%>PX%(PXn%(NBars%)) THEN
15310  IF A%>PX%(PXn%(NBars%))+2*Pgap% ENDPROC ELSE A%=PX%(PXn%(NBars%))
15320  ENDIF
15330REM ensure bar numbers are always completely updated; but don't lose 1st-note draw
15340IF NBars%>2 THEN
15350WHILE PX%(PXn%(BAR%+2))<A% AND BAR%<=NBars%-1
15360 BAR%+=1
15370 ENDWHILE  :REM get to drawstart quickly
15380 IF BAR%>NBars% ENDPROC
15390 PROCGetBarInfo(BAR%)
15400 IF GP%>=GATE% ENDPROC
15410 WHILEPX%(PX%+3)<A%ANDPX%<EX%
15420  PROCskip_gate
15430  ENDWHILE:REM Skip music until A%
15440ELSE
15450 PROCstart_music
15460ENDIF
15470WHILEPX%(PX%)<=B%ANDGP%<GATE%
15480IF?GP% PROCdraw_notes(?GP%):GP%+=1 ELSEPROCdraw_attribute(GP%?1):GP%+=2:IF PLAYING% PROCCheckQ
15490ENDWHILE
15500ENDPROC
15510
15520REM   PROCEDURE: draw_notes(Gate G%)
15530REM
15540REM DESCRIPTION: Get notes from the indicated channel queues and draw the
15550REM              particular types of note in the correct places on the stave.
15560REM              One may be a rest, may have accidentals preceding it, may have
15570REM              dots following it, may be tied
15580REM
15590REM ASSUMPTIONS: Gate is non-zero
15600REM
15610REM Join=?N%(C%)AND2
15620:
15630DEF PROCdraw_notes(G%)
15640LOCAL C%,x%,y%,s%,l%,NC0%,NC1%,lasty%,checkstagger%
15650PX%+=1:REM Move on to next position
15660x%=X%+PX%(PX%):REM Calculate gate column X (convert from work- to screen-coord)
15670checkstagger%=FALSE
15680C%=-1
15690REPEAT
15700REPEATC%-=TRUE:UNTILG%AND%1<<C%
15710NC0%=?N%(C%) : NC1%=N%(C%)?1 :REM fast local vars
15720y%=Y%+Y_STAVE%(S_C%(C%))
15730IFNC0%AND&F8 THEN
15740l%=(NC0%>>3)-16
15750IFABSl%>5 PROCsprite(ledger%+l%DIV2,x%,y%):REM Ledger lines
15760y%+=Li%*l%
15770s%=NC1%>>5ORNC0%<<3AND8
15780IF checkstagger% THEN
15790REM stagger next note if too close to one below
15800REM stagger fails sometimes if channels of 2 adjacent notes are not in draw order?
15810 IF ABS(lasty%-y%)<2*Li% PROCsprite(s%,x%+Pgap%,y%):checkstagger%=FALSE ELSE PROCsprite(s%,x%,y%)
15820ELSE
15830 PROCsprite(s%,x%,y%):checkstagger%=TRUE
15840 ENDIF
15850lasty%=y%
15860IFNC1%AND7 PROCsprite(accidental%ORNC1%AND7,x%-x%(s%),y%)
15870ELSE
15880s%=rest%ORNC1%>>5
15890PROCsprite(s%,x%,y%)
15900ENDIF
15910IFNC1%AND24 PROCsprite(dot%+(NC1%>>3AND3),x%+x%(s%),y%)
15920IFNC0%AND4 PROCsprite(tie%,x%,y%)
15930N%(C%)+=2:REM Pull from note queue
15940UNTIL(2<<C%)>G%:REM Until no more notes (1 bits)
15950ENDPROC
15960::
15970DEF PROCdraw_attribute(A%)
15980LOCALx%,N%
15990N%=TRUE:REPEATN%-=TRUE:UNTILA%AND%1<<N%
16000IFPTYPE%(PX%)EOR%1<<N% PX%+=1
16010x%=X%+PX%(PX%)
16020ONN%+1 PROCdraw_time_sig(A%),PROCdraw_key_sig(A%),PROCdraw_clef(A%),PROCdraw_slur(A%),PROCdraw_octave(A%),PROCdraw_bar_line(A%)
16030ENDPROC
16040
16050DEF PROCPutBarInfo(bar%)
16060REM setup the various pointers to arrays at the start of this bar
16070FOR n%=0 TO 7
16080 BPn%(n%,bar%)=N%(n%)
16090 NEXT
16100PXn%(bar%)=PX%
16110GPn%(bar%)=GP%
16120FOR n%=0 TO Max_Stave%
16130 CLEFn%(n%,bar%)=CLEF%(n%)
16140 NEXT
16150SIGn%(0,bar%)=SIG%(0)
16160SIGn%(1,bar%)=SIG%(1)
16170ENDPROC
16180
16190DEF PROCGetBarInfo(bar%)
16200REM get the values of the data at the start of this bar
16210FOR n%=0 TO 7
16220 N%(n%)=BPn%(n%,bar%)
16230 NEXT
16240PX%=PXn%(bar%)
16250GP%=GPn%(bar%)
16260FOR n%=0 TO Max_Stave%
16270 CLEF%(n%)=CLEFn%(n%,bar%)
16280 NEXT
16290SIG%(0)=SIGn%(0,bar%)
16300SIG%(1)=SIGn%(1,bar%)
16310ENDPROC
16320
16330DEF PROCSetupBarStarts(bar%)
16340REM find pointers to various bits at the starts of all bars through
16350REM the music. Start at bar%
16360REM this is just to speed up redraw, avoiding all the note-skipping
16370LOCAL last%
16380BAR%=bar%
16390IF bar%>0 PROCGetBarInfo(bar%) ELSE PROCstart_music
16400last%=BAR%
16410PROCPutBarInfo(BAR%)
16420WHILE GP%<GATE%
16430 IF?GP% THEN
16440  PROCskip_notes(?GP%):GP%+=1
16450 ELSE
16460  PROCskip_attribute(GP%?1):GP%+=2
16470  IF BAR%<>last% last%=BAR% : PROCPutBarInfo(BAR%)
16480 ENDIF
16490 ENDWHILE
16500BAR%+=1
16510PROCPutBarInfo(BAR%)
16520NBars%=BAR%
16530ENDPROC
16540
16550DEF PROCskip_gate
16560IF?GP% PROCskip_notes(?GP%):GP%+=1 ELSEPROCskip_attribute(GP%?1):GP%+=2
16570ENDPROC
16580
16590DEF PROCskip_notes(G%)
16600PX%+=1
16610LOCALC%:C%=-1
16620REPEATREPEATC%+=1:UNTILG%AND%1<<C%:N%(C%)+=2:UNTIL(2<<C%)>G%
16630ENDPROC
16640
16650DEF PROCskip_attribute(A%)
16660LOCALT%
16670T%=%1:IFA%AND%1 ELSEREPEATT%=T%<<%1:UNTILA%ANDT%
16680CASET%OF
16690WHENTime%,Key%:SIG%(T%-1)=A%
16700WHENClef%:CLEF%(A%>>6)=A%>>3AND3
16710WHENBar%:BAR%+=1
16720ENDCASE
16730IFT%EORPTYPE%(PX%) PX%+=1
16740ENDPROC
16750
16760DEF PROCback_gate
16770IFGP%?-2 GP%-=1:PROCback_notes(?GP%) ELSEGP%-=2:PROCback_attribute(GP%?1)
16780ENDPROC
16790
16800DEF PROCback_notes(G%)
16810PX%-=1
16820LOCALC%:C%=TRUE
16830REPEATREPEATC%-=TRUE:UNTILG%AND%1<<C%:N%(C%)-=2:UNTIL(2<<C%)>G%
16840ENDPROC
16850
16860DEF PROCback_attribute(A%)
16870IFA%=Bar% BAR%-=1
16880IFA%ANDPTYPE%(PX%+1)+TRUE ELSEIFA%ANDPTYPE%(PX%+1) ENDPROC
16890PX%-=1
16900ENDPROC
16910
16920DEF PROCdraw_time_sig(A%)
16930SIG%(0)=A%
16940LOCALS%,B$,D$,w%
16950B$=STR$((A%>>1AND15)+1)
16960D$=STR$(%1<<(A%>>5)-1)
16970w%=x%
16980IFLENB$<2 w%+=PW%(PX%)>>2
16990IFLEND$<2 x%+=PW%(PX%)>>2
17000FORS%=0TOSTAVE%+PERC%
17010MOVEw%,Y%+Y_STAVE%(S%)+Li%*4-Vi%:PRINTB$
17020MOVEx%,Y%+Y_STAVE%(S%)-Vi%:PRINTD$
17030NEXT
17040ENDIF
17050ENDPROC
17060
17070DEF PROCdraw_key_sig(A%)
17080LOCALS%,C%,N%,a%,W%
17090IFA%AND56 SIG%(1)=A% ELSESWAPA%,SIG%(1):a%=accidental%+1:REM Change to C Major uses naturals in old key sig positions
17100N%=(A%>>3AND7)-1
17110IFN%>=0 THEN
17120A%=A%>>2AND%1:REM 0-Sharp or 1-flat signature
17130IFa% ELSEa%=accidental%+2+A%
17140W%=x%(a%)+X%(a%)
17150x%+=x%(a%)
17160FOR C%=0 TO N%
17170FOR S%=0TOSTAVE%
17180PROCsprite(a%,x%,Y%+Y_STAVE%(S%)+Li%*Key_Y%(CLEF%(S%),A%,C%))
17190NEXT
17200x%+=W%
17210NEXT
17220ENDIF
17230ENDPROC
17240
17250DEF PROCdraw_clef(A%)
17260LOCALS%
17270S%=A%>>6
17280CLEF%(S%)=A%>>3AND3
17290IFS%<=STAVE% PROCsprite(clef%+CLEF%(S%),x%,Y%+Y_STAVE%(S%))
17300ENDPROC
17310
17320DEF PROCdraw_slur(A%)
17330ENDPROC
17340
17350DEF PROCdraw_octave(A%)
17360ENDPROC
17370
17380DEF PROCdraw_bar_line(A%)
17390BAR%+=1
17400FORS%=0TOSTAVE%+PERC%
17410PROCsprite(bar%,x%,Y%+Y_STAVE%(S%))
17420NEXT
17430IF BAR%MOD5=0 THEN
17440  MOVE x%+Hi%,Y%+Y_STAVE%(0)+Stave_Height%+2*Vi%
17450  PRINT STR$(BAR%)
17460  ENDIF
17470IF(STAVE%+1)AND2 THEN
17480LOCAL y%
17490MOVEx%+Hi%,Y%+Y_STAVE%(STAVE%)+Stave_Height%DIV2
17500y%=Y_STAVE%(STAVE%-1)-Y_STAVE%(STAVE%)-Stave_Height%
17510DRAW BY 0,y% : MOVE BY Hi%,0 : DRAW BY 0,-y% : REM Connect keyboard staves
17520ENDIF
17530ENDPROC
17540
17550DEF PROCput_down
17560LOCALC%,PX%,X%,Y%,S%,s%
17570SYS "Hourglass_On"
17580GP%=SCRIBE%(sgp%)
17590FORC%=0TO7:N%(C%)=SCRIBE%(C%):NEXT
17600PX%=SCRIBE%(posx%)
17610X%=SCRIBE%(sx%)
17620Y%=SCRIBE%(sy%)
17630s%=SCRIBE%(sprite%)
17640S%=SCRIBE%(stave%)
17650C%=SCRIBE%(sc%)
17660PROCrelease:REM undraw sprite being dragged
17670IFs%<accidental% PROCput_note ELSEIFs%<clef% PROCput_accidental ELSEIFs%<dot% PROCput_clef ELSEIFs%<bar% PROCput_dot ELSEIFs%<time% PROCput_bar ELSEIFs%<key% PROCput_time ELSEIFs%<tie% PROCput_key ELSEPROCput_tie
17680GP%=SCRIBE%(sgp%)
17690FORC%=0TO7:N%(C%)=SCRIBE%(C%):NEXT
17700PROCarrange_stave(SCRIBE%(stave%))
17710IF PX%(EX%)+200*Hi%>S_Width% PROCSetExtent(PX%(EX%)+200*Hi%)
17720IF NOT CHANGED% THEN
17730 CHANGED%=TRUE
17740 $Updated%="YES"
17750 PROCUpdateTitle(FNGetStr(ScoreTitle%)+" *")
17760 ENDIF
17770SYS "Hourglass_Off"
17780ENDPROC
17790
17800DEF PROCput_note
17810LOCALL%,E%
17820L%=SCRIBE%(line%)
17830IFX%=PX%(PX%+1) THEN
17840IFs%>=rest% L%=-16
17850E%=GP%=EP%
17860IFE% PROCinsert_gate(1) ELSEC%=FNconflict(Note%,S%,L%)
17870IFE%ORC%=TRUE THEN
17880C%=FNallocate_channel(S%)
17890IFC%>=0 THEN
17900PROCinsert_note(C%)
17910PROCnote_type(C%,s%AND7)
17920IFs%<rest% PROCnote_line(C%,L%):PROCnote_stem(C%,s%AND8)
17930s%=!N%(C%)
17940IFE% PROCset_score(PX%):X%=PX%(PX%+1)
17950PROCupdate_note(S%,s%,X%,Y%)
17960ENDIF
17970ELSE
17980s%=!N%(C%)
17990PROCdelete_note(C%)
18000IF?GP% THEN
18010PROCupdate_note(S%,s%,X%,Y%)
18020ELSE
18030PROCdelete_gate(1)
18040IFGP%?-2=0 WHILE?GP%=0ANDGP%<EP%:PROCdelete_gate(2):ENDWHILE
18050PROCrescore(PX%)
18060ENDIF
18070ENDIF
18080ELSE
18090IFX%>PX%(PX%+1) PROCskip_gate
18100PROCinsert_gate(1)
18110C%=FNallocate_channel(S%)
18120PROCinsert_note(C%)
18130PROCnote_type(C%,s%AND7)
18140IFs%<rest% PROCnote_line(C%,L%):PROCnote_stem(C%,s%AND8)
18150PROCrescore(PX%)
18160ENDIF
18170ENDPROC
18180
18190DEF PROCput_tie
18200IF?N%(C%)AND4 THEN
18210PROCnote_tie(C%,FALSE)
18220PROCupdate_score(X%+24,Y%+12,X%+70,Y%+24)
18230ELSE
18240LOCALI%
18250PROCnote_tie(C%,TRUE)
18260PROCskip_notes(?GP%):GP%+=1
18270PROCarrange_stave(S%)
18280GP%=SCRIBE%(sgp%)
18290FORI%=0TO7:N%(I%)=SCRIBE%(I%):NEXT
18300IFN%(C%)+2>=FINE%(C%)OR(?N%(C%)EORN%(C%)?2)AND&F8 PROCnote_tie(C%,FALSE) ELSEPROCupdate_score(X%+24,Y%+12,X%+70,Y%+24)
18310ENDIF
18320ENDPROC
18330
18340DEF PROCput_accidental
18350LOCALA%,a%
18360a%=N%(C%)?1AND7
18370A%=s%AND7
18380IFA%=a% A%=0
18390PROCnote_accidental(C%,A%)
18400IFA%*a% PROCupdate_score(X%-34,Y%-24,X%+16,Y%+52) ELSEPROCrescore(PX%)
18410ENDPROC
18420
18430DEF PROCput_dot
18440LOCALD%,d%
18450d%=N%(C%)?1>>3AND3
18460D%=s%AND3
18470IFD%=d% D%=0
18480PROCnote_dots(C%,D%)
18490IFD%*d% THEN
18500s%=N%(C%)?1>>5OR?N%(C%)<<3AND8:IF?N%(C%)AND&F8 ELSEs%=s%ORrest%
18510X%+=x%(s%)
18520PROCupdate_score(X%+24,Y%-8,X%+50,Y%)
18530ELSE
18540PROCrescore(PX%)
18550ENDIF
18560ENDPROC
18570
18580DEF PROCput_clef
18590LOCALc%
18600c%=s%AND3
18610IFGP%=EP%OR?GP%OR(GP%?1AND%111)<>Clef% THEN
18620PROCinsert_gate(2)
18630PROCclef(S%,c%)
18640ELSE
18650WHILE ?GP%=0AND(GP%?1AND%111)=Clef%AND(GP%?1>>6)<>S%ANDGP%<EP%
18660PROCskip_gate
18670ENDWHILE
18680IFGP%<EP%AND?GP%=0AND(GP%?1AND%111)=Clef%AND(GP%?1>>6)=S% THEN
18690IF(GP%?1>>3AND3)<>c% PROCclef(S%,c%) ELSEPROCdelete_gate(2)
18700ELSE
18710PROCinsert_gate(2)
18720PROCclef(S%,c%)
18730ENDIF
18740ENDIF
18750PROCrescore(PX%)
18760ENDPROC
18770
18780DEF PROCput_key
18790IFGP%=EP%OR?GP%OR(GP%?1AND%11)<>Key% THEN
18800PROCinsert_gate(2)
18810PROCkey_sig(KEY_SIG%(0),KEY_SIG%(1))
18820ELSE
18830IFKEY_SIG%(1)>0AND(GP%?1>>2AND%1)<>KEY_SIG%(0)OR(GP%?1>>3)<>KEY_SIG%(1) PROCkey_sig(KEY_SIG%(0),KEY_SIG%(1)) ELSEPROCdelete_gate(2)
18840ENDIF
18850PROCrescore(PX%)
18860ENDPROC
18870
18880DEF PROCput_time
18890IFGP%=EP%OR?GP%OR(GP%?1AND%1)<>Time% THEN
18900PROCinsert_gate(2)
18910PROCtime_sig(TIME_SIG%(0),TIME_SIG%(1))
18920PROCrescore(PX%)
18930ELSE
18940IF(GP%?1>>1AND15)<>TIME_SIG%(0)OR(GP%?1>>5)<>TIME_SIG%(1) THEN
18950PROCtime_sig(TIME_SIG%(0),TIME_SIG%(1))
18960PROCupdate_score(X%,-Score_Height%,X%+48,0)
18970ELSE
18980PROCdelete_gate(2)
18990PROCrescore(PX%)
19000ENDIF
19010ENDIF
19020ENDPROC
19030
19040DEF PROCput_bar
19050IF(?GP%ORGP%?1<>Bar%)ANDX%>PX%(PX%+1)ANDGP%<EP% PROCskip_gate ELSEIFGP%?-2=0ANDGP%?-1=Bar% PROCback_gate
19060IFGP%>MUSIC% THEN
19070IFGP%<EP%AND?GP%=0ANDGP%?1=Bar% THEN
19080PROCdelete_gate(2)
19090NBars%-=1
19100WHILE?GP%=0ANDGP%<EP%
19110PROCdelete_gate(2)
19120ENDWHILE
19130PROCrescore(PX%)
19140ELSE
19150IFGP%?-2 PROCinsert_gate(2):PROCbar:NBars%+=1:PROCrescore(PX%)
19160ENDIF
19170ENDIF
19180ENDPROC
19190
19200DEF PROCrescore(px%)
19210IFpx% ELSEPROCstart_music:REM Bar position assumed set, but reset if px%=0
19220PROCset_score(px%)
19230IF px%=0 PROCSetupBarStarts(0) ELSE PROCSetupBarStarts(FNFindBar(px%))
19240PROCupdate_score(PX%(px%),-Score_Height%,Score_Width%,0)
19250ENDPROC
19260
19270DEF PROCupdate_note(S%,N%,X%,Y%)
19280LOCALlx0%,lx1%,ly0%,ly1%
19290PROCbound_note(N%):REM Get minimum bounding rectangle of note
19300IFN%AND4 lx1%=X%(tie%):IFY%(tie%)>ly1% ly1%=Y%(tie%):REM Tie sets suffix and may be higher (Tie bounds only apply to updating)
19310IFABS(Y%-Y_STAVE%(S%))>Li%*5 THEN
19320IFx%(dot%)>lx0% lx0%=x%(dot%)
19330IFX%(dot%)>lx1% lx1%=X%(dot%):REM Extend to ledger extent
19340ENDIF
19350ly1%+=Y%:Y%-=ly0%:ly0%=Y_STAVE%(S%):REM Stave position
19360IFly1%<ly0%-Li%*5 ly1%=ly0%-Li%*5 ELSEIFY%>ly0%+Li%*5 Y%=ly0%+Li%*5:REM If ledger lines will be drawn increase vertical update space
19370PROCupdate_score(X%-lx0%,Y%,X%+lx1%+Pgap%,ly1%):REM Update symbol space
19380ENDPROC
19390
19400DEF PROCattach(s%,V%)
19410SCRIBE%(sx%)=TRUE:REM New position (Maintain Y for orientation maintainance)
19420SCRIBE%(drawn%)=FALSE
19430IFs%<rest%ANDSCRIBE%(sprite%)<rest% s%=s%AND7ORSCRIBE%(sprite%)AND8:REM Maintain note orientation
19440SCRIBE%(sprite%)=s%
19450SCRIBE%(valid%)=V%
19460SCORING%=TRUE
19470ENDPROC
19480::
19490DEF PROCrelease
19500IFSCORING%ANDSCRIBE%(drawn%) THEN
19510LOCALWindow%:Window%=Icon%+100:REM Don't corrupt window workspace
19520PROCfloat(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%)):REM Undraw sprite
19530IFSCRIBE%(sprite%)<rest% IFABSSCRIBE%(line%)>5 PROCfloat(ledger%+SCRIBE%(line%)DIV2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%))):REM Undraw ledger lines
19540SCRIBE%(sx%)=TRUE:REM Continue drawing of symbol
19550SCRIBE%(drawn%)=FALSE
19560ENDIF
19570ENDPROC
19580::
19590REM   PROCEDURE: scribe(At X%,Y%)
19600REM
19610REM DESCRIPTION: Draw current music symbol at position over score window
19620:
19630DEF PROCscribe(X%,Y%)
19640LOCALS%,L%,C%
19650Window%!handle%=ScoreWind_h%
19660SYS GetWindowState%,,Window%+handle%
19670X%-=Window%!x0%-Window%!scx%
19680Y%-=Window%!y1%-Window%!scy%
19690PROCproximate(SCRIBE%(valid%))
19700IFX%<>SCRIBE%(sx%)ORY%<>SCRIBE%(sy%) THEN
19710LOCALA%
19720A%=TRUE
19730IF(SCRIBE%(valid%)AND112)=96 A%=FALSE:IFC%>=0 A%=SCRIBE%(valid%)AND8ORS%<=STAVE%AND?N%(C%)AND&F8
19740IFA% THEN
19750IFSCRIBE%(drawn%) THEN
19760PROCfloat(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
19770IFSCRIBE%(sprite%)<rest% IFABSSCRIBE%(line%)>5 PROCfloat(ledger%+SCRIBE%(line%)DIV2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
19780ELSE
19790SCRIBE%(drawn%)=TRUE
19800ENDIF
19810IFSCRIBE%(sprite%)<rest% THEN
19820IFABSL%>5 PROCfloat(ledger%+L%DIV2,X%,Y_STAVE%(S%))
19830IFY%<>SCRIBE%(sy%) SCRIBE%(sprite%)=SCRIBE%(sprite%)AND7OR8ANDY%>SCRIBE%(sy%)
19840ENDIF
19850SCRIBE%(sx%)=X%
19860SCRIBE%(sy%)=Y%
19870SCRIBE%(stave%)=S%
19880IFS%<=Max_Stave% SCRIBE%(sclef%)=CLEF%(S%) ELSESCRIBE%(sclef%)=CLEF%(Max_Stave%)
19890SCRIBE%(line%)=L%
19900SCRIBE%(posx%)=PX%
19910SCRIBE%(sgp%)=GP%
19920SCRIBE%(sc%)=C%
19930FORC%=0TO7:SCRIBE%(C%)=N%(C%):NEXT
19940PROCfloat(SCRIBE%(sprite%),X%,Y%)
19950ENDIF
19960ENDIF
19970ENDPROC
19980::
19990REM   PROCEDURE: proximate(Positions valid mask V%)
20000REM
20010REM DESCRIPTION: Will set X%,Y% to be the nearest valid position to the point
20020REM              X%,Y% supplied (all in stave coordinates) and return the
20030REM              associated position index PX%.
20040REM
20050REM              A mask is supplied to indicate the valid positions:
20060REM              V% bit  0 -> Valid Time signature positions
20070REM                      1 -> Valid Key signature positions
20080REM                      2 -> Valid Clef positions
20090REM                      3 -> At note positions
20100REM                      4 -> In between notes
20110REM                      5 -> To nearest stave line (else nearest stave)
20120REM                      6 -> To nearest symbol present
20130REM                      7 -> On bar line if near
20140REM
20150REM   EFFECTS: Sets S%=Stave, L%=Line(-15..15), C%=Channel of note, GP%,N%()=Gate & note pointers, PX%=PX%() index, X%,Y% position
20160:
20170DEF PROCproximate(V%):REM (V%, var X%,Y%) = (S%,L%,PX%)
20180LOCALd%,D%:REM Distance previous&current
20190LOCALpx%,x%:REM Previous PX%, Between note X position
20200LOCALgp%:REM Previous gate pointer, key sig
20210IF NBars%>4 THEN BAR%=LHBAR% ELSE BAR%=0
20220PROCGetBarInfo(BAR%) : REM Start from start of page
20230D%=4*S_Width%:REM A suitably excessive distance
20240IF V%AND7 THEN
20250LOCALT%:REM Type mask
20260X%-=X%(clef%)>>1:REM Pointer points to centre of Clef/Key/Time
20270T%=-V%<<1AND6:REM Valid Clef/Key/Time: Work out types to ignore after bars
20280REPEAT
20290PROCsavp:REM Save previous distance, pointers etc
20300REPEATPROCskip_gate:UNTILPTYPE%(PX%)ANDBar%ORGP%=EP%:REM Move to next bar PX%
20310IFPTYPE%(PX%)ANDBar% THEN
20320WHILEPTYPE%(PX%+1)ANDT%ANDGP%<EP%
20330REPEATPROCskip_gate:UNTILGP%=EP%ORGP%?1AND%111EOR%100:REM Skip ALL clefs
20340ENDWHILE:REM Skipping any T% types
20350D%=ABS(X%-PX%(PX%+1)):REM Calculate distance to this position
20360ELSE
20370D%=2*S_Width%:REM No more bars
20380ENDIF
20390UNTILD%>d%ORGP%=EP%:REM Until distance increases or no more positions
20400IFd%<D% PROCrstp:REM Previous position may be closer
20410X%=PX%(PX%+1):REM Set as position
20420ELSE
20430X%-=X%(2)>>1:REM Pointer points to centre of note
20440REPEAT
20450PROCsavp:REM Save previous distance, pointers etc
20460PROCskip_gate:REM Next symbol
20470WHILEPTYPE%(PX%+1)ANDGP%<EP%:PROCskip_gate:ENDWHILE:REM Skip any attribute types
20480D%=ABS(X%-PX%(PX%+1)):REM Calculate distance to this note position
20490UNTILD%>d%ORGP%=EP%:REM Until distance increases or no more notes
20500IFd%<D%ORGP%=EP%ANDV%AND64 PROCrstp:REM Previous position may be closer (or the last valid note position for an accidental/dot to appear)
20510IFV%AND16ANDGP%<EP% THEN
20520REM Valid between notes (if before last position)
20530IFX%<PX%(PX%+1)ORX%>PX%(EX%) THEN
20540IFPTYPE%(PX%) x%=PX%(PX%)+PW%(PX%)-X%(2) ELSEx%=PX%(PX%):REM Before current: between previous. (also if after last note)
20550x%=x%+PX%(PX%+1)>>1
20560IFV%AND128 x%+=Hi%*4:IFPTYPE%(PX%)=Bar% x%=PX%(PX%)
20570ELSE
20580x%=PX%(PX%+1)+PX%(PX%+2)>>1:REM After current: between next.
20590IFV%AND128 x%+=Hi%*4:IFPTYPE%(PX%+2)=Bar% x%=PX%(PX%+2)
20600ENDIF
20610IFV%AND8ANDABS(PX%(PX%+1)-X%)<ABS(x%-X%) X%=PX%(PX%+1) ELSEX%=x%:REM If on notes also valid then find closest position
20620ELSE
20630X%=PX%(PX%+1):REM Only at notes valid: closest position
20640ENDIF
20650ENDIF
20660C%=-1:REM Initially no channel
20670L%=0:REM Initially centre line
20680IFV%AND64AND?GP%>0 THEN
20690REM To nearest symbol at gate (just note at the moment !!)
20700LOCALG%,c%:REM Gate mask copy, Previous channel counter
20710c%=C%
20720d%=2*S_Height%:REM A suitably excessive distance
20730G%=?GP%
20740REPEAT
20750REPEATC%-=TRUE:UNTILG%AND%1<<C%
20760D%=Y%-Y_STAVE%(S_C%(C%))
20770IF?N%(C%)AND&F8 D%=ABS(D%-Li%*((?N%(C%)>>3)-16)) ELSED%=ABSD%:REM Distance to note/rest
20780IFD%<d% d%=D%:c%=C%
20790UNTIL(2<<C%)>G%
20800C%=c%:REM Nearest note
20810S%=S_C%(C%)
20820IF?N%(C%)AND&F8 L%=(?N%(C%)>>3)-16
20830ELSE
20840LOCALMS%:REM Highest stave number
20850MS%=STAVE%:IFV%AND6 ELSEMS%+=PERC%:REM Clef & Key not on percussion.
20860S%=-1:REM Before first stave
20870D%=2*S_Height%:REM A suitably excessive distance
20880REPEAT
20890d%=D%:REM Copy previous distance
20900S%+=1:REM Next stave
20910D%=ABS(Y%-Y_STAVE%(S%)):REM Distance between point and current stave
20920UNTILD%>d%ORS%=MS%:REM Until distance increases or no more staves
20930S%+=d%<D%:REM Previous stave was closest unless last&current stave is nearer
20940IFV%AND32THEN
20950IFS%=STAVE%+1 S%+=Y%>=Y_STAVE%(STAVE%)-Li%*16:REM Ledger lines take priority over percussion lines
20960IFS%<=STAVE% THEN
20970L%=(Y%-Y_STAVE%(S%))/Li%+16.75:L%-=16:REM Y% is L% Lines away from centre stave
20980IFABSL%>15 L%=15*SGNL%:REM No further than 15 lines away
20990ENDIF
21000ENDIF
21010ENDIF
21020Y%=Y_STAVE%(S%)+L%*Li%:REM Centre line + offset
21030ENDPROC
21040::
21050
21060DEF PROCsavp:n%()=N%():d%=D%:px%=PX%:gp%=GP%:clef%()=CLEF%():sig%()=SIG%():ENDPROC
21070
21080DEF PROCrstp:N%()=n%():PX%=px%:GP%=gp%:CLEF%()=clef%():SIG%()=sig%():ENDPROC
21090
21100DEF PROCSetTempo(T%)
21110Tempo%=T%
21120SYS Sound_QTempo,Tempo%(T%)*128*4096DIV6000
21130ENDPROC
21140
21150REM given x position, return number of bar
21160DEF FNFindBar(xpos%)
21170LOCAL bar%
21180bar%=0
21190WHILE PX%(PXn%(bar%))<xpos% AND bar%<=NBars%:bar%+=1:ENDWHILE
21200IF bar%>0 bar%-=1
21210=bar%
21220
21230DEF PROCplay_start
21240LOCALC%,n%
21250SYS Sound_Configure,8
21260REM set play start bar PBAR% to start of currently displayed window (scx%)
21270Window%!handle%=ScoreWind_h%
21280SYS GetWindowState%,,Window%+handle%
21290PBAR%=FNFindBar(Window%!scx%)
21300PP%=GPn%(PBAR%)
21310FOR n%=0 TO 7
21320 P%(n%)=BPn%(n%,PBAR%)
21330 NEXT
21340FORC%=0TO3
21350PCLEF%(C%)=Clef%(CLEFn%(C%,PBAR%))
21360NEXT
21370PROCplay_key_sig(SIGn%(1,PBAR%))
21380PLAYING%=TRUE
21390SCROLLING%=TRUE
21400Beats%=((SIGn%(0,PBAR%)>>1AND&F)+1)*Length%(SIGn%(0,PBAR%)>>3AND%11100)
21410Q%()=Beats%
21420TIE%=&FF
21430B2%=&10000
21440SYS Sound_QBeat,Beats%
21450SYS Sound_QSchedule,Beats%,Sch%ORSound_QTempo,Tempo%(Tempo%)*128*4096DIV6000
21460C%=Beats%/50*&1000:IFC%>&7FFF C%=&7FFF
21470SYS Sound_QTempo,C%
21480MIDI_OFF%(0,0) = -1
21490MIDI_OFF%(1,0) = -1
21500ENDPROC
21510
21520REM flush sound queue and ensure note_offs are sent to midi channels
21530DEFPROCplay_stop
21540LOCAL note%, n%
21550PLAYING%=FALSE
21560SYS Sound_QInit
21570IF MIDIpresent% THEN
21580 FOR n%=0 TO 1
21590  note%=0
21600  WHILE (MIDI_OFF%(n%,note%) > 0)
21610   SYS MIDI_TxCommand%, MIDI_OFF%(n%,note%)
21620   note%+=1
21630   ENDWHILE
21640  NEXT
21650 REM reset end markers
21660 MIDI_OFF%(0,0) = -1
21670 MIDI_OFF%(1,0) = -1
21680 ENDIF
21690ENDPROC
21700
21710REM This should give a reasonable approximation to a smooth scroll
21720DEF PROCCheckScroll
21730LOCAL PosX%, WindowWidth%, BarPos%, LastScroll%,ThisScroll%
21740IF ScoreClosed% THEN
21750 IF NOT PLAYING% SCROLLING%=FALSE
21760 ENDPROC
21770 ENDIF
21780IF BADMODE% OR PBAR%<=2 ENDPROC
21790IF PLAYING% PROCCheckQ
21800IF PLAYING% SBAR%=PBAR%-2 ELSE B1%=B2%:B2%=BEAT:IFB2%<B1%:SBAR%+=1
21810IF SBAR%>=NBars% OR SBAR%>PBAR%+2 SCROLLING%=FALSE:ENDPROC
21820SYS GetWindowState%,,ScoreWBlk%+handle%
21830WindowWidth%=ScoreWBlk%!x1%-ScoreWBlk%!x0%
21840LastScroll%=ScoreWBlk%!scx%
21850PosX%=PX%(PXn%(SBAR%))
21860BarPos%=(PX%(PXn%(SBAR%+1))-PosX%)*BEAT DIV Beats%
21870IF BarPos%*2<Pgap% ENDPROC :REM if small amount into bar can scroll to wrong bar (sync with play)
21880PosX%+=BarPos%
21890ThisScroll% = PosX%-WindowWidth%DIV2
21900IF ThisScroll%<=0 ENDPROC
21910IF ThisScroll%<>LastScroll% THEN
21920 REM auto-scroll
21930 REM divide scroll into small bits to make it appear smooth
21940 ScoreWBlk%!scx%=(LastScroll%+ThisScroll%)/2
21950 SYS OpenWindow%,,ScoreWBlk%+handle%
21960 ScoreWBlk%!scx%=ThisScroll%
21970 SYS OpenWindow%,,ScoreWBlk%+handle%
21980 LHBAR%=FNFindBar(ThisScroll%)-1 :REM the bar number at the left of the window
21990 IF PLAYING%=FALSE THEN
22000REM stop scrolling at end of music
22010   IF ScoreWBlk%!scx%<=LastScroll% SCROLLING%=FALSE
22020   ENDIF
22030 ENDIF
22040ENDPROC
22050
22060DEF PROCplay_bar
22070LOCALC%,L%,I%,D%,S%,Q%,T%,B%,A%:REM Vars for play_bar & play_notes
22080LOCAL f
22090MIDI_Notenum%=0
22100Q%()=Beats%:REM Reset stave queue counters for next bar
22110B%=PBAR%
22120Accidental%()=0:REM No incidental accidentals initially
22130First%=TRUE
22140WHILEB%=PBAR%ANDPP%<GATE%
22150IF?PP% PROCplay_notes(?PP%):PP%+=1 ELSEPROCplay_attribute(PP%?1):PP%+=2
22160First%=FALSE
22170ENDWHILE
22180IFPP%>=GATE% PLAYING%=FALSE:SBAR%+=1
22190ENDPROC
22200
22210REM Notes for each gate start playing at Q%; the latest Q%() of the staves on
22220REM which notes are to play. This is because all notes in a gate play at the
22230REM same time and cannot start before the shortest of the notes preceding them
22240REM have finished.
22250REM Q% is the time at which the notes in the gate are played
22260REM Q%(S%) is the time at the end of the shortest note played on stave S%.
22270REM QI%(S%) is the current shortest note beats interval on stave S%
22280
22290DEF PROCplay_notes(G%)
22300LOCAL note%, packed%, Qoff%,xtraVol,tempo
22310tempo = 5 * 128 * Tempo%(Tempo%) / 6000
22320Q%=FALSE:C%=TRUE
22330REPEATREPEATC%-=TRUE:UNTILG%AND%1<<C%
22340IFQ%(S_C%(C%))>Q% Q%=Q%(S_C%(C%))
22350UNTIL(2<<C%)>G%
22360QI%()=&10000:C%=TRUE
22370REPEAT
22380  IF First% xtraVol=1.01 ELSE xtraVol=1.0 :REM a little dynamics. stress 1st beat in bar very slightly
22390  REPEATC%-=TRUE:UNTILG%AND%1<<C%
22400  IF INT(xtraVol*Volume%(Volumes%(C%)))>&7F xtraVol=1.0  :REM ensure no overflow
22410  T%=?P%(C%):D%=P%(C%)?1:I%=D%>>3:S%=S_C%(C%):L%=T%>>3:A%=0
22420  IFL%ANDS%<=STAVE% THEN
22430    IFD%AND7 Accidental%(S%,L%)=D%AND7
22440    A%=Accidental%(S%,L%):L%+=PCLEF%(S%):IFA% ELSEA%=Key%(L%MOD7):REM If no accidental then revert to key signature
22450    ENDIF
22460  IFTIE%AND%1<<C% THEN
22470    D%=Duration%(Tempo%)?I%:IFT%AND4 TIE%=TIE%ANDNOT(%1<<C%):T%=P%(C%)+1:REPEATT%+=2:D%+=Duration%(Tempo%)?(?T%>>3):UNTILT%>FINE%(C%)OR4ANDNOTT%?TRUE:IFD%>254 D%=254
22480    IFL% THEN
22490      SOUNDC%+1,INT(xtraVol*Volume%(Volumes%(C%)))OR&100,Line(L%)+Aoff(A%),D%,Q%
22500      IF MIDIpresent% THEN
22510        IF (MIDIChannel%(C%)>=1) AND (MIDIChannel%(C%)<=16) THEN
22520          note% = 12 + INT(((Line(L%)+Aoff(A%))/&1000) * 12)
22530          packed% = (MIDIChannel%(C%)-1) OR (note%<<8) OR INT(xtraVol*(Volume%(Volumes%(C%)))<<16)
22540          MIDI_OFF%(PBAR%MOD2,MIDI_Notenum%) = M_NoteOff% OR packed%
22550          MIDI_Notenum% += 1
22560          MIDI_OFF%(PBAR%MOD2,MIDI_Notenum%) = -1 :REM end marker
22570          REM D% = no. of 5 centisecs
22580          Qoff% = Q% + D% * tempo
22590          IF Qoff% > Q% + 15 Qoff% -= 10  :REM ensure note is off after start and before next note start
22600          SYS Sound_QSchedule,Q%,    Sch% OR MIDI_TxCommand%, M_NoteOn%  OR packed%
22610          SYS Sound_QSchedule,Qoff%, Sch% OR MIDI_TxCommand%, M_NoteOff% OR packed%
22620          ENDIF
22630        ENDIF
22640      ENDIF
22650  ELSE
22660    IF4ANDNOTT% TIE%=TIE%OR%1<<C%
22670    ENDIF
22680  P%(C%)+=2:IFLength%(I%)<QI%(S%) QI%(S%)=Length%(I%):Q%(S%)=Q%+QI%(S%)
22690  UNTIL(2<<C%)>G%
22700ENDPROC
22710
22720DEF PROCplay_attribute(A%)
22730C%=TRUE:REPEATC%-=TRUE:UNTILA%AND%1<<C%
22740ONC%+1 PROCplay_time_sig(A%),PROCplay_key_sig(A%),PROCplay_clef(A%),PROCplay_slur(A%),PROCplay_octave(A%),PROCplay_bar_line(A%)
22750ENDPROC
22760
22770DEF PROCplay_time_sig(A%)
22780A%=((A%>>1AND&F)+1)*Length%(A%>>3AND%11100)
22790SYS Sound_QSchedule,Beats%,Sch%ORSound_QBeat,A%
22800Beats%=A%
22810ENDPROC
22820
22830DEF PROCplay_key_sig(A%)
22840LOCALN%:A%=A%>>2
22850FORN%=0TO6:Key%(N%)=Key_Sig%(A%,N%):NEXT
22860ENDPROC
22870
22880DEF PROCplay_clef(A%)
22890PCLEF%(A%>>6)=Clef%(A%>>3AND3)
22900ENDPROC
22910
22920DEF PROCplay_slur(A%)
22930ENDPROC
22940
22950DEF PROCplay_octave(A%)
22960ENDPROC
22970
22980DEF PROCplay_bar_line(A%)
22990PBAR%+=1
23000ENDPROC
23010
23020DEF FNinitialise
23030LOCAL SoundEnable%
23040PROCEnumerateSWIs
23050PROCinitialise_miscellany
23060PROCinitialise_screen
23070PROCinitialise_sprites
23080PROCinitialise_wimp
23090SoundEnable%=FNinitialise_sound
23100PROCinitialise_music
23110PROCinitialise_menu
23120IF SoundEnable%=1 IF FNCheckOK("Sound is not enabled. Do you wish to quit?", 3) PROCterminate
23130=TRUE
23140
23150DEF PROCEnumerateSWIs
23160LOCALW%:W%        = &400C0
23170SpriteOp%          = &2E
23180Initialise%        = W%+0
23190CreateWindow%      = W%+1
23200CreateIcon%        = W%+2
23210OpenWindow%        = W%+5
23220CloseWindow%       = W%+6
23230Poll%              = W%+7
23240RedrawWindow%     = W%+8
23250UpdateWindow%      = W%+9
23260GetRectangle%      = W%+10
23270GetWindowState%    = W%+11
23280SetIconState%      = W%+13
23290GetIconInfo%       = W%+14
23300GetPointerInfo%    = W%+15
23310DragBox           = W%+16
23320ForceRedraw       = W%+17
23330CreateMenu        = W%+20
23340DecodeMenu        = W%+21
23350SetExtent         = W%+23
23360OpenTemplate      = W%+25
23370CloseTemplate     = W%+26
23380LoadTemplate      = W%+27
23390CloseDown         = W%+29
23400SYS "OS_SWINumberFromString",0,"Wimp_SendMessage" TO SendMessage
23410SYS "OS_SWINumberFromString",0,"Wimp_GetWindowOutline" TO GetWindowOutline
23420SYS "OS_SWINumberFromString",0,"Wimp_SetColour" TO SetColour
23430
23440LOCAL S0,S1,S2
23450SYS "OS_SWINumberFromString",0,"Sound_Configure" TO S0
23460SYS "OS_SWINumberFromString",0,"Sound_Volume"    TO S1
23470SYS "OS_SWINumberFromString",0,"Sound_QInit"     TO S2
23480Sound_Configure       = S0
23490Sound_Enable          = S0+1
23500Sound_Stereo          = S0+2
23510Sound_Volume          = S1
23520Sound_InstallVoice    = S1+3
23530Sound_AttachVoice     = S1+5
23540Sound_Control         = S1+9
23550Sound_QInit           = S2
23560Sound_QSchedule       = S2+1
23570Sound_QRemove         = S2+2
23580Sound_QFree           = S2+3
23590Sound_QTempo          = S2+5
23600Sound_QBeat           = S2+6
23610Sch%=&F000000
23620LOCAL M%
23630LOCAL ERROR
23640ON ERROR LOCAL MIDIpresent%=FALSE : ENDPROC
23650SYS "OS_SWINumberFromString",0,"MIDI_SoundEnable" TO M%
23660M_NoteOff% = &80
23670M_NoteOn%  = &90
23680MIDI_SoundEnable%        = M%
23690MIDI_SetTxChannel%       = M% + 2
23700MIDI_SetTxActiveSensing% = M% + 3
23710MIDI_TxCommand%          = M% + 10
23720MIDI_TxLocalControl%     = M% + 15
23730MIDI_TxOmniModeOff%      = M% + 17
23740MIDI_TxOmniModeOn%       = M% + 18
23750MIDI_TxMonoModeOn%       = M% + 19
23760MIDI_TxPolyModeOn%       = M% + 20
23770MIDI_TxProgramChange%    = M% + 21
23780MIDI_TxSystemReset%      = M% + 30
23790MIDIpresent%=TRUE : REM disable untested MIDI bits
23800ENDPROC
23810
23820DEF PROCinitialise_miscellany
23830DIM Resourcedir 255
23840LOCAL len
23850SYS "OS_ReadVarVal", "Maestro$dir", Resourcedir, 255, 0, 0 TO ,,len
23860Resourcedir?len=13 : REM It needs a cr termination
23870Resourcedir$=$Resourcedir
23880TIME=0
23890AwaitingAck%=FALSE
23900DRAGGING%=FALSE
23910SAVING%=FALSE
23920PLAYING%=FALSE
23930SCROLLING%=FALSE
23940TRANSCRIBE%=TRUE
23950DIM String_Space% 256
23960OS_File=&8
23970Sprite$=Resourcedir$+".Sprites"
23980CHANGED%=FALSE
23990FILE%=FALSE
24000laddr%=0
24010eaddr%=0
24020ENDPROC
24030
24040DEF PROCinitialise_screen
24050DIM modeblockin  40
24060DIM modeblockout 40
24070PROCgetmodeinfo(TRUE)
24080PROCset_colours
24090ENDPROC
24100
24110DEF PROCset_colours
24120LOCALC%
24130REM colours defined in memo from WStoye 21/7/88
24140C_MenuTitlefg = 7
24150C_MenuTitlebg = 2
24160C_Menufg = 7
24170C_Menubg = 0
24180C_MenuItemfg = 7
24190C_MenuItembg = 0
24200ENDPROC
24210
24220DEF PROCgetmodeinfo(new)
24230LOCAL S_Rows%, S_Columns%
24240modeblockin!0=0 : REM ModeFlags
24250modeblockin!4=1 : REM ScrRCol
24260modeblockin!8=2 : REM ScrBCol
24270modeblockin!12=3 : REM NColour
24280modeblockin!16=4 : REM XEigFactor
24290modeblockin!20=5 : REM YEigFactor
24300modeblockin!24=11 : REM XWindLimit
24310modeblockin!28=12 : REM YWindLimit
24320modeblockin!32=-1 : REM terminate list
24330SYS "OS_ReadVduVariables",modeblockin, modeblockout
24340BADMODE% = FALSE : REM ((modeblockout!12)>15) :REM doesn't work in 256-colour modes
24350REM no point in reading sizes since they are fixed by the wimp
24360Hi%=1<<(modeblockout!16)
24370Vi%=1<<(modeblockout!20)
24380S_Width%=Hi% * ((modeblockout!24)+1)
24390S_Height%=Vi% * ((modeblockout!28)+1)
24400Hi%=2: Vi%=4
24410C_Width%=8*Hi% : C_Height%=8*Vi%
24420IF NOT new THEN
24430  IF NOT BADMODE% SYS"Wimp_ReadPixTrans",&200,SprBlk%,S%(0),,,,factors%,pixtrans%
24440  ENDIF
24450ENDPROC
24460
24470DEF PROCinitialise_sprites
24480DIM factors% 16
24490DIM pixtrans% 16
24500SYS "Wimp_SpriteOp", 11,,Resourcedir$+".!Sprites" :REM merge music file type sprite into wimp sprite area
24510SpriteLen% = 10000
24520DIM SprBlk% SpriteLen%
24530!SprBlk% = SpriteLen%        :REM initialise private sprite area
24540SprBlk%!4 = 0
24550SprBlk%!8 = 16
24560SprBlk%!12 = 16
24570SYS SpriteOp%, 512+10, SprBlk%, Sprite$ :REM *SLOAD equivalent
24580SprPlot% = &234  : REM sprite plot code
24590LOCAL I%,N%,x%,y%,W%,H%
24600RESTORE
24610N%=-1
24620READS$
24630WHILES$<>""
24640READx%,y%,W%,H%,S$
24650N%+=1
24660ENDWHILE
24670IFFNassert(N%>=0,"loading sprite data.") STOP
24680DIM S$(N%),x%(N%),y%(N%),X%(N%),Y%(N%), S%(N%) : REM S%() are sprite pointers
24690RESTORE
24700FORI%=0TON%
24710READ S$(I%),x%,y%,W%,H%
24720SYS SpriteOp%, 256+24, SprBlk%, S$(I%) TO ,,S%(I%) : REM get pointer to sprite
24730x%(I%)=x%*Hi%
24740y%(I%)=y%*Vi%
24750X%(I%)=(W%-x%)*Hi%
24760Y%(I%)=(H%-y%)*Vi%
24770NEXT
24780note%=0
24790rest%=16
24800accidental%=24
24810clef%=32
24820high%=36
24830dot%=44
24840ledger%=47
24850bar%=48
24860time%=55
24870key%=56
24880tie%=57
24890pointer%=58
24900DIM SL%(N%,1):REM List & item indexes for each sprite (set in list definitions)
24910SCORING%=FALSE:REM Flag indicating a sprite is to be drawn under the pointer
24920wasSCORING%=FALSE
24930stopSCORING%=TRUE
24940SCORING%=FALSE
24950DIM SCRIBE%(18):REM Details of symbol under pointer
24960REM 0-7 Channel pointers into N%()
24970sx%=8:REM Current sprite X position
24980sy%=9:REM Current sprite Y position
24990drawn%=10:REM Flag indicating sprite presence
25000sprite%=11:REM Sprite number
25010valid%=12:REM Valid stave positions
25020stave%=13:REM Current stave symbol is on
25030sclef%=14:REM Current clef applying to symbol (used for key sigs)
25040line%=15:REM Current stave line symbol is on
25050posx%=16:REM X music position
25060sgp%=17:REM Symbol gate pointer
25070sc%=18:REM Channel number if symbol specified close to note
25080PROCgetmodeinfo(FALSE)
25090ENDPROC
25100REM name, x, y, w, h
25110DATA B,7,3,26,7,SB,0,2,12,5,Mu,0,2,11,15,Cu,0,2,11,15,Qu,0,2,17,17,SQu,0,2,17,17,DSQu,0,2,17,17,SDSQu,0,2,17,17
25120DATA B,7,3,26,7,SB,0,2,12,5,Md,0,12,11,15,Cd,0,12,11,15,Qd,0,14,11,17,SQd,0,14,11,17,DSQd,0,14,11,17,SDSQd,0,14,11,17
25130DATA Rest,-1,-1,8,4,Rest,-1,-2,8,4,Rest,-1,0,8,4,Rest4,-2,5,7,12,Rest8,-1,4,9,8,Rest16,0,8,11,12,Rest32,1,8,13,16,Rest64,2,12,15,20
25140DATA M,0,2,11,5,Natural,8,6,7,13,Sharp,10,5,9,11,Flat,8,3,7,12,Sharp2,9,2,8,5,Flat2,14,3,13,12,NSharp,17,6,16,13,NFlat,15,6,14,15
25150DATA Treble,0,16,18,31,Alto,0,8,16,19,Alto,0,4,16,19,Bass,0,7,20,17
25160DATA Bh,7,3,26,7,SBh,0,2,12,5,Mh,0,2,11,5,Ch,0,2,11,5
25170DATA ldg5,2,28,15,17,ldg4,2,24,15,13,ldg3,2,20,15,9,ldg2,2,16,15,5,ldg1,2,12,15,1
25180DATA Dot1,-12,2,3,2,Dot2,-12,2,8,2,Dot3,-12,2,13,2,Bar,-1,8,2,17,C,0,2,11,5
25190DATA ldg1,2,-12,15,1,ldg2,2,-12,15,5,ldg3,2,-12,15,9,ldg4,2,-12,15,13,ldg5,2,-12,15,17
25200DATA Time,1,9,25,19,Key,0,13,0,30,Tie,-12,-3,23,3,""
25210
25220DEF PROCinitialise_wimp
25230PROCenumerate_wimp_offsets
25240task%=ASC("T")+(ASC("A")<<8)+(ASC("S")<<16)+(ASC("K")<<24)
25250SYS Initialise%, 200, task%, "Maestro" TO ,Task_h%
25260Mouse_X%=640:Mouse_Y%=560
25270PTIME%=0
25280DIM SpriteName% 14
25290$SpriteName%="!Maestro"
25300!Icon%=-1: REM iconbar utility
25310Icon%!4=0
25320Icon%!8=0
25330Icon%!12=64
25340Icon%!16=68
25350Icon%!20=(&311A OR (0<<24) OR (7<<28)) :REM indirected
25360Icon%!24=SpriteName% :REM indirected name
25370Icon%!28=1 :REM use common sprite area
25380Icon%!32=12 :REM name length
25390SYS CreateIcon%, ,Icon% TO Maestro_h%
25400PROCload_templates
25410ENDPROC
25420
25430DEF PROCenumerate_wimp_offsets
25440DIM Wimp_Space% &4000
25450Window%=Wimp_Space%+4
25460handle%=-4
25470x0%=0:y0%=4:x1%=8:y1%=12
25480scx%=16:scy%=20
25490under%=24
25500flags=28:status=30
25510tFrgd=32:tBkgd=33:Frgd=34:Bkgd=35
25520sbo=36:sbi=37
25530tHigh=38
25540title_flags=56
25550work_area_flags=60
25560sprite_area=64
25570title=72
25580icons=84
25590icon_defs=88
25600Icon%=Wimp_Space%+4
25610iflags=16
25620Colour=19
25630idata=20
25640Mouse%=Wimp_Space%
25650buttons=8
25660window=12
25670icon=16
25680old_buttons=20
25690colour=23
25700state=4
25710mask=8
25720Clip%=Window%+24
25730key=20
25740ENDPROC
25750
25760DEF PROCload_templates
25770LOCAL size, end
25780DIM windowname 12
25790DIM ScoreWBlk% 32
25800DIM NotePBlk% 32
25810DIM SharpPBlk% 32
25820DIM RestPBlk% 32
25830DIM ScoreTitle% 256
25840size = 1000
25850dialogsize = 3000
25860DIM InstrIndirect size : REM buffer for indirected text of instruments list
25870ScoreWBlk%-=handle%
25880DIM DialogIndirect dialogsize : REM buff for indirected text of dialog boxes
25890NotePBlk%-=handle%
25900SharpPBlk%-=handle%
25910RestPBlk%-=handle%
25920SYS OpenTemplate, ,Resourcedir$+".Templates"
25930$windowname="ScoreWind"
25940SYS LoadTemplate, ,Window%, ScoreTitle%, ScoreTitle%+255, -1, $windowname, 0
25950Window%!68=&10001 :REM reserved word sets min window size. to other than title size
25960SYS CreateWindow%, ,Window% TO ScoreWind_h%
25970ScoreWBlk%!handle%=ScoreWind_h%
25980SYS GetWindowState%, ScoreWind_h%, ScoreWBlk%+handle%
25990$windowname="SharpsPane"
26000SYS LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
26010Window%!64=SprBlk% :REM use private sprite area
26020SYS CreateWindow%,, Window% TO SharpsPane_h%
26030SharpPBlk%!handle%=SharpsPane_h%
26040SYS GetWindowState%,, SharpPBlk%+handle%
26050SharpPBlk%!under%=-1
26060$windowname="RestsPane"
26070SYS LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
26080Window%!64=SprBlk% :REM use private sprite area
26090SYS CreateWindow%, ,Window% TO RestsPane_h%
26100RestPBlk%!handle%=RestsPane_h%
26110SYS GetWindowState%,, RestPBlk%+handle%
26120RestPBlk%!under%=SharpsPane_h%
26130$windowname="NotesPane"
26140SYS LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
26150Window%!64=SprBlk% :REM use private sprite area
26160SYS CreateWindow%, ,Window% TO NotesPane_h%
26170NotePBlk%!handle%=NotesPane_h%
26180SYS GetWindowState%,, NotePBlk%+handle%
26190NotePBlk%!under%=RestsPane_h%
26200PaneHeight%=Window%!y1%-Window%!y0%
26210SelW%=NotesPane_h%:SelI%=0
26220$windowname="InstrWind"
26230 SYS LoadTemplate, ,Window%, InstrIndirect, InstrIndirect+size, -1, $windowname, 0
26240IF NOT MIDIpresent% Window%!8-=100:Window%!48-=100:REM hide MIDI column in window
26250SYS CreateWindow%, ,Window%  TO InstrWind_h%
26260LOCAL n%
26270DIM StaveStr%(7), VoiceStr%(7), VolumeStr%(7), StereoStr%(7), MIDIChStr%(7) :REM pointers to icon strings
26280VoiceSize%=20 : VolSize%=4 : SterSize%=14 : MIDIChSize%=3
26290FOR n%=0 TO 7
26300  StaveStr%(n%)  = InstrIndirect + n%*14
26310  NEXT
26320InstrIndirect+=8*14
26330FOR n%=0 TO 7
26340  VoiceStr%(n%)  = InstrIndirect + n%*VoiceSize%
26350  VolumeStr%(n%) = InstrIndirect + 8*VoiceSize% + n%*VolSize%
26360  StereoStr%(n%) = InstrIndirect + 8*VoiceSize% + 8*VolSize% + n%*SterSize%
26370  MIDIChStr%(n%) = InstrIndirect + 8*VoiceSize% + 8*VolSize% +  8*SterSize% +n%*MIDIChSize%
26380  IF NOT MIDIpresent% PROCUpdateIcon(InstrWind_h%, 32+n%, 1<<22, 0) :REM make icons unselectable
26390  NEXT
26400end=DialogIndirect+dialogsize
26410$windowname="progInfo"
26420SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26430SYS CreateWindow%, ,Window%  TO ProgInfo_h%
26440DialogIndirect+=13 : REM skip indirected window title
26450$DialogIndirect = "Maestro"         : DialogIndirect+=40
26460$DialogIndirect = "Music player"    : DialogIndirect+=40
26470$DialogIndirect = "Acorn Computers" : DialogIndirect+=40
26480$DialogIndirect = VersionStr$       : DialogIndirect+=30
26490$windowname="query"
26500SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26510SYS CreateWindow%, ,Window%  TO AbortQuery_h%
26520DialogIndirect+=100 :REM "music not saved etc."
26530DialogIndirect+=100
26540DIM FileSpriteName% 16
26550$FileSpriteName%="file_"+STR$~MusicFileType%
26560$windowname="xfer_send"
26570SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26580Window%!64=1 :REM use common sprite area
26590SpriteIcon%=Window%+88+32*2  :REM pointer to icon number 2 in save window
26600SpriteIcon%!16=SpriteIcon%!16 OR 1<<1 OR 1<<8 :REM indirected sprite
26610SpriteIcon%!16=SpriteIcon%!16 AND NOT 1 :REM not text
26620SpriteIcon%!24=1 :REM wimp area pointer
26630SpriteIcon%!28=12
26640SYS CreateWindow%, ,Window%  TO Save_h%
26650SaveText=DialogIndirect
26660$SaveText="MusicFile"+CHR$(0) : DialogIndirect+=255
26670SaveSprite%=DialogIndirect :REM address of file type sprite in save window
26680DialogIndirect+=16
26690$SaveSprite%=$FileSpriteName%
26700$windowname="dboxfile_db"
26710SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26720SYS CreateWindow%, ,Window%  TO Load_h%
26730DialogIndirect+=30 : LoadText=DialogIndirect
26740$LoadText=$SaveText : DialogIndirect+=255
26750$windowname="TimeSigW"
26760SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26770SYS CreateWindow%, ,Window%  TO TimeSig_h%
26780BarLength%=DialogIndirect : DialogIndirect+=3
26790NoteValue%=DialogIndirect : DialogIndirect+=3
26800$windowname="BarW"
26810SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26820SYS CreateWindow%, ,Window%  TO Bar_h%
26830BarNum%=DialogIndirect : DialogIndirect+=15 :REM allow for validation str
26840$windowname="FileInfo"
26850SYS LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
26860Window%!64=1 :REM use common sprite area
26870SpriteIcon%=Window%+88+32*6  :REM pointer to icon number 6 in save window
26880SpriteIcon%!16=SpriteIcon%!16 OR 1<<1 OR 1<<8 :REM indirected sprite
26890SpriteIcon%!16=SpriteIcon%!16 AND NOT 1 :REM not text
26900SpriteIcon%!24=1 :REM wimp area pointer
26910SpriteIcon%!28=12
26920SYS CreateWindow%, ,Window%  TO FileInfo_h%
26930ThisFile%=DialogIndirect : DialogIndirect+=255
26940Updated%=DialogIndirect : DialogIndirect+=12
26950FileType%=DialogIndirect : DialogIndirect+=20
26960FileSize%=DialogIndirect : DialogIndirect+=20
26970FileDate%=DialogIndirect : DialogIndirect+=100
26980FileTypeSprite%=DialogIndirect :REM address of file type sprite in window
26990$FileTypeSprite%=$FileSpriteName% : DialogIndirect+=16
27000$ThisFile%="<untitled>"
27010$Updated%="NO"
27020F$="<untitled>"
27030$ThisFile%=F$+CHR$(0)
27040$ScoreTitle%=F$+CHR$(0)
27050SYS CloseTemplate
27060IF FNassert(DialogIndirect<end-10, "Not enough memory to load window templates.") : STOP
27070ScoreClosed%=FALSE
27080ENDPROC
27090
27100DEF PROCinitialise_menu
27110LOCAL item$, sub%, MenuBlock, SubMenuBlock, MenuEnd, MenuItemsList
27120LOCAL nextsub%, flags%, m%, width%
27130MenuSize% = 28+(20*24)
27140DIM MenuStart 15*MenuSize%  :REM allow 15 menus max
27150MenuEnd=MenuStart+15*MenuSize%
27160DIM MenuString 14*4
27170DIM StaveNum% 1 : REM buffers for writeable icons
27180DIM ValstrS 10
27190RESTORE +0
27200MenuBlock=MenuStart
27210READ item$
27220WHILE item$>""
27230 CASE LEFT$(item$,3) OF
27240  WHEN "Mae" : IconMenu%=MenuBlock
27250REM note there are 2 "Maestro" menus. IconMenu% is the 2nd
27260  WHEN "Sta" : StaveMenu%=MenuBlock
27270  WHEN "Vol" : VolumeMenu%=MenuBlock
27280  WHEN "Tem" : TempoMenu%=MenuBlock
27290  WHEN "Maj" : MajorMenu%=MenuBlock
27300  WHEN "Min" : MinorMenu%=MenuBlock
27310  ENDCASE
27320 $MenuBlock = item$
27330 MenuBlock?12 = C_MenuTitlefg
27340 MenuBlock?13 = C_MenuTitlebg
27350 MenuBlock?14 = C_Menufg
27360 MenuBlock?15 = C_Menubg
27370 READ width%
27380REM adjust menu width
27390 MenuBlock!16 = width% * C_Width%
27400 MenuBlock!20 = 44
27410 MenuBlock!24 = 0
27420 MenuItemsList=MenuBlock+28
27430 SubMenuBlock=MenuBlock+MenuSize%
27440 nextsub%=SubMenuBlock
27450 READ item$
27460 WHILE item$>""
27470   READ sub%
27480   IF sub%=0 sub%=-1 ELSE sub%=nextsub% : nextsub%+=MenuSize%
27490   IF FNassert(sub%<MenuEnd, "Menu too big.") STOP
27500REM pointers to windows
27510   CASE LEFT$(item$,4) OF
27520    WHEN "Inst" : sub%=InstrWind_h%
27530    WHEN "Info" : sub%=ProgInfo_h%
27540    WHEN "Save" : sub%=Save_h%
27550    WHEN "File" : sub%=FileInfo_h%
27560    WHEN "Time" : sub%=TimeSig_h%
27570    WHEN "Goto" : sub%=Bar_h%
27580    ENDCASE
27590   $(MenuItemsList+12) = item$+CHR$(0)
27600   MenuItemsList!4 = sub%
27610   MenuItemsList!8 = &21 OR (C_MenuItemfg<<24) OR (C_MenuItembg<<28)
27620   READ flags%
27630   !MenuItemsList=flags% AND %111
27640   REM indirect writeable icons
27650   IF flags%AND4 THEN
27660    MenuItemsList!8 = (MenuItemsList!8) OR 1<<8 :REM set indirect bit
27670    CASE LEFT$(item$,4) OF
27680     WHEN "Stav"
27690      MenuItemsList!12=StaveNum%   :REM buffer pointer
27700      $ValstrS="a1-4"
27710      MenuItemsList!16 = ValstrS :REM validation string
27720      MenuItemsList!20 = 2 :REM buffer length
27730     ENDCASE
27740    ENDIF
27750   MenuItemsList+=24
27760   READ item$
27770   ENDWHILE
27780 REM last item
27790 MenuItemsList-=24
27800 !MenuItemsList = !MenuItemsList OR &80 : REM last item
27810 READ item$
27820 MenuBlock=SubMenuBlock
27830ENDWHILE
27840$BarLength%="4"
27850PROCSetVolume(6) : REM ff
27860PROCSetTempo(8)  : REM moderato
27870$StaveNum%=LEFT$(STR$(STAVE%+1),1)
27880item% = FNFindMenuItem("+percussion", StaveMenu%)
27890IF (item%>=0) !item% = FNSetBit(PERC%=1, !item%, 0):REM set or clear tick
27900REM abstracted from set key sig
27910LOCAL n
27920IF KEY_SIG%(1) n=accidental%+2+KEY_SIG%(0) : X%(key%)=(x%(n)+X%(n))*KEY_SIG%(1) ELSE X%(key%)=x%(accidental%+2)+X%(accidental%+2)
27930CONFIRM%=FALSE
27940ENDPROC
27950REM [title, width, [item, 1 if sub_menu pointer, flags] ]
27960DATA "Maestro", 12
27970DATA "Save",0,0, "File",0,0, "Clear",0,2
27980DATA "Staves",1,0, "Instruments",0,0, "Volume",1,0, "Tempo",1,2
27990DATA "Time sig.",0,0, "Key sig.",1,2
28000DATA "Goto",0,0, "Play",0,0,""
28010DATA "Staves",12
28020DATA "StaveNum",0,4, "+percussion",0,0,""
28030REM 4 indicates writeable
28040DATA "Volume",4
28050DATA "ppp",0,0, "pp",0,0, "p",0,0, "mp",0,0, "mf", 0,0
28060DATA "f",0,0, "ff",0,1, "fff",0,0,""
28070DATA "Tempo",12
28080DATA "Largissimo",0,0, "Largo",0,0, "Larghetto",0,0, "Grave",0,0
28090DATA "Adagio",0,0, "Adagietto",0,0, "Andante",0,0, "Andantino",0,0
28100DATA "Moderato",0,1, "Allegretto",0,0, "Allegro",0,0, "Vivace",0,0
28110DATA "Veloce",0,0, "Presto",0,0, "Prestissimo",0,0,""
28120DATA "Key sig.",6
28130DATA "Major",1,0, "Minor",1,0,""
28140DATA "Major",3
28150DATA "Cb",0,0, "Gb",0,0, "Db",0,0, "Ab",0,0, "Eb",0,0, "Bb",0,0, "F",0,2
28160DATA "C", 0,3 : REM dotted line and tick
28170DATA "G", 0,0, "D", 0,0, "A", 0,0, "E", 0,0, "B", 0,0, "F#",0,0, "C#",0,0,""
28180DATA "Minor",3
28190DATA "Ab",0,0, "Eb",0,0, "Bb",0,0, "F", 0,0, "C", 0,0, "G", 0,0, "D",0,2
28200DATA "A", 0,3 : REM dotted line and tick
28210DATA "E", 0,0, "B", 0,0, "F#",0,0, "C#",0,0, "G#",0,0, "D#",0,0, "A#",0,0,""
28220DATA "Maestro",5
28230DATA "Info",0,0, "Quit",0,0,""
28240DATA ""
28250
28260DEF FNFindMenuItem(item$, menu%) : REM return pointer to menu item
28270LOCAL item%,this$
28280item$=LEFT$(item$,3)
28290item%=menu%+28
28300this$=LEFT$($(item%+12),3)
28310IF (this$ <> item$) THEN
28320  REPEAT
28330    item%+=24
28340    this$=LEFT$($(item%+12),3)
28350    UNTIL ( (this$ = item$) OR (!item% AND &80)>0 )
28360  ENDIF
28370IF (this$ <> item$) THEN =-1 : REM not found
28380=item%
28390
28400DEF FNinitialise_sound
28410LOCAL SoundEnable%
28420SYS Sound_Configure,8 TO PrevConfigure
28430SYS Sound_Enable,0 TO SoundEnable%
28440REM disconnect midi interpreter
28450IF MIDIpresent% SYS MIDI_SoundEnable%,0
28460=SoundEnable%
28470
28480DEF PROCClearAllMusic
28490FINE%()=MUSIC%()
28500PP%=MUSIC%:P%()=MUSIC%()
28510NBars%=0 :REM number of bars
28520BAR%=0:REM Current bar number
28530PBAR%=0:REM Playing bar counter
28540SBAR%=0:REM scrolling bar number
28550PROCstart_music:REM Set pointers to start of music store
28560EP%=GP%
28570PROCbar:REM Music always starts off with a bar
28580GATE%=MUSIC%+2:REM End of minimum score
28590PX%(0)=0:REM Score starts at left window edge
28600PXn%(BAR%)=0
28610PW%(0)=4*Hi%:REM Bar width
28620PTYPE%(0)=Bar%:REM Score starts with a bar
28630GP%=MUSIC%:REM Reset gate pointer for set score
28640GPn%(BAR%)=GP%
28650PROCrescore(0)
28660PROCSetExtent(S_Width%)
28670PROCrelease
28680wasSCORING%=FALSE
28690stopSCORING%=TRUE
28700SCORING%=FALSE
28710CHANGED%=FALSE
28720$Updated%="NO"
28730PROCUpdateTitle("<untitled>")
28740$SaveText="MusicFile"+CHR$(0)
28750$LoadText="MusicFile"+CHR$(0)
28760n=FNGetFileInfo("") :REM clear file info stuff
28770$FileDate%=""
28780ENDPROC
28790
28800REM   PROCEDURE: initialise_music
28810REM
28820REM  STRUCTURES: Queue of Gate;
28830REM              Queue of Music;
28840REM
28850REM       TYPES:  Gate= byte0>0 -> Gate_Mask
28860REM                     byte0=0 -> Music_Attribute
28870REM
28880REM          Gate_Mask= byte; bitn=1 -> gate 1 note/rest from music queue n (n=0-7)
28890REM
28900REM    Music_Attribute= word; bit0_7=0
28910REM                             bit8=1 -> Time signature bit12_9 No. beats-1
28920REM                                                      bit15_13 Beat type
28930REM                             bit9=1 -> Key signature bit10 0-#, 1-b
28940REM                                                     bit13_11 0-7
28950REM                            bit10=1 -> Clef bit12_11 Treble,Alto,Tenor,Bass
28960REM                                            bit15_14 Stave 1-4
28970REM                            bit11=1 -> Slur switch bit12 on/off
28980REM                                                   bit15_14 Stave 1-4
28990REM                            bit12=1 -> Octave shift bit13 0-up,1-down
29000REM                                                    bit15_14 Stave 1-4
29010REM                            bit13=1 -> bar
29020REM                         (bit13_0=0 -> Reserved)
29030REM
29040REM              Music= word; bit7_3>0 -> Note
29050REM                           bit7_3=0 -> Rest
29060REM
29070REM               Note= word; bit0=     Stem orientation: 0-up,1-down
29080REM                           bit1=1 -> Join barbs to next note
29090REM                           bit2=1 -> Tie with next note
29100REM                         bit7_3>0    Note stave line position 1 to 31 (16=centre line)
29110REM                        bit10_8>0 -> Accidental N,#,b,X,bb,N#,Nb
29120REM                       bit12_11=     Number of dots 0 to 3
29130REM                       bit15_13=     Type: Breve to Semi-demi-semiquaver
29140REM
29150REM               Rest= word; bit0=0    NB If a rest coincides with a note, its
29160REM                           bit1=0       position is determined by the
29170REM                           bit2=0       following note on the same channel.
29180REM                         bit7_3=0
29190REM                        bit10_8=0
29200REM                       bit12_11=     Number of dots 0 to 3
29210REM                       bit15_13=     Type: Breve rest to Semi-demi-semiquaver rest
29220REM
29230REM      Position_type= 0 -> Note
29240REM                     1 -> Time Signature
29250REM                     2 -> Key Signature
29260REM                     3 -> Clef
29270REM                     4 -> Slur
29280REM                     5 -> Octave shift
29290REM                     6 -> Bar
29300:
29310DEF PROCinitialise_music
29320LOCALN%,C%:REM Note,channel
29330PROCinitialise_options
29340Note%=0:Time%=1:Key%=2:Clef%=4:Slur%=8:Octave%=16:Bar%=32:REM Stave attribute enumerators
29350DIM Ninc%(6),Line(42),Aoff(7),Clef%(3),Key%(6),Key_Sig%(15,6),Length%(31),Duration%(NTempos%),Accidental%(3,31)
29360FORN%=0TO6:Ninc%(N%)=ASCMID$("024579;",N%+1)AND15:NEXT:REM Note increment
29370LOCALST:ST=&1000/12:REM Semitone increment
29380FORN%=0TO42
29390Line(N%)=(1+N%DIV7<<12)+Ninc%(N%MOD7)*ST+.49
29400NEXT:REM Notes corresponding to stave lines (C octave 1 TO C octave 7)
29410Aoff(2)=ST:Aoff(3)=-ST:Aoff(4)=ST*2:Aoff(5)=-ST*2:Aoff(6)=ST:Aoff(7)=-ST:REM Accidental offsets
29420Clef%(0)=11:Clef%(1)=5:Clef%(2)=3:Clef%(3)=-1:REM Line offsets for each clef
29430FORC%=2TO15
29440FORN%=0TO(C%>>1)-1
29450Key_Sig%(C%,(7+Key_Y%(1,C%AND%1,N%))MOD7)=C%MOD2+2
29460NEXT
29470NEXT:REM Set up note offsets for each key signature
29480FORC%=0TO31
29490Length%(C%)=(%1<<7-(C%>>2))*(%1111000>>(C%AND3)AND%1111):REM Length of each possible note/rest (dotted) in tempo beats
29500NEXT
29510LOCALD%:REM Duration
29520FORN%=0TONTempos%
29530DIM C% 32:Duration%(N%)=C%:REM Reserve space for each tempo
29540FORC%=0TO31
29550D%=75/Tempo%(N%)*Length%(C%)/8+.5:REM Durations of note+dot combinations in 20ths of a second for each tempo (Max 22.5 Seconds)
29560IFD%>254 D%=254:REM Limit to maximum possible duration (12.7 Seconds)
29570Duration%(N%)?C%=D%
29580NEXT
29590NEXT
29600TIE%=&FF:REM Tie state of channels - Each bit corresponds to a channel, 0 if tied
29610SPACE%=HIMEM-END :REM find available space to tailor allocation
29620IFFNassert(SPACE%>1024,"Not enough memory available for music storage.") STOP
29630Max_Gate%=SPACE%/100 :REM max no. of gates (events, chords)
29640Max_Bar%=Max_Gate%/4 :REM maximum number of bars
29650PLAYING%=FALSE:REM Flag indicating play in process
29660SCROLLING%=FALSE:REM Flag indicating auto-scrolling while playing
29670DIM Q%(Max_Stave%+2):REM Time positions of next notes on each stave
29680DIM QI%(Max_Stave%+2):REM Time increments of Q%() for each stave
29690B1%=0:B2%=0:REM Alternate beat counters used to detect zero wrap
29700::
29710DIM GPn%(Max_Bar%) :REM GP% at the start of each bar
29720DIM PX%(Max_Gate%),PW%(Max_Gate%),PTYPE%(Max_Gate%):REM Notation screen positions, widths & types
29730REM PX% is PX%() index to screen positions & types - Always refers to the note/attribute just passed
29740DIM PXn%(Max_Bar%) :REM PX% at start of each bar
29750DIM BPn%(7,Max_Bar%):REM Indices to (8) note queues at the start of each bar
29760DIM MUSIC%(7),FINE%(7):REM Pointers delimiting music storage
29770DIM N%(7),n%(7):REM Pointers to current notes (n%()=copy, cf PROCproximate)
29780DIM C%(7),c%(7):REM Indexes of gate channels used in sorting
29790DIM CLEF%(Max_Stave%),clef%(Max_Stave%):REM Current clef on each stave (& clef copy)
29800DIM CLEFn%(Max_Stave%,Max_Bar%) :REM CLEF% at start of each bar
29810DIM SIG%(1),sig%(1):REM Base bar key & time sigs, current and copy
29820DIM SIGn%(1,Max_Bar%) :REM SIG% at the start of each bar
29830DIM P%(7),PCLEF%(3):REM Playing note pointers, clef
29840MaxNotesInBar%=128
29850REM while one half of draw q is being filled, the other half is being used for scrolling.
29860LOCAL n%
29870n%=MaxNotesInBar%*4
29880DIM MIDI_OFF%(1,n%) :REM an array of MIDI noteoffs if playing is stopped in the middle of a bar
29890MIDI_OFF%(0,0)=-1
29900MIDI_OFF%(1,0)=-1
29910MIDI_Notenum%=0
29920SPACE%=HIMEM-END
29930SPACE%-=&4000:REM Leave a few K for the program and Basic stack
29940IFFNassert(SPACE%>1024,"Not enough memory available for music storage.") STOP
29950DIM MUSIC% SPACE%+8:REM Allocate main music space (+8: Extra bytes in case of overrun)
29960FINE%=MUSIC%+SPACE%:REM End of music memory
29970GATE%=MUSIC%:REM No gate space used as yet
29980FORC%=0TO7
29990MUSIC%(C%)=MUSIC%+(C%+1)*SPACE%/9
30000NEXT:REM Share out storage (NB No bounds checking ever occurs!)
30010FINE%()=MUSIC%():REM No music defined yet
30020Pgap%=X%(2)DIV2+1:REM Symbol spacing (half note blob width)
30030:
30040REM Now set up basic score
30050PROCClearAllMusic
30060ENDPROC
30070
30080DEF PROCinitialise_options
30090LOCALN%,C%
30100NTempos%=14
30110DIM Tempo%(NTempos%)
30120Tempo%(0)=40
30130Tempo%(1)=50
30140Tempo%(2)=60
30150Tempo%(3)=65
30160Tempo%(4)=70
30170Tempo%(5)=80
30180Tempo%(6)=90
30190Tempo%(7)=100
30200Tempo%(8)=115
30210Tempo%(9)=130
30220Tempo%(10)=145
30230Tempo%(11)=160
30240Tempo%(12)=175
30250Tempo%(13)=190
30260Tempo%(14)=210
30270
30280DIM TIME_SIG%(1):REM Current time signature numerator(0) and denominator(1)
30290TIME_SIG%()=3:REM 4/4 time (= (n+1)/2^(d-1))
30300
30310DIM KEY_SIG%(1):REM Current key signature
30320DIM Key_Y%(3,1,6):REM Key signature 0-sharp/1-flat stave line positions
30330LOCAL C%,A%,P%:REM Indices
30340FOR C%=0 TO 3:REM For each clef
30350FOR A%=0 TO 1:REM For each accidental type
30360FOR P%=0 TO 6:REM For each accidental position
30370Key_Y%(C%,1-A%,P%)=3*(P%AND%1)-P%DIV2+(P%-3)*A%+(A%ANDC%<>2AND(P%AND5)=0)*7-1-(C%-1>>1)-2*(C%=2)
30380REM Position offsets of key signature accidentals from centre stave line
30390NEXT
30400NEXT
30410NEXT
30420KEY_SIG%(0)=1
30430KEY_SIG%(1)=0
30440LOCAL item%
30450Max_Stave%=3
30460Li%=2*Vi%
30470Stave_Height%=Li%*8
30480DIM Y_STAVE%(Max_Stave%+2)
30490STAVE%=0   :REM means 1 stave
30500PERC%=0    :REM means no percussion
30510Score_Width%=S_Width%
30520PROCposition_staves
30530
30540NVolumes%=7
30550DIM Volume%(NVolumes%),Volumes%(7)
30560FORR%=0TONVolumes%
30570Volume%(R%)=(R%+1)*120/(NVolumes%+1)-1 :REM don't permit full volume so that dynamics are possible
30580NEXT
30590SYS Sound_Volume TO R%
30600RestoreVolume=R%
30610Volume%=R%*(NVolumes%+1)/120-.5:IFVolume%<0 Volume%=0 :REM don't permit full volume. This is reserved for dynamics
30620SYS Sound_Volume,Volume%(Volume%)
30630FORR%=0TO7:Volumes%(R%)=6:NEXT
30640
30650LOCALS%
30660DIM Stave_Channels%(Max_Stave%+2,7):REM Primary stave allocation of channels 0-7 for each stave structure
30670FOR S%=0 TO Max_Stave%
30680FOR R%=0 TO 7
30690Stave_Channels%(S%,R%)=(S%+1)*R%DIV8:REM Close formula to desired data
30700NEXT
30710NEXT
30720Stave_Channels%(2,1)=1
30730Stave_Channels%(2,2)=1
30740Stave_Channels%(2,5)=2:REM Correct the exceptions to formula
30750DIM S_C%(7):REM Current stave allocation
30760FORR%=0TO7
30770S_C%(R%)=Stave_Channels%(STAVE%,R%):REM Initialise channel allocation (Also reset each time stave structure is changed)
30780NEXT
30790:REM Now get names and channel allocation of instruments
30800LOCALI$,L%,M%:REM Instrument name, Number of instruments, Instrument name length, Max
30810MAX_Voices%=20
30820DIM Voice$(20):REM Instrument voice descriptions
30830DIM RestoreVoice%(7)
30840DIM Instrument%(7,1):REM Instrument information 0=Stave, 1=Voice
30850DIM Nth$(6):REM First,Second stave etc
30860Nth$(1)="1st stave":Nth$(2)="2nd stave":Nth$(3)="3rd stave":Nth$(4)="4th stave":Nth$(5)="1st perc":Nth$(6)="2nd perc"
30870SYS Sound_InstallVoice TO I$,NVoices%:NVoices%-=1:REM NVoices% is now number of voices/instruments available
30880IF FNassert(NVoices%>0,"No sound voices are installed.") STOP
30890FORR%=1TONVoices%
30900SYS Sound_InstallVoice,0,R% TO Voice$(R%)
30910NEXT:REM Get names of voices/instruments
30920FORR%=0TO7
30930SYS Sound_AttachVoice,R%+1,0 TO L%,S%
30940RestoreVoice%(R%)=S%
30950IFS%<1ORS%>NVoices% S%=1:REM Make sure a voice is attached to all channels
30960SYS Sound_AttachVoice,L%,S%
30970Instrument%(R%,0)=S_C%(R%)+1:REM Instrument stave
30980Instrument%(R%,1)=S%:REM Instrument voice
30990$(VoiceStr%(R%)) = LEFT$(Voice$(S%), VoiceSize%)
31000NEXT:REM Get details of each channel
31010PROCSetDefaultChannels
31020DIM Volume$(NVolumes%)
31030Volume$(0)="ppp" : Volume$(1)="pp" : Volume$(2)="p" : Volume$(3)="mp" : Volume$(4)="mf" : Volume$(5)="f" : Volume$(6)="ff" : Volume$(7)="fff"
31040FORR%=0TO7
31050$(VolumeStr%(R%)) = LEFT$(Volume$(Volumes%(R%)), VolSize%)
31060NEXT
31070NStereos%=6
31080DIM Stereo%(NStereos%),Stereo$(NStereos%,1),Stereo_Position%(7)
31090Stereo$(0,0)="Full L.":Stereo$(1,0)="Left":Stereo$(2,0)="Centre L.":Stereo$(3,0)="Centre":Stereo$(4,0)="Centre R.":Stereo$(5,0)="Right":Stereo$(6,0)="Full R."
31100FORR%=0TONStereos%
31110Stereo%(R%)=(2*R%/NStereos%-1)*127
31120Stereo$(R%,1)="Stereo position ("+STR$Stereo%(R%)+")"
31130NEXT
31140FORR%=0TO7
31150Stereo_Position%(R%)=NStereos%DIV2
31160SYS Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
31170$(StereoStr%(R%)) = LEFT$(Stereo$(Stereo_Position%(R%), 0), SterSize%)
31180NEXT
31190
31200NMIDIChannels%=16
31210DIM MIDIChannel%(7)
31220FORR%=0TO7
31230MIDIChannel%(R%)=1
31240IF MIDIpresent% THEN
31250  $(MIDIChStr%(R%))="1"
31260ELSE
31270  $(MIDIChStr%(R%))=" "
31280  ENDIF
31290NEXT
31300
31310ENDPROC
31320
31330DEF PROCrestore
31340REMOSCLI("audio off")
31350FORR%=0TO7    :REM restore channel/voice allocation
31360SYS Sound_AttachVoice,R%+1,RestoreVoice%(R%)
31370NEXT
31380SYS Sound_Volume, RestoreVolume :REM restore volume
31390SYS Sound_Configure,PrevConfigure
31400ENDPROC
31410
31420DEF PROCexit
31430PROCremove_panes
31440PROCCloseWindow(ScoreWind_h%)
31450PROCrestore
31460ENDPROC
31470
31480DEF PROCterminate
31490IF INITIALISED% IF PLAYING% PROCplay_stop
31500IF Task_h%>0 THEN
31510 ON ERROR SYS CloseDown, task%, Task_h% : END
31520ELSE
31530 ON ERROR END
31540 ENDIF
31550IF INITIALISED% PROCexit :PROCCloseWindow(AbortQuery_h%)
31560REMCLOSE#debug
31570ON ERROR END
31580IF Task_h%>0 THEN SYS CloseDown, task%, Task_h%
31590END
31600ENDPROC
31610
31620DEF FNassert(E%,A$)
31630LOCAL e%
31640IFE% THEN=FALSE ELSE e%=FNCheckOK("ERROR: "+A$+" Program will exit.",1)
31650PROCterminate
31660=TRUE
31670
31680DEF PROCerror
31690LOCAL e%
31700LOCAL ERROR
31710ON ERROR LOCAL PROCterminate: STOP
31720SYS "Hourglass_Smash"
31730E$=REPORT$+" at line "+STR$ERL+". Exit program?"
31740FILE%=FILE%:IFFILE% CLOSE#FILE%:FILE%=FALSE
31750IF INITIALISED% THEN
31760  IF FNCheckOK(E$,3) PROCterminate
31770ELSE
31780  e%=FNCheckOK(E$,1) : PROCterminate
31790  ENDIF
31800ENDPROC
31810
31820DEF PROCOpenAbortQuery(x, y)
31830LOCAL xsize%, ysize%
31840Window%!handle%=AbortQuery_h%
31850SYS GetWindowState%, ,Window%+handle%
31860xsize% = Window%!x1%-Window%!x0%
31870ysize% = Window%!y1%-Window%!y0%
31880Window%!x0% = x - xsize%/2
31890Window%!x1% = x + xsize%/2
31900Window%!y0% = y - ysize%/2
31910Window%!y1% = y + ysize%/2
31920SYS OpenWindow%, ,Window%+handle%
31930ENDPROC
31940
31950DEF FNCheckOK(E$, boxes%)
31960LOCAL E%
31970!ERRBLOCK%=0
31980$(ERRBLOCK%+4)=LEFT$(E$,100)+CHR$0
31990SYS "Wimp_ReportError", ERRBLOCK%, boxes%, "Maestro" TO ,E%
32000=E%=1 :  REM return TRUE if OK pressed

� > Music.Maestxt
� (c) Acorn Computers 1988

(!VersionStr$="1.65 (4-Jan-89)"
2
<
Task_h%=0
FMusicFileType%=&AF1
PINITIALISED%=�
Z� ERRBLOCK% 200
d� space for an error window
n.SPACE%=�-� :� check enough space available
x� SPACE%<100000 �
��debug=OPENOUT "debugfile"
�� � �error:�
�� get name of file to load
�ș "OS_GetEnv" � EnvStr$
�� �EnvStr$," -quit ") �
�  I%=�EnvStr$,"""")
�  I%=�EnvStr$,"""",I%+1)
�!  �I%+=1:��EnvStr$,I%,1)<>" "
�  f$=�EnvStr$,I%)
�  �
�INITIALISED%=�initialise
�.mask%=0 : � mask out unwanted reason codes
�� � �error
�
  � PLAYING% �CheckQ
)  ș Poll%,mask%,Window%+handle% � R%
"Q  � PLAYING% �CheckQ: � recheck since poll might have stayed away for a while
,
  Ȏ R% �
6	  � 0
@l   � AwaitingAck% �CheckOK("Bad Data Transfer, Receiver Dead",3) :AwaitingAck%=� : CHANGED%=wasCHANGED%
J!   � SCORING% �symbol_pointer
T'   � f$<>"" �load_music(f$) : f$=""
^2   � SCROLLING% �CheckScroll :� auto-scrolling
h   � 1:�redraw_window_request
r  � 2:�open_window_request
|  � 3:�close_window_request
�,  � 4          :� pointer leaving window
�'   � Window%!handle%=ScoreWind_h% �
�     �release
�     wasSCORING%=SCORING%
�     SCORING%=�
�   �
�D     � Window%!handle%=AbortQuery_h% �CloseWindow(AbortQuery_h%)
�
     �
�U  � 5: � Window%!handle%=ScoreWind_h% SCORING% = (wasSCORING% � � stopSCORING%)=�
�  � 6:�mouse_button_click
�  � 7:�UserDragBox
�  � 8:�KeyPressed
�  � 9:�MenuSelect
B  � 10: �ScrollReq(Window%!(handle%+32), Window%!(handle%+36))
  � 17,18:�receive
  �
&	  � �
0�
:
D
� �CheckQ
NB1%=B2%: B2%=Ə
X�B2%<B1% �play_bar
b�
l
v� �receive
�� task%, ref%, block,F$
�%block=Window% :� temporary buffer
�ref%=!(Window%+handle%+8)
�task%=!(Window%+handle%+4)
�8� task%=Task_h% � : � ignore messages from this task
�Ȏ Window%!(handle%+16) �
�	  � 0
�   � � CHANGED% �
�    �terminate
�   �
�    !block=20
�    block!12=ref%
�#    block!16=0    :� quit block
G    ș SendMessage,19,block :� acknowledge, and refuse quit request
D    � �CheckOK("Unsaved music. Do you really want to quit?",3) �
     �terminate
 	    �
*#     ș GetPointerInfo%,,Mouse%
45     �OpenWindow(Save_h%, Mouse%!x0%, Mouse%!y0%)
>
     �
H	    �
R  � 2 : � save file
\   � SAVING% �
f    wasCHANGED%=CHANGED%
p0    �save_music(�GetStr(Window%+handle%+44))
z    SAVING%=�
�"    ș GetPointerInfo%, ,block
�    block!20=block!12
�    block!24=block!16
�    block!28=block!0
�    block!32=block!4
�    block!0=44
�    block!12=ref%
�3    block!16=3 :� DataLoad application to filer
�    block!40=MusicFileType%
�    ș SendMessage,17,block
�    AwaitingAck%=�
�    �CloseMenu
�	    �
 � 3 : � load file
.  �load_music(�GetStr(Window%+handle%+44))
  �DataLoadAck(ref%)
$B � 4 :AwaitingAck%=� : � DataLoadAck. End of DataSave protocol
.% � 5 : � open double-clicked file
80  � !(Window%+handle%+40) = MusicFileType% �
B0    �load_music(�GetStr(Window%+handle%+44))
L    �DataLoadAck(ref%)
V	    �
` � &502:�Help(ref%)
j � &400C1:�getmodeinfo(�)
t �
~�
�
�� �Help(ref%)
�� block%,text$
�block%=Window%+handle%
�block%!12 = ref%
�)block%!16 = &503 :� Send help message
�text$=""
�Ȏ block%!32 �
�J � -2 : text$="This is the Maestro icon.|MClick SELECT to open score."
� � ScoreWind_h%
�!  �SCORING%�SCRIBE%(drawn%) �
�2   text$="Click SELECT to place item in score"
  �

=   text$="Select an item in a pane to place on the score"
  �
 � NotesPane_h%
('  text$="Click SELECT to select a "
2  Ȏ block%!36 �
<"    � 0 : text$=text$+"breve."
F&    � 1 : text$=text$+"semibreve."
P"    � 2 : text$=text$+"minim."
Z$    � 3 : text$=text$+"crochet."
d#    � 4 : text$=text$+"quaver."
n'    � 5 : text$=text$+"semiquaver."
x+    � 6 : text$=text$+"demisemiquaver."
�/    � 7 : text$=text$+"hemidemisemiquaver."
�     text$=""
�	    �
� � SharpsPane_h%
�'  text$="Click SELECT to select a "
�  Ȏ block%!36 �
�$    � 0 : text$=text$+"natural."
�"    � 1 : text$=text$+"sharp."
�!    � 2 : text$=text$+"flat."
�)    � 3 : text$=text$+"double-sharp."
�(    � 4 : text$=text$+"double-flat."
�.    � 5 : text$=text$+"naturalised sharp."
�-    � 6 : text$=text$+"naturalised flat."
     � 7 : text$=text$+"dot."
'    � 8 : text$=text$+"double-dot."
'    � 9 : text$=text$+"triple-dot."
"!    � 10 : text$=text$+"tie."
,&    � 11 : text$=text$+"bar line."
6)    � 12 : text$=text$+"treble clef."
@'    � 13 : text$=text$+"bass clef."
J+    � 14 : text$=text$+"key signature."
T,    � 15 : text$=text$+"time signature."
^     text$=""
h	    �
r � RestsPane_h%
|'  text$="Click SELECT to select a "
�  Ȏ block%!36 �
�'    � 0 : text$=text$+"breve rest."
�+    � 1 : text$=text$+"semibreve rest."
�'    � 2 : text$=text$+"minim rest."
�)    � 3 : text$=text$+"crochet rest."
�(    � 4 : text$=text$+"quaver rest."
�,    � 5 : text$=text$+"semiquaver rest."
�0    � 6 : text$=text$+"demisemiquaver rest."
�4    � 7 : text$=text$+"hemidemisemiquaver rest."
�     text$=""
�	    �
� � InstrWind_h%
�  � (block%!36>7) �
   � (block%!36<16) �
M    text$="Click SELECT or ADJUST to select an instrument for this stave"
	    �
&    � (block%!36<24) �
0I     text$="Click SELECT or ADJUST to set the volume of this channel"
:e     � � (block%!36<32) text$="Click SELECT or ADJUST to set the stereo position of this channel"
D
     �
N	    �
X   �
b � Save_h%
l�  � block%!36=2 text$="Drag this icon into a directory window to save it in that directory" � text$="Fill in the file name and then drag the icon into a filer directory window to save it"
v � TimeSig_h%
�I  text$="use SELECT and ADJUST on each field to set a time signature"
� � AbortQuery_h%
�,  text$="click YES to terminate Maestro"
� �
�$(block%+20)=text$
�(block%!0 = (((20+�(text$)+1)�4)*4)+4
�2$(block%+21+�(text$)) = �(0) :� null-terminate
�3ș SendMessage,17,block% :� acknowledge message
��
�
�� �DataLoadAck(ref%)
�� block
�block=Window%
block!0 = 20
block!12 = ref%
block!16 = 4 :� DataLoadAck
 2ș SendMessage,17,block :� acknowledge message
*�
4
>� �redraw_window_request
H� R%
R*ș RedrawWindow%,,Window%+handle% � R%
\	ȕ R%
fF  � Window%!handle% = ScoreWind_h% �draw_staves:� PLAYING% �CheckQ
p-� try to avoid interruptions in the music
z,  ș GetRectangle%,,Window%+handle% � R%
�  �
��
�
�� �place_top_panes(behind)
�� xsize%
�"xsize%=Window%!x1%-Window%!x0%
�RestPBlk%!x1%=Window%!x1%
�&RestPBlk%!x0%=Window%!x0%+xsize%/2
�RestPBlk%!y1%=Window%!y1%
�+RestPBlk%!y0%=RestPBlk%!y1%-PaneHeight%
�RestPBlk%!under%=behind
�3ș OpenWindow%, RestsPane_h%, RestPBlk%+handle%
�NotePBlk%!x0%=Window%!x0%
	NotePBlk%!x1%=RestPBlk%!x0%
	NotePBlk%!y1%=Window%!y1%
	+NotePBlk%!y0%=NotePBlk%!y1%-PaneHeight%
	$!NotePBlk%!under%=RestsPane_h%
	.3ș OpenWindow%, NotesPane_h%, NotePBlk%+handle%
	8�
	B
	L!� �place_bottom_panes(behind)
	V� xsize%
	`"xsize%=Window%!x0%+Window%!x1%
	jSharpPBlk%!x0%=Window%!x0%
	t(SharpPBlk%!x1%=SharpPBlk%!x0%+xsize%
	~SharpPBlk%!x1%=Window%!x1%
	�SharpPBlk%!y0%=Window%!y0%
	�-SharpPBlk%!y1%=SharpPBlk%!y0%+PaneHeight%
	�SharpPBlk%!under%=behind
	�5ș OpenWindow%, SharpsPane_h%, SharpPBlk%+handle%
	��
	�
	�� �remove_panes
	��CloseWindow(NotesPane_h%)
	��CloseWindow(SharpsPane_h%)
	��CloseWindow(RestsPane_h%)
	��
	�
� �open_window_request

� bhandle%
bhandle%=Window%!under%
�release
($� Window%!handle%=ScoreWind_h% �
2 � TRANSCRIBE% �
<P� define window stack as top->bottom sharpspane->restspane->notespane->score
FJ� open top or bottom panes before score depending on direction of drag
P,  ș GetWindowState%,,SharpPBlk%+handle%
Z>  � SharpPBlk%!under%=bhandle% Window%!under%=NotesPane_h%
d,  ș GetWindowState%,,ScoreWBlk%+handle%
n$  � Window%!y1%>ScoreWBlk%!y1% �
x!   �place_top_panes(bhandle%)
�   �
�$   �place_bottom_panes(bhandle%)
�   �
�  �
�S � PLAYING% � Window%!scx%<>ScoreWBlk%!scx% �:� no user-scrolling while playing
�$ ș OpenWindow%,,Window%+handle%
� ScoreClosed%=�
� � TRANSCRIBE% �
�  � bhandle%=-2 �
�2   � find behind handle% if pushed to the back
�-   ș GetWindowState%,,ScoreWBlk%+handle%
�#   bhandle% = ScoreWBlk%!under%
�   �
  � re-open all panes
#  �place_bottom_panes(bhandle%)
%  �place_top_panes(SharpsPane_h%)
"o  � bhandle%=ScoreWind_h%  ș OpenWindow%,,Window%+handle% :� ensure window is behind panes in unusual case
,  �
6Q LHBAR%=�FindBar(ScoreWBlk%!scx%) :� the bar number at the left of the window
@ �
J$ ș OpenWindow%,,Window%+handle%
T �
^�
h
r� �close_window_request
|$ș CloseWindow%,,Window%+handle%
�A� Window%!handle%=ScoreWind_h% �remove_panes : ScoreClosed%=�
��
�
�� �mouse_button_click
��B%,C%,W%,I%,inc%
�#W%=Mouse%!window:I%=Mouse%!icon
�B%=%111�Mouse%!buttons
�+Mouse_X%=Mouse%!x0%:Mouse_Y%=Mouse%!y0%
�� B%=%010 �
�  �CheckInstalledVoices
�  �StopScoring
�2  � W%=-2 �OpenMenu(IconMenu%) � �OpenMainMenu
��
1� B%=%100 inc%=-1 � � B%=%001 inc%=1 � inc%=0
Ȏ W% �
A� -2 : � ScoreClosed% � � PLAYING% �setup_staves:� :� iconbar
&� AbortQuery_h%
0  � I%=2 �
:    �terminate
D	    �
N      �CloseMenu
X%      �CloseWindow(AbortQuery_h%)
b	    �
l� NotesPane_h%
v  � I%>=0 �
�  �release
�  wasSCORING%=�
�  stopSCORING%=�
�(  �UpdateIcon(SelW%, SelI%, 0, 1<<2)
�"  �UpdateIcon(W%, I%, 1<<2, 0)
�  SelW%=W%
�  SelI%=I%
�  �attach(note%+I%,%111000)
�  �
�� RestsPane_h%
�  � I%>=0 �
�  �release
�  wasSCORING%=�

  stopSCORING%=�

(  �UpdateIcon(SelW%, SelI%, 0, 1<<2)

"  �UpdateIcon(W%, I%, 1<<2, 0)

   SelW%=W%

*  SelI%=I%

4  �attach(rest%+I%,%11000)

>  �

H� SharpsPane_h%

R  � I%>=0 �

\  �release

f  wasSCORING%=�

p  stopSCORING%=�

z(  �UpdateIcon(SelW%, SelI%, 0, 1<<2)

�"  �UpdateIcon(W%, I%, 1<<2, 0)

�  SelW%=W%

�  SelI%=I%

�U  � I%<7  �attach(accidental%+I%+1,%1100000) �� I%<11 �attach(dot%+I%-6,%1101000)

�$  � I%=10 �attach(tie%,%1101000)

�%  � I%=11 �attach(bar%,%10010000)

�1  � I%=12 �attach(clef%,%100)  :� Treble clef

�/  � I%=13 �attach(clef%+3,%100):� Bass clef

�3  � I%=14 �attach(key%,%10)    :� key signature

�4  � I%=15 �attach(time%,%1)    :� time signature

�  �

�� ScoreWind_h%

�3  � B%=%100 �SCORING%�SCRIBE%(drawn%) �put_down
� InstrWind_h%
  � chan%, v%
  �CheckInstalledVoices
$  �StopScoring
.  � I%>=8 �
8    chan%=I%-8
B    � chan%<8 �
L&      v%=�AttachVoice(chan%, inc%)
V+      ș Sound_AttachVoice, chan%+1, v%
`6      $(VoiceStr%(chan%))=�Voice$(v%), VoiceSize%)
j#      Instrument%(chan%,1) = v%
t"      �UpdateIcon(W%, I%, 0,0)
~	    �
�    chan%-=8
�    � chan%<8 �
�      v%=Volumes%(chan%)
�=      v%+=inc% : � v%>NVolumes% v%=NVolumes% �� v%<0 v%=0
�      Volumes%(chan%)=v%
�C      $(VolumeStr%(chan%))=�Volume$(Volumes%(chan%)), VolSize%)
�"      �UpdateIcon(W%, I%, 0,0)
�	    �
�    chan%-=8
�    � chan%<8 �
�$      v%=Stereo_Position%(chan%)
�H      v%+=inc% : � v%>NStereos% v%=NStereos% �� v%<0 v%=0: � no wrap
$      Stereo_Position%(chan%)=v%

B      ș Sound_Stereo,chan%+1,Stereo%(Stereo_Position%(chan%))
Q      $(StereoStr%(chan%)) = �Stereo$(Stereo_Position%(chan%), 0), SterSize%)
"      �UpdateIcon(W%, I%, 0,0)
(	    �
2    � MIDIpresent% �
<      chan%-=8
F      � chan%<8 �
P"        v%=MIDIChannel%(chan%)
ZI        v%+=inc% : � v%>NMIDIChannels% v%=1 �� v%<1 v%=NMIDIChannels%
d"        MIDIChannel%(chan%)=v%
n9        $(MIDIChStr%(chan%)) = �(MIDIChannel%(chan%))
x$        �UpdateIcon(W%, I%, 0,0)
�
        �
�      �
�	    �
�	    �
�	    �
�	    �
�
� Save_h%
�  �StopScoring
�@  � I%=0 �save_music(�GetStr(SaveText))       :   � 0 is OK.
�  � I%=2 �
�;    � x%, y%                          : � dragging icon
�    Window%!handle%=W%
�+    ș GetWindowState%,,Window%+handle%
&    ysize%=Window%!y1%-Window%!y0%
    x%=Window%!x0%
    y%=Window%!y0%
"    !Window% = W%
,    Window%!4 = I%
6R    ș GetIconInfo%, ,Window% : � returns icon box in right place for drag box
@    Window%!8  += x%
J!    Window%!12 += y% + ysize%
T    Window%!16 += x%
^!    Window%!20 += y% + ysize%
hG� get size in appropriate part of block: parent box=screen boundary
r    Window%!24 = 0
|    Window%!28 = 0
�    Window%!32 = S_Width%
�    Window%!36 = S_Height%
�    !Window%=0
�*    Window%!4=5: � fixed size drag box
�    SAVING%=�
�    DRAGGING%=�
�    ș DragBox, ,Window%
�  �
�    �CloseWindow(Save_h%)
�    �CloseMenu
�	    �
�
� Load_h%
�  �StopScoring
@  � I%=0 �load_music(�GetStr(LoadText))       :   � 0 is OK.
  �CloseWindow(Load_h%)
  �CloseMenu
&� TimeSig_h%
0
  Ȏ I% �
:
   � 0
D0    TIME_SIG%(0)=1+(TIME_SIG%(0)+inc%+14)�15
N%    $BarLength%=�(TIME_SIG%(0)+1)
X
   � 1
b,    TIME_SIG%(1)=(TIME_SIG%(1)-inc%)�4+2
l*    $NoteValue%=�(1<<(TIME_SIG%(1)-1))
v	    �
�*  � I%=0 � I%=1 �UpdateIcon(W%,I%,0,0)
��
��
��
�
�� �CheckInstalledVoices
�,� NewVoice$, NewNVoices%, changedVoices%
�changedVoices%=�
�9ș Sound_InstallVoice � I$,NewNVoices%:NewNVoices%-=1
�<� �assert(NVoices%>0,"No sound voices are installed.") �
�q� MIDIpresent% NewNVoices%+=1:Voice$(NewNVoices%)="":� allow a NULL voice to permit just MIDI on this channel
�� NewNVoices%<>NVoices% �
�  changedVoices%=�
  NVoices%=NewNVoices%
  �
/� NVoices%>MAX_Voices% NVoices%=MAX_Voices%
 �R%=1�NVoices%
*$� (MIDIpresent% � R%=NVoices%) �
4 Voice$(R%)=""
>�
H+ ș Sound_InstallVoice,0,R% � NewVoice$
R � NewVoice$<>Voice$(R%) �
\  changedVoices%=�
f  Voice$(R%)=NewVoice$
p  �
z �
�(�:� find if instruments have changed
�� � changedVoices% �
��R%=0�7
�'ș Sound_AttachVoice,R%+1,0 � L%,S%
�J�S%<1�S%>NVoices% S%=1:� Make sure a voice is attached to all channels
�ș Sound_AttachVoice,L%,S%
�3Instrument%(R%,0)=S_C%(R%)+1:� Instrument stave
�+Instrument%(R%,1)=S%:� Instrument voice
�/$(VoiceStr%(R%)) = �Voice$(S%), VoiceSize%)
�(�UpdateIcon(InstrWind_h%, R%+8, 0,0)
�#�:� Get details of each channel
��SetDefaultChannels
��

G� �AttachVoice(chan%,inc%) :� inc% is +1 or -1 or 0 to find nearest
� stop%,v%,perc%
$�CheckInstalledVoices
.6� NVoices%<2 ș Sound_AttachVoice, chan%+1, 1 : =1
8e� attach next voice to channel. Attach percussion voice only on perc line, and not on stave lines
BGperc%=(�$StaveStr%(chan%),"perc")>0) :� is it a percussion channel?
L(ș Sound_AttachVoice, chan%+1 � , v%
V� v%=0 v%=1
`4ș Sound_AttachVoice, chan%+1, v%  :� restore it
j6� check if current voice is valid for this channel
t8� inc%=0 � � (perc% = (�Voice$(v%),"Perc")>0)) � =v%
~� inc or dec until found
�� �(inc%)<>1 � inc%=1
�stop%=v%
��
�6 v%+=inc% : � v%>NVoices% v%=1 �� v%<1 v%=NVoices%
�b � MIDIpresent% � Voice$(v%)="" stop%=v% :� permit NULL voice on any channel if MIDI installed
�3 � (perc% = (�Voice$(v%),"Perc")>0)) � stop%=v%
�=v%
�
�$� �UpdateIcon(W%, I%, st%, msk%)
� Window%!handle%=W%:!Icon%=I%
�#Icon%!state=st%:Icon%!mask=msk%
�:ș SetIconState%,,Window%+handle% : � update icon text
�


� �UserDragBox
� block
(DRAGGING%=�
2%block=Window% :� temporary buffer
<� SAVING% �
F   ș GetPointerInfo%, ,block
P  block!32=block!4
Z  block!28=!block
d  block!24=block!16
nB  block!20=block!12 : � this is the destination window handle%
x$  block!16=1        : � DataSave
�  block!12=0
�)  block!36=0  :� don't know file size
�  block!40=MusicFileType%
�(  $(block+44)=�GetLeafName(SaveText)
�  !block = 60
�)  ș SendMessage, 17, block, block!20
�  �
��
�
�H� �SetBit(test, word, bitnum) : � set or clear bit depending on test
�� test �
�  = word � (1<<bitnum)
��
  = word � � (1<<bitnum)
�

"� �MenuSelect
,*� item%, n, selection, SoundEnable%,F$
6selection=Window%+handle%
@7ș DecodeMenu, ,CurrentMenu%, selection, MenuString
J+Ȏ �$MenuString,�$MenuString, ".")-1) �
T  � "Save"
^   F$=�GetStr(SaveText)
h&   � ( �F$,".")=0 � �F$,":")=0 ) �
r0    �OpenWindow(Save_h%, Mouse_X%, Mouse_Y%)
|   �
�    �save_music(F$)
�   �
�  � "Staves"
�   ș "Hourglass_On"
�)   � �$StaveNum%,1)="" $StaveNum%="1"
�!   STAVE%=�(�$StaveNum%,1))-1
�"   � �$MenuString,"+perc",6) �
�#    � PERC%=1 PERC%=0 � PERC%=1
�	    �
�7   item% = �FindMenuItem("+percussion", StaveMenu%)
�L   � (item%>=0) !item% = �SetBit(PERC%=1, !item%, 0):� set or clear tick
�   �setup_score
�   �start_music
   �rescore(0)
   ș "Hourglass_Off"
C  � "Instruments" : �OpenWindow(InstrWind_h%,Mouse_X%,Mouse_Y%)
&  � "Volume"
0    � selection!4>=0 �
:!      �SetVolume(selection!4)
D0      �SetMenuTick(VolumeMenu%, selection!4)
N      �
X  � "Tempo"
b    � selection!4>=0 �
l       �SetTempo(selection!4)
v/      �SetMenuTick(TempoMenu%, selection!4)
�      �
�2  � "Time sig" : TIME_SIG%(0)=�($BarLength%)-1
�  � "Key sig"
�    � selection!4>=0 �
�+     KEY_SIG%(0) = ((selection!8)>=7)+1
�)     KEY_SIG%(1) = �((selection!8)-7)
�.     �SetMenuTick(MajorMenu%, selection!8)
�.     �SetMenuTick(MinorMenu%, selection!8)
І     � KEY_SIG%(1) n=accidental%+2+KEY_SIG%(0) : X%(key%)=(x%(n)+X%(n))*KEY_SIG%(1) � X%(key%)=x%(accidental%+2)+X%(accidental%+2)
�
     �
�  � "Play"
�j    ș Sound_Enable,0 � SoundEnable%:� dont pretend to be able to play if the sound system is disabled
�    � SoundEnable%=2 �
     SCORING%=�
     PLAYING%=� PLAYING%
     SCROLLING%=PLAYING%
 ,     � PLAYING% �play_start � �play_stop
*@    � n=�CheckOK("Sound is not enabled. You cannot play", 1)
4
     �
>  � "Clear"
HM    � CHANGED% � � �CheckOK("Are you sure? Current music is unsaved",3) �
R    �ClearAllMusic
\$    Window%!handle%=ScoreWind_h%
f+    ș GetWindowState%,,Window%+handle%
p    Window%!scx%=0
z    LHBAR%=0
�'    ș OpenWindow%,,Window%+handle%
�.    ș GetWindowState%,,ScoreWBlk%+handle%
�=  � "Info" : �OpenWindow(ProgInfo_h%, Mouse_X%, Mouse_Y%)
�L  � "Quit" : � CHANGED% �OpenAbortQuery(Mouse_X%, Mouse_Y%) � �terminate
�  � "Goto"
�$    Window%!handle%=ScoreWind_h%
�+    ș GetWindowState%,,Window%+handle%
�    Window%!scx%=0
�;    ș OpenWindow%,,Window%+handle% : � set scroll to 0
�.    ș GetWindowState%,,ScoreWBlk%+handle%
�<    LHBAR%=0 :� the bar number at the left of the window
�  �
�"  � (CurrentMenu%=MenuStart) �
!   ș GetPointerInfo%,,Mouse%
?   � %001 � Mouse%!buttons �OpenMainMenu :� persistent menu
   �
$�
.
8 � �SetMenuTick(menu%, this%)
B-� set 1 tick in menu and clear all others
L� n, item%
V	n = 0
`item%=menu%+28
j>!item% = �SetBit(n=this%, !item%, 0)  :� set or clear tick
t�
~ item% += 24
� n += 1
�? !item% = �SetBit(n=this%, !item%, 0)  :� set or clear tick
� � (!item% � &80)
��
�
�� �KeyPressed
�� ThisWindow%
� � !(Window%+handle%+24)=13 �
�!  ThisWindow%=Window%!handle%
�  Ȏ (ThisWindow%) �
�I    � Save_h% : �save_music(�GetStr(SaveText)) : � c/r in save window
�I    � Load_h% : �load_music(�GetStr(LoadText)) : � c/r in load window
    � Bar_h%

     BAR%=�($BarNum%)
3     � BAR%>NBars% BAR%=NBars% �� BAR%<0 BAR%=0
%     Window%!handle%=ScoreWind_h%
(,     ș GetWindowState%,,Window%+handle%
2%     Window%!scx%=PX%(PXn%(BAR%))
<O     ș OpenWindow%,,Window%+handle% : � set scroll to requested bar number
F/     ș GetWindowState%,,ScoreWBlk%+handle%
PU     LHBAR%=�FindBar(ScoreWBlk%!scx%) :� the bar number at the left of the window
ZU    : ș "Wimp_ProcessKey",!(Window%+handle%+24) : �  ie. pass on key code in R0
d   �
n  �CloseWindow(ThisWindow%)
x  �CloseMenu
�  �
�O  ș "Wimp_ProcessKey",!(Window%+handle%+24) : � ie. pass on key code in R0
�  �
��
�
�&� �ScrollReq(x_scroll%, y_scroll%)
�G� if bad mode disallow scroll to prevent mode warning being garbled
�� BADMODE% �
�$� Window%!handle%=ScoreWind_h% �
�!  � PLAYING%�(x_scroll%<>0) �
�  Ȏ �(x_scroll%) �
�+    � 1:Window%!scx%+=x_scroll%*4*Pgap%
�A    � 2:Window%!scx%+=(x_scroll%/2)*(Window%!x1%-Window%!x0%)
	    �
  Ȏ �(y_scroll%) �
-    � 1:Window%!scy%+=y_scroll%*C_Height%
"A    � 2:Window%!scy%+=(y_scroll%/2)*(Window%!y1%-Window%!y0%)
,	    �
6&  ș OpenWindow%, ,Window%+handle%
@,  ș GetWindowState%,,ScoreWBlk%+handle%
J  ScoreClosed%=�
TR  LHBAR%=�FindBar(ScoreWBlk%!scx%) :� the bar number at the left of the window
^  �
h�
r
|� �OpenMainMenu
�� item%
�,item% = �FindMenuItem("Play", MenuStart)
�6� (item%>=0) !item% = �SetBit(PLAYING%, !item%, 0)
�� set or clear tick
�,item% = �FindMenuItem("Goto", MenuStart)
�9� (item%>=0) item%!8 = �SetBit(PLAYING%, item%!8, 22)
�+� shaded bit. disable Goto when playing
�Hș CreateMenu, ,MenuStart, Mouse_X%-C_Width%*4, Mouse_Y%+C_Height%*4
�CurrentMenu%=MenuStart
��CloseWindow(Save_h%)
��CloseWindow(Load_h%)
��
�
� �OpenMenu(Menu%)
� (Menu%=IconMenu%) �
]  ș CreateMenu, ,IconMenu%, Mouse_X%-C_Width%*4, 112+C_Height%*2:� y adjusted to line up
&�
0D  ș CreateMenu, ,Menu%, Mouse_X%-C_Width%*4, Mouse_Y%+C_Height%
:�
DCurrentMenu%=Menu%
N�CloseWindow(Save_h%)
X�CloseWindow(Load_h%)
b�
l
v� �CloseMenu
�ș CreateMenu, ,-1
��CloseWindow(Save_h%)
��CloseWindow(Load_h%)
��
�
�� �symbol_pointer
�ș GetPointerInfo%,,Mouse%
�A� (Mouse%!window=ScoreWind_h%) �scribe(Mouse%!x0%,Mouse%!y0%)
��
�
�� �StopScoring
�stopSCORING%=�
��release
J�UpdateIcon(SelW%, SelI%, 0, 1<<2) :� remove highlight on icon in pane
�

 � �UpdateTitle(T$)
*
� a,b,c,d
4$ScoreTitle%=T$+�(0)
> Window%!handle%=ScoreWind_h%
H'ș GetWindowState%,,Window%+handle%
RTa=Window%!x0% : b=Window%!y1% : c=Window%!x1% :� get title area and force redraw
\(ș GetWindowOutline,,Window%+handle%
fd=Window%!y1%
p-ș ForceRedraw,-1,a+Hi%,b+Vi%,c-Hi%,d+Vi%
z�
�
�� �OpenWindow(h%, x%, y%)
�� xsize%, ysize%
�Window%!handle% = h%
�(ș GetWindowState%, ,Window%+handle%
�"xsize%=Window%!x1%-Window%!x0%
�"ysize%=Window%!y1%-Window%!y0%
�Window%!under%=-1
�Window%!x0%=x%
�"Window%!x1%=Window%!x0%+xsize%
�Window%!y0%=y%
�"Window%!y1%=Window%!y0%+ysize%
�$ș OpenWindow%, ,Window%+handle%
�

� �CloseWindow(h%)
$Window%!handle%=h%
.%ș CloseWindow%, ,Window%+handle%
8�
B
L� �SetExtent(W%)
VScore_Width%=W%
`Window%!x0%=0
j*Window%!y0%=-Score_Height%-PaneHeight%
tWindow%!x1%=Score_Width%
~Window%!y1%=PaneHeight%
�%ș SetExtent,ScoreWind_h%,Window%
��
�
�.� �GetLeafName(name%) :� returns leaf name
�� ch$,n%,name$
�name$=�GetStr(name%)
�3� ( (�name$,".")=0) � (�name$,":")=0) ) �=name$
�n%=�(name$)
�+� scan string to find leaf name of file
��
�  ch$= �name$, n%, 1)
�  n%-=1
#  � (n%<=0 � ch$="." � ch$=":")

$� n%>0 � =�name$, �(name$)-n%-1)

 � �GetStr(s%) : � get string
(� n$
2ȕ?s%:n$+=�?s%:s%+=1:�
<=n$
F
P� �SetVolume(R%)
Zș Sound_Volume,Volume%(R%)
d�
n
x� �SetDefaultChannels
�
�S%,P%
�-� only 1 percussion channel permitted now
�_�S%=0�7:S_C%(S%)=Stave_Channels%(STAVE%,S%):�:� Channel assignment changes if staves change
�A� PERC% S_C%(7)=STAVE%+1:� Steal channel for percussion lines
��S%=0�7
� Instrument%(S%,0)=S_C%(S%)+1
��$StaveStr%(S%)=Nth$(Instrument%(S%,0)+(STAVE%-3)*((Instrument%(S%,0)-1)>STAVE%))+";" :� set up stave names in instrument wimdow
�<�UpdateIcon(InstrWind_h%,S%,0,0) :� update text in icons
�v%=�AttachVoice(S%,0)
� ș Sound_AttachVoice,S%+1,v%
�-$(VoiceStr%(S%))=�Voice$(v%), VoiceSize%)
�Instrument%(S%,1) = v%
�'�UpdateIcon(InstrWind_h%,S%+8, 0,0)
�:� Instrument allocation
G� PERC% $StaveStr%(7)=Nth$(5)+";" :� steal 1 channel for percussion
�
"
,� �setup_score
6
�S%,P%
@-� only 1 percussion channel permitted now
J1�setup_staves:� Calculate new stave positions
T�SetDefaultChannels
^�
h
r� �GetFileInfo(F$)
|&�T%,L%,A%,M$,time%,FileType$,r2,r3
�5� F$<>"" șOS_File,5,F$ � T%,,laddr%,eaddr%,L%,A%
�2� (F$="") � ((T%=1) � (A% � 1) � (L%>8)) = 0 �
� $ThisFile%="<untitled>"+�(0)
�$FileSize%=""
�$FileType%=""
�$FileDate%=""
�=�
��
�$ThisFile%=F$
�$FileSize%=�(L%)
� � ((laddr%>>20)�&FFF)=&FFF �
�-  � (laddr%>>8 � &FFF) = MusicFileType% �
�    FileType$= "Music  "
   �
 8    ș "OS_FSControl",18,,laddr%>>8 � &FFF � ,,r2,r3
 X    FileType$=�(r2 � &FF) + �((r2>>8) � &FF) + �((r2>>16) � &FF) + �((r2>>24) � &FF)
 &[    FileType$ += �(r3 � &FF) + �((r3>>8) � &FF) + �((r3>>16) � &FF) + �((r3>>24) � &FF)
 0	    �
 :/  $FileType%=FileType$+�~(laddr%>>8 � &FFF)
 D*  time%=Window% :� a convenient buffer
 N;� load and execution addresses are, in fact, time stamp
 X  time%?4=laddr% � &FF
 b  time%?3=eaddr%>>24 � &FF
 l  time%?2=eaddr%>>16 � &FF
 v  time%?1=eaddr%>>8  � &FF
 �  time%?0=eaddr%     � &FF
 �>  ș "OS_ConvertStandardDateAndTime", time%, FileDate%, 28
 �3  � put timestamp of file into file info window
 �  �
 ��
 �=�
 �
 �� �load_music(F$)
 �� F%,M$
 �� �
 �I� CHANGED% � � �CheckOK("Are you sure? Current music is unsaved",3) �
 �SCORING%=�
 �� PLAYING% �play_stop
!SCROLLING%=�
!8� �F$=0 � �7 : T%=�CheckOK("Invalid filename",1) : �
!ș "Hourglass_On"
! Y� � � �7: �("FX 229,1") : �ClearAllMusic : ș "Hourglass_Off" : T%=�CheckOK(�$,1) : �
!*&�("FX 229,0") :� enable escape key
!4
FILE%=�F$
!> M$="":�R%=1�7:M$+=��#FILE%:�
!HB%=�#FILE%
!R�M$="Maestro" �
!\$LoadText=F$+�(0)
!f$SaveText=F$+�(0)
!pn� � �GetFileInfo(F$) � �7 :�("FX 229,1") : ș "Hourglass_Off" :T%=�CheckOK("Invalid or locked file",1) : �
!zT%=�
!�NBars%=0
!�Ȏ �#FILE% �
!�� 0:T%=�
!�� 1
!�*�lTempo:�lInstruments:�lStaves:�lMusic
!�"� File id version 2 and above
!�A%=�
!��
!�N� �#FILE% �lMusic,�lStaves,�lInstruments,�lVolumes,�lStereos,�lTempo �A%=�
!���#FILE%�A%
!��
!��#FILE%:FILE%=�
!��("FX 229,1")
"$Updated%="NO"
"�UpdateTitle(F$)
"ș "Hourglass_Off"
"$ș "Hourglass_On"
".	�T% �
"8 �position_staves
"B �start_music
"L �set_score(0)
"V �SetupBarStarts(0)
"` �setup_score
"j3 �update_score(0,-Score_Height%,Score_Width%,0)
"t �StopScoring
"~ CHANGED%=�
"� �
"��
"��("FX 229,1")
"�T%=�
"��
"�5� � T% � �7 : T%=�CheckOK("Invalid music file",1)
"�ș "Hourglass_Off"
"��
"�
"�
� �lMusic
"�
�C%,B%
"��#FILE%,GATE%:GATE%+=MUSIC%
#�C%=0�7
#
+�#FILE%,FINE%(C%):FINE%(C%)+=MUSIC%(C%)
#�
#,B%=MUSIC%:ȕB%<GATE%:?B%=�#FILE%:B%+=1:�
#(�C%=0�7
#24B%=MUSIC%(C%):ȕB%<FINE%(C%):?B%=�#FILE%:B%+=1:�
#<�
#FPP%=MUSIC%:P%()=MUSIC%()
#P�
#Z
#d� �lStaves
#n� item%
#xSTAVE%=�#FILE%
#�$StaveNum%=��(STAVE%+1),1)
#�PERC%=�#FILE%
#�4item% = �FindMenuItem("+percussion", StaveMenu%)
#�E� item%>0 !item%=�SetBit(PERC%=1, !item%, 0) :� set or clear tick
#��
#�
#�� �lInstruments
#��C%, chan%,v%
#��C%=0�7
#�chan%=�#FILE%:� Channel
#�Kv%=�#FILE%�(NVoices%+1):� Write voice numbers allocated to each channel
#�� v%=0 v%=1
#�%ș Sound_AttachVoice, chan%+1, v%
$=v%=�AttachVoice(chan%, 0) :� check if it is a valid voice
$%ș Sound_AttachVoice, chan%+1, v%
$Instrument%(chan%,1) = v%
$"0$(VoiceStr%(chan%))=�Voice$(v%), VoiceSize%)
$,+�UpdateIcon(InstrWind_h%, chan%+8, 0,0)
$6�
$@�
$J
$T� �lVolumes
$^�C%
$h�C%=0�7
$rVolumes%(C%)=�#FILE%
$|"�Volumes%(C%)>7 Volumes%(C%)=7
$�"�Volumes%(C%)<0 Volumes%(C%)=0
$�7$(VolumeStr%(C%))=�Volume$(Volumes%(C%)), VolSize%)
$�O�UpdateIcon(InstrWind_h%, C%+16, 0,0)   :� update icon in instrument window
$��
$��
$�
$�� �lStereos
$��C%
$��C%=0�7
$� Stereo_Position%(C%)=�#FILE%
$�6ș Sound_Stereo,C%+1,Stereo%(Stereo_Position%(C%))
$�E$(StereoStr%(C%)) = �Stereo$(Stereo_Position%(C%), 0), SterSize%)
$�)�UpdateIcon(InstrWind_h%, C%+24, 0,0)
%�
%�
%
%&
� �lTempo
%0� t
%:
t=�#FILE%
%D�SetTempo(t)
%N�SetMenuTick(TempoMenu%, t)
%X�
%b
%l� �save_music(F$)
%v
� block,n
%�� �
%�block=Window%
%�$SaveText=F$+�(0)
%�$LoadText=F$+�(0)
%�6� simple check for pathname rather than local name
%�#� ( �F$,".")=0 � �F$,":")=0 ) �
%�B n=�CheckOK("To save, drag the icon to a directory viewer.",1)
%� �
%� �
%�ș "Hourglass_On"
%�D� � � �("FX 229,1") : ș "Hourglass_Off" : T%=�CheckOK(�$,1) : �
%�&�("FX 229,0") :� enable escape key
%�1� CHANGED%  � (((laddr%>>20)�&FFF) <> &FFF) �
&*  � file changed or wasn't timestamped
&  � get current time
&&  block?0=3:ș "OS_Word",&0E,block
&   laddr%=block?4
&*  eaddr%=block!0
&4  �
&>3� force music file type, and preserve timestamp
&H<laddr%=(laddr% � &FF) � (&FFF<<20) � (MusicFileType%<<8)
&R7� I don't know what the length will be, so use zero
&\/ș "OS_File", &07, F$, laddr%, eaddr%, 0, 0
&f-� OPENUP, error if directory or not found
&p!ș "OS_Find", &CC, F$ � FILE%
&z:� timestamp is automatically updated on 1st byte write
&��#FILE%,"Maestro"
&�
�#FILE%,2
&��sMusic
&��sStaves
&��sInstruments
&�
�sVolumes
&�
�sStereos
&��sTempo
&��#FILE%:FILE%=�
&�6� (� CHANGED%)  � (((laddr%>>20) � &FFF) = &FFF) �
&�,  � file not changed and was timestamped
&�#  � preserve original timestamp
&�7  ș OS_File,2,F$,laddr% :� re-stamp with old stamp
'0  ș OS_File,3,F$,,eaddr% :� nb eaddr% in r3
'  �
'�("FX 229,1")
'$F%=�GetFileInfo(F$)
'.CHANGED%=�
'8$Updated%="NO"
'B�UpdateTitle(F$)
'L5� � T% � �7 : T%=�CheckOK("Invalid music file",1)
'Vș "Hourglass_Off"
'`�
'j
't
� �sMusic
'~
�C%,B%
'�
�#FILE%,1
'��#FILE%,GATE%-MUSIC%
'��C%=0�7
'� �#FILE%,FINE%(C%)-MUSIC%(C%)
'��
'�,B%=MUSIC%:ȕB%<GATE%:�#FILE%,?B%:B%+=1:�
'��C%=0�7
'�4B%=MUSIC%(C%):ȕB%<FINE%(C%):�#FILE%,?B%:B%+=1:�
'��
'��
'�
'�� �sStaves
(
�#FILE%,2
(
�#FILE%,STAVE%
(�#FILE%,PERC%
(�
((
(2� �sInstruments
(<�C%
(F
�#FILE%,3
(P�C%=0�7
(Z�#FILE%,C%
(d�#FILE%,Instrument%(C%,1)
(n�
(x�
(�
(�� �sVolumes
(��C%
(�
�#FILE%,4
(��C%=0�7
(��#FILE%,Volumes%(C%)
(��
(��
(�
(�� �sStereos
(��C%
(�
�#FILE%,5
(��C%=0�7
) �#FILE%,Stereo_Position%(C%)
)�
)�
)"
),
� �sTempo
)6
�#FILE%,6
)@�#FILE%,Tempo%
)J�
)T
)^7� �sprite(s%,X%,Y%) : � plot sprite S%(s%) at X%,Y%
)hXș SpriteOp%, SprPlot%, SprBlk%, S%(s%), X%-x%(s%),Y%-y%(s%), 8, factors%, pixtrans%
)r4� overwrite screen colour, but using sprite mask
)|�
)�
)�� �float(s%,X%,Y%)
)��R%
)� Window%!handle%=ScoreWind_h%
)�Window%!x1%=X%+X%(s%)
)�X%-=x%(s%)
)�Window%!x0%=X%
)�Window%!y1%=Y%+Y%(s%)
)�Y%-=y%(s%)
)�Window%!y0%=Y%
)�*ș UpdateWindow%,,Window%+handle% � R%
)� X%+=Window%!x0%-Window%!scx%
)� Y%+=Window%!y1%-Window%!scy%
*ChSprite%=S%(s%)
*	ȕ R%
*  Ȏ s%  �
*&.    � key%  : �float_key_sig(X%,Y%+y%(s%))
*0(    � time% : �float_time_sig(X%,Y%)
*:4      : pixtrans%?1 = pixtrans%?0 � pixtrans%?1
*D_                 ș SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%,Y%, 11, factors%, pixtrans%
*N<                 pixtrans%?1 = pixtrans%?0 � pixtrans%?1
*X	    �
*b,  ș GetRectangle%,,Window%+handle% � R%
*l  �
*v�
*�
*�� �float_key_sig(X%,Y%)
*��I%,A%,C%,W%
*��KEY_SIG%(1) �
*�C%=SCRIBE%(sclef%)
*�A%=KEY_SIG%(0)
*�I%=accidental%+2+A%
*�W%=x%(I%)+X%(I%):Y%-=y%(I%)
*�ChSprite%=S%(I%)
*�� I%=0 � KEY_SIG%(1)-1
*�cș SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%, Y%+Li%*Key_Y%(C%,A%,I%), 3, factors%, pixtrans%
*�
X%+=W%
*��
+�
+Uș SpriteOp%, SprPlot%, SprBlk%, ChSprite%, X%, Y%-y%(s%), 3, factors%, pixtrans%
+�
+ �
+*
+4� �float_time_sig(X%,Y%)
+>ș SetColour, 7 � 3<<4
+HR� �($NoteValue%)>1 � X%+C_Width%�2, Y%+C_Height% � � X%+C_Width%, Y%+C_Height%
+R� $NoteValue%
+\V� �($BarLength%)>1 � X%+C_Width%�2, Y%+2*C_Height% � � X%+C_Width%, Y%+2*C_Height%
+f� $BarLength%
+p�
+z
+�Q� *********************************************************************** REM
+�Q�                                                                         REM
+�Q�         M U S I C   T R A N S C R I P T I O N   R O U T I N E S         REM
+�Q�                                                                         REM
+�Q� *********************************************************************** REM
+�::
+��   PROCEDURE: start_music
+��
+�/� DESCRIPTION: Initialise to start of music
+�:
+�� �start_music
+�� n%
+�BAR%=0 :� current bar
,EGP%=MUSIC%:� Set current gate pointer to start of displayed music
,N%()=MUSIC%()
,1CLEF%()=0:� Start with base clefs (NOT BASS!)
,$6SIG%(0)=%01100111:� (Default time sig of 4/4 time)
,.VSIG%(1)=%00000010:� (Default of C Major) First displayed signatures attribute byte
,8	PX%=0
,B�PutBarInfo(0)
,L�
,V
,`1�   PROCEDURE: note_type(Channel C%, Type T%)
,j
,t� �note_type(C%,T%)
,~ N%(C%)?1=N%(C%)?1�&1F �T%<<5
,��
,�
,�� �note_dots(C%,D%)
,� N%(C%)?1=N%(C%)?1�&E7 �D%<<3
,��
,�
,�� �note_accidental(C%,A%)
,�N%(C%)?1=N%(C%)?1�&F8 �A%
,��
,�
,�7�   PROCEDURE: note_line(Channel C%, Stave line L%)
,��
-c�        NOTE: If a note's position is not defined or specified as -16, it is treated as a rest
-

-� �note_line(C%,L%)
-!?N%(C%)=?N%(C%)�7 �(16+L%)<<3
-(�
-2
-<� �note_tie(C%,T%)
-F"?N%(C%)=?N%(C%)�&FB �(T%<>0)�4
-P�
-Z
-d� �note_join(C%,J%)
-n"?N%(C%)=?N%(C%)�&FD �(J%<>0)�2
-x�
-�
-�� �note_stem(C%,D%)
-�#?N%(C%)=?N%(C%)�&FE �(D%<>0)�%1
-��
-�
-�� �note_clear(C%)
-�?N%(C%)=0:N%(C%)?1=0
-��
-�
-�>�   PROCEDURE: time_sig(Number of beats-1 N%,Beat type B%)
-�
-�� �time_sig(N%,B%)
-�"?GP%=0:GP%?1=Time%�N%<<1�B%<<5
.�
.
."�   PROCEDURE: key_sig(Key K%)
."
.,� �key_sig(A%,N%)
.6!?GP%=0:GP%?1=Key%�A%<<2�N%<<3
.@�
.J
.T*�   PROCEDURE: clef(Stave S%, Clef C%)
.^
.h� �clef(S%,C%)
.r"?GP%=0:GP%?1=Clef%�C%<<3�S%<<6
.|�
.�
.�
� �bar
.�?GP%=0:GP%?1=Bar%
.��
.�
.�� �insert_gate(W%)
.��G%
.��GP%<GATE% �
.�C�G%=GATE%-W%�GP%�-4:G%!W%=!G%:�:� Shift up by W% from insertion
.�#G%+=3:� Byte before last copied
.�6ȕG%>=GP%:G%?W%=?G%:G%+=�:�:� Clear up in odd word
.��
.�6GATE%+=W%:� Insert gate of size W% into gate queue
/@EP%+=W%:� This assumes gates will only be inserted below EP%
//?GP%=0:GP%?(W%-1)=0:� Zeroise inserted gate
/�
/&
/0� �insert_note(C%)
/:�N%
/D�N%(C%)<FINE%(C%) �
/NB�N%=FINE%(C%)-2�N%(C%)�-4:N%!2=!N%:�:� Shift up from insertion
/XN%+=3:� Last copied word
/b8ȕN%>=N%(C%):N%?2=?N%:N%+=�:�:� Clear up in odd word
/l�
/v5FINE%(C%)+=2:� Insert a note word into this queue
/�#?GP%=?GP%�%1<<C%:� Mark in gate
/��note_clear(C%)
/��
/�::
/�� �delete_gate(W%)
/��G%
/�
GATE%-=W%
/�*�GP%<GATE% �G%=GP%�GATE%�4:!G%=G%!W%:�
/�?EP%-=W%:� This assumes gates will only be deleted below EP%
/��
/�::
/�� �delete_note(C%)
/��N%
0FINE%(C%)-=2
07�N%(C%)<FINE%(C%) �N%=N%(C%)�FINE%(C%)�4:!N%=N%!2:�
0?GP%=?GP%��(%1<<C%)
0 �
0*
04� �allocate_channel(S%)
0>
�C%,c%,G%
0HG%=?GP%
0RC%=-1:c%=7
0\�
0fȕc%>=0�G%�%1<<c%:c%+=�:�
0p�c%>=0 �S_C%(c%)=S% C%=c%
0z	c%+=�
0�	�c%<0
0�=C%
0�
0�� �arrange_stave(S%)
0�
�C%,B%
0�
B%=�:C%=�
0�#�?GP% ��GP%+=2:�?GP%�GP%>=GATE%
0�ȕB%�GP%<GATE%
0�C%=C%��sort_gate
0��skip_notes(?GP%):GP%+=1
0�.�?GP% �B%=C%:C%=�:�GP%+=2:�?GP%�GP%>=GATE%
0��
0��
1
1� �sort_gate
10�C%,NC%,NN%,G%,g%,pg%,d%,shortest%,Gchanged%
1$shortest%=255
1.G%=?GP%
18g%=�previous_gate(GP%)
1Bpg%=�preceding_gate(GP%)
1L
NC%=-1
1V
NN%=-1
1`�C%=0�7
1j�S_C%(C%)=S% �
1t2NC%+=1:n%(NC%)=C%:�G%�%1<<C% NN%+=1:C%(NN%)=C%
1~A�pg%�%1<<C% d%=N%(C%)?-1>>3�%11100:�d%<shortest% shortest%=d%
1��
1��
1�shortest%=shortest%�%11100
1��g%�NC%>0�NN%>=0 �sort
1�=Gchanged%
1�
1�� �sort
1�
�N%,M%
1�c%()=-1
1�
�M%=0�NC%
1�
�N%=0�NN%
1�-�same_pitch(n%(M%),C%(N%)) c%(N%)=n%(M%)
2�
2
�
2
�N%=0�NN%
2�c%(N%)<0 c%(N%)=�best
2(�
22
�N%=0�NN%
2<]�C%(N%)=c%(N%) �Gchanged%=�:M%=�in(c%(N%),C%()):�M%>N% �swap_notes(N%,M%) ��move_note(N%)
2F�
2P�
2Z
2d� �swap_notes(N%,M%)
2n
�s%,d%
2xs%=C%(N%):d%=c%(N%)
2�ȔC%(N%),C%(M%)
2�Ȕ?N%(s%),?N%(d%)
2�ȔN%(s%)?1,N%(d%)?1
2��
2�
2�� �move_note(N%)
2�
�s%,d%
2�s%=C%(N%):d%=c%(N%)
2��insert_note(d%)
2�?N%(d%)=?N%(s%)
2�N%(d%)?1=N%(s%)?1
2��delete_note(s%)
2��
3
3� �best
3
�N%,C%
3"#� short%,free%,rest%,any%,tied%
3,� N%=NC%�0�-1
36
C%=n%(N%)
3@�in(C%,c%())<0 �
3J�N%(C%)?-2�4 �
3Ttied%=C%+1
3^�
3h�pg%�%1<<C% �
3r)�(N%(C%)?-1>>3)=shortest% short%=C%+1
3|�N%(C%)?-2�&F8 �rest%=C%+1
3��
3�free%=C%+1
3��
3�
any%=C%+1
3��
3��
3��
3�P�short% C%=short% ��free% C%=free% ��rest% C%=rest% ��any% C%=any% �C%=tied%
3�	=C%-1
3�
3�� �in(U%,U%())
3��I%:I%=NN%
3�ȕI%�U%<>U%(I%):I%-=1:�
4=I%+(U%<>U%(I%))
4
4�� �same_pitch(c%,C%):�R%,r%:R%=?N%(C%)�&F8:r%=N%(c%)?-2�&F8:=N%(c%)-2>=MUSIC%(c%)�(g%�(N%(c%)?-2�4)=4)�%1<<c%�(R%�r%)=� �(�<>R%�r%=�)
4&
40� �preceding_gate(gp%)
4:�C%,gm%
4D'�C%=0�7:�S_C%(C%)=S% gm%=gm%�%1<<C%
4N�
4X�
4b
gp%-=1
4l#�gm%�?gp%�gp%<MUSIC%+2�gp%?-1=�
4v =?gp%�gp%>MUSIC%+1�gp%?-1<>�
4�
4�� �previous_gate(gp%)
4��C%,gm%
4�'�C%=0�7:�S_C%(C%)=S% gm%=gm%�%1<<C%
4��
4��
4�
gp%-=1
4�"ȕgp%>MUSIC%�gp%?-1=�:gp%-=2:�
4��gm%�?gp%�gp%<MUSIC%+2
4�=?gp%�gp%>MUSIC%+1
4�
4�� �conflict(T%,S%,L%)
4��C%,co%
5
L%+=16
5C%=7
5�
5 /co%=?GP%�%1<<C%�S_C%(C%)=S%�(?N%(C%)>>3)=L%
5*	C%+=�
54
�co%�C%<�
5>=C%-(co%<>0)
5H
5RQ� *********************************************************************** REM
5\Q�                                                                         REM
5fQ�           M U S I C   T Y P E S E T T I N G   R O U T I N E S           REM
5pQ�                                                                         REM
5zQ� *********************************************************************** REM
5�::
5�3�   PROCEDURE: set_score(Starting position PX%)
5��
5�N� DESCRIPTION: Typeset music score from current bar to end of music/screen
5�K�              No drawing is done as only the positions are calculated.
5��
5�F�     EFFECTS: Stores gate X positions & types in PX%() & PTYPE%()
5�:
5�� �set_score(PX%)
5�ȕ GP%<GATE%
5�?�?GP% �set_notes(?GP%):GP%+=1 ��set_attribute(GP%?1):GP%+=2
5�,�:� Until edge of screen or end of music
5�5EP%=GP%:� Last GP%, pointer to first undrawn gate
6.EX%=PX%:� Last PX%, index to last position
6OPX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%:� Appendation position after last symbol
6O� PX%(PX%+1)>S_Width% �SetExtent(PX%(PX%+1)+100*Hi%) � �SetExtent(S_Width%)
6$PXn%(NBars%)=PX%
6..PTYPE%(PX%+1)=Note%:� Note type by default
68�
6B::
6Lr� NOTE: The key signature is the only attribute that must be kept track of in order to ensure correct setting.
6V��       This is because a naturalising signature consists of the same number of naturals as accidentals in the previous key signature
6`:
6j� �set_attribute(A%)
6t(�A%�PTYPE%(PX%)+� ��A%�PTYPE%(PX%) �
6~&�T%:T%=%1:�A%�%1 ��T%=T%<<1:�A%�T%
6�&PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
6�
PX%+=1
6�PTYPE%(PX%)=T%
6�Ȏ T% �
6��Time%:PW%(PX%)=20*Hi%
6�	�Key%
6�c�A%�56 T%=accidental%+(A%>>2�%1)+2:SIG%(1)=A% �T%=accidental%+1:ȔA%,SIG%(1):�A%�56 �A%=8:T%+=1
6�&PW%(PX%)=(A%>>3�7)*(x%(T%)+X%(T%))
6�+�Clef%:PW%(PX%)=x%(clef%+3)+X%(clef%+3)
6��Bar%:PW%(PX%)=Hi%*4
6��
6��
7
7
� �set_notes(G%)
7�lx0%,lx1%,ly0%,ly1%
7B�C%,P%,R%,s%:� Channel, Note prefix & remainder widths, Sprite
7(	C%=-1
72�
7<�C%-=�:�G%�%1<<C%
7F�bound_note(!N%(C%))
7P%�lx0%>P% P%=lx0%:� Maximum prefix
7Z(�lx1%>R% R%=lx1%:� Maximum remainder
7d$N%(C%)+=2:� Pull from note queue
7n.�(2<<C%)>G%:� Until no more notes (1 bits)
7xnPX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%+P%:� Next position is previous position + width+gap+prefix of next note
7�%PX%+=1:� next note position index
7�#PW%(PX%)=R%:� Width of new note
7�!PTYPE%(PX%)=Note%:� Note type
7��
7�
7�� �bound_note(L%)
7�
�H%,S%,s%
7�H%=L%>>8�&FF
7�?�L%�&F8 S%=H%>>5�L%<<3�8 �S%=rest%�H%>>5:� Note/rest sprite
7�lx0%=x%(S%):� Prefix width
7�lx1%=X%(S%):� Suffix width
7�!ly0%=y%(S%):� Decender height
7�!ly1%=Y%(S%):� Ascender height
8�H%�7 �
8s%=accidental%�H%�7
8'lx0%+=x%(s%):� Add accidental width
8"&�y%(s%)>ly0% ly0%=y%(s%):� Lower ?
8,'�Y%(s%)>ly1% ly1%=Y%(s%):� Higher ?
86�
8@k�H%�24 s%=dot%+(H%>>3�3):lx1%=x%(S%)+X%(s%):�y%(s%)>ly0% ly0%=y%(s%):� Dot adds suffix and may be lower
8J�
8T::
8^� �position_staves
8h� Y%,S%
8r8Score_Height%=(PERC%+1+3*(STAVE%+1)+1)*Stave_Height%
8|%Y%=-Score_Height%-Stave_Height%�2
8�D�PERC% �S%=PERC%�1�-1:Y%+=Stave_Height%:Y_STAVE%(STAVE%+S%)=Y%:�
8�:� S%=STAVE%�0�-1:Y%+=3*Stave_Height%:Y_STAVE%(S%)=Y%:�
8��
8�
8�� �setup_staves
8�� O%
8��position_staves
8�#ScoreWBlk%!handle%=ScoreWind_h%
8�*ș GetWindowState%,,ScoreWBlk%+handle%
8�;ScoreWBlk%!y0%=ScoreWBlk%!y1%-Score_Height%-PaneHeight%
8�3ScoreWBlk%!scx%=0:ScoreWBlk%!scy%=PaneHeight%/2
8�ScoreWBlk%!under%=-1
8�&ș OpenWindow%,,ScoreWBlk%+handle%
9LHBAR%=0
9ScoreClosed%=�
9 Window%!handle%=ScoreWind_h%
9&'ș GetWindowState%,,Window%+handle%
90?� TRANSCRIBE% �place_top_panes(-1): �place_bottom_panes(-1)
9:� PLAYING% �CheckScroll
9D�
9N
9XD� �update_score(Window%!x0%,Window%!y0%,Window%!x1%,Window%!y1%)
9b Window%!handle%=ScoreWind_h%
9l*ș UpdateWindow%,,Window%+handle% � R%
9v	ȕ R%
9��:�draw_staves
9�*ș GetRectangle%,,Window%+handle% � R%
9��
9��
9�
9��   PROCEDURE: draw_staves
9��
9�/� DESCRIPTION: Draw current stave structure
9�&�              1 stave for 1 voice
9�(�              2 staves for keyboard
9�4�              3 staves for 1 voice and keyboard
9�.�              4 staves for 4 voice chorus
9�:
:� �draw_staves
:c� Y%,T%,B%,S%,L%:� Y%,T%,B%=Position & Y bounds of each stave, S%=Stave index, L%=Line position
:Q� x%,y%,lx1%:� Virtual coordinates of bottom left & top right of score window
: 6� c%,t%,b%:� Left edge of clip window and Y bounds
:*y%=Window%!y1%-Window%!scy%
:4x%=Window%!x0%-Window%!scx%
:>8lx1%=x%+Score_Width%:� lx1%>Clip%!x1% lx1%=Clip%!x1%
:H%c%=Clip%!x0%:�c%<x%+Hi% c%=x%+Hi%
:Rb%=Clip%!y0%:t%=Clip%!y1%
:\�PERC% �
:f� S%=STAVE%+1�STAVE%+PERC%
:pY%=y%+Y_STAVE%(S%)
:z!�b%<=Y%�t%>=Y% �c%,Y%,lx1%,Y%
:��
:��
:�� S%=0 � STAVE%
:�@Y%=y%+Y_STAVE%(S%):T%=Y%+Stave_Height%�2:B%=T%-Stave_Height%
:��b%<=T%�t%>=B% �
:�)�c%,Y%,lx1%,Y%:� Plot centre bar line
:��L%=Li%*2�L%*2�L%
:�*�c%,Y%+L%,lx1%,Y%+L%:� Plot upper line
:�*�c%,Y%-L%,lx1%,Y%-L%:� Plot lower line
:��
:��
:��
:�B%=Score_Width%
;.T%=Clip%!x1%-x%:�T%<B% B%=T%:� Right bound
;+T%=Clip%!x0%-x%:�T%<0 T%=0:� Left bound
;� � BADMODE% �
;$6  �draw_score(x%,y%,T%,B%):� Draw symbols on stave
;.�
;8$  � Window%!x0%, Window%!y1%-100
;B8  � "Cannot display score in this (256-colour) mode"
;L  �
;V�
;`::
;j;�   PROCEDURE: draw_score(Based X%,Y%, PX bounds A%,B%)
;t�
;~O� DESCRIPTION: Write current section of music score that appears between A%
;��              and B%
;�:
;�� �draw_score(X%,Y%,A%,B%)
;��PX%
;�
BAR%=0
;�t� must be subtle about redrawing last note (or other item) of score to prevent picking up rubbish data after end
;�� A%>PX%(PXn%(NBars%)) �
;�=  � A%>PX%(PXn%(NBars%))+2*Pgap% � � A%=PX%(PXn%(NBars%))
;�  �
;�T� ensure bar numbers are always completely updated; but don't lose 1st-note draw
;�� NBars%>2 �
;�,ȕ PX%(PXn%(BAR%+2))<A% � BAR%<=NBars%-1
< BAR%+=1
<
# �  :� get to drawstart quickly
< � BAR%>NBars% �
< �GetBarInfo(BAR%)
<( � GP%>=GATE% �
<2 ȕPX%(PX%+3)<A%�PX%<EX%
<<  �skip_gate
<F  �:� Skip music until A%
<P�
<Z �start_music
<d�
<nȕPX%(PX%)<=B%�GP%<GATE%
<xT�?GP% �draw_notes(?GP%):GP%+=1 ��draw_attribute(GP%?1):GP%+=2:� PLAYING% �CheckQ
<��
<��
<�
<�&�   PROCEDURE: draw_notes(Gate G%)
<��
<�K� DESCRIPTION: Get notes from the indicated channel queues and draw the
<�O�              particular types of note in the correct places on the stave.
<�Q�              One may be a rest, may have accidentals preceding it, may have
<�1�              dots following it, may be tied
<��
<�#� ASSUMPTIONS: Gate is non-zero
<��
<�� Join=?N%(C%)AND2
=:
=� �draw_notes(G%)
=3� C%,x%,y%,s%,l%,NC0%,NC1%,lasty%,checkstagger%
="%PX%+=1:� Move on to next position
=,Qx%=X%+PX%(PX%):� Calculate gate column X (convert from work- to screen-coord)
=6checkstagger%=�
=@	C%=-1
=J�
=T�C%-=�:�G%�%1<<C%
=^3NC0%=?N%(C%) : NC1%=N%(C%)?1 :� fast local vars
=hy%=Y%+Y_STAVE%(S_C%(C%))
=r�NC0%�&F8 �
=|l%=(NC0%>>3)-16
=�5�l%>5 �sprite(ledger%+l%�2,x%,y%):� Ledger lines
=�y%+=Li%*l%
=�s%=NC1%>>5�NC0%<<3�8
=�� checkstagger% �
=�1� stagger next note if too close to one below
=�T� stagger fails sometimes if channels of 2 adjacent notes are not in draw order?
=�U � �(lasty%-y%)<2*Li% �sprite(s%,x%+Pgap%,y%):checkstagger%=� � �sprite(s%,x%,y%)
=��
=�& �sprite(s%,x%,y%):checkstagger%=�
=� �
=�
lasty%=y%
=�4�NC1%�7 �sprite(accidental%�NC1%�7,x%-x%(s%),y%)
=��
>s%=rest%�NC1%>>5
>�sprite(s%,x%,y%)
>�
>&3�NC1%�24 �sprite(dot%+(NC1%>>3�3),x%+x%(s%),y%)
>0�NC0%�4 �sprite(tie%,x%,y%)
>:$N%(C%)+=2:� Pull from note queue
>D.�(2<<C%)>G%:� Until no more notes (1 bits)
>N�
>X::
>b� �draw_attribute(A%)
>l
�x%,N%
>vN%=�:�N%-=�:�A%�%1<<N%
>��PTYPE%(PX%)�%1<<N% PX%+=1
>�x%=X%+PX%(PX%)
>�p�N%+1 �draw_time_sig(A%),�draw_key_sig(A%),�draw_clef(A%),�draw_slur(A%),�draw_octave(A%),�draw_bar_line(A%)
>��
>�
>�� �PutBarInfo(bar%)
>�C� setup the various pointers to arrays at the start of this bar
>�� n%=0 � 7
>� BPn%(n%,bar%)=N%(n%)
>� �
>�PXn%(bar%)=PX%
>�GPn%(bar%)=GP%
>�� n%=0 � Max_Stave%
? CLEFn%(n%,bar%)=CLEF%(n%)
? �
?SIGn%(0,bar%)=SIG%(0)
? SIGn%(1,bar%)=SIG%(1)
?*�
?4
?>� �GetBarInfo(bar%)
?H9� get the values of the data at the start of this bar
?R� n%=0 � 7
?\ N%(n%)=BPn%(n%,bar%)
?f �
?pPX%=PXn%(bar%)
?zGP%=GPn%(bar%)
?�� n%=0 � Max_Stave%
?� CLEF%(n%)=CLEFn%(n%,bar%)
?� �
?�SIG%(0)=SIGn%(0,bar%)
?�SIG%(1)=SIGn%(1,bar%)
?��
?�
?�� �SetupBarStarts(bar%)
?�E� find pointers to various bits at the starts of all bars through
?�� the music. Start at bar%
?�E� this is just to speed up redraw, avoiding all the note-skipping
?�� last%
?�
BAR%=bar%
@-� bar%>0 �GetBarInfo(bar%) � �start_music
@last%=BAR%
@�PutBarInfo(BAR%)
@$ȕ GP%<GATE%
@. �?GP% �
@8  �skip_notes(?GP%):GP%+=1
@B �
@L#  �skip_attribute(GP%?1):GP%+=2
@V2  � BAR%<>last% last%=BAR% : �PutBarInfo(BAR%)
@` �
@j �
@tBAR%+=1
@~�PutBarInfo(BAR%)
@�NBars%=BAR%
@��
@�
@�� �skip_gate
@�A�?GP% �skip_notes(?GP%):GP%+=1 ��skip_attribute(GP%?1):GP%+=2
@��
@�
@�� �skip_notes(G%)
@�
PX%+=1
@�
�C%:C%=-1
@�,��C%+=1:�G%�%1<<C%:N%(C%)+=2:�(2<<C%)>G%
@��
A
A
� �skip_attribute(A%)
A�T%
A#T%=%1:�A%�%1 ��T%=T%<<%1:�A%�T%
A(	ȎT%�
A2�Time%,Key%:SIG%(T%-1)=A%
A<�Clef%:CLEF%(A%>>6)=A%>>3�3
AF�Bar%:BAR%+=1
AP�
AZ�T%�PTYPE%(PX%) PX%+=1
Ad�
An
Ax� �back_gate
A�C�GP%?-2 GP%-=1:�back_notes(?GP%) �GP%-=2:�back_attribute(GP%?1)
A��
A�
A�� �back_notes(G%)
A�
PX%-=1
A��C%:C%=�
A�,��C%-=�:�G%�%1<<C%:N%(C%)-=2:�(2<<C%)>G%
A��
A�
A�� �back_attribute(A%)
A��A%=Bar% BAR%-=1
A�,�A%�PTYPE%(PX%+1)+� ��A%�PTYPE%(PX%+1) �
A�
PX%-=1
B�
B
B� �draw_time_sig(A%)
B"SIG%(0)=A%
B,�S%,B$,D$,w%
B6B$=�((A%>>1�15)+1)
B@D$=�(%1<<(A%>>5)-1)
BJ	w%=x%
BT�B$<2 w%+=PW%(PX%)>>2
B^�D$<2 x%+=PW%(PX%)>>2
Bh�S%=0�STAVE%+PERC%
Br%�w%,Y%+Y_STAVE%(S%)+Li%*4-Vi%:�B$
B|�x%,Y%+Y_STAVE%(S%)-Vi%:�D$
B��
B��
B��
B�
B�� �draw_key_sig(A%)
B��S%,C%,N%,a%,W%
B�o�A%�56 SIG%(1)=A% �ȔA%,SIG%(1):a%=accidental%+1:� Change to C Major uses naturals in old key sig positions
B�N%=(A%>>3�7)-1
B��N%>=0 �
B�-A%=A%>>2�%1:� 0-Sharp or 1-flat signature
B��a% �a%=accidental%+2+A%
B�W%=x%(a%)+X%(a%)
B�x%+=x%(a%)
C� C%=0 � N%
C� S%=0�STAVE%
C>�sprite(a%,x%,Y%+Y_STAVE%(S%)+Li%*Key_Y%(CLEF%(S%),A%,C%))
C&�
C0
x%+=W%
C:�
CD�
CN�
CX
Cb� �draw_clef(A%)
Cl�S%
CvS%=A%>>6
C�CLEF%(S%)=A%>>3�3
C�;�S%<=STAVE% �sprite(clef%+CLEF%(S%),x%,Y%+Y_STAVE%(S%))
C��
C�
C�� �draw_slur(A%)
C��
C�
C�� �draw_octave(A%)
C��
C�
C�� �draw_bar_line(A%)
C�BAR%+=1
C��S%=0�STAVE%+PERC%
D$�sprite(bar%,x%,Y%+Y_STAVE%(S%))
D�
D� BAR%�5=0 �
D 1  � x%+Hi%,Y%+Y_STAVE%(0)+Stave_Height%+2*Vi%
D*  � �(BAR%)
D4  �
D>�(STAVE%+1)�2 �
DH� y%
DR/�x%+Hi%,Y%+Y_STAVE%(STAVE%)+Stave_Height%�2
D\8y%=Y_STAVE%(STAVE%-1)-Y_STAVE%(STAVE%)-Stave_Height%
DfC� BY 0,y% : � BY Hi%,0 : � BY 0,-y% : � Connect keyboard staves
Dp�
Dz�
D�
D�� �put_down
D��C%,PX%,X%,Y%,S%,s%
D�ș "Hourglass_On"
D�GP%=SCRIBE%(sgp%)
D� �C%=0�7:N%(C%)=SCRIBE%(C%):�
D�PX%=SCRIBE%(posx%)
D�X%=SCRIBE%(sx%)
D�Y%=SCRIBE%(sy%)
D�s%=SCRIBE%(sprite%)
D�S%=SCRIBE%(stave%)
D�C%=SCRIBE%(sc%)
D�*�release:� undraw sprite being dragged
E��s%<accidental% �put_note ��s%<clef% �put_accidental ��s%<dot% �put_clef ��s%<bar% �put_dot ��s%<time% �put_bar ��s%<key% �put_time ��s%<tie% �put_key ��put_tie
EGP%=SCRIBE%(sgp%)
E �C%=0�7:N%(C%)=SCRIBE%(C%):�
E$#�arrange_stave(SCRIBE%(stave%))
E.<� PX%(EX%)+200*Hi%>S_Width% �SetExtent(PX%(EX%)+200*Hi%)
E8� � CHANGED% �
EB CHANGED%=�
EL $Updated%="YES"
EV, �UpdateTitle(�GetStr(ScoreTitle%)+" *")
E` �
Ejș "Hourglass_Off"
Et�
E~
E�� �put_note
E�
�L%,E%
E�L%=SCRIBE%(line%)
E��X%=PX%(PX%+1) �
E��s%>=rest% L%=-16
E�E%=GP%=EP%
E�2�E% �insert_gate(1) �C%=�conflict(Note%,S%,L%)
E��E%�C%=� �
E�C%=�allocate_channel(S%)
E��C%>=0 �
E��insert_note(C%)
E��note_type(C%,s%�7)
F3�s%<rest% �note_line(C%,L%):�note_stem(C%,s%�8)
F
s%=!N%(C%)
F%�E% �set_score(PX%):X%=PX%(PX%+1)
F�update_note(S%,s%,X%,Y%)
F(�
F2�
F<s%=!N%(C%)
FF�delete_note(C%)
FP�?GP% �
FZ�update_note(S%,s%,X%,Y%)
Fd�
Fn�delete_gate(1)
Fx0�GP%?-2=0 ȕ?GP%=0�GP%<EP%:�delete_gate(2):�
F��rescore(PX%)
F��
F��
F��
F��X%>PX%(PX%+1) �skip_gate
F��insert_gate(1)
F�C%=�allocate_channel(S%)
F��insert_note(C%)
F��note_type(C%,s%�7)
F�3�s%<rest% �note_line(C%,L%):�note_stem(C%,s%�8)
F��rescore(PX%)
F��
F��
G
G� �put_tie
G�?N%(C%)�4 �
G"�note_tie(C%,�)
G,*�update_score(X%+24,Y%+12,X%+70,Y%+24)
G6�
G@�I%
GJ�note_tie(C%,�)
GT�skip_notes(?GP%):GP%+=1
G^�arrange_stave(S%)
GhGP%=SCRIBE%(sgp%)
Gr �I%=0�7:N%(I%)=SCRIBE%(I%):�
G|g�N%(C%)+2>=FINE%(C%)�(?N%(C%)�N%(C%)?2)�&F8 �note_tie(C%,�) ��update_score(X%+24,Y%+12,X%+70,Y%+24)
G��
G��
G�
G�� �put_accidental
G�
�A%,a%
G�a%=N%(C%)?1�7
G�A%=s%�7
G��A%=a% A%=0
G��note_accidental(C%,A%)
G�@�A%*a% �update_score(X%-34,Y%-24,X%+16,Y%+52) ��rescore(PX%)
G��
G�
G�� �put_dot
H
�D%,d%
Hd%=N%(C%)?1>>3�3
HD%=s%�3
H&�D%=d% D%=0
H0�note_dots(C%,D%)
H:�D%*d% �
HD9s%=N%(C%)?1>>5�?N%(C%)<<3�8:�?N%(C%)�&F8 �s%=s%�rest%
HNX%+=x%(s%)
HX&�update_score(X%+24,Y%-8,X%+50,Y%)
Hb�
Hl�rescore(PX%)
Hv�
H��
H�
H�� �put_clef
H��c%
H�c%=s%�3
H�'�GP%=EP%�?GP%�(GP%?1�%111)<>Clef% �
H��insert_gate(2)
H��clef(S%,c%)
H��
H�7ȕ ?GP%=0�(GP%?1�%111)=Clef%�(GP%?1>>6)<>S%�GP%<EP%
H��skip_gate
H��
H�6�GP%<EP%�?GP%=0�(GP%?1�%111)=Clef%�(GP%?1>>6)=S% �
I3�(GP%?1>>3�3)<>c% �clef(S%,c%) ��delete_gate(2)
I�
I�insert_gate(2)
I �clef(S%,c%)
I*�
I4�
I>�rescore(PX%)
IH�
IR
I\� �put_key
If%�GP%=EP%�?GP%�(GP%?1�%11)<>Key% �
Ip�insert_gate(2)
Iz%�key_sig(KEY_SIG%(0),KEY_SIG%(1))
I��
I�x�KEY_SIG%(1)>0�(GP%?1>>2�%1)<>KEY_SIG%(0)�(GP%?1>>3)<>KEY_SIG%(1) �key_sig(KEY_SIG%(0),KEY_SIG%(1)) ��delete_gate(2)
I��
I��rescore(PX%)
I��
I�
I�� �put_time
I�%�GP%=EP%�?GP%�(GP%?1�%1)<>Time% �
I��insert_gate(2)
I�(�time_sig(TIME_SIG%(0),TIME_SIG%(1))
I��rescore(PX%)
I��
I�;�(GP%?1>>1�15)<>TIME_SIG%(0)�(GP%?1>>5)<>TIME_SIG%(1) �
J(�time_sig(TIME_SIG%(0),TIME_SIG%(1))
J,�update_score(X%,-Score_Height%,X%+48,0)
J�
J$�delete_gate(2)
J.�rescore(PX%)
J8�
JB�
JL�
JV
J`� �put_bar
JjZ�(?GP%�GP%?1<>Bar%)�X%>PX%(PX%+1)�GP%<EP% �skip_gate ��GP%?-2=0�GP%?-1=Bar% �back_gate
Jt�GP%>MUSIC% �
J~ �GP%<EP%�?GP%=0�GP%?1=Bar% �
J��delete_gate(2)
J�
NBars%-=1
J�ȕ?GP%=0�GP%<EP%
J��delete_gate(2)
J��
J��rescore(PX%)
J��
J�8�GP%?-2 �insert_gate(2):�bar:NBars%+=1:�rescore(PX%)
J��
J��
J��
J�
K� �rescore(px%)
K
E�px% ��start_music:� Bar position assumed set, but reset if px%=0
K�set_score(px%)
K?� px%=0 �SetupBarStarts(0) � �SetupBarStarts(�FindBar(px%))
K(9�update_score(PX%(px%),-Score_Height%,Score_Width%,0)
K2�
K<
KF� �update_note(S%,N%,X%,Y%)
KP�lx0%,lx1%,ly0%,ly1%
KZ<�bound_note(N%):� Get minimum bounding rectangle of note
Kd|�N%�4 lx1%=X%(tie%):�Y%(tie%)>ly1% ly1%=Y%(tie%):� Tie sets suffix and may be higher (Tie bounds only apply to updating)
Kn�(Y%-Y_STAVE%(S%))>Li%*5 �
Kx �x%(dot%)>lx0% lx0%=x%(dot%)
K�:�X%(dot%)>lx1% lx1%=X%(dot%):� Extend to ledger extent
K��
K�8ly1%+=Y%:Y%-=ly0%:ly0%=Y_STAVE%(S%):� Stave position
K���ly1%<ly0%-Li%*5 ly1%=ly0%-Li%*5 ��Y%>ly0%+Li%*5 Y%=ly0%+Li%*5:� If ledger lines will be drawn increase vertical update space
K�F�update_score(X%-lx0%,Y%,X%+lx1%+Pgap%,ly1%):� Update symbol space
K��
K�
K�� �attach(s%,V%)
K�KSCRIBE%(sx%)=�:� New position (Maintain Y for orientation maintainance)
K�SCRIBE%(drawn%)=�
K�[�s%<rest%�SCRIBE%(sprite%)<rest% s%=s%�7�SCRIBE%(sprite%)�8:� Maintain note orientation
K�SCRIBE%(sprite%)=s%
K�SCRIBE%(valid%)=V%
LSCORING%=�
L�
L::
L"� �release
L,�SCORING%�SCRIBE%(drawn%) �
L6?�Window%:Window%=Icon%+100:� Don't corrupt window workspace
L@F�float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%)):� Undraw sprite
LJ��SCRIBE%(sprite%)<rest% �SCRIBE%(line%)>5 �float(ledger%+SCRIBE%(line%)�2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%))):� Undraw ledger lines
LT/SCRIBE%(sx%)=�:� Continue drawing of symbol
L^SCRIBE%(drawn%)=�
Lh�
Lr�
L|::
L�#�   PROCEDURE: scribe(At X%,Y%)
L��
L�J� DESCRIPTION: Draw current music symbol at position over score window
L�:
L�� �scribe(X%,Y%)
L�
�S%,L%,C%
L� Window%!handle%=ScoreWind_h%
L�'ș GetWindowState%,,Window%+handle%
L� X%-=Window%!x0%-Window%!scx%
L� Y%-=Window%!y1%-Window%!scy%
L��proximate(SCRIBE%(valid%))
L�(�X%<>SCRIBE%(sx%)�Y%<>SCRIBE%(sy%) �
L��A%
MA%=�
MU�(SCRIBE%(valid%)�112)=96 A%=�:�C%>=0 A%=SCRIBE%(valid%)�8�S%<=STAVE%�?N%(C%)�&F8
M	�A% �
M&�SCRIBE%(drawn%) �
M06�float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
M:v�SCRIBE%(sprite%)<rest% �SCRIBE%(line%)>5 �float(ledger%+SCRIBE%(line%)�2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
MD�
MNSCRIBE%(drawn%)=�
MX�
Mb�SCRIBE%(sprite%)<rest% �
Ml/�L%>5 �float(ledger%+L%�2,X%,Y_STAVE%(S%))
MvK�Y%<>SCRIBE%(sy%) SCRIBE%(sprite%)=SCRIBE%(sprite%)�7�8�Y%>SCRIBE%(sy%)
M��
M�SCRIBE%(sx%)=X%
M�SCRIBE%(sy%)=Y%
M�SCRIBE%(stave%)=S%
M�P�S%<=Max_Stave% SCRIBE%(sclef%)=CLEF%(S%) �SCRIBE%(sclef%)=CLEF%(Max_Stave%)
M�SCRIBE%(line%)=L%
M�SCRIBE%(posx%)=PX%
M�SCRIBE%(sgp%)=GP%
M�SCRIBE%(sc%)=C%
M� �C%=0�7:SCRIBE%(C%)=N%(C%):�
M�"�float(SCRIBE%(sprite%),X%,Y%)
M��
M��
N�
N::
N5�   PROCEDURE: proximate(Positions valid mask V%)
N �
N*O� DESCRIPTION: Will set X%,Y% to be the nearest valid position to the point
N4K�              X%,Y% supplied (all in stave coordinates) and return the
N>1�              associated position index PX%.
NH�
NRF�              A mask is supplied to indicate the valid positions:
N\>�              V% bit  0 -> Valid Time signature positions
Nf=�                      1 -> Valid Key signature positions
Np4�                      2 -> Valid Clef positions
Nz1�                      3 -> At note positions
N�0�                      4 -> In between notes
N�J�                      5 -> To nearest stave line (else nearest stave)
N�9�                      6 -> To nearest symbol present
N�3�                      7 -> On bar line if near
N��
N���   EFFECTS: Sets S%=Stave, L%=Line(-15..15), C%=Channel of note, GP%,N%()=Gate & note pointers, PX%=PX%() index, X%,Y% position
N�:
N�4� �proximate(V%):� (V%, var X%,Y%) = (S%,L%,PX%)
N�&�d%,D%:� Distance previous&current
N�3�px%,x%:� Previous PX%, Between note X position
N�)�gp%:� Previous gate pointer, key sig
N�%� NBars%>4 � BAR%=LHBAR% � BAR%=0
N�2�GetBarInfo(BAR%) : � Start from start of page
O1D%=4*S_Width%:� A suitably excessive distance
O� V%�7 �
O�T%:� Type mask
O$@X%-=X%(clef%)>>1:� Pointer points to centre of Clef/Key/Time
O.JT%=-V%<<1�6:� Valid Clef/Key/Time: Work out types to ignore after bars
O8�
OB0�savp:� Save previous distance, pointers etc
OL@��skip_gate:�PTYPE%(PX%)�Bar%�GP%=EP%:� Move to next bar PX%
OV�PTYPE%(PX%)�Bar% �
O`ȕPTYPE%(PX%+1)�T%�GP%<EP%
Oj9��skip_gate:�GP%=EP%�GP%?1�%111�%100:� Skip ALL clefs
Ot�:� Skipping any T% types
O~=D%=�(X%-PX%(PX%+1)):� Calculate distance to this position
O��
O� D%=2*S_Width%:� No more bars
O��
O�B�D%>d%�GP%=EP%:� Until distance increases or no more positions
O�2�d%<D% �rstp:� Previous position may be closer
O�#X%=PX%(PX%+1):� Set as position
O��
O�3X%-=X%(2)>>1:� Pointer points to centre of note
O��
O�0�savp:� Save previous distance, pointers etc
O��skip_gate:� Next symbol
O�CȕPTYPE%(PX%+1)�GP%<EP%:�skip_gate:�:� Skip any attribute types
PBD%=�(X%-PX%(PX%+1)):� Calculate distance to this note position
P
>�D%>d%�GP%=EP%:� Until distance increases or no more notes
P��d%<D%�GP%=EP%�V%�64 �rstp:� Previous position may be closer (or the last valid note position for an accidental/dot to appear)
P�V%�16�GP%<EP% �
P(3� Valid between notes (if before last position)
P2 �X%<PX%(PX%+1)�X%>PX%(EX%) �
P<v�PTYPE%(PX%) x%=PX%(PX%)+PW%(PX%)-X%(2) �x%=PX%(PX%):� Before current: between previous. (also if after last note)
PFx%=x%+PX%(PX%+1)>>1
PP3�V%�128 x%+=Hi%*4:�PTYPE%(PX%)=Bar% x%=PX%(PX%)
PZ�
Pd>x%=PX%(PX%+1)+PX%(PX%+2)>>1:� After current: between next.
Pn7�V%�128 x%+=Hi%*4:�PTYPE%(PX%+2)=Bar% x%=PX%(PX%+2)
Px�
P�l�V%�8��(PX%(PX%+1)-X%)<�(x%-X%) X%=PX%(PX%+1) �X%=x%:� If on notes also valid then find closest position
P��
P�9X%=PX%(PX%+1):� Only at notes valid: closest position
P��
P��
P� C%=-1:� Initially no channel
P� L%=0:� Initially centre line
P��V%�64�?GP%>0 �
P�<� To nearest symbol at gate (just note at the moment !!)
P�5�G%,c%:� Gate mask copy, Previous channel counter
P�	c%=C%
P�2d%=2*S_Height%:� A suitably excessive distance
P�G%=?GP%
Q�
Q�C%-=�:�G%�%1<<C%
QD%=Y%-Y_STAVE%(S_C%(C%))
Q"O�?N%(C%)�&F8 D%=�(D%-Li%*((?N%(C%)>>3)-16)) �D%=�D%:� Distance to note/rest
Q,�D%<d% d%=D%:c%=C%
Q6�(2<<C%)>G%
Q@C%=c%:� Nearest note
QJS%=S_C%(C%)
QT#�?N%(C%)�&F8 L%=(?N%(C%)>>3)-16
Q^�
Qh�MS%:� Highest stave number
Qr@MS%=STAVE%:�V%�6 �MS%+=PERC%:� Clef & Key not on percussion.
Q|S%=-1:� Before first stave
Q�2D%=2*S_Height%:� A suitably excessive distance
Q��
Q�"d%=D%:� Copy previous distance
Q�S%+=1:� Next stave
Q�DD%=�(Y%-Y_STAVE%(S%)):� Distance between point and current stave
Q�>�D%>d%�S%=MS%:� Until distance increases or no more staves
Q�NS%+=d%<D%:� Previous stave was closest unless last&current stave is nearer
Q��V%�32�
Q�c�S%=STAVE%+1 S%+=Y%>=Y_STAVE%(STAVE%)-Li%*16:� Ledger lines take priority over percussion lines
Q��S%<=STAVE% �
Q�QL%=(Y%-Y_STAVE%(S%))/Li%+16.75:L%-=16:� Y% is L% Lines away from centre stave
Q�5�L%>15 L%=15*�L%:� No further than 15 lines away
Q��
R�
R�
R1Y%=Y_STAVE%(S%)+L%*Li%:� Centre line + offset
R&�
R0::
R:
RDK� �savp:n%()=N%():d%=D%:px%=PX%:gp%=GP%:clef%()=CLEF%():sig%()=SIG%():�
RN
RXE� �rstp:N%()=n%():PX%=px%:GP%=gp%:CLEF%()=clef%():SIG%()=sig%():�
Rb
Rl� �SetTempo(T%)
Rv
Tempo%=T%
R�,ș Sound_QTempo,Tempo%(T%)*128*4096�6000
R��
R�
R�,� given x position, return number of bar
R�� �FindBar(xpos%)
R�
� bar%
R�
bar%=0
R�5ȕ PX%(PXn%(bar%))<xpos% � bar%<=NBars%:bar%+=1:�
R�� bar%>0 bar%-=1
R�	=bar%
R�
R�� �play_start
R�
�C%,n%
Sș Sound_Configure,8
SL� set play start bar PBAR% to start of currently displayed window (scx%)
S Window%!handle%=ScoreWind_h%
S 'ș GetWindowState%,,Window%+handle%
S* PBAR%=�FindBar(Window%!scx%)
S4PP%=GPn%(PBAR%)
S>� n%=0 � 7
SH P%(n%)=BPn%(n%,PBAR%)
SR �
S\�C%=0�3
Sf&PCLEF%(C%)=Clef%(CLEFn%(C%,PBAR%))
Sp�
Sz!�play_key_sig(SIGn%(1,PBAR%))
S�PLAYING%=�
S�SCROLLING%=�
S�GBeats%=((SIGn%(0,PBAR%)>>1�&F)+1)*Length%(SIGn%(0,PBAR%)>>3�%11100)
S�Q%()=Beats%
S�TIE%=&FF
S�B2%=&10000
S�ș Sound_QBeat,Beats%
S�Lș Sound_QSchedule,Beats%,Sch%�Sound_QTempo,Tempo%(Tempo%)*128*4096�6000
S�)C%=Beats%/50*&1000:�C%>&7FFF C%=&7FFF
S�ș Sound_QTempo,C%
S�MIDI_OFF%(0,0) = -1
S�MIDI_OFF%(1,0) = -1
S��
T
TF� flush sound queue and ensure note_offs are sent to midi channels
T��play_stop
T$� note%, n%
T.PLAYING%=�
T8ș Sound_QInit
TB� MIDIpresent% �
TL � n%=0 � 1
TV
  note%=0
T`"  ȕ (MIDI_OFF%(n%,note%) > 0)
Tj.   ș MIDI_TxCommand%, MIDI_OFF%(n%,note%)
Tt   note%+=1
T~   �
T�  �
T� � reset end markers
T� MIDI_OFF%(0,0) = -1
T� MIDI_OFF%(1,0) = -1
T� �
T��
T�
T�D� This should give a reasonable approximation to a smooth scroll
T�� �CheckScroll
T�;� PosX%, WindowWidth%, BarPos%, LastScroll%,ThisScroll%
T�� ScoreClosed% �
T� � � PLAYING% SCROLLING%=�
U �
U
 �
U� BADMODE% � PBAR%<=2 �
U� PLAYING% �CheckQ
U(?� PLAYING% SBAR%=PBAR%-2 � B1%=B2%:B2%=Ə:�B2%<B1%:SBAR%+=1
U22� SBAR%>=NBars% � SBAR%>PBAR%+2 SCROLLING%=�:�
U<*ș GetWindowState%,,ScoreWBlk%+handle%
UF.WindowWidth%=ScoreWBlk%!x1%-ScoreWBlk%!x0%
UPLastScroll%=ScoreWBlk%!scx%
UZPosX%=PX%(PXn%(SBAR%))
Ud2BarPos%=(PX%(PXn%(SBAR%+1))-PosX%)*Ə � Beats%
Un\� BarPos%*2<Pgap% � :� if small amount into bar can scroll to wrong bar (sync with play)
UxPosX%+=BarPos%
U�&ThisScroll% = PosX%-WindowWidth%�2
U�� ThisScroll%<=0 �
U� � ThisScroll%<>LastScroll% �
U� � auto-scroll
U�= � divide scroll into small bits to make it appear smooth
U�0 ScoreWBlk%!scx%=(LastScroll%+ThisScroll%)/2
U�' ș OpenWindow%,,ScoreWBlk%+handle%
U�  ScoreWBlk%!scx%=ThisScroll%
U�' ș OpenWindow%,,ScoreWBlk%+handle%
U�O LHBAR%=�FindBar(ThisScroll%)-1 :� the bar number at the left of the window
U� � PLAYING%=� �
U�$� stop scrolling at end of music
U�2   � ScoreWBlk%!scx%<=LastScroll% SCROLLING%=�
V   �
V �
V�
V"
V,� �play_bar
V6@�C%,L%,I%,D%,S%,Q%,T%,B%,A%:� Vars for play_bar & play_notes
V@� f
VJMIDI_Notenum%=0
VT9Q%()=Beats%:� Reset stave queue counters for next bar
V^B%=PBAR%
Vh9Accidental%()=0:� No incidental accidentals initially
VrFirst%=�
V|ȕB%=PBAR%�PP%<GATE%
V�A�?PP% �play_notes(?PP%):PP%+=1 ��play_attribute(PP%?1):PP%+=2
V�First%=�
V��
V�#�PP%>=GATE% PLAYING%=�:SBAR%+=1
V��
V�
V�O� Notes for each gate start playing at Q%; the latest Q%() of the staves on
V�N� which notes are to play. This is because all notes in a gate play at the
V�P� same time and cannot start before the shortest of the notes preceding them
V�� have finished.
V�>� Q% is the time at which the notes in the gate are played
V�L� Q%(S%) is the time at the end of the shortest note played on stave S%.
V�E� QI%(S%) is the current shortest note beats interval on stave S%
W
W� �play_notes(G%)
W)� note%, packed%, Qoff%,xtraVol,tempo
W&+tempo = 5 * 128 * Tempo%(Tempo%) / 6000
W0
Q%=�:C%=�
W:��C%-=�:�G%�%1<<C%
WD$�Q%(S_C%(C%))>Q% Q%=Q%(S_C%(C%))
WN�(2<<C%)>G%
WXQI%()=&10000:C%=�
Wb�
Wld  � First% xtraVol=1.01 � xtraVol=1.0 :� a little dynamics. stress 1st beat in bar very slightly
Wv  �C%-=�:�G%�%1<<C%
W�O  � �(xtraVol*Volume%(Volumes%(C%)))>&7F xtraVol=1.0  :� ensure no overflow
W�?  T%=?P%(C%):D%=P%(C%)?1:I%=D%>>3:S%=S_C%(C%):L%=T%>>3:A%=0
W�  �L%�S%<=STAVE% �
W�%    �D%�7 Accidental%(S%,L%)=D%�7
W�o    A%=Accidental%(S%,L%):L%+=PCLEF%(S%):�A% �A%=Key%(L%�7):� If no accidental then revert to key signature
W�	    �
W�  �TIE%�%1<<C% �
WƐ    D%=Duration%(Tempo%)?I%:�T%�4 TIE%=TIE%��(%1<<C%):T%=P%(C%)+1:�T%+=2:D%+=Duration%(Tempo%)?(?T%>>3):�T%>FINE%(C%)�4��T%?�:�D%>254 D%=254
W�
    �L% �
W�M      �C%+1,�(xtraVol*Volume%(Volumes%(C%)))�&100,Line(L%)+Aoff(A%),D%,Q%
W�      � MIDIpresent% �
W�>        � (MIDIChannel%(C%)>=1) � (MIDIChannel%(C%)<=16) �
W�>          note% = 12 + �(((Line(L%)+Aoff(A%))/&1000) * 12)
Xb          packed% = (MIDIChannel%(C%)-1) � (note%<<8) � �(xtraVol*(Volume%(Volumes%(C%)))<<16)
XE          MIDI_OFF%(PBAR%�2,MIDI_Notenum%) = M_NoteOff% � packed%
X           MIDI_Notenum% += 1
X A          MIDI_OFF%(PBAR%�2,MIDI_Notenum%) = -1 :� end marker
X*'          � D% = no. of 5 centisecs
X4%          Qoff% = Q% + D% * tempo
X>i          � Qoff% > Q% + 15 Qoff% -= 10  :� ensure note is off after start and before next note start
XHT          ș Sound_QSchedule,Q%,    Sch% � MIDI_TxCommand%, M_NoteOn%  � packed%
XRT          ș Sound_QSchedule,Qoff%, Sch% � MIDI_TxCommand%, M_NoteOff% � packed%
X\          �
Xf
        �
Xp      �
Xz  �
X�    �4��T% TIE%=TIE%�%1<<C%
X�	    �
X�J  P%(C%)+=2:�Length%(I%)<QI%(S%) QI%(S%)=Length%(I%):Q%(S%)=Q%+QI%(S%)
X�  �(2<<C%)>G%
X��
X�
X�� �play_attribute(A%)
X�C%=�:�C%-=�:�A%�%1<<C%
X�p�C%+1 �play_time_sig(A%),�play_key_sig(A%),�play_clef(A%),�play_slur(A%),�play_octave(A%),�play_bar_line(A%)
X��
X�
X�� �play_time_sig(A%)
X�+A%=((A%>>1�&F)+1)*Length%(A%>>3�%11100)
Y1ș Sound_QSchedule,Beats%,Sch%�Sound_QBeat,A%
Y
Beats%=A%
Y�
Y$
Y.� �play_key_sig(A%)
Y8�N%:A%=A%>>2
YB&�N%=0�6:Key%(N%)=Key_Sig%(A%,N%):�
YL�
YV
Y`� �play_clef(A%)
Yj PCLEF%(A%>>6)=Clef%(A%>>3�3)
Yt�
Y~
Y�� �play_slur(A%)
Y��
Y�
Y�� �play_octave(A%)
Y��
Y�
Y�� �play_bar_line(A%)
Y�PBAR%+=1
Y��
Y�
Y�� �initialise
Y�� SoundEnable%
Z�EnumerateSWIs
Z
�initialise_miscellany
Z�initialise_screen
Z�initialise_sprites
Z(�initialise_wimp
Z2"SoundEnable%=�initialise_sound
Z<�initialise_music
ZF�initialise_menu
ZP[� SoundEnable%=1 � �CheckOK("Sound is not enabled. Do you wish to quit?", 3) �terminate
ZZ=�
Zd
Zn� �EnumerateSWIs
Zx�W%:W%        = &400C0
Z�SpriteOp%          = &2E
Z�Initialise%        = W%+0
Z�CreateWindow%      = W%+1
Z�CreateIcon%        = W%+2
Z�OpenWindow%        = W%+5
Z�CloseWindow%       = W%+6
Z�Poll%              = W%+7
Z�RedrawWindow%     = W%+8
Z�UpdateWindow%      = W%+9
Z�GetRectangle%      = W%+10
Z�GetWindowState%    = W%+11
Z�SetIconState%      = W%+13
Z�GetIconInfo%       = W%+14
[GetPointerInfo%    = W%+15
[DragBox           = W%+16
[ForceRedraw       = W%+17
["CreateMenu        = W%+20
[,DecodeMenu        = W%+21
[6SetExtent         = W%+23
[@OpenTemplate      = W%+25
[JCloseTemplate     = W%+26
[TLoadTemplate      = W%+27
[^CloseDown         = W%+29
[hBș "OS_SWINumberFromString",0,"Wimp_SendMessage" � SendMessage
[rLș "OS_SWINumberFromString",0,"Wimp_GetWindowOutline" � GetWindowOutline
[|>ș "OS_SWINumberFromString",0,"Wimp_SetColour" � SetColour
[�
[�� S0,S1,S2
[�8ș "OS_SWINumberFromString",0,"Sound_Configure" � S0
[�8ș "OS_SWINumberFromString",0,"Sound_Volume"    � S1
[�8ș "OS_SWINumberFromString",0,"Sound_QInit"     � S2
[�Sound_Configure       = S0
[� Sound_Enable          = S0+1
[� Sound_Stereo          = S0+2
[�Sound_Volume          = S1
[� Sound_InstallVoice    = S1+3
[� Sound_AttachVoice     = S1+5
[� Sound_Control         = S1+9
[�Sound_QInit           = S2
\ Sound_QSchedule       = S2+1
\ Sound_QRemove         = S2+2
\ Sound_QFree           = S2+3
\& Sound_QTempo          = S2+5
\0 Sound_QBeat           = S2+6
\:Sch%=&F000000
\D� M%
\N� �
\X� � � MIDIpresent%=� : �
\b9ș "OS_SWINumberFromString",0,"MIDI_SoundEnable" � M%
\lM_NoteOff% = &80
\vM_NoteOn%  = &90
\�!MIDI_SoundEnable%        = M%
\�%MIDI_SetTxChannel%       = M% + 2
\�%MIDI_SetTxActiveSensing% = M% + 3
\�&MIDI_TxCommand%          = M% + 10
\�&MIDI_TxLocalControl%     = M% + 15
\�&MIDI_TxOmniModeOff%      = M% + 17
\�&MIDI_TxOmniModeOn%       = M% + 18
\�&MIDI_TxMonoModeOn%       = M% + 19
\�&MIDI_TxPolyModeOn%       = M% + 20
\�&MIDI_TxProgramChange%    = M% + 21
\�&MIDI_TxSystemReset%      = M% + 30
\�1MIDIpresent%=� : � disable untested MIDI bits
\��
]
]� �initialise_miscellany
]� Resourcedir 255
] 	� len
]*Eș "OS_ReadVarVal", "Maestro$dir", Resourcedir, 255, 0, 0 � ,,len
]44Resourcedir?len=13 : � It needs a cr termination
]>Resourcedir$=$Resourcedir
]H�=0
]RAwaitingAck%=�
]\DRAGGING%=�
]f
SAVING%=�
]pPLAYING%=�
]zSCROLLING%=�
]�TRANSCRIBE%=�
]�� String_Space% 256
]�OS_File=&8
]�#Sprite$=Resourcedir$+".Sprites"
]�CHANGED%=�
]�FILE%=�
]�laddr%=0
]�eaddr%=0
]��
]�
]�� �initialise_screen
]�� modeblockin  40
]�� modeblockout 40
^�getmodeinfo(�)
^�set_colours
^�
^$
^.� �set_colours
^8�C%
^B1� colours defined in memo from WStoye 21/7/88
^LC_MenuTitlefg = 7
^VC_MenuTitlebg = 2
^`C_Menufg = 7
^jC_Menubg = 0
^tC_MenuItemfg = 7
^~C_MenuItembg = 0
^��
^�
^�� �getmodeinfo(new)
^�� S_Rows%, S_Columns%
^�!modeblockin!0=0 : � ModeFlags
^�modeblockin!4=1 : � ScrRCol
^�modeblockin!8=2 : � ScrBCol
^� modeblockin!12=3 : � NColour
^�#modeblockin!16=4 : � XEigFactor
^�#modeblockin!20=5 : � YEigFactor
^�$modeblockin!24=11 : � XWindLimit
^�$modeblockin!28=12 : � YWindLimit
_(modeblockin!32=-1 : � terminate list
_
6ș "OS_ReadVduVariables",modeblockin, modeblockout
_QBADMODE% = � : � ((modeblockout!12)>15) :REM doesn't work in 256-colour modes
_@� no point in reading sizes since they are fixed by the wimp
_(Hi%=1<<(modeblockout!16)
_2Vi%=1<<(modeblockout!20)
_<(S_Width%=Hi% * ((modeblockout!24)+1)
_F)S_Height%=Vi% * ((modeblockout!28)+1)
_PHi%=2: Vi%=4
_Z$C_Width%=8*Hi% : C_Height%=8*Vi%
_d
� � new �
_nQ  � � BADMODE% ș"Wimp_ReadPixTrans",&200,SprBlk%,S%(0),,,,factors%,pixtrans%
_x  �
_��
_�
_�� �initialise_sprites
_�� factors% 16
_�� pixtrans% 16
_�jș "Wimp_SpriteOp", 11,,Resourcedir$+".!Sprites" :� merge music file type sprite into wimp sprite area
_�SpriteLen% = 10000
_�� SprBlk% SpriteLen%
_�B!SprBlk% = SpriteLen%        :� initialise private sprite area
_�SprBlk%!4 = 0
_�SprBlk%!8 = 16
_�SprBlk%!12 = 16
_�?ș SpriteOp%, 512+10, SprBlk%, Sprite$ :� *SLOAD equivalent
`)SprPlot% = &234  : � sprite plot code
`� I%,N%,x%,y%,W%,H%
`�
`"	N%=-1
`,�S$
`6ȕS$<>""
`@�x%,y%,W%,H%,S$
`J	N%+=1
`T�
`^,�assert(N%>=0,"loading sprite data.") �
`hM� S$(N%),x%(N%),y%(N%),X%(N%),Y%(N%), S%(N%) : � S%() are sprite pointers
`r�
`|�I%=0�N%
`�� S$(I%),x%,y%,W%,H%
`�Nș SpriteOp%, 256+24, SprBlk%, S$(I%) � ,,S%(I%) : � get pointer to sprite
`�x%(I%)=x%*Hi%
`�y%(I%)=y%*Vi%
`�X%(I%)=(W%-x%)*Hi%
`�Y%(I%)=(H%-y%)*Vi%
`��
`�note%=0
`�rest%=16
`�accidental%=24
`�clef%=32
`�high%=36
`�dot%=44
aledger%=47
abar%=48
atime%=55
a&key%=56
a0tie%=57
a:pointer%=58
aDO� SL%(N%,1):� List & item indexes for each sprite (set in list definitions)
aNJSCORING%=�:� Flag indicating a sprite is to be drawn under the pointer
aXwasSCORING%=�
abstopSCORING%=�
alSCORING%=�
av3� SCRIBE%(18):� Details of symbol under pointer
a�$� 0-7 Channel pointers into N%()
a�%sx%=8:� Current sprite X position
a�%sy%=9:� Current sprite Y position
a�/drawn%=10:� Flag indicating sprite presence
a�sprite%=11:� Sprite number
a�%valid%=12:� Valid stave positions
a�*stave%=13:� Current stave symbol is on
a�Csclef%=14:� Current clef applying to symbol (used for key sigs)
a�.line%=15:� Current stave line symbol is on
a�posx%=16:� X music position
a�!sgp%=17:� Symbol gate pointer
a�=sc%=18:� Channel number if symbol specified close to note
a��getmodeinfo(�)
b�
b� name, x, y, w, h
bp� B,7,3,26,7,SB,0,2,12,5,Mu,0,2,11,15,Cu,0,2,11,15,Qu,0,2,17,17,SQu,0,2,17,17,DSQu,0,2,17,17,SDSQu,0,2,17,17
b v� B,7,3,26,7,SB,0,2,12,5,Md,0,12,11,15,Cd,0,12,11,15,Qd,0,14,11,17,SQd,0,14,11,17,DSQd,0,14,11,17,SDSQd,0,14,11,17
b*�� Rest,-1,-1,8,4,Rest,-1,-2,8,4,Rest,-1,0,8,4,Rest4,-2,5,7,12,Rest8,-1,4,9,8,Rest16,0,8,11,12,Rest32,1,8,13,16,Rest64,2,12,15,20
b4�� M,0,2,11,5,Natural,8,6,7,13,Sharp,10,5,9,11,Flat,8,3,7,12,Sharp2,9,2,8,5,Flat2,14,3,13,12,NSharp,17,6,16,13,NFlat,15,6,14,15
b>D� Treble,0,16,18,31,Alto,0,8,16,19,Alto,0,4,16,19,Bass,0,7,20,17
bH6� Bh,7,3,26,7,SBh,0,2,12,5,Mh,0,2,11,5,Ch,0,2,11,5
bRR� ldg5,2,28,15,17,ldg4,2,24,15,13,ldg3,2,20,15,9,ldg2,2,16,15,5,ldg1,2,12,15,1
b\L� Dot1,-12,2,3,2,Dot2,-12,2,8,2,Dot3,-12,2,13,2,Bar,-1,8,2,17,C,0,2,11,5
bfW� ldg1,2,-12,15,1,ldg2,2,-12,15,5,ldg3,2,-12,15,9,ldg4,2,-12,15,13,ldg5,2,-12,15,17
bp5� Time,1,9,25,19,Key,0,13,0,30,Tie,-12,-3,23,3,""
bz
b�� �initialise_wimp
b��enumerate_wimp_offsets
b�6task%=�("T")+(�("A")<<8)+(�("S")<<16)+(�("K")<<24)
b�4ș Initialise%, 200, task%, "Maestro" � ,Task_h%
b�Mouse_X%=640:Mouse_Y%=560
b�PTIME%=0
b�� SpriteName% 14
b�$SpriteName%="!Maestro"
b� !Icon%=-1: � iconbar utility
b�
Icon%!4=0
b�
Icon%!8=0
b�Icon%!12=64
b�Icon%!16=68
c6Icon%!20=(&311A � (0<<24) � (7<<28)) :� indirected
c+Icon%!24=SpriteName% :� indirected name
c(Icon%!28=1 :� use common sprite area
c$Icon%!32=12 :� name length
c.'ș CreateIcon%, ,Icon% � Maestro_h%
c8�load_templates
cB�
cL
cV� �enumerate_wimp_offsets
c`� Wimp_Space% &4000
cjWindow%=Wimp_Space%+4
cthandle%=-4
c~x0%=0:y0%=4:x1%=8:y1%=12
c�scx%=16:scy%=20
c�
under%=24
c�flags=28:status=30
c�%tFrgd=32:tBkgd=33:Frgd=34:Bkgd=35
c�sbo=36:sbi=37
c�tHigh=38
c�title_flags=56
c�work_area_flags=60
c�sprite_area=64
c�title=72
c�icons=84
c�icon_defs=88
dIcon%=Wimp_Space%+4
d

iflags=16
d
Colour=19
didata=20
d(Mouse%=Wimp_Space%
d2
buttons=8
d<
window=12
dFicon=16
dPold_buttons=20
dZ
colour=23
ddstate=4
dn
mask=8
dxClip%=Window%+24
d�
key=20
d��
d�
d�� �load_templates
d�� size, end
d�� windowname 12
d�� ScoreWBlk% 32
d�� NotePBlk% 32
d�� SharpPBlk% 32
d�� RestPBlk% 32
d�� ScoreTitle% 256
d�size = 1000
d�dialogsize = 3000
eK� InstrIndirect size : � buffer for indirected text of instruments list
eScoreWBlk%-=handle%
eL� DialogIndirect dialogsize : � buff for indirected text of dialog boxes
e"NotePBlk%-=handle%
e,SharpPBlk%-=handle%
e6RestPBlk%-=handle%
e@/ș OpenTemplate, ,Resourcedir$+".Templates"
eJ$windowname="ScoreWind"
eTOș LoadTemplate, ,Window%, ScoreTitle%, ScoreTitle%+255, -1, $windowname, 0
e^UWindow%!68=&10001 :� reserved word sets min window size. to other than title size
eh-ș CreateWindow%, ,Window% � ScoreWind_h%
er#ScoreWBlk%!handle%=ScoreWind_h%
e|8ș GetWindowState%, ScoreWind_h%, ScoreWBlk%+handle%
e�$windowname="SharpsPane"
e�Mș LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
e�1Window%!64=SprBlk% :� use private sprite area
e�.ș CreateWindow%,, Window% � SharpsPane_h%
e�$SharpPBlk%!handle%=SharpsPane_h%
e�+ș GetWindowState%,, SharpPBlk%+handle%
e�SharpPBlk%!under%=-1
e�$windowname="RestsPane"
e�Mș LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
e�1Window%!64=SprBlk% :� use private sprite area
e�-ș CreateWindow%, ,Window% � RestsPane_h%
e�"RestPBlk%!handle%=RestsPane_h%
e�*ș GetWindowState%,, RestPBlk%+handle%
f"RestPBlk%!under%=SharpsPane_h%
f$windowname="NotesPane"
fMș LoadTemplate, ,Window%, Window%+icons, Window%+200, -1, $windowname, 0
f&1Window%!64=SprBlk% :� use private sprite area
f0-ș CreateWindow%, ,Window% � NotesPane_h%
f:"NotePBlk%!handle%=NotesPane_h%
fD*ș GetWindowState%,, NotePBlk%+handle%
fN!NotePBlk%!under%=RestsPane_h%
fX'PaneHeight%=Window%!y1%-Window%!y0%
fbSelW%=NotesPane_h%:SelI%=0
fl$windowname="InstrWind"
fvU ș LoadTemplate, ,Window%, InstrIndirect, InstrIndirect+size, -1, $windowname, 0
f�P� � MIDIpresent% Window%!8-=100:Window%!48-=100:� hide MIDI column in window
f�.ș CreateWindow%, ,Window%  � InstrWind_h%
f�� n%
f�i� StaveStr%(7), VoiceStr%(7), VolumeStr%(7), StereoStr%(7), MIDIChStr%(7) :� pointers to icon strings
f�=VoiceSize%=20 : VolSize%=4 : SterSize%=14 : MIDIChSize%=3
f�� n%=0 � 7
f�,  StaveStr%(n%)  = InstrIndirect + n%*14
f�  �
f�InstrIndirect+=8*14
f�� n%=0 � 7
f�4  VoiceStr%(n%)  = InstrIndirect + n%*VoiceSize%
f�A  VolumeStr%(n%) = InstrIndirect + 8*VoiceSize% + n%*VolSize%
f�O  StereoStr%(n%) = InstrIndirect + 8*VoiceSize% + 8*VolSize% + n%*SterSize%
g_  MIDIChStr%(n%) = InstrIndirect + 8*VoiceSize% + 8*VolSize% +  8*SterSize% +n%*MIDIChSize%
g\  � � MIDIpresent% �UpdateIcon(InstrWind_h%, 32+n%, 1<<22, 0) :� make icons unselectable
g  �
g !end=DialogIndirect+dialogsize
g*$windowname="progInfo"
g4Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
g>-ș CreateWindow%, ,Window%  � ProgInfo_h%
gH7DialogIndirect+=13 : � skip indirected window title
gR<$DialogIndirect = "Maestro"         : DialogIndirect+=40
g\<$DialogIndirect = "Music player"    : DialogIndirect+=40
gf<$DialogIndirect = "Acorn Computers" : DialogIndirect+=40
gp<$DialogIndirect = VersionStr$       : DialogIndirect+=30
gz$windowname="query"
g�Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
g�/ș CreateWindow%, ,Window%  � AbortQuery_h%
g�1DialogIndirect+=100 :� "music not saved etc."
g�DialogIndirect+=100
g�� FileSpriteName% 16
g�-$FileSpriteName%="file_"+�~MusicFileType%
g�$windowname="xfer_send"
g�Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
g�*Window%!64=1 :� use common sprite area
g�KSpriteIcon%=Window%+88+32*2  :� pointer to icon number 2 in save window
g�DSpriteIcon%!16=SpriteIcon%!16 � 1<<1 � 1<<8 :� indirected sprite
g�3SpriteIcon%!16=SpriteIcon%!16 � � 1 :� not text
g�)SpriteIcon%!24=1 :� wimp area pointer
hSpriteIcon%!28=12
h)ș CreateWindow%, ,Window%  � Save_h%
hSaveText=DialogIndirect
h$4$SaveText="MusicFile"+�(0) : DialogIndirect+=255
h.LSaveSprite%=DialogIndirect :� address of file type sprite in save window
h8DialogIndirect+=16
hB!$SaveSprite%=$FileSpriteName%
hL$windowname="dboxfile_db"
hVFș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
h`)ș CreateWindow%, ,Window%  � Load_h%
hj0DialogIndirect+=30 : LoadText=DialogIndirect
ht-$LoadText=$SaveText : DialogIndirect+=255
h~$windowname="TimeSigW"
h�Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
h�,ș CreateWindow%, ,Window%  � TimeSig_h%
h�1BarLength%=DialogIndirect : DialogIndirect+=3
h�1NoteValue%=DialogIndirect : DialogIndirect+=3
h�$windowname="BarW"
h�Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
h�(ș CreateWindow%, ,Window%  � Bar_h%
h�KBarNum%=DialogIndirect : DialogIndirect+=15 :� allow for validation str
h�$windowname="FileInfo"
h�Fș LoadTemplate, ,Window%, DialogIndirect, end, -1, $windowname, 0
h�*Window%!64=1 :� use common sprite area
h�KSpriteIcon%=Window%+88+32*6  :� pointer to icon number 6 in save window
iDSpriteIcon%!16=SpriteIcon%!16 � 1<<1 � 1<<8 :� indirected sprite
i
3SpriteIcon%!16=SpriteIcon%!16 � � 1 :� not text
i)SpriteIcon%!24=1 :� wimp area pointer
iSpriteIcon%!28=12
i(-ș CreateWindow%, ,Window%  � FileInfo_h%
i22ThisFile%=DialogIndirect : DialogIndirect+=255
i<0Updated%=DialogIndirect : DialogIndirect+=12
iF1FileType%=DialogIndirect : DialogIndirect+=20
iP1FileSize%=DialogIndirect : DialogIndirect+=20
iZ2FileDate%=DialogIndirect : DialogIndirect+=100
idKFileTypeSprite%=DialogIndirect :� address of file type sprite in window
in:$FileTypeSprite%=$FileSpriteName% : DialogIndirect+=16
ix$ThisFile%="<untitled>"
i�$Updated%="NO"
i�F$="<untitled>"
i�$ThisFile%=F$+�(0)
i�$ScoreTitle%=F$+�(0)
i�ș CloseTemplate
i�W� �assert(DialogIndirect<end-10, "Not enough memory to load window templates.") : �
i�ScoreClosed%=�
i��
i�
i�� �initialise_menu
i�B� item$, sub%, MenuBlock, SubMenuBlock, MenuEnd, MenuItemsList
i�"� nextsub%, flags%, m%, width%
i�MenuSize% = 28+(20*24)
j3� MenuStart 15*MenuSize%  :� allow 15 menus max
j"MenuEnd=MenuStart+15*MenuSize%
j� MenuString 14*4
j"1� StaveNum% 1 : � buffers for writeable icons
j,� ValstrS 10
j6� +0
j@MenuBlock=MenuStart
jJ� item$
jTȕ item$>""
j^ Ȏ �item$,3) �
jh#  � "Mae" : IconMenu%=MenuBlock
jr<� note there are 2 "Maestro" menus. IconMenu% is the 2nd
j|$  � "Sta" : StaveMenu%=MenuBlock
j�%  � "Vol" : VolumeMenu%=MenuBlock
j�$  � "Tem" : TempoMenu%=MenuBlock
j�$  � "Maj" : MajorMenu%=MenuBlock
j�$  � "Min" : MinorMenu%=MenuBlock
j�  �
j� $MenuBlock = item$
j�! MenuBlock?12 = C_MenuTitlefg
j�! MenuBlock?13 = C_MenuTitlebg
j� MenuBlock?14 = C_Menufg
j� MenuBlock?15 = C_Menubg
j�
 � width%
j�� adjust menu width
j�% MenuBlock!16 = width% * C_Width%
k MenuBlock!20 = 44
k MenuBlock!24 = 0
k MenuItemsList=MenuBlock+28
k&% SubMenuBlock=MenuBlock+MenuSize%
k0 nextsub%=SubMenuBlock
k: � item$
kD ȕ item$>""
kN
   � sub%
kX=   � sub%=0 sub%=-1 � sub%=nextsub% : nextsub%+=MenuSize%
kb1   � �assert(sub%<MenuEnd, "Menu too big.") �
kl� pointers to windows
kv   Ȏ �item$,4) �
k�$    � "Inst" : sub%=InstrWind_h%
k�#    � "Info" : sub%=ProgInfo_h%
k�    � "Save" : sub%=Save_h%
k�#    � "File" : sub%=FileInfo_h%
k�"    � "Time" : sub%=TimeSig_h%
k�    � "Goto" : sub%=Bar_h%
k�	    �
k�'   $(MenuItemsList+12) = item$+�(0)
k�   MenuItemsList!4 = sub%
k�F   MenuItemsList!8 = &21 � (C_MenuItemfg<<24) � (C_MenuItembg<<28)
k�   � flags%
k�#   !MenuItemsList=flags% � %111
k�!   � indirect writeable icons
l   � flags%�4 �
lF    MenuItemsList!8 = (MenuItemsList!8) � 1<<8 :� set indirect bit
l    Ȏ �item$,4) �
l      � "Stav"
l*8      MenuItemsList!12=StaveNum%   :� buffer pointer
l4      $ValstrS="a1-4"
l>9      MenuItemsList!16 = ValstrS :� validation string
lH/      MenuItemsList!20 = 2 :� buffer length
lR
     �
l\	    �
lf   MenuItemsList+=24
lp   � item$
lz   �
l� � last item
l� MenuItemsList-=24
l�8 !MenuItemsList = !MenuItemsList � &80 : � last item
l� � item$
l� MenuBlock=SubMenuBlock
l��
l�$BarLength%="4"
l��SetVolume(6) : � ff
l��SetTempo(8)  : � moderato
l�$StaveNum%=��(STAVE%+1),1)
l�4item% = �FindMenuItem("+percussion", StaveMenu%)
l�I� (item%>=0) !item% = �SetBit(PERC%=1, !item%, 0):� set or clear tick
l�!� abstracted from set key sig
m� n
m�� KEY_SIG%(1) n=accidental%+2+KEY_SIG%(0) : X%(key%)=(x%(n)+X%(n))*KEY_SIG%(1) � X%(key%)=x%(accidental%+2)+X%(accidental%+2)
mCONFIRM%=�
m$�
m.;� [title, width, [item, 1 if sub_menu pointer, flags] ]
m8� "Maestro", 12
mB)� "Save",0,0, "File",0,0, "Clear",0,2
mL@� "Staves",1,0, "Instruments",0,0, "Volume",1,0, "Tempo",1,2
mV%� "Time sig.",0,0, "Key sig.",1,2
m`� "Goto",0,0, "Play",0,0,""
mj� "Staves",12
mt*� "StaveNum",0,4, "+percussion",0,0,""
m~� 4 indicates writeable
m�� "Volume",4
m�7� "ppp",0,0, "pp",0,0, "p",0,0, "mp",0,0, "mf", 0,0
m�%� "f",0,0, "ff",0,1, "fff",0,0,""
m�� "Tempo",12
m�A� "Largissimo",0,0, "Largo",0,0, "Larghetto",0,0, "Grave",0,0
m�C� "Adagio",0,0, "Adagietto",0,0, "Andante",0,0, "Andantino",0,0
m�C� "Moderato",0,1, "Allegretto",0,0, "Allegro",0,0, "Vivace",0,0
m�6� "Veloce",0,0, "Presto",0,0, "Prestissimo",0,0,""
m�� "Key sig.",6
m�!� "Major",1,0, "Minor",1,0,""
m�� "Major",3
m�I� "Cb",0,0, "Gb",0,0, "Db",0,0, "Ab",0,0, "Eb",0,0, "Bb",0,0, "F",0,2
n)� "C", 0,3 : REM dotted line and tick
n
M� "G", 0,0, "D", 0,0, "A", 0,0, "E", 0,0, "B", 0,0, "F#",0,0, "C#",0,0,""
n� "Minor",3
nI� "Ab",0,0, "Eb",0,0, "Bb",0,0, "F", 0,0, "C", 0,0, "G", 0,0, "D",0,2
n()� "A", 0,3 : REM dotted line and tick
n2M� "E", 0,0, "B", 0,0, "F#",0,0, "C#",0,0, "G#",0,0, "D#",0,0, "A#",0,0,""
n<� "Maestro",5
nF� "Info",0,0, "Quit",0,0,""
nP� ""
nZ
ndA� �FindMenuItem(item$, menu%) : � return pointer to menu item
nn� item%,this$
nxitem$=�item$,3)
n�item%=menu%+28
n�this$=�$(item%+12),3)
n�� (this$ <> item$) �
n�  �
n�    item%+=24
n�    this$=�$(item%+12),3)
n�0    � ( (this$ = item$) � (!item% � &80)>0 )
n�  �
n�*� (this$ <> item$) � =-1 : � not found
n�
=item%
n�
n�� �initialise_sound
n�� SoundEnable%
o(ș Sound_Configure,8 � PrevConfigure
o$ș Sound_Enable,0 � SoundEnable%
o!� disconnect midi interpreter
o")� MIDIpresent% ș MIDI_SoundEnable%,0
o,=SoundEnable%
o6
o@� �ClearAllMusic
oJFINE%()=MUSIC%()
oTPP%=MUSIC%:P%()=MUSIC%()
o^NBars%=0 :� number of bars
ohBAR%=0:� Current bar number
or!PBAR%=0:� Playing bar counter
o|"SBAR%=0:� scrolling bar number
o�7�start_music:� Set pointers to start of music store
o�EP%=GP%
o�-�bar:� Music always starts off with a bar
o�)GATE%=MUSIC%+2:� End of minimum score
o�/PX%(0)=0:� Score starts at left window edge
o�PXn%(BAR%)=0
o�PW%(0)=4*Hi%:� Bar width
o�,PTYPE%(0)=Bar%:� Score starts with a bar
o�1GP%=MUSIC%:� Reset gate pointer for set score
o�GPn%(BAR%)=GP%
o��rescore(0)
o��SetExtent(S_Width%)
o��release
pwasSCORING%=�
pstopSCORING%=�
pSCORING%=�
p&CHANGED%=�
p0$Updated%="NO"
p:�UpdateTitle("<untitled>")
pD$SaveText="MusicFile"+�(0)
pN$LoadText="MusicFile"+�(0)
pX/n=�GetFileInfo("") :� clear file info stuff
pb$FileDate%=""
pl�
pv
p�#�   PROCEDURE: initialise_music
p��
p�!�  STRUCTURES: Queue of Gate;
p�"�              Queue of Music;
p��
p�.�       TYPES:  Gate= byte0>0 -> Gate_Mask
p�4�                     byte0=0 -> Music_Attribute
p��
p�U�          Gate_Mask= byte; bitn=1 -> gate 1 note/rest from music queue n (n=0-7)
p��
p�(�    Music_Attribute= word; bit0_7=0
p�N�                             bit8=1 -> Time signature bit12_9 No. beats-1
p�M�                                                      bit15_13 Beat type
qH�                             bit9=1 -> Key signature bit10 0-#, 1-b
qF�                                                     bit13_11 0-7
qP�                            bit10=1 -> Clef bit12_11 Treble,Alto,Tenor,Bass
q C�                                            bit15_14 Stave 1-4
q*D�                            bit11=1 -> Slur switch bit12 on/off
q4J�                                                   bit15_14 Stave 1-4
q>J�                            bit12=1 -> Octave shift bit13 0-up,1-down
qHK�                                                    bit15_14 Stave 1-4
qR/�                            bit13=1 -> bar
q\5�                         (bit13_0=0 -> Reserved)
qf�
qp0�              Music= word; bit7_3>0 -> Note
qz0�                           bit7_3=0 -> Rest
q��
q�G�               Note= word; bit0=     Stem orientation: 0-up,1-down
q�A�                           bit1=1 -> Join barbs to next note
q�<�                           bit2=1 -> Tie with next note
q�[�                         bit7_3>0    Note stave line position 1 to 31 (16=centre line)
q�E�                        bit10_8>0 -> Accidental N,#,b,X,bb,N#,Nb
q�?�                       bit12_11=     Number of dots 0 to 3
q�M�                       bit15_13=     Type: Breve to Semi-demi-semiquaver
q��
q�Q�               Rest= word; bit0=0    NB If a rest coincides with a note, its
q�J�                           bit1=0       position is determined by the
q�P�                           bit2=0       following note on the same channel.
q�&�                         bit7_3=0
r&�                        bit10_8=0
r?�                       bit12_11=     Number of dots 0 to 3
rW�                       bit15_13=     Type: Breve rest to Semi-demi-semiquaver rest
r$�
r.#�      Position_type= 0 -> Note
r8-�                     1 -> Time Signature
rB,�                     2 -> Key Signature
rL#�                     3 -> Clef
rV#�                     4 -> Slur
r`+�                     5 -> Octave shift
rj"�                     6 -> Bar
rt:
r~� �initialise_music
r��N%,C%:� Note,channel
r��initialise_options
r�[Note%=0:Time%=1:Key%=2:Clef%=4:Slur%=8:Octave%=16:Bar%=32:� Stave attribute enumerators
r�q� Ninc%(6),Line(42),Aoff(7),Clef%(3),Key%(6),Key_Sig%(15,6),Length%(31),Duration%(NTempos%),Accidental%(3,31)
r�=�N%=0�6:Ninc%(N%)=��"024579;",N%+1)�15:�:� Note increment
r�(�ST:ST=&1000/12:� Semitone increment
r��N%=0�42
r�,Line(N%)=(1+N%�7<<12)+Ninc%(N%�7)*ST+.49
r�E�:� Notes corresponding to stave lines (C octave 1 TO C octave 7)
r�aAoff(2)=ST:Aoff(3)=-ST:Aoff(4)=ST*2:Aoff(5)=-ST*2:Aoff(6)=ST:Aoff(7)=-ST:� Accidental offsets
r�NClef%(0)=11:Clef%(1)=5:Clef%(2)=3:Clef%(3)=-1:� Line offsets for each clef
r��C%=2�15
s�N%=0�(C%>>1)-1
s
0Key_Sig%(C%,(7+Key_Y%(1,C%�%1,N%))�7)=C%�2+2
s�
s2�:� Set up note offsets for each key signature
s(�C%=0�31
s2tLength%(C%)=(%1<<7-(C%>>2))*(%1111000>>(C%�3)�%1111):� Length of each possible note/rest (dotted) in tempo beats
s<�
sF�D%:� Duration
sP�N%=0�NTempos%
sZ;� C% 32:Duration%(N%)=C%:� Reserve space for each tempo
sd�C%=0�31
sn�D%=75/Tempo%(N%)*Length%(C%)/8+.5:� Durations of note+dot combinations in 20ths of a second for each tempo (Max 22.5 Seconds)
sxF�D%>254 D%=254:� Limit to maximum possible duration (12.7 Seconds)
s�Duration%(N%)?C%=D%
s��
s��
s�STIE%=&FF:� Tie state of channels - Each bit corresponds to a channel, 0 if tied
s�;SPACE%=�-� :� find available space to tailor allocation
s�L�assert(SPACE%>1024,"Not enough memory available for music storage.") �
s�=Max_Gate%=SPACE%/100 :� max no. of gates (events, chords)
s�2Max_Bar%=Max_Gate%/4 :� maximum number of bars
s�0PLAYING%=�:� Flag indicating play in process
s�?SCROLLING%=�:� Flag indicating auto-scrolling while playing
s�C� Q%(Max_Stave%+2):� Time positions of next notes on each stave
s�@� QI%(Max_Stave%+2):� Time increments of Q%() for each stave
s�BB1%=0:B2%=0:� Alternate beat counters used to detect zero wrap
t::
t4� GPn%(Max_Bar%) :� GP% at the start of each bar
ta� PX%(Max_Gate%),PW%(Max_Gate%),PTYPE%(Max_Gate%):� Notation screen positions, widths & types
t"f� PX% is PX%() index to screen positions & types - Always refers to the note/attribute just passed
t,0� PXn%(Max_Bar%) :� PX% at start of each bar
t6L� BPn%(7,Max_Bar%):� Indices to (8) note queues at the start of each bar
t@<� MUSIC%(7),FINE%(7):� Pointers delimiting music storage
tJK� N%(7),n%(7):� Pointers to current notes (n%()=copy, cf PROCproximate)
tT<� C%(7),c%(7):� Indexes of gate channels used in sorting
t^T� CLEF%(Max_Stave%),clef%(Max_Stave%):� Current clef on each stave (& clef copy)
th?� CLEFn%(Max_Stave%,Max_Bar%) :� CLEF% at start of each bar
trB� SIG%(1),sig%(1):� Base bar key & time sigs, current and copy
t|8� SIGn%(1,Max_Bar%) :� SIG% at the start of each bar
t�3� P%(7),PCLEF%(3):� Playing note pointers, clef
t�MaxNotesInBar%=128
t�[� while one half of draw q is being filled, the other half is being used for scrolling.
t�� n%
t�n%=MaxNotesInBar%*4
t�_� MIDI_OFF%(1,n%) :� an array of MIDI noteoffs if playing is stopped in the middle of a bar
t�MIDI_OFF%(0,0)=-1
t�MIDI_OFF%(1,0)=-1
t�MIDI_Notenum%=0
t�SPACE%=�-�
t�ASPACE%-=&4000:� Leave a few K for the program and Basic stack
t�L�assert(SPACE%>1024,"Not enough memory available for music storage.") �
t�V� MUSIC% SPACE%+8:� Allocate main music space (+8: Extra bytes in case of overrun)
u-FINE%=MUSIC%+SPACE%:� End of music memory
u,GATE%=MUSIC%:� No gate space used as yet
u�C%=0�7
u&%MUSIC%(C%)=MUSIC%+(C%+1)*SPACE%/9
u0>�:� Share out storage (NB No bounds checking ever occurs!)
u:+FINE%()=MUSIC%():� No music defined yet
uD;Pgap%=X%(2)�2+1:� Symbol spacing (half note blob width)
uN:
uX� Now set up basic score
ub�ClearAllMusic
ul�
uv
u�� �initialise_options
u�
�N%,C%
u�NTempos%=14
u�� Tempo%(NTempos%)
u�Tempo%(0)=40
u�Tempo%(1)=50
u�Tempo%(2)=60
u�Tempo%(3)=65
u�Tempo%(4)=70
u�Tempo%(5)=80
u�Tempo%(6)=90
u�Tempo%(7)=100
u�Tempo%(8)=115
vTempo%(9)=130
vTempo%(10)=145
vTempo%(11)=160
v Tempo%(12)=175
v*Tempo%(13)=190
v4Tempo%(14)=210
v>
vHK� TIME_SIG%(1):� Current time signature numerator(0) and denominator(1)
vR.TIME_SIG%()=3:� 4/4 time (= (n+1)/2^(d-1))
v\
vf)� KEY_SIG%(1):� Current key signature
vpG� Key_Y%(3,1,6):� Key signature 0-sharp/1-flat stave line positions
vz� C%,A%,P%:� Indices
v�� C%=0 � 3:� For each clef
v�)� A%=0 � 1:� For each accidental type
v�-� P%=0 � 6:� For each accidental position
v�ZKey_Y%(C%,1-A%,P%)=3*(P%�%1)-P%�2+(P%-3)*A%+(A%�C%<>2�(P%�5)=0)*7-1-(C%-1>>1)-2*(C%=2)
v�J� Position offsets of key signature accidentals from centre stave line
v��
v��
v��
v�KEY_SIG%(0)=1
v�KEY_SIG%(1)=0
v�� item%
v�Max_Stave%=3
v�
Li%=2*Vi%
wStave_Height%=Li%*8
w� Y_STAVE%(Max_Stave%+2)
wSTAVE%=0   :� means 1 stave
w$%PERC%=0    :� means no percussion
w.Score_Width%=S_Width%
w8�position_staves
wB
wLNVolumes%=7
wV$� Volume%(NVolumes%),Volumes%(7)
w`�R%=0�NVolumes%
wjdVolume%(R%)=(R%+1)*120/(NVolumes%+1)-1 :� don't permit full volume so that dynamics are possible
wt�
w~ș Sound_Volume � R%
w�RestoreVolume=R%
w�sVolume%=R%*(NVolumes%+1)/120-.5:�Volume%<0 Volume%=0 :� don't permit full volume. This is reserved for dynamics
w�$ș Sound_Volume,Volume%(Volume%)
w��R%=0�7:Volumes%(R%)=6:�
w�
w��S%
w�i� Stave_Channels%(Max_Stave%+2,7):� Primary stave allocation of channels 0-7 for each stave structure
w�� S%=0 � Max_Stave%
w�� R%=0 � 7
w�FStave_Channels%(S%,R%)=(S%+1)*R%�8:� Close formula to desired data
w��
w��
xStave_Channels%(2,1)=1
x
Stave_Channels%(2,2)=1
x>Stave_Channels%(2,5)=2:� Correct the exceptions to formula
x(� S_C%(7):� Current stave allocation
x(�R%=0�7
x2yS_C%(R%)=Stave_Channels%(STAVE%,R%):� Initialise channel allocation (Also reset each time stave structure is changed)
x<�
xF::� Now get names and channel allocation of instruments
xPS�I$,L%,M%:� Instrument name, Number of instruments, Instrument name length, Max
xZMAX_Voices%=20
xd0� Voice$(20):� Instrument voice descriptions
xn� RestoreVoice%(7)
xx@� Instrument%(7,1):� Instrument information 0=Stave, 1=Voice
x�&� Nth$(6):� First,Second stave etc
x�yNth$(1)="1st stave":Nth$(2)="2nd stave":Nth$(3)="3rd stave":Nth$(4)="4th stave":Nth$(5)="1st perc":Nth$(6)="2nd perc"
x�lș Sound_InstallVoice � I$,NVoices%:NVoices%-=1:� NVoices% is now number of voices/instruments available
x�<� �assert(NVoices%>0,"No sound voices are installed.") �
x��R%=1�NVoices%
x�+ș Sound_InstallVoice,0,R% � Voice$(R%)
x�'�:� Get names of voices/instruments
x��R%=0�7
x�'ș Sound_AttachVoice,R%+1,0 � L%,S%
x�RestoreVoice%(R%)=S%
x�J�S%<1�S%>NVoices% S%=1:� Make sure a voice is attached to all channels
x�ș Sound_AttachVoice,L%,S%
x�3Instrument%(R%,0)=S_C%(R%)+1:� Instrument stave
y+Instrument%(R%,1)=S%:� Instrument voice
y/$(VoiceStr%(R%)) = �Voice$(S%), VoiceSize%)
y#�:� Get details of each channel
y"�SetDefaultChannels
y,� Volume$(NVolumes%)
y6�Volume$(0)="ppp" : Volume$(1)="pp" : Volume$(2)="p" : Volume$(3)="mp" : Volume$(4)="mf" : Volume$(5)="f" : Volume$(6)="ff" : Volume$(7)="fff"
y@�R%=0�7
yJ9$(VolumeStr%(R%)) = �Volume$(Volumes%(R%)), VolSize%)
yT�
y^NStereos%=6
yhA� Stereo%(NStereos%),Stereo$(NStereos%,1),Stereo_Position%(7)
yr�Stereo$(0,0)="Full L.":Stereo$(1,0)="Left":Stereo$(2,0)="Centre L.":Stereo$(3,0)="Centre":Stereo$(4,0)="Centre R.":Stereo$(5,0)="Right":Stereo$(6,0)="Full R."
y|�R%=0�NStereos%
y�&Stereo%(R%)=(2*R%/NStereos%-1)*127
y�6Stereo$(R%,1)="Stereo position ("+�Stereo%(R%)+")"
y��
y��R%=0�7
y�$Stereo_Position%(R%)=NStereos%�2
y�6ș Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
y�E$(StereoStr%(R%)) = �Stereo$(Stereo_Position%(R%), 0), SterSize%)
y��
y�
y�NMIDIChannels%=16
y�� MIDIChannel%(7)
y��R%=0�7
y�MIDIChannel%(R%)=1
z� MIDIpresent% �
z  $(MIDIChStr%(R%))="1"
z�
z&  $(MIDIChStr%(R%))=" "
z0  �
z:�
zD
zN�
zX
zb� �restore
zl�OSCLI("audio off")
zv2�R%=0�7    :� restore channel/voice allocation
z�/ș Sound_AttachVoice,R%+1,RestoreVoice%(R%)
z��
z�4ș Sound_Volume, RestoreVolume :� restore volume
z�$ș Sound_Configure,PrevConfigure
z��
z�
z�� �exit
z��remove_panes
z��CloseWindow(ScoreWind_h%)
z��restore
z��
z�
z�� �terminate
{(� INITIALISED% � PLAYING% �play_stop
{� Task_h%>0 �
{) � � ș CloseDown, task%, Task_h% : �
{ �
{*
 � � �
{4 �
{>5� INITIALISED% �exit :�CloseWindow(AbortQuery_h%)
{H�CLOSE#debug
{R	� � �
{\.� Task_h%>0 � ș CloseDown, task%, Task_h%
{f�
{p�
{z
{�� �assert(E%,A$)
{�� e%
{�?�E% �=� � e%=�CheckOK("ERROR: "+A$+" Program will exit.",1)
{��terminate
{�=�
{�
{�� �error
{�� e%
{�� �
{�� � � �terminate: �
{�ș "Hourglass_Smash"
{�*E$=�$+" at line "+Þ+". Exit program?"
{�&FILE%=FILE%:�FILE% �#FILE%:FILE%=�
|� INITIALISED% �
|!  � �CheckOK(E$,3) �terminate
|�
|$$  e%=�CheckOK(E$,1) : �terminate
|.  �
|8�
|B
|L� �OpenAbortQuery(x, y)
|V� xsize%, ysize%
|`!Window%!handle%=AbortQuery_h%
|j(ș GetWindowState%, ,Window%+handle%
|t$xsize% = Window%!x1%-Window%!x0%
|~$ysize% = Window%!y1%-Window%!y0%
|�Window%!x0% = x - xsize%/2
|�Window%!x1% = x + xsize%/2
|�Window%!y0% = y - ysize%/2
|�Window%!y1% = y + ysize%/2
|�$ș OpenWindow%, ,Window%+handle%
|��
|�
|�� �CheckOK(E$, boxes%)
|�� E%
|�!ERRBLOCK%=0
|�$(ERRBLOCK%+4)=�E$,100)+�0
|�=ș "Wimp_ReportError", ERRBLOCK%, boxes%, "Maestro" � ,E%
}(=E%=1 :  � return TRUE if OK pressed
�
00000000  0d 00 0a 15 f4 20 3e 20  4d 75 73 69 63 2e 4d 61  |..... > Music.Ma|
00000010  65 73 74 78 74 0d 00 14  1e f4 20 28 63 29 20 41  |estxt..... (c) A|
00000020  63 6f 72 6e 20 43 6f 6d  70 75 74 65 72 73 20 31  |corn Computers 1|
00000030  39 38 38 0d 00 1e 04 0d  00 28 21 56 65 72 73 69  |988......(!Versi|
00000040  6f 6e 53 74 72 24 3d 22  31 2e 36 35 20 28 34 2d  |onStr$="1.65 (4-|
00000050  4a 61 6e 2d 38 39 29 22  0d 00 32 04 0d 00 3c 0d  |Jan-89)"..2...<.|
00000060  54 61 73 6b 5f 68 25 3d  30 0d 00 46 17 4d 75 73  |Task_h%=0..F.Mus|
00000070  69 63 46 69 6c 65 54 79  70 65 25 3d 26 41 46 31  |icFileType%=&AF1|
00000080  0d 00 50 12 49 4e 49 54  49 41 4c 49 53 45 44 25  |..P.INITIALISED%|
00000090  3d a3 0d 00 5a 13 de 20  45 52 52 42 4c 4f 43 4b  |=...Z.. ERRBLOCK|
000000a0  25 20 32 30 30 0d 00 64  1f f4 20 73 70 61 63 65  |% 200..d.. space|
000000b0  20 66 6f 72 20 61 6e 20  65 72 72 6f 72 20 77 69  | for an error wi|
000000c0  6e 64 6f 77 0d 00 6e 2e  53 50 41 43 45 25 3d 93  |ndow..n.SPACE%=.|
000000d0  2d e0 20 3a f4 20 63 68  65 63 6b 20 65 6e 6f 75  |-. :. check enou|
000000e0  67 68 20 73 70 61 63 65  20 61 76 61 69 6c 61 62  |gh space availab|
000000f0  6c 65 0d 00 78 15 e7 20  53 50 41 43 45 25 3c 31  |le..x.. SPACE%<1|
00000100  30 30 30 30 30 20 fa 0d  00 82 1e f4 64 65 62 75  |00000 ......debu|
00000110  67 3d 4f 50 45 4e 4f 55  54 20 22 64 65 62 75 67  |g=OPENOUT "debug|
00000120  66 69 6c 65 22 0d 00 8c  10 ee 20 85 20 f2 65 72  |file"..... . .er|
00000130  72 6f 72 3a e0 0d 00 96  1e f4 20 67 65 74 20 6e  |ror:...... get n|
00000140  61 6d 65 20 6f 66 20 66  69 6c 65 20 74 6f 20 6c  |ame of file to l|
00000150  6f 61 64 0d 00 a0 1c c8  99 20 22 4f 53 5f 47 65  |oad...... "OS_Ge|
00000160  74 45 6e 76 22 20 b8 20  45 6e 76 53 74 72 24 0d  |tEnv" . EnvStr$.|
00000170  00 aa 1b e7 20 a7 45 6e  76 53 74 72 24 2c 22 20  |.... .EnvStr$," |
00000180  2d 71 75 69 74 20 22 29  20 8c 0d 00 b4 17 20 20  |-quit ") .....  |
00000190  49 25 3d a7 45 6e 76 53  74 72 24 2c 22 22 22 22  |I%=.EnvStr$,""""|
000001a0  29 0d 00 be 1c 20 20 49  25 3d a7 45 6e 76 53 74  |)....  I%=.EnvSt|
000001b0  72 24 2c 22 22 22 22 2c  49 25 2b 31 29 0d 00 c8  |r$,"""",I%+1)...|
000001c0  21 20 20 f5 49 25 2b 3d  31 3a fd c1 45 6e 76 53  |!  .I%+=1:..EnvS|
000001d0  74 72 24 2c 49 25 2c 31  29 3c 3e 22 20 22 0d 00  |tr$,I%,1)<>" "..|
000001e0  d2 15 20 20 66 24 3d c1  45 6e 76 53 74 72 24 2c  |..  f$=.EnvStr$,|
000001f0  49 25 29 0d 00 dc 07 20  20 cd 0d 00 e6 1c 49 4e  |I%)....  .....IN|
00000200  49 54 49 41 4c 49 53 45  44 25 3d a4 69 6e 69 74  |ITIALISED%=.init|
00000210  69 61 6c 69 73 65 0d 00  f0 2e 6d 61 73 6b 25 3d  |ialise....mask%=|
00000220  30 20 3a 20 f4 20 6d 61  73 6b 20 6f 75 74 20 75  |0 : . mask out u|
00000230  6e 77 61 6e 74 65 64 20  72 65 61 73 6f 6e 20 63  |nwanted reason c|
00000240  6f 64 65 73 0d 00 fa 0e  ee 20 85 20 f2 65 72 72  |odes..... . .err|
00000250  6f 72 0d 01 04 05 f5 0d  01 0e 18 20 20 e7 20 50  |or.........  . P|
00000260  4c 41 59 49 4e 47 25 20  f2 43 68 65 63 6b 51 0d  |LAYING% .CheckQ.|
00000270  01 18 29 20 20 c8 99 20  50 6f 6c 6c 25 2c 6d 61  |..)  .. Poll%,ma|
00000280  73 6b 25 2c 57 69 6e 64  6f 77 25 2b 68 61 6e 64  |sk%,Window%+hand|
00000290  6c 65 25 20 b8 20 52 25  0d 01 22 51 20 20 e7 20  |le% . R%.."Q  . |
000002a0  50 4c 41 59 49 4e 47 25  20 f2 43 68 65 63 6b 51  |PLAYING% .CheckQ|
000002b0  3a 20 f4 20 72 65 63 68  65 63 6b 20 73 69 6e 63  |: . recheck sinc|
000002c0  65 20 70 6f 6c 6c 20 6d  69 67 68 74 20 68 61 76  |e poll might hav|
000002d0  65 20 73 74 61 79 65 64  20 61 77 61 79 20 66 6f  |e stayed away fo|
000002e0  72 20 61 20 77 68 69 6c  65 0d 01 2c 0d 20 20 c8  |r a while..,.  .|
000002f0  8e 20 52 25 20 ca 0d 01  36 09 20 20 c9 20 30 0d  |. R% ...6.  . 0.|
00000300  01 40 6c 20 20 20 e7 20  41 77 61 69 74 69 6e 67  |.@l   . Awaiting|
00000310  41 63 6b 25 20 e7 a4 43  68 65 63 6b 4f 4b 28 22  |Ack% ..CheckOK("|
00000320  42 61 64 20 44 61 74 61  20 54 72 61 6e 73 66 65  |Bad Data Transfe|
00000330  72 2c 20 52 65 63 65 69  76 65 72 20 44 65 61 64  |r, Receiver Dead|
00000340  22 2c 33 29 20 3a 41 77  61 69 74 69 6e 67 41 63  |",3) :AwaitingAc|
00000350  6b 25 3d a3 20 3a 20 43  48 41 4e 47 45 44 25 3d  |k%=. : CHANGED%=|
00000360  77 61 73 43 48 41 4e 47  45 44 25 0d 01 4a 21 20  |wasCHANGED%..J! |
00000370  20 20 e7 20 53 43 4f 52  49 4e 47 25 20 f2 73 79  |  . SCORING% .sy|
00000380  6d 62 6f 6c 5f 70 6f 69  6e 74 65 72 0d 01 54 27  |mbol_pointer..T'|
00000390  20 20 20 e7 20 66 24 3c  3e 22 22 20 f2 6c 6f 61  |   . f$<>"" .loa|
000003a0  64 5f 6d 75 73 69 63 28  66 24 29 20 3a 20 66 24  |d_music(f$) : f$|
000003b0  3d 22 22 0d 01 5e 32 20  20 20 e7 20 53 43 52 4f  |=""..^2   . SCRO|
000003c0  4c 4c 49 4e 47 25 20 f2  43 68 65 63 6b 53 63 72  |LLING% .CheckScr|
000003d0  6f 6c 6c 20 3a f4 20 61  75 74 6f 2d 73 63 72 6f  |oll :. auto-scro|
000003e0  6c 6c 69 6e 67 0d 01 68  20 20 20 c9 20 31 3a f2  |lling..h   . 1:.|
000003f0  72 65 64 72 61 77 5f 77  69 6e 64 6f 77 5f 72 65  |redraw_window_re|
00000400  71 75 65 73 74 0d 01 72  1e 20 20 c9 20 32 3a f2  |quest..r.  . 2:.|
00000410  6f 70 65 6e 5f 77 69 6e  64 6f 77 5f 72 65 71 75  |open_window_requ|
00000420  65 73 74 0d 01 7c 1f 20  20 c9 20 33 3a f2 63 6c  |est..|.  . 3:.cl|
00000430  6f 73 65 5f 77 69 6e 64  6f 77 5f 72 65 71 75 65  |ose_window_reque|
00000440  73 74 0d 01 86 2c 20 20  c9 20 34 20 20 20 20 20  |st...,  . 4     |
00000450  20 20 20 20 20 3a f4 20  70 6f 69 6e 74 65 72 20  |     :. pointer |
00000460  6c 65 61 76 69 6e 67 20  77 69 6e 64 6f 77 0d 01  |leaving window..|
00000470  90 27 20 20 20 e7 20 57  69 6e 64 6f 77 25 21 68  |.'   . Window%!h|
00000480  61 6e 64 6c 65 25 3d 53  63 6f 72 65 57 69 6e 64  |andle%=ScoreWind|
00000490  5f 68 25 20 8c 0d 01 9a  11 20 20 20 20 20 f2 72  |_h% .....     .r|
000004a0  65 6c 65 61 73 65 0d 01  a4 1d 20 20 20 20 20 77  |elease....     w|
000004b0  61 73 53 43 4f 52 49 4e  47 25 3d 53 43 4f 52 49  |asSCORING%=SCORI|
000004c0  4e 47 25 0d 01 ae 13 20  20 20 20 20 53 43 4f 52  |NG%....     SCOR|
000004d0  49 4e 47 25 3d a3 0d 01  b8 08 20 20 20 cc 0d 01  |ING%=.....   ...|
000004e0  c2 44 20 20 20 20 20 e7  20 57 69 6e 64 6f 77 25  |.D     . Window%|
000004f0  21 68 61 6e 64 6c 65 25  3d 41 62 6f 72 74 51 75  |!handle%=AbortQu|
00000500  65 72 79 5f 68 25 20 f2  43 6c 6f 73 65 57 69 6e  |ery_h% .CloseWin|
00000510  64 6f 77 28 41 62 6f 72  74 51 75 65 72 79 5f 68  |dow(AbortQuery_h|
00000520  25 29 0d 01 cc 0a 20 20  20 20 20 cd 0d 01 d6 55  |%)....     ....U|
00000530  20 20 c9 20 35 3a 20 e7  20 57 69 6e 64 6f 77 25  |  . 5: . Window%|
00000540  21 68 61 6e 64 6c 65 25  3d 53 63 6f 72 65 57 69  |!handle%=ScoreWi|
00000550  6e 64 5f 68 25 20 53 43  4f 52 49 4e 47 25 20 3d  |nd_h% SCORING% =|
00000560  20 28 77 61 73 53 43 4f  52 49 4e 47 25 20 80 20  | (wasSCORING% . |
00000570  ac 20 73 74 6f 70 53 43  4f 52 49 4e 47 25 29 3d  |. stopSCORING%)=|
00000580  b9 0d 01 e0 1d 20 20 c9  20 36 3a f2 6d 6f 75 73  |.....  . 6:.mous|
00000590  65 5f 62 75 74 74 6f 6e  5f 63 6c 69 63 6b 0d 01  |e_button_click..|
000005a0  ea 16 20 20 c9 20 37 3a  f2 55 73 65 72 44 72 61  |..  . 7:.UserDra|
000005b0  67 42 6f 78 0d 01 f4 15  20 20 c9 20 38 3a f2 4b  |gBox....  . 8:.K|
000005c0  65 79 50 72 65 73 73 65  64 0d 01 fe 15 20 20 c9  |eyPressed....  .|
000005d0  20 39 3a f2 4d 65 6e 75  53 65 6c 65 63 74 0d 02  | 9:.MenuSelect..|
000005e0  08 42 20 20 c9 20 31 30  3a 20 f2 53 63 72 6f 6c  |.B  . 10: .Scrol|
000005f0  6c 52 65 71 28 57 69 6e  64 6f 77 25 21 28 68 61  |lReq(Window%!(ha|
00000600  6e 64 6c 65 25 2b 33 32  29 2c 20 57 69 6e 64 6f  |ndle%+32), Windo|
00000610  77 25 21 28 68 61 6e 64  6c 65 25 2b 33 36 29 29  |w%!(handle%+36))|
00000620  0d 02 12 16 20 20 c9 20  31 37 2c 31 38 3a f2 72  |....  . 17,18:.r|
00000630  65 63 65 69 76 65 0d 02  1c 07 20 20 cb 0d 02 26  |eceive....  ...&|
00000640  09 20 20 fd 20 a3 0d 02  30 05 e0 0d 02 3a 04 0d  |.  . ...0....:..|
00000650  02 44 0d dd 20 f2 43 68  65 63 6b 51 0d 02 4e 13  |.D.. .CheckQ..N.|
00000660  42 31 25 3d 42 32 25 3a  20 42 32 25 3d c6 8f 0d  |B1%=B2%: B2%=...|
00000670  02 58 16 e7 42 32 25 3c  42 31 25 20 f2 70 6c 61  |.X..B2%<B1% .pla|
00000680  79 5f 62 61 72 0d 02 62  05 e1 0d 02 6c 04 0d 02  |y_bar..b....l...|
00000690  76 0e dd 20 f2 72 65 63  65 69 76 65 0d 02 80 1b  |v.. .receive....|
000006a0  ea 20 74 61 73 6b 25 2c  20 72 65 66 25 2c 20 62  |. task%, ref%, b|
000006b0  6c 6f 63 6b 2c 46 24 0d  02 8a 25 62 6c 6f 63 6b  |lock,F$...%block|
000006c0  3d 57 69 6e 64 6f 77 25  20 3a f4 20 74 65 6d 70  |=Window% :. temp|
000006d0  6f 72 61 72 79 20 62 75  66 66 65 72 0d 02 94 1d  |orary buffer....|
000006e0  72 65 66 25 3d 21 28 57  69 6e 64 6f 77 25 2b 68  |ref%=!(Window%+h|
000006f0  61 6e 64 6c 65 25 2b 38  29 0d 02 9e 1e 74 61 73  |andle%+8)....tas|
00000700  6b 25 3d 21 28 57 69 6e  64 6f 77 25 2b 68 61 6e  |k%=!(Window%+han|
00000710  64 6c 65 25 2b 34 29 0d  02 a8 38 e7 20 74 61 73  |dle%+4)...8. tas|
00000720  6b 25 3d 54 61 73 6b 5f  68 25 20 e1 20 3a 20 f4  |k%=Task_h% . : .|
00000730  20 69 67 6e 6f 72 65 20  6d 65 73 73 61 67 65 73  | ignore messages|
00000740  20 66 72 6f 6d 20 74 68  69 73 20 74 61 73 6b 0d  | from this task.|
00000750  02 b2 1d c8 8e 20 57 69  6e 64 6f 77 25 21 28 68  |..... Window%!(h|
00000760  61 6e 64 6c 65 25 2b 31  36 29 20 ca 0d 02 bc 09  |andle%+16) .....|
00000770  20 20 c9 20 30 0d 02 c6  15 20 20 20 e7 20 ac 20  |  . 0....   . . |
00000780  43 48 41 4e 47 45 44 25  20 8c 0d 02 d0 12 20 20  |CHANGED% .....  |
00000790  20 20 f2 74 65 72 6d 69  6e 61 74 65 0d 02 da 08  |  .terminate....|
000007a0  20 20 20 cc 0d 02 e4 11  20 20 20 20 21 62 6c 6f  |   .....    !blo|
000007b0  63 6b 3d 32 30 0d 02 ee  15 20 20 20 20 62 6c 6f  |ck=20....    blo|
000007c0  63 6b 21 31 32 3d 72 65  66 25 0d 02 f8 23 20 20  |ck!12=ref%...#  |
000007d0  20 20 62 6c 6f 63 6b 21  31 36 3d 30 20 20 20 20  |  block!16=0    |
000007e0  3a f4 20 71 75 69 74 20  62 6c 6f 63 6b 0d 03 02  |:. quit block...|
000007f0  47 20 20 20 20 c8 99 20  53 65 6e 64 4d 65 73 73  |G    .. SendMess|
00000800  61 67 65 2c 31 39 2c 62  6c 6f 63 6b 20 3a f4 20  |age,19,block :. |
00000810  61 63 6b 6e 6f 77 6c 65  64 67 65 2c 20 61 6e 64  |acknowledge, and|
00000820  20 72 65 66 75 73 65 20  71 75 69 74 20 72 65 71  | refuse quit req|
00000830  75 65 73 74 0d 03 0c 44  20 20 20 20 e7 20 a4 43  |uest...D    . .C|
00000840  68 65 63 6b 4f 4b 28 22  55 6e 73 61 76 65 64 20  |heckOK("Unsaved |
00000850  6d 75 73 69 63 2e 20 44  6f 20 79 6f 75 20 72 65  |music. Do you re|
00000860  61 6c 6c 79 20 77 61 6e  74 20 74 6f 20 71 75 69  |ally want to qui|
00000870  74 3f 22 2c 33 29 20 8c  0d 03 16 13 20 20 20 20  |t?",3) .....    |
00000880  20 f2 74 65 72 6d 69 6e  61 74 65 0d 03 20 09 20  | .terminate.. . |
00000890  20 20 20 cc 0d 03 2a 23  20 20 20 20 20 c8 99 20  |   ...*#     .. |
000008a0  47 65 74 50 6f 69 6e 74  65 72 49 6e 66 6f 25 2c  |GetPointerInfo%,|
000008b0  2c 4d 6f 75 73 65 25 0d  03 34 35 20 20 20 20 20  |,Mouse%..45     |
000008c0  f2 4f 70 65 6e 57 69 6e  64 6f 77 28 53 61 76 65  |.OpenWindow(Save|
000008d0  5f 68 25 2c 20 4d 6f 75  73 65 25 21 78 30 25 2c  |_h%, Mouse%!x0%,|
000008e0  20 4d 6f 75 73 65 25 21  79 30 25 29 0d 03 3e 0a  | Mouse%!y0%)..>.|
000008f0  20 20 20 20 20 cd 0d 03  48 09 20 20 20 20 cd 0d  |     ...H.    ..|
00000900  03 52 17 20 20 c9 20 32  20 3a 20 f4 20 73 61 76  |.R.  . 2 : . sav|
00000910  65 20 66 69 6c 65 0d 03  5c 12 20 20 20 e7 20 53  |e file..\.   . S|
00000920  41 56 49 4e 47 25 20 8c  0d 03 66 1c 20 20 20 20  |AVING% ...f.    |
00000930  77 61 73 43 48 41 4e 47  45 44 25 3d 43 48 41 4e  |wasCHANGED%=CHAN|
00000940  47 45 44 25 0d 03 70 30  20 20 20 20 f2 73 61 76  |GED%..p0    .sav|
00000950  65 5f 6d 75 73 69 63 28  a4 47 65 74 53 74 72 28  |e_music(.GetStr(|
00000960  57 69 6e 64 6f 77 25 2b  68 61 6e 64 6c 65 25 2b  |Window%+handle%+|
00000970  34 34 29 29 0d 03 7a 11  20 20 20 20 53 41 56 49  |44))..z.    SAVI|
00000980  4e 47 25 3d a3 0d 03 84  22 20 20 20 20 c8 99 20  |NG%=...."    .. |
00000990  47 65 74 50 6f 69 6e 74  65 72 49 6e 66 6f 25 2c  |GetPointerInfo%,|
000009a0  20 2c 62 6c 6f 63 6b 0d  03 8e 19 20 20 20 20 62  | ,block....    b|
000009b0  6c 6f 63 6b 21 32 30 3d  62 6c 6f 63 6b 21 31 32  |lock!20=block!12|
000009c0  0d 03 98 19 20 20 20 20  62 6c 6f 63 6b 21 32 34  |....    block!24|
000009d0  3d 62 6c 6f 63 6b 21 31  36 0d 03 a2 18 20 20 20  |=block!16....   |
000009e0  20 62 6c 6f 63 6b 21 32  38 3d 62 6c 6f 63 6b 21  | block!28=block!|
000009f0  30 0d 03 ac 18 20 20 20  20 62 6c 6f 63 6b 21 33  |0....    block!3|
00000a00  32 3d 62 6c 6f 63 6b 21  34 0d 03 b6 12 20 20 20  |2=block!4....   |
00000a10  20 62 6c 6f 63 6b 21 30  3d 34 34 0d 03 c0 15 20  | block!0=44.... |
00000a20  20 20 20 62 6c 6f 63 6b  21 31 32 3d 72 65 66 25  |   block!12=ref%|
00000a30  0d 03 ca 33 20 20 20 20  62 6c 6f 63 6b 21 31 36  |...3    block!16|
00000a40  3d 33 20 3a f4 20 44 61  74 61 4c 6f 61 64 20 61  |=3 :. DataLoad a|
00000a50  70 70 6c 69 63 61 74 69  6f 6e 20 74 6f 20 66 69  |pplication to fi|
00000a60  6c 65 72 0d 03 d4 1f 20  20 20 20 62 6c 6f 63 6b  |ler....    block|
00000a70  21 34 30 3d 4d 75 73 69  63 46 69 6c 65 54 79 70  |!40=MusicFileTyp|
00000a80  65 25 0d 03 de 1f 20 20  20 20 c8 99 20 53 65 6e  |e%....    .. Sen|
00000a90  64 4d 65 73 73 61 67 65  2c 31 37 2c 62 6c 6f 63  |dMessage,17,bloc|
00000aa0  6b 0d 03 e8 16 20 20 20  20 41 77 61 69 74 69 6e  |k....    Awaitin|
00000ab0  67 41 63 6b 25 3d b9 0d  03 f2 12 20 20 20 20 f2  |gAck%=.....    .|
00000ac0  43 6c 6f 73 65 4d 65 6e  75 0d 03 fc 09 20 20 20  |CloseMenu....   |
00000ad0  20 cd 0d 04 06 16 20 c9  20 33 20 3a 20 f4 20 6c  | ..... . 3 : . l|
00000ae0  6f 61 64 20 66 69 6c 65  0d 04 10 2e 20 20 f2 6c  |oad file....  .l|
00000af0  6f 61 64 5f 6d 75 73 69  63 28 a4 47 65 74 53 74  |oad_music(.GetSt|
00000b00  72 28 57 69 6e 64 6f 77  25 2b 68 61 6e 64 6c 65  |r(Window%+handle|
00000b10  25 2b 34 34 29 29 0d 04  1a 18 20 20 f2 44 61 74  |%+44))....  .Dat|
00000b20  61 4c 6f 61 64 41 63 6b  28 72 65 66 25 29 0d 04  |aLoadAck(ref%)..|
00000b30  24 42 20 c9 20 34 20 3a  41 77 61 69 74 69 6e 67  |$B . 4 :Awaiting|
00000b40  41 63 6b 25 3d a3 20 3a  20 f4 20 44 61 74 61 4c  |Ack%=. : . DataL|
00000b50  6f 61 64 41 63 6b 2e 20  45 6e 64 20 6f 66 20 44  |oadAck. End of D|
00000b60  61 74 61 53 61 76 65 20  70 72 6f 74 6f 63 6f 6c  |ataSave protocol|
00000b70  0d 04 2e 25 20 c9 20 35  20 3a 20 f4 20 6f 70 65  |...% . 5 : . ope|
00000b80  6e 20 64 6f 75 62 6c 65  2d 63 6c 69 63 6b 65 64  |n double-clicked|
00000b90  20 66 69 6c 65 0d 04 38  30 20 20 e7 20 21 28 57  | file..80  . !(W|
00000ba0  69 6e 64 6f 77 25 2b 68  61 6e 64 6c 65 25 2b 34  |indow%+handle%+4|
00000bb0  30 29 20 3d 20 4d 75 73  69 63 46 69 6c 65 54 79  |0) = MusicFileTy|
00000bc0  70 65 25 20 8c 0d 04 42  30 20 20 20 20 f2 6c 6f  |pe% ...B0    .lo|
00000bd0  61 64 5f 6d 75 73 69 63  28 a4 47 65 74 53 74 72  |ad_music(.GetStr|
00000be0  28 57 69 6e 64 6f 77 25  2b 68 61 6e 64 6c 65 25  |(Window%+handle%|
00000bf0  2b 34 34 29 29 0d 04 4c  1a 20 20 20 20 f2 44 61  |+44))..L.    .Da|
00000c00  74 61 4c 6f 61 64 41 63  6b 28 72 65 66 25 29 0d  |taLoadAck(ref%).|
00000c10  04 56 09 20 20 20 20 cd  0d 04 60 17 20 c9 20 26  |.V.    ...`. . &|
00000c20  35 30 32 3a f2 48 65 6c  70 28 72 65 66 25 29 0d  |502:.Help(ref%).|
00000c30  04 6a 1d 20 c9 20 26 34  30 30 43 31 3a f2 67 65  |.j. . &400C1:.ge|
00000c40  74 6d 6f 64 65 69 6e 66  6f 28 a3 29 0d 04 74 06  |tmodeinfo(.)..t.|
00000c50  20 cb 0d 04 7e 05 e1 0d  04 88 04 0d 04 92 11 dd  | ...~...........|
00000c60  20 f2 48 65 6c 70 28 72  65 66 25 29 0d 04 9c 12  | .Help(ref%)....|
00000c70  ea 20 62 6c 6f 63 6b 25  2c 74 65 78 74 24 0d 04  |. block%,text$..|
00000c80  a6 1a 62 6c 6f 63 6b 25  3d 57 69 6e 64 6f 77 25  |..block%=Window%|
00000c90  2b 68 61 6e 64 6c 65 25  0d 04 b0 14 62 6c 6f 63  |+handle%....bloc|
00000ca0  6b 25 21 31 32 20 3d 20  72 65 66 25 0d 04 ba 29  |k%!12 = ref%...)|
00000cb0  62 6c 6f 63 6b 25 21 31  36 20 3d 20 26 35 30 33  |block%!16 = &503|
00000cc0  20 3a f4 20 53 65 6e 64  20 68 65 6c 70 20 6d 65  | :. Send help me|
00000cd0  73 73 61 67 65 0d 04 c4  0c 74 65 78 74 24 3d 22  |ssage....text$="|
00000ce0  22 0d 04 ce 12 c8 8e 20  62 6c 6f 63 6b 25 21 33  |"...... block%!3|
00000cf0  32 20 ca 0d 04 d8 4a 20  c9 20 2d 32 20 3a 20 74  |2 ....J . -2 : t|
00000d00  65 78 74 24 3d 22 54 68  69 73 20 69 73 20 74 68  |ext$="This is th|
00000d10  65 20 4d 61 65 73 74 72  6f 20 69 63 6f 6e 2e 7c  |e Maestro icon.||
00000d20  4d 43 6c 69 63 6b 20 53  45 4c 45 43 54 20 74 6f  |MClick SELECT to|
00000d30  20 6f 70 65 6e 20 73 63  6f 72 65 2e 22 0d 04 e2  | open score."...|
00000d40  13 20 c9 20 53 63 6f 72  65 57 69 6e 64 5f 68 25  |. . ScoreWind_h%|
00000d50  0d 04 ec 21 20 20 e7 53  43 4f 52 49 4e 47 25 80  |...!  .SCORING%.|
00000d60  53 43 52 49 42 45 25 28  64 72 61 77 6e 25 29 20  |SCRIBE%(drawn%) |
00000d70  8c 0d 04 f6 32 20 20 20  74 65 78 74 24 3d 22 43  |....2   text$="C|
00000d80  6c 69 63 6b 20 53 45 4c  45 43 54 20 74 6f 20 70  |lick SELECT to p|
00000d90  6c 61 63 65 20 69 74 65  6d 20 69 6e 20 73 63 6f  |lace item in sco|
00000da0  72 65 22 0d 05 00 07 20  20 cc 0d 05 0a 3d 20 20  |re"....  ....=  |
00000db0  20 74 65 78 74 24 3d 22  53 65 6c 65 63 74 20 61  | text$="Select a|
00000dc0  6e 20 69 74 65 6d 20 69  6e 20 61 20 70 61 6e 65  |n item in a pane|
00000dd0  20 74 6f 20 70 6c 61 63  65 20 6f 6e 20 74 68 65  | to place on the|
00000de0  20 73 63 6f 72 65 22 0d  05 14 07 20 20 cd 0d 05  | score"....  ...|
00000df0  1e 13 20 c9 20 4e 6f 74  65 73 50 61 6e 65 5f 68  |.. . NotesPane_h|
00000e00  25 0d 05 28 27 20 20 74  65 78 74 24 3d 22 43 6c  |%..('  text$="Cl|
00000e10  69 63 6b 20 53 45 4c 45  43 54 20 74 6f 20 73 65  |ick SELECT to se|
00000e20  6c 65 63 74 20 61 20 22  0d 05 32 14 20 20 c8 8e  |lect a "..2.  ..|
00000e30  20 62 6c 6f 63 6b 25 21  33 36 20 ca 0d 05 3c 22  | block%!36 ...<"|
00000e40  20 20 20 20 c9 20 30 20  3a 20 74 65 78 74 24 3d  |    . 0 : text$=|
00000e50  74 65 78 74 24 2b 22 62  72 65 76 65 2e 22 0d 05  |text$+"breve."..|
00000e60  46 26 20 20 20 20 c9 20  31 20 3a 20 74 65 78 74  |F&    . 1 : text|
00000e70  24 3d 74 65 78 74 24 2b  22 73 65 6d 69 62 72 65  |$=text$+"semibre|
00000e80  76 65 2e 22 0d 05 50 22  20 20 20 20 c9 20 32 20  |ve."..P"    . 2 |
00000e90  3a 20 74 65 78 74 24 3d  74 65 78 74 24 2b 22 6d  |: text$=text$+"m|
00000ea0  69 6e 69 6d 2e 22 0d 05  5a 24 20 20 20 20 c9 20  |inim."..Z$    . |
00000eb0  33 20 3a 20 74 65 78 74  24 3d 74 65 78 74 24 2b  |3 : text$=text$+|
00000ec0  22 63 72 6f 63 68 65 74  2e 22 0d 05 64 23 20 20  |"crochet."..d#  |
00000ed0  20 20 c9 20 34 20 3a 20  74 65 78 74 24 3d 74 65  |  . 4 : text$=te|
00000ee0  78 74 24 2b 22 71 75 61  76 65 72 2e 22 0d 05 6e  |xt$+"quaver."..n|
00000ef0  27 20 20 20 20 c9 20 35  20 3a 20 74 65 78 74 24  |'    . 5 : text$|
00000f00  3d 74 65 78 74 24 2b 22  73 65 6d 69 71 75 61 76  |=text$+"semiquav|
00000f10  65 72 2e 22 0d 05 78 2b  20 20 20 20 c9 20 36 20  |er."..x+    . 6 |
00000f20  3a 20 74 65 78 74 24 3d  74 65 78 74 24 2b 22 64  |: text$=text$+"d|
00000f30  65 6d 69 73 65 6d 69 71  75 61 76 65 72 2e 22 0d  |emisemiquaver.".|
00000f40  05 82 2f 20 20 20 20 c9  20 37 20 3a 20 74 65 78  |../    . 7 : tex|
00000f50  74 24 3d 74 65 78 74 24  2b 22 68 65 6d 69 64 65  |t$=text$+"hemide|
00000f60  6d 69 73 65 6d 69 71 75  61 76 65 72 2e 22 0d 05  |misemiquaver."..|
00000f70  8c 12 20 20 20 20 7f 20  74 65 78 74 24 3d 22 22  |..    . text$=""|
00000f80  0d 05 96 09 20 20 20 20  cb 0d 05 a0 14 20 c9 20  |....    ..... . |
00000f90  53 68 61 72 70 73 50 61  6e 65 5f 68 25 0d 05 aa  |SharpsPane_h%...|
00000fa0  27 20 20 74 65 78 74 24  3d 22 43 6c 69 63 6b 20  |'  text$="Click |
00000fb0  53 45 4c 45 43 54 20 74  6f 20 73 65 6c 65 63 74  |SELECT to select|
00000fc0  20 61 20 22 0d 05 b4 14  20 20 c8 8e 20 62 6c 6f  | a "....  .. blo|
00000fd0  63 6b 25 21 33 36 20 ca  0d 05 be 24 20 20 20 20  |ck%!36 ....$    |
00000fe0  c9 20 30 20 3a 20 74 65  78 74 24 3d 74 65 78 74  |. 0 : text$=text|
00000ff0  24 2b 22 6e 61 74 75 72  61 6c 2e 22 0d 05 c8 22  |$+"natural."..."|
00001000  20 20 20 20 c9 20 31 20  3a 20 74 65 78 74 24 3d  |    . 1 : text$=|
00001010  74 65 78 74 24 2b 22 73  68 61 72 70 2e 22 0d 05  |text$+"sharp."..|
00001020  d2 21 20 20 20 20 c9 20  32 20 3a 20 74 65 78 74  |.!    . 2 : text|
00001030  24 3d 74 65 78 74 24 2b  22 66 6c 61 74 2e 22 0d  |$=text$+"flat.".|
00001040  05 dc 29 20 20 20 20 c9  20 33 20 3a 20 74 65 78  |..)    . 3 : tex|
00001050  74 24 3d 74 65 78 74 24  2b 22 64 6f 75 62 6c 65  |t$=text$+"double|
00001060  2d 73 68 61 72 70 2e 22  0d 05 e6 28 20 20 20 20  |-sharp."...(    |
00001070  c9 20 34 20 3a 20 74 65  78 74 24 3d 74 65 78 74  |. 4 : text$=text|
00001080  24 2b 22 64 6f 75 62 6c  65 2d 66 6c 61 74 2e 22  |$+"double-flat."|
00001090  0d 05 f0 2e 20 20 20 20  c9 20 35 20 3a 20 74 65  |....    . 5 : te|
000010a0  78 74 24 3d 74 65 78 74  24 2b 22 6e 61 74 75 72  |xt$=text$+"natur|
000010b0  61 6c 69 73 65 64 20 73  68 61 72 70 2e 22 0d 05  |alised sharp."..|
000010c0  fa 2d 20 20 20 20 c9 20  36 20 3a 20 74 65 78 74  |.-    . 6 : text|
000010d0  24 3d 74 65 78 74 24 2b  22 6e 61 74 75 72 61 6c  |$=text$+"natural|
000010e0  69 73 65 64 20 66 6c 61  74 2e 22 0d 06 04 20 20  |ised flat."...  |
000010f0  20 20 20 c9 20 37 20 3a  20 74 65 78 74 24 3d 74  |   . 7 : text$=t|
00001100  65 78 74 24 2b 22 64 6f  74 2e 22 0d 06 0e 27 20  |ext$+"dot."...' |
00001110  20 20 20 c9 20 38 20 3a  20 74 65 78 74 24 3d 74  |   . 8 : text$=t|
00001120  65 78 74 24 2b 22 64 6f  75 62 6c 65 2d 64 6f 74  |ext$+"double-dot|
00001130  2e 22 0d 06 18 27 20 20  20 20 c9 20 39 20 3a 20  |."...'    . 9 : |
00001140  74 65 78 74 24 3d 74 65  78 74 24 2b 22 74 72 69  |text$=text$+"tri|
00001150  70 6c 65 2d 64 6f 74 2e  22 0d 06 22 21 20 20 20  |ple-dot.".."!   |
00001160  20 c9 20 31 30 20 3a 20  74 65 78 74 24 3d 74 65  | . 10 : text$=te|
00001170  78 74 24 2b 22 74 69 65  2e 22 0d 06 2c 26 20 20  |xt$+"tie."..,&  |
00001180  20 20 c9 20 31 31 20 3a  20 74 65 78 74 24 3d 74  |  . 11 : text$=t|
00001190  65 78 74 24 2b 22 62 61  72 20 6c 69 6e 65 2e 22  |ext$+"bar line."|
000011a0  0d 06 36 29 20 20 20 20  c9 20 31 32 20 3a 20 74  |..6)    . 12 : t|
000011b0  65 78 74 24 3d 74 65 78  74 24 2b 22 74 72 65 62  |ext$=text$+"treb|
000011c0  6c 65 20 63 6c 65 66 2e  22 0d 06 40 27 20 20 20  |le clef."..@'   |
000011d0  20 c9 20 31 33 20 3a 20  74 65 78 74 24 3d 74 65  | . 13 : text$=te|
000011e0  78 74 24 2b 22 62 61 73  73 20 63 6c 65 66 2e 22  |xt$+"bass clef."|
000011f0  0d 06 4a 2b 20 20 20 20  c9 20 31 34 20 3a 20 74  |..J+    . 14 : t|
00001200  65 78 74 24 3d 74 65 78  74 24 2b 22 6b 65 79 20  |ext$=text$+"key |
00001210  73 69 67 6e 61 74 75 72  65 2e 22 0d 06 54 2c 20  |signature."..T, |
00001220  20 20 20 c9 20 31 35 20  3a 20 74 65 78 74 24 3d  |   . 15 : text$=|
00001230  74 65 78 74 24 2b 22 74  69 6d 65 20 73 69 67 6e  |text$+"time sign|
00001240  61 74 75 72 65 2e 22 0d  06 5e 12 20 20 20 20 7f  |ature."..^.    .|
00001250  20 74 65 78 74 24 3d 22  22 0d 06 68 09 20 20 20  | text$=""..h.   |
00001260  20 cb 0d 06 72 13 20 c9  20 52 65 73 74 73 50 61  | ...r. . RestsPa|
00001270  6e 65 5f 68 25 0d 06 7c  27 20 20 74 65 78 74 24  |ne_h%..|'  text$|
00001280  3d 22 43 6c 69 63 6b 20  53 45 4c 45 43 54 20 74  |="Click SELECT t|
00001290  6f 20 73 65 6c 65 63 74  20 61 20 22 0d 06 86 14  |o select a "....|
000012a0  20 20 c8 8e 20 62 6c 6f  63 6b 25 21 33 36 20 ca  |  .. block%!36 .|
000012b0  0d 06 90 27 20 20 20 20  c9 20 30 20 3a 20 74 65  |...'    . 0 : te|
000012c0  78 74 24 3d 74 65 78 74  24 2b 22 62 72 65 76 65  |xt$=text$+"breve|
000012d0  20 72 65 73 74 2e 22 0d  06 9a 2b 20 20 20 20 c9  | rest."...+    .|
000012e0  20 31 20 3a 20 74 65 78  74 24 3d 74 65 78 74 24  | 1 : text$=text$|
000012f0  2b 22 73 65 6d 69 62 72  65 76 65 20 72 65 73 74  |+"semibreve rest|
00001300  2e 22 0d 06 a4 27 20 20  20 20 c9 20 32 20 3a 20  |."...'    . 2 : |
00001310  74 65 78 74 24 3d 74 65  78 74 24 2b 22 6d 69 6e  |text$=text$+"min|
00001320  69 6d 20 72 65 73 74 2e  22 0d 06 ae 29 20 20 20  |im rest."...)   |
00001330  20 c9 20 33 20 3a 20 74  65 78 74 24 3d 74 65 78  | . 3 : text$=tex|
00001340  74 24 2b 22 63 72 6f 63  68 65 74 20 72 65 73 74  |t$+"crochet rest|
00001350  2e 22 0d 06 b8 28 20 20  20 20 c9 20 34 20 3a 20  |."...(    . 4 : |
00001360  74 65 78 74 24 3d 74 65  78 74 24 2b 22 71 75 61  |text$=text$+"qua|
00001370  76 65 72 20 72 65 73 74  2e 22 0d 06 c2 2c 20 20  |ver rest."...,  |
00001380  20 20 c9 20 35 20 3a 20  74 65 78 74 24 3d 74 65  |  . 5 : text$=te|
00001390  78 74 24 2b 22 73 65 6d  69 71 75 61 76 65 72 20  |xt$+"semiquaver |
000013a0  72 65 73 74 2e 22 0d 06  cc 30 20 20 20 20 c9 20  |rest."...0    . |
000013b0  36 20 3a 20 74 65 78 74  24 3d 74 65 78 74 24 2b  |6 : text$=text$+|
000013c0  22 64 65 6d 69 73 65 6d  69 71 75 61 76 65 72 20  |"demisemiquaver |
000013d0  72 65 73 74 2e 22 0d 06  d6 34 20 20 20 20 c9 20  |rest."...4    . |
000013e0  37 20 3a 20 74 65 78 74  24 3d 74 65 78 74 24 2b  |7 : text$=text$+|
000013f0  22 68 65 6d 69 64 65 6d  69 73 65 6d 69 71 75 61  |"hemidemisemiqua|
00001400  76 65 72 20 72 65 73 74  2e 22 0d 06 e0 12 20 20  |ver rest."....  |
00001410  20 20 7f 20 74 65 78 74  24 3d 22 22 0d 06 ea 09  |  . text$=""....|
00001420  20 20 20 20 cb 0d 06 f4  13 20 c9 20 49 6e 73 74  |    ..... . Inst|
00001430  72 57 69 6e 64 5f 68 25  0d 06 fe 17 20 20 e7 20  |rWind_h%....  . |
00001440  28 62 6c 6f 63 6b 25 21  33 36 3e 37 29 20 8c 0d  |(block%!36>7) ..|
00001450  07 08 19 20 20 20 e7 20  28 62 6c 6f 63 6b 25 21  |...   . (block%!|
00001460  33 36 3c 31 36 29 20 8c  0d 07 12 4d 20 20 20 20  |36<16) ....M    |
00001470  74 65 78 74 24 3d 22 43  6c 69 63 6b 20 53 45 4c  |text$="Click SEL|
00001480  45 43 54 20 6f 72 20 41  44 4a 55 53 54 20 74 6f  |ECT or ADJUST to|
00001490  20 73 65 6c 65 63 74 20  61 6e 20 69 6e 73 74 72  | select an instr|
000014a0  75 6d 65 6e 74 20 66 6f  72 20 74 68 69 73 20 73  |ument for this s|
000014b0  74 61 76 65 22 0d 07 1c  09 20 20 20 20 cc 0d 07  |tave"....    ...|
000014c0  26 1a 20 20 20 20 e7 20  28 62 6c 6f 63 6b 25 21  |&.    . (block%!|
000014d0  33 36 3c 32 34 29 20 8c  0d 07 30 49 20 20 20 20  |36<24) ...0I    |
000014e0  20 74 65 78 74 24 3d 22  43 6c 69 63 6b 20 53 45  | text$="Click SE|
000014f0  4c 45 43 54 20 6f 72 20  41 44 4a 55 53 54 20 74  |LECT or ADJUST t|
00001500  6f 20 73 65 74 20 74 68  65 20 76 6f 6c 75 6d 65  |o set the volume|
00001510  20 6f 66 20 74 68 69 73  20 63 68 61 6e 6e 65 6c  | of this channel|
00001520  22 0d 07 3a 65 20 20 20  20 20 cc 20 e7 20 28 62  |"..:e     . . (b|
00001530  6c 6f 63 6b 25 21 33 36  3c 33 32 29 20 74 65 78  |lock%!36<32) tex|
00001540  74 24 3d 22 43 6c 69 63  6b 20 53 45 4c 45 43 54  |t$="Click SELECT|
00001550  20 6f 72 20 41 44 4a 55  53 54 20 74 6f 20 73 65  | or ADJUST to se|
00001560  74 20 74 68 65 20 73 74  65 72 65 6f 20 70 6f 73  |t the stereo pos|
00001570  69 74 69 6f 6e 20 6f 66  20 74 68 69 73 20 63 68  |ition of this ch|
00001580  61 6e 6e 65 6c 22 0d 07  44 0a 20 20 20 20 20 cd  |annel"..D.     .|
00001590  0d 07 4e 09 20 20 20 20  cd 0d 07 58 08 20 20 20  |..N.    ...X.   |
000015a0  cd 0d 07 62 0e 20 c9 20  53 61 76 65 5f 68 25 0d  |...b. . Save_h%.|
000015b0  07 6c bf 20 20 e7 20 62  6c 6f 63 6b 25 21 33 36  |.l.  . block%!36|
000015c0  3d 32 20 74 65 78 74 24  3d 22 44 72 61 67 20 74  |=2 text$="Drag t|
000015d0  68 69 73 20 69 63 6f 6e  20 69 6e 74 6f 20 61 20  |his icon into a |
000015e0  64 69 72 65 63 74 6f 72  79 20 77 69 6e 64 6f 77  |directory window|
000015f0  20 74 6f 20 73 61 76 65  20 69 74 20 69 6e 20 74  | to save it in t|
00001600  68 61 74 20 64 69 72 65  63 74 6f 72 79 22 20 8b  |hat directory" .|
00001610  20 74 65 78 74 24 3d 22  46 69 6c 6c 20 69 6e 20  | text$="Fill in |
00001620  74 68 65 20 66 69 6c 65  20 6e 61 6d 65 20 61 6e  |the file name an|
00001630  64 20 74 68 65 6e 20 64  72 61 67 20 74 68 65 20  |d then drag the |
00001640  69 63 6f 6e 20 69 6e 74  6f 20 61 20 66 69 6c 65  |icon into a file|
00001650  72 20 64 69 72 65 63 74  6f 72 79 20 77 69 6e 64  |r directory wind|
00001660  6f 77 20 74 6f 20 73 61  76 65 20 69 74 22 0d 07  |ow to save it"..|
00001670  76 11 20 c9 20 54 69 6d  65 53 69 67 5f 68 25 0d  |v. . TimeSig_h%.|
00001680  07 80 49 20 20 74 65 78  74 24 3d 22 75 73 65 20  |..I  text$="use |
00001690  53 45 4c 45 43 54 20 61  6e 64 20 41 44 4a 55 53  |SELECT and ADJUS|
000016a0  54 20 6f 6e 20 65 61 63  68 20 66 69 65 6c 64 20  |T on each field |
000016b0  74 6f 20 73 65 74 20 61  20 74 69 6d 65 20 73 69  |to set a time si|
000016c0  67 6e 61 74 75 72 65 22  0d 07 8a 14 20 c9 20 41  |gnature".... . A|
000016d0  62 6f 72 74 51 75 65 72  79 5f 68 25 0d 07 94 2c  |bortQuery_h%...,|
000016e0  20 20 74 65 78 74 24 3d  22 63 6c 69 63 6b 20 59  |  text$="click Y|
000016f0  45 53 20 74 6f 20 74 65  72 6d 69 6e 61 74 65 20  |ES to terminate |
00001700  4d 61 65 73 74 72 6f 22  0d 07 9e 06 20 cb 0d 07  |Maestro".... ...|
00001710  a8 16 24 28 62 6c 6f 63  6b 25 2b 32 30 29 3d 74  |..$(block%+20)=t|
00001720  65 78 74 24 0d 07 b2 28  62 6c 6f 63 6b 25 21 30  |ext$...(block%!0|
00001730  20 3d 20 28 28 28 32 30  2b a9 28 74 65 78 74 24  | = (((20+.(text$|
00001740  29 2b 31 29 81 34 29 2a  34 29 2b 34 0d 07 bc 32  |)+1).4)*4)+4...2|
00001750  24 28 62 6c 6f 63 6b 25  2b 32 31 2b a9 28 74 65  |$(block%+21+.(te|
00001760  78 74 24 29 29 20 3d 20  bd 28 30 29 20 3a f4 20  |xt$)) = .(0) :. |
00001770  6e 75 6c 6c 2d 74 65 72  6d 69 6e 61 74 65 0d 07  |null-terminate..|
00001780  c6 33 c8 99 20 53 65 6e  64 4d 65 73 73 61 67 65  |.3.. SendMessage|
00001790  2c 31 37 2c 62 6c 6f 63  6b 25 20 3a f4 20 61 63  |,17,block% :. ac|
000017a0  6b 6e 6f 77 6c 65 64 67  65 20 6d 65 73 73 61 67  |knowledge messag|
000017b0  65 0d 07 d0 05 e1 0d 07  da 04 0d 07 e4 18 dd 20  |e.............. |
000017c0  f2 44 61 74 61 4c 6f 61  64 41 63 6b 28 72 65 66  |.DataLoadAck(ref|
000017d0  25 29 0d 07 ee 0b ea 20  62 6c 6f 63 6b 0d 07 f8  |%)..... block...|
000017e0  11 62 6c 6f 63 6b 3d 57  69 6e 64 6f 77 25 0d 08  |.block=Window%..|
000017f0  02 10 62 6c 6f 63 6b 21  30 20 3d 20 32 30 0d 08  |..block!0 = 20..|
00001800  0c 13 62 6c 6f 63 6b 21  31 32 20 3d 20 72 65 66  |..block!12 = ref|
00001810  25 0d 08 16 1f 62 6c 6f  63 6b 21 31 36 20 3d 20  |%....block!16 = |
00001820  34 20 3a f4 20 44 61 74  61 4c 6f 61 64 41 63 6b  |4 :. DataLoadAck|
00001830  0d 08 20 32 c8 99 20 53  65 6e 64 4d 65 73 73 61  |.. 2.. SendMessa|
00001840  67 65 2c 31 37 2c 62 6c  6f 63 6b 20 3a f4 20 61  |ge,17,block :. a|
00001850  63 6b 6e 6f 77 6c 65 64  67 65 20 6d 65 73 73 61  |cknowledge messa|
00001860  67 65 0d 08 2a 05 e1 0d  08 34 04 0d 08 3e 1c dd  |ge..*....4...>..|
00001870  20 f2 72 65 64 72 61 77  5f 77 69 6e 64 6f 77 5f  | .redraw_window_|
00001880  72 65 71 75 65 73 74 0d  08 48 08 ea 20 52 25 0d  |request..H.. R%.|
00001890  08 52 2a c8 99 20 52 65  64 72 61 77 57 69 6e 64  |.R*.. RedrawWind|
000018a0  6f 77 25 2c 2c 57 69 6e  64 6f 77 25 2b 68 61 6e  |ow%,,Window%+han|
000018b0  64 6c 65 25 20 b8 20 52  25 0d 08 5c 09 c8 95 20  |dle% . R%..\... |
000018c0  52 25 0d 08 66 46 20 20  e7 20 57 69 6e 64 6f 77  |R%..fF  . Window|
000018d0  25 21 68 61 6e 64 6c 65  25 20 3d 20 53 63 6f 72  |%!handle% = Scor|
000018e0  65 57 69 6e 64 5f 68 25  20 f2 64 72 61 77 5f 73  |eWind_h% .draw_s|
000018f0  74 61 76 65 73 3a e7 20  50 4c 41 59 49 4e 47 25  |taves:. PLAYING%|
00001900  20 f2 43 68 65 63 6b 51  0d 08 70 2d f4 20 74 72  | .CheckQ..p-. tr|
00001910  79 20 74 6f 20 61 76 6f  69 64 20 69 6e 74 65 72  |y to avoid inter|
00001920  72 75 70 74 69 6f 6e 73  20 69 6e 20 74 68 65 20  |ruptions in the |
00001930  6d 75 73 69 63 0d 08 7a  2c 20 20 c8 99 20 47 65  |music..z,  .. Ge|
00001940  74 52 65 63 74 61 6e 67  6c 65 25 2c 2c 57 69 6e  |tRectangle%,,Win|
00001950  64 6f 77 25 2b 68 61 6e  64 6c 65 25 20 b8 20 52  |dow%+handle% . R|
00001960  25 0d 08 84 07 20 20 ce  0d 08 8e 05 e1 0d 08 98  |%....  .........|
00001970  04 0d 08 a2 1e dd 20 f2  70 6c 61 63 65 5f 74 6f  |...... .place_to|
00001980  70 5f 70 61 6e 65 73 28  62 65 68 69 6e 64 29 0d  |p_panes(behind).|
00001990  08 ac 0c ea 20 78 73 69  7a 65 25 0d 08 b6 22 78  |.... xsize%..."x|
000019a0  73 69 7a 65 25 3d 57 69  6e 64 6f 77 25 21 78 31  |size%=Window%!x1|
000019b0  25 2d 57 69 6e 64 6f 77  25 21 78 30 25 0d 08 c0  |%-Window%!x0%...|
000019c0  1d 52 65 73 74 50 42 6c  6b 25 21 78 31 25 3d 57  |.RestPBlk%!x1%=W|
000019d0  69 6e 64 6f 77 25 21 78  31 25 0d 08 ca 26 52 65  |indow%!x1%...&Re|
000019e0  73 74 50 42 6c 6b 25 21  78 30 25 3d 57 69 6e 64  |stPBlk%!x0%=Wind|
000019f0  6f 77 25 21 78 30 25 2b  78 73 69 7a 65 25 2f 32  |ow%!x0%+xsize%/2|
00001a00  0d 08 d4 1d 52 65 73 74  50 42 6c 6b 25 21 79 31  |....RestPBlk%!y1|
00001a10  25 3d 57 69 6e 64 6f 77  25 21 79 31 25 0d 08 de  |%=Window%!y1%...|
00001a20  2b 52 65 73 74 50 42 6c  6b 25 21 79 30 25 3d 52  |+RestPBlk%!y0%=R|
00001a30  65 73 74 50 42 6c 6b 25  21 79 31 25 2d 50 61 6e  |estPBlk%!y1%-Pan|
00001a40  65 48 65 69 67 68 74 25  0d 08 e8 1b 52 65 73 74  |eHeight%....Rest|
00001a50  50 42 6c 6b 25 21 75 6e  64 65 72 25 3d 62 65 68  |PBlk%!under%=beh|
00001a60  69 6e 64 0d 08 f2 33 c8  99 20 4f 70 65 6e 57 69  |ind...3.. OpenWi|
00001a70  6e 64 6f 77 25 2c 20 52  65 73 74 73 50 61 6e 65  |ndow%, RestsPane|
00001a80  5f 68 25 2c 20 52 65 73  74 50 42 6c 6b 25 2b 68  |_h%, RestPBlk%+h|
00001a90  61 6e 64 6c 65 25 0d 08  fc 1d 4e 6f 74 65 50 42  |andle%....NotePB|
00001aa0  6c 6b 25 21 78 30 25 3d  57 69 6e 64 6f 77 25 21  |lk%!x0%=Window%!|
00001ab0  78 30 25 0d 09 06 1f 4e  6f 74 65 50 42 6c 6b 25  |x0%....NotePBlk%|
00001ac0  21 78 31 25 3d 52 65 73  74 50 42 6c 6b 25 21 78  |!x1%=RestPBlk%!x|
00001ad0  30 25 0d 09 10 1d 4e 6f  74 65 50 42 6c 6b 25 21  |0%....NotePBlk%!|
00001ae0  79 31 25 3d 57 69 6e 64  6f 77 25 21 79 31 25 0d  |y1%=Window%!y1%.|
00001af0  09 1a 2b 4e 6f 74 65 50  42 6c 6b 25 21 79 30 25  |..+NotePBlk%!y0%|
00001b00  3d 4e 6f 74 65 50 42 6c  6b 25 21 79 31 25 2d 50  |=NotePBlk%!y1%-P|
00001b10  61 6e 65 48 65 69 67 68  74 25 0d 09 24 21 4e 6f  |aneHeight%..$!No|
00001b20  74 65 50 42 6c 6b 25 21  75 6e 64 65 72 25 3d 52  |tePBlk%!under%=R|
00001b30  65 73 74 73 50 61 6e 65  5f 68 25 0d 09 2e 33 c8  |estsPane_h%...3.|
00001b40  99 20 4f 70 65 6e 57 69  6e 64 6f 77 25 2c 20 4e  |. OpenWindow%, N|
00001b50  6f 74 65 73 50 61 6e 65  5f 68 25 2c 20 4e 6f 74  |otesPane_h%, Not|
00001b60  65 50 42 6c 6b 25 2b 68  61 6e 64 6c 65 25 0d 09  |ePBlk%+handle%..|
00001b70  38 05 e1 0d 09 42 04 0d  09 4c 21 dd 20 f2 70 6c  |8....B...L!. .pl|
00001b80  61 63 65 5f 62 6f 74 74  6f 6d 5f 70 61 6e 65 73  |ace_bottom_panes|
00001b90  28 62 65 68 69 6e 64 29  0d 09 56 0c ea 20 78 73  |(behind)..V.. xs|
00001ba0  69 7a 65 25 0d 09 60 22  78 73 69 7a 65 25 3d 57  |ize%..`"xsize%=W|
00001bb0  69 6e 64 6f 77 25 21 78  30 25 2b 57 69 6e 64 6f  |indow%!x0%+Windo|
00001bc0  77 25 21 78 31 25 0d 09  6a 1e 53 68 61 72 70 50  |w%!x1%..j.SharpP|
00001bd0  42 6c 6b 25 21 78 30 25  3d 57 69 6e 64 6f 77 25  |Blk%!x0%=Window%|
00001be0  21 78 30 25 0d 09 74 28  53 68 61 72 70 50 42 6c  |!x0%..t(SharpPBl|
00001bf0  6b 25 21 78 31 25 3d 53  68 61 72 70 50 42 6c 6b  |k%!x1%=SharpPBlk|
00001c00  25 21 78 30 25 2b 78 73  69 7a 65 25 0d 09 7e 1e  |%!x0%+xsize%..~.|
00001c10  53 68 61 72 70 50 42 6c  6b 25 21 78 31 25 3d 57  |SharpPBlk%!x1%=W|
00001c20  69 6e 64 6f 77 25 21 78  31 25 0d 09 88 1e 53 68  |indow%!x1%....Sh|
00001c30  61 72 70 50 42 6c 6b 25  21 79 30 25 3d 57 69 6e  |arpPBlk%!y0%=Win|
00001c40  64 6f 77 25 21 79 30 25  0d 09 92 2d 53 68 61 72  |dow%!y0%...-Shar|
00001c50  70 50 42 6c 6b 25 21 79  31 25 3d 53 68 61 72 70  |pPBlk%!y1%=Sharp|
00001c60  50 42 6c 6b 25 21 79 30  25 2b 50 61 6e 65 48 65  |PBlk%!y0%+PaneHe|
00001c70  69 67 68 74 25 0d 09 9c  1c 53 68 61 72 70 50 42  |ight%....SharpPB|
00001c80  6c 6b 25 21 75 6e 64 65  72 25 3d 62 65 68 69 6e  |lk%!under%=behin|
00001c90  64 0d 09 a6 35 c8 99 20  4f 70 65 6e 57 69 6e 64  |d...5.. OpenWind|
00001ca0  6f 77 25 2c 20 53 68 61  72 70 73 50 61 6e 65 5f  |ow%, SharpsPane_|
00001cb0  68 25 2c 20 53 68 61 72  70 50 42 6c 6b 25 2b 68  |h%, SharpPBlk%+h|
00001cc0  61 6e 64 6c 65 25 0d 09  b0 05 e1 0d 09 ba 04 0d  |andle%..........|
00001cd0  09 c4 13 dd 20 f2 72 65  6d 6f 76 65 5f 70 61 6e  |.... .remove_pan|
00001ce0  65 73 0d 09 ce 1e f2 43  6c 6f 73 65 57 69 6e 64  |es.....CloseWind|
00001cf0  6f 77 28 4e 6f 74 65 73  50 61 6e 65 5f 68 25 29  |ow(NotesPane_h%)|
00001d00  0d 09 d8 1f f2 43 6c 6f  73 65 57 69 6e 64 6f 77  |.....CloseWindow|
00001d10  28 53 68 61 72 70 73 50  61 6e 65 5f 68 25 29 0d  |(SharpsPane_h%).|
00001d20  09 e2 1e f2 43 6c 6f 73  65 57 69 6e 64 6f 77 28  |....CloseWindow(|
00001d30  52 65 73 74 73 50 61 6e  65 5f 68 25 29 0d 09 ec  |RestsPane_h%)...|
00001d40  05 e1 0d 09 f6 04 0d 0a  00 1a dd 20 f2 6f 70 65  |........... .ope|
00001d50  6e 5f 77 69 6e 64 6f 77  5f 72 65 71 75 65 73 74  |n_window_request|
00001d60  0d 0a 0a 0e ea 20 62 68  61 6e 64 6c 65 25 0d 0a  |..... bhandle%..|
00001d70  14 1b 62 68 61 6e 64 6c  65 25 3d 57 69 6e 64 6f  |..bhandle%=Windo|
00001d80  77 25 21 75 6e 64 65 72  25 0d 0a 1e 0c f2 72 65  |w%!under%.....re|
00001d90  6c 65 61 73 65 0d 0a 28  24 e7 20 57 69 6e 64 6f  |lease..($. Windo|
00001da0  77 25 21 68 61 6e 64 6c  65 25 3d 53 63 6f 72 65  |w%!handle%=Score|
00001db0  57 69 6e 64 5f 68 25 20  8c 0d 0a 32 14 20 e7 20  |Wind_h% ...2. . |
00001dc0  54 52 41 4e 53 43 52 49  42 45 25 20 8c 0d 0a 3c  |TRANSCRIBE% ...<|
00001dd0  50 f4 20 64 65 66 69 6e  65 20 77 69 6e 64 6f 77  |P. define window|
00001de0  20 73 74 61 63 6b 20 61  73 20 74 6f 70 2d 3e 62  | stack as top->b|
00001df0  6f 74 74 6f 6d 20 73 68  61 72 70 73 70 61 6e 65  |ottom sharpspane|
00001e00  2d 3e 72 65 73 74 73 70  61 6e 65 2d 3e 6e 6f 74  |->restspane->not|
00001e10  65 73 70 61 6e 65 2d 3e  73 63 6f 72 65 0d 0a 46  |espane->score..F|
00001e20  4a f4 20 6f 70 65 6e 20  74 6f 70 20 6f 72 20 62  |J. open top or b|
00001e30  6f 74 74 6f 6d 20 70 61  6e 65 73 20 62 65 66 6f  |ottom panes befo|
00001e40  72 65 20 73 63 6f 72 65  20 64 65 70 65 6e 64 69  |re score dependi|
00001e50  6e 67 20 6f 6e 20 64 69  72 65 63 74 69 6f 6e 20  |ng on direction |
00001e60  6f 66 20 64 72 61 67 0d  0a 50 2c 20 20 c8 99 20  |of drag..P,  .. |
00001e70  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 25 2c  |GetWindowState%,|
00001e80  2c 53 68 61 72 70 50 42  6c 6b 25 2b 68 61 6e 64  |,SharpPBlk%+hand|
00001e90  6c 65 25 0d 0a 5a 3e 20  20 e7 20 53 68 61 72 70  |le%..Z>  . Sharp|
00001ea0  50 42 6c 6b 25 21 75 6e  64 65 72 25 3d 62 68 61  |PBlk%!under%=bha|
00001eb0  6e 64 6c 65 25 20 57 69  6e 64 6f 77 25 21 75 6e  |ndle% Window%!un|
00001ec0  64 65 72 25 3d 4e 6f 74  65 73 50 61 6e 65 5f 68  |der%=NotesPane_h|
00001ed0  25 0d 0a 64 2c 20 20 c8  99 20 47 65 74 57 69 6e  |%..d,  .. GetWin|
00001ee0  64 6f 77 53 74 61 74 65  25 2c 2c 53 63 6f 72 65  |dowState%,,Score|
00001ef0  57 42 6c 6b 25 2b 68 61  6e 64 6c 65 25 0d 0a 6e  |WBlk%+handle%..n|
00001f00  24 20 20 e7 20 57 69 6e  64 6f 77 25 21 79 31 25  |$  . Window%!y1%|
00001f10  3e 53 63 6f 72 65 57 42  6c 6b 25 21 79 31 25 20  |>ScoreWBlk%!y1% |
00001f20  8c 0d 0a 78 21 20 20 20  f2 70 6c 61 63 65 5f 74  |...x!   .place_t|
00001f30  6f 70 5f 70 61 6e 65 73  28 62 68 61 6e 64 6c 65  |op_panes(bhandle|
00001f40  25 29 0d 0a 82 08 20 20  20 cc 0d 0a 8c 24 20 20  |%)....   ....$  |
00001f50  20 f2 70 6c 61 63 65 5f  62 6f 74 74 6f 6d 5f 70  | .place_bottom_p|
00001f60  61 6e 65 73 28 62 68 61  6e 64 6c 65 25 29 0d 0a  |anes(bhandle%)..|
00001f70  96 08 20 20 20 cd 0d 0a  a0 07 20 20 cd 0d 0a aa  |..   .....  ....|
00001f80  53 20 e7 20 50 4c 41 59  49 4e 47 25 20 80 20 57  |S . PLAYING% . W|
00001f90  69 6e 64 6f 77 25 21 73  63 78 25 3c 3e 53 63 6f  |indow%!scx%<>Sco|
00001fa0  72 65 57 42 6c 6b 25 21  73 63 78 25 20 e1 3a f4  |reWBlk%!scx% .:.|
00001fb0  20 6e 6f 20 75 73 65 72  2d 73 63 72 6f 6c 6c 69  | no user-scrolli|
00001fc0  6e 67 20 77 68 69 6c 65  20 70 6c 61 79 69 6e 67  |ng while playing|
00001fd0  0d 0a b4 24 20 c8 99 20  4f 70 65 6e 57 69 6e 64  |...$ .. OpenWind|
00001fe0  6f 77 25 2c 2c 57 69 6e  64 6f 77 25 2b 68 61 6e  |ow%,,Window%+han|
00001ff0  64 6c 65 25 0d 0a be 13  20 53 63 6f 72 65 43 6c  |dle%.... ScoreCl|
00002000  6f 73 65 64 25 3d a3 0d  0a c8 14 20 e7 20 54 52  |osed%=..... . TR|
00002010  41 4e 53 43 52 49 42 45  25 20 8c 0d 0a d2 15 20  |ANSCRIBE% ..... |
00002020  20 e7 20 62 68 61 6e 64  6c 65 25 3d 2d 32 20 8c  | . bhandle%=-2 .|
00002030  0d 0a dc 32 20 20 20 f4  20 66 69 6e 64 20 62 65  |...2   . find be|
00002040  68 69 6e 64 20 68 61 6e  64 6c 65 25 20 69 66 20  |hind handle% if |
00002050  70 75 73 68 65 64 20 74  6f 20 74 68 65 20 62 61  |pushed to the ba|
00002060  63 6b 0d 0a e6 2d 20 20  20 c8 99 20 47 65 74 57  |ck...-   .. GetW|
00002070  69 6e 64 6f 77 53 74 61  74 65 25 2c 2c 53 63 6f  |indowState%,,Sco|
00002080  72 65 57 42 6c 6b 25 2b  68 61 6e 64 6c 65 25 0d  |reWBlk%+handle%.|
00002090  0a f0 23 20 20 20 62 68  61 6e 64 6c 65 25 20 3d  |..#   bhandle% =|
000020a0  20 53 63 6f 72 65 57 42  6c 6b 25 21 75 6e 64 65  | ScoreWBlk%!unde|
000020b0  72 25 0d 0a fa 08 20 20  20 cd 0d 0b 04 19 20 20  |r%....   .....  |
000020c0  f4 20 72 65 2d 6f 70 65  6e 20 61 6c 6c 20 70 61  |. re-open all pa|
000020d0  6e 65 73 0d 0b 0e 23 20  20 f2 70 6c 61 63 65 5f  |nes...#  .place_|
000020e0  62 6f 74 74 6f 6d 5f 70  61 6e 65 73 28 62 68 61  |bottom_panes(bha|
000020f0  6e 64 6c 65 25 29 0d 0b  18 25 20 20 f2 70 6c 61  |ndle%)...%  .pla|
00002100  63 65 5f 74 6f 70 5f 70  61 6e 65 73 28 53 68 61  |ce_top_panes(Sha|
00002110  72 70 73 50 61 6e 65 5f  68 25 29 0d 0b 22 6f 20  |rpsPane_h%).."o |
00002120  20 e7 20 62 68 61 6e 64  6c 65 25 3d 53 63 6f 72  | . bhandle%=Scor|
00002130  65 57 69 6e 64 5f 68 25  20 20 c8 99 20 4f 70 65  |eWind_h%  .. Ope|
00002140  6e 57 69 6e 64 6f 77 25  2c 2c 57 69 6e 64 6f 77  |nWindow%,,Window|
00002150  25 2b 68 61 6e 64 6c 65  25 20 3a f4 20 65 6e 73  |%+handle% :. ens|
00002160  75 72 65 20 77 69 6e 64  6f 77 20 69 73 20 62 65  |ure window is be|
00002170  68 69 6e 64 20 70 61 6e  65 73 20 69 6e 20 75 6e  |hind panes in un|
00002180  75 73 75 61 6c 20 63 61  73 65 0d 0b 2c 07 20 20  |usual case..,.  |
00002190  cd 0d 0b 36 51 20 4c 48  42 41 52 25 3d a4 46 69  |...6Q LHBAR%=.Fi|
000021a0  6e 64 42 61 72 28 53 63  6f 72 65 57 42 6c 6b 25  |ndBar(ScoreWBlk%|
000021b0  21 73 63 78 25 29 20 3a  f4 20 74 68 65 20 62 61  |!scx%) :. the ba|
000021c0  72 20 6e 75 6d 62 65 72  20 61 74 20 74 68 65 20  |r number at the |
000021d0  6c 65 66 74 20 6f 66 20  74 68 65 20 77 69 6e 64  |left of the wind|
000021e0  6f 77 0d 0b 40 06 20 cc  0d 0b 4a 24 20 c8 99 20  |ow..@. ...J$ .. |
000021f0  4f 70 65 6e 57 69 6e 64  6f 77 25 2c 2c 57 69 6e  |OpenWindow%,,Win|
00002200  64 6f 77 25 2b 68 61 6e  64 6c 65 25 0d 0b 54 06  |dow%+handle%..T.|
00002210  20 cd 0d 0b 5e 05 e1 0d  0b 68 04 0d 0b 72 1b dd  | ...^....h...r..|
00002220  20 f2 63 6c 6f 73 65 5f  77 69 6e 64 6f 77 5f 72  | .close_window_r|
00002230  65 71 75 65 73 74 0d 0b  7c 24 c8 99 20 43 6c 6f  |equest..|$.. Clo|
00002240  73 65 57 69 6e 64 6f 77  25 2c 2c 57 69 6e 64 6f  |seWindow%,,Windo|
00002250  77 25 2b 68 61 6e 64 6c  65 25 0d 0b 86 41 e7 20  |w%+handle%...A. |
00002260  57 69 6e 64 6f 77 25 21  68 61 6e 64 6c 65 25 3d  |Window%!handle%=|
00002270  53 63 6f 72 65 57 69 6e  64 5f 68 25 20 f2 72 65  |ScoreWind_h% .re|
00002280  6d 6f 76 65 5f 70 61 6e  65 73 20 3a 20 53 63 6f  |move_panes : Sco|
00002290  72 65 43 6c 6f 73 65 64  25 3d b9 0d 0b 90 05 e1  |reClosed%=......|
000022a0  0d 0b 9a 04 0d 0b a4 19  dd 20 f2 6d 6f 75 73 65  |......... .mouse|
000022b0  5f 62 75 74 74 6f 6e 5f  63 6c 69 63 6b 0d 0b ae  |_button_click...|
000022c0  15 ea 42 25 2c 43 25 2c  57 25 2c 49 25 2c 69 6e  |..B%,C%,W%,I%,in|
000022d0  63 25 0d 0b b8 23 57 25  3d 4d 6f 75 73 65 25 21  |c%...#W%=Mouse%!|
000022e0  77 69 6e 64 6f 77 3a 49  25 3d 4d 6f 75 73 65 25  |window:I%=Mouse%|
000022f0  21 69 63 6f 6e 0d 0b c2  1a 42 25 3d 25 31 31 31  |!icon....B%=%111|
00002300  80 4d 6f 75 73 65 25 21  62 75 74 74 6f 6e 73 0d  |.Mouse%!buttons.|
00002310  0b cc 2b 4d 6f 75 73 65  5f 58 25 3d 4d 6f 75 73  |..+Mouse_X%=Mous|
00002320  65 25 21 78 30 25 3a 4d  6f 75 73 65 5f 59 25 3d  |e%!x0%:Mouse_Y%=|
00002330  4d 6f 75 73 65 25 21 79  30 25 0d 0b d6 0f e7 20  |Mouse%!y0%..... |
00002340  42 25 3d 25 30 31 30 20  8c 0d 0b e0 1b 20 20 f2  |B%=%010 .....  .|
00002350  43 68 65 63 6b 49 6e 73  74 61 6c 6c 65 64 56 6f  |CheckInstalledVo|
00002360  69 63 65 73 0d 0b ea 12  20 20 f2 53 74 6f 70 53  |ices....  .StopS|
00002370  63 6f 72 69 6e 67 0d 0b  f4 32 20 20 e7 20 57 25  |coring...2  . W%|
00002380  3d 2d 32 20 f2 4f 70 65  6e 4d 65 6e 75 28 49 63  |=-2 .OpenMenu(Ic|
00002390  6f 6e 4d 65 6e 75 25 29  20 8b 20 f2 4f 70 65 6e  |onMenu%) . .Open|
000023a0  4d 61 69 6e 4d 65 6e 75  0d 0b fe 05 cc 0d 0c 08  |MainMenu........|
000023b0  31 e7 20 42 25 3d 25 31  30 30 20 69 6e 63 25 3d  |1. B%=%100 inc%=|
000023c0  2d 31 20 8b 20 e7 20 42  25 3d 25 30 30 31 20 69  |-1 . . B%=%001 i|
000023d0  6e 63 25 3d 31 20 8b 20  69 6e 63 25 3d 30 0d 0c  |nc%=1 . inc%=0..|
000023e0  12 0b c8 8e 20 57 25 20  ca 0d 0c 1c 41 c9 20 2d  |.... W% ....A. -|
000023f0  32 20 3a 20 e7 20 53 63  6f 72 65 43 6c 6f 73 65  |2 : . ScoreClose|
00002400  64 25 20 84 20 ac 20 50  4c 41 59 49 4e 47 25 20  |d% . . PLAYING% |
00002410  f2 73 65 74 75 70 5f 73  74 61 76 65 73 3a e1 20  |.setup_staves:. |
00002420  3a f4 20 69 63 6f 6e 62  61 72 0d 0c 26 13 c9 20  |:. iconbar..&.. |
00002430  41 62 6f 72 74 51 75 65  72 79 5f 68 25 0d 0c 30  |AbortQuery_h%..0|
00002440  0e 20 20 e7 20 49 25 3d  32 20 8c 0d 0c 3a 12 20  |.  . I%=2 ...:. |
00002450  20 20 20 f2 74 65 72 6d  69 6e 61 74 65 0d 0c 44  |   .terminate..D|
00002460  09 20 20 20 20 cc 0d 0c  4e 14 20 20 20 20 20 20  |.    ...N.      |
00002470  f2 43 6c 6f 73 65 4d 65  6e 75 0d 0c 58 25 20 20  |.CloseMenu..X%  |
00002480  20 20 20 20 f2 43 6c 6f  73 65 57 69 6e 64 6f 77  |    .CloseWindow|
00002490  28 41 62 6f 72 74 51 75  65 72 79 5f 68 25 29 0d  |(AbortQuery_h%).|
000024a0  0c 62 09 20 20 20 20 cd  0d 0c 6c 12 c9 20 4e 6f  |.b.    ...l.. No|
000024b0  74 65 73 50 61 6e 65 5f  68 25 0d 0c 76 0f 20 20  |tesPane_h%..v.  |
000024c0  e7 20 49 25 3e 3d 30 20  8c 0d 0c 80 0e 20 20 f2  |. I%>=0 .....  .|
000024d0  72 65 6c 65 61 73 65 0d  0c 8a 13 20 20 77 61 73  |release....  was|
000024e0  53 43 4f 52 49 4e 47 25  3d b9 0d 0c 94 14 20 20  |SCORING%=.....  |
000024f0  73 74 6f 70 53 43 4f 52  49 4e 47 25 3d a3 0d 0c  |stopSCORING%=...|
00002500  9e 28 20 20 f2 55 70 64  61 74 65 49 63 6f 6e 28  |.(  .UpdateIcon(|
00002510  53 65 6c 57 25 2c 20 53  65 6c 49 25 2c 20 30 2c  |SelW%, SelI%, 0,|
00002520  20 31 3c 3c 32 29 0d 0c  a8 22 20 20 f2 55 70 64  | 1<<2)..."  .Upd|
00002530  61 74 65 49 63 6f 6e 28  57 25 2c 20 49 25 2c 20  |ateIcon(W%, I%, |
00002540  31 3c 3c 32 2c 20 30 29  0d 0c b2 0e 20 20 53 65  |1<<2, 0)....  Se|
00002550  6c 57 25 3d 57 25 0d 0c  bc 0e 20 20 53 65 6c 49  |lW%=W%....  SelI|
00002560  25 3d 49 25 0d 0c c6 1f  20 20 f2 61 74 74 61 63  |%=I%....  .attac|
00002570  68 28 6e 6f 74 65 25 2b  49 25 2c 25 31 31 31 30  |h(note%+I%,%1110|
00002580  30 30 29 0d 0c d0 07 20  20 cd 0d 0c da 12 c9 20  |00)....  ...... |
00002590  52 65 73 74 73 50 61 6e  65 5f 68 25 0d 0c e4 0f  |RestsPane_h%....|
000025a0  20 20 e7 20 49 25 3e 3d  30 20 8c 0d 0c ee 0e 20  |  . I%>=0 ..... |
000025b0  20 f2 72 65 6c 65 61 73  65 0d 0c f8 13 20 20 77  | .release....  w|
000025c0  61 73 53 43 4f 52 49 4e  47 25 3d b9 0d 0d 02 14  |asSCORING%=.....|
000025d0  20 20 73 74 6f 70 53 43  4f 52 49 4e 47 25 3d a3  |  stopSCORING%=.|
000025e0  0d 0d 0c 28 20 20 f2 55  70 64 61 74 65 49 63 6f  |...(  .UpdateIco|
000025f0  6e 28 53 65 6c 57 25 2c  20 53 65 6c 49 25 2c 20  |n(SelW%, SelI%, |
00002600  30 2c 20 31 3c 3c 32 29  0d 0d 16 22 20 20 f2 55  |0, 1<<2)..."  .U|
00002610  70 64 61 74 65 49 63 6f  6e 28 57 25 2c 20 49 25  |pdateIcon(W%, I%|
00002620  2c 20 31 3c 3c 32 2c 20  30 29 0d 0d 20 0e 20 20  |, 1<<2, 0).. .  |
00002630  53 65 6c 57 25 3d 57 25  0d 0d 2a 0e 20 20 53 65  |SelW%=W%..*.  Se|
00002640  6c 49 25 3d 49 25 0d 0d  34 1e 20 20 f2 61 74 74  |lI%=I%..4.  .att|
00002650  61 63 68 28 72 65 73 74  25 2b 49 25 2c 25 31 31  |ach(rest%+I%,%11|
00002660  30 30 30 29 0d 0d 3e 07  20 20 cd 0d 0d 48 13 c9  |000)..>.  ...H..|
00002670  20 53 68 61 72 70 73 50  61 6e 65 5f 68 25 0d 0d  | SharpsPane_h%..|
00002680  52 0f 20 20 e7 20 49 25  3e 3d 30 20 8c 0d 0d 5c  |R.  . I%>=0 ...\|
00002690  0e 20 20 f2 72 65 6c 65  61 73 65 0d 0d 66 13 20  |.  .release..f. |
000026a0  20 77 61 73 53 43 4f 52  49 4e 47 25 3d b9 0d 0d  | wasSCORING%=...|
000026b0  70 14 20 20 73 74 6f 70  53 43 4f 52 49 4e 47 25  |p.  stopSCORING%|
000026c0  3d a3 0d 0d 7a 28 20 20  f2 55 70 64 61 74 65 49  |=...z(  .UpdateI|
000026d0  63 6f 6e 28 53 65 6c 57  25 2c 20 53 65 6c 49 25  |con(SelW%, SelI%|
000026e0  2c 20 30 2c 20 31 3c 3c  32 29 0d 0d 84 22 20 20  |, 0, 1<<2)..."  |
000026f0  f2 55 70 64 61 74 65 49  63 6f 6e 28 57 25 2c 20  |.UpdateIcon(W%, |
00002700  49 25 2c 20 31 3c 3c 32  2c 20 30 29 0d 0d 8e 0e  |I%, 1<<2, 0)....|
00002710  20 20 53 65 6c 57 25 3d  57 25 0d 0d 98 0e 20 20  |  SelW%=W%....  |
00002720  53 65 6c 49 25 3d 49 25  0d 0d a2 55 20 20 e7 20  |SelI%=I%...U  . |
00002730  49 25 3c 37 20 20 f2 61  74 74 61 63 68 28 61 63  |I%<7  .attach(ac|
00002740  63 69 64 65 6e 74 61 6c  25 2b 49 25 2b 31 2c 25  |cidental%+I%+1,%|
00002750  31 31 30 30 30 30 30 29  20 8b e7 20 49 25 3c 31  |1100000) .. I%<1|
00002760  31 20 f2 61 74 74 61 63  68 28 64 6f 74 25 2b 49  |1 .attach(dot%+I|
00002770  25 2d 36 2c 25 31 31 30  31 30 30 30 29 0d 0d ac  |%-6,%1101000)...|
00002780  24 20 20 e7 20 49 25 3d  31 30 20 f2 61 74 74 61  |$  . I%=10 .atta|
00002790  63 68 28 74 69 65 25 2c  25 31 31 30 31 30 30 30  |ch(tie%,%1101000|
000027a0  29 0d 0d b6 25 20 20 e7  20 49 25 3d 31 31 20 f2  |)...%  . I%=11 .|
000027b0  61 74 74 61 63 68 28 62  61 72 25 2c 25 31 30 30  |attach(bar%,%100|
000027c0  31 30 30 30 30 29 0d 0d  c0 31 20 20 e7 20 49 25  |10000)...1  . I%|
000027d0  3d 31 32 20 f2 61 74 74  61 63 68 28 63 6c 65 66  |=12 .attach(clef|
000027e0  25 2c 25 31 30 30 29 20  20 3a f4 20 54 72 65 62  |%,%100)  :. Treb|
000027f0  6c 65 20 63 6c 65 66 0d  0d ca 2f 20 20 e7 20 49  |le clef.../  . I|
00002800  25 3d 31 33 20 f2 61 74  74 61 63 68 28 63 6c 65  |%=13 .attach(cle|
00002810  66 25 2b 33 2c 25 31 30  30 29 3a f4 20 42 61 73  |f%+3,%100):. Bas|
00002820  73 20 63 6c 65 66 0d 0d  d4 33 20 20 e7 20 49 25  |s clef...3  . I%|
00002830  3d 31 34 20 f2 61 74 74  61 63 68 28 6b 65 79 25  |=14 .attach(key%|
00002840  2c 25 31 30 29 20 20 20  20 3a f4 20 6b 65 79 20  |,%10)    :. key |
00002850  73 69 67 6e 61 74 75 72  65 0d 0d de 34 20 20 e7  |signature...4  .|
00002860  20 49 25 3d 31 35 20 f2  61 74 74 61 63 68 28 74  | I%=15 .attach(t|
00002870  69 6d 65 25 2c 25 31 29  20 20 20 20 3a f4 20 74  |ime%,%1)    :. t|
00002880  69 6d 65 20 73 69 67 6e  61 74 75 72 65 0d 0d e8  |ime signature...|
00002890  07 20 20 cd 0d 0d f2 12  c9 20 53 63 6f 72 65 57  |.  ...... ScoreW|
000028a0  69 6e 64 5f 68 25 0d 0d  fc 33 20 20 e7 20 42 25  |ind_h%...3  . B%|
000028b0  3d 25 31 30 30 20 e7 53  43 4f 52 49 4e 47 25 80  |=%100 .SCORING%.|
000028c0  53 43 52 49 42 45 25 28  64 72 61 77 6e 25 29 20  |SCRIBE%(drawn%) |
000028d0  f2 70 75 74 5f 64 6f 77  6e 0d 0e 06 12 c9 20 49  |.put_down..... I|
000028e0  6e 73 74 72 57 69 6e 64  5f 68 25 0d 0e 10 11 20  |nstrWind_h%.... |
000028f0  20 ea 20 63 68 61 6e 25  2c 20 76 25 0d 0e 1a 1b  | . chan%, v%....|
00002900  20 20 f2 43 68 65 63 6b  49 6e 73 74 61 6c 6c 65  |  .CheckInstalle|
00002910  64 56 6f 69 63 65 73 0d  0e 24 12 20 20 f2 53 74  |dVoices..$.  .St|
00002920  6f 70 53 63 6f 72 69 6e  67 0d 0e 2e 0f 20 20 e7  |opScoring....  .|
00002930  20 49 25 3e 3d 38 20 8c  0d 0e 38 12 20 20 20 20  | I%>=8 ...8.    |
00002940  63 68 61 6e 25 3d 49 25  2d 38 0d 0e 42 13 20 20  |chan%=I%-8..B.  |
00002950  20 20 e7 20 63 68 61 6e  25 3c 38 20 8c 0d 0e 4c  |  . chan%<8 ...L|
00002960  26 20 20 20 20 20 20 76  25 3d a4 41 74 74 61 63  |&      v%=.Attac|
00002970  68 56 6f 69 63 65 28 63  68 61 6e 25 2c 20 69 6e  |hVoice(chan%, in|
00002980  63 25 29 0d 0e 56 2b 20  20 20 20 20 20 c8 99 20  |c%)..V+      .. |
00002990  53 6f 75 6e 64 5f 41 74  74 61 63 68 56 6f 69 63  |Sound_AttachVoic|
000029a0  65 2c 20 63 68 61 6e 25  2b 31 2c 20 76 25 0d 0e  |e, chan%+1, v%..|
000029b0  60 36 20 20 20 20 20 20  24 28 56 6f 69 63 65 53  |`6      $(VoiceS|
000029c0  74 72 25 28 63 68 61 6e  25 29 29 3d c0 56 6f 69  |tr%(chan%))=.Voi|
000029d0  63 65 24 28 76 25 29 2c  20 56 6f 69 63 65 53 69  |ce$(v%), VoiceSi|
000029e0  7a 65 25 29 0d 0e 6a 23  20 20 20 20 20 20 49 6e  |ze%)..j#      In|
000029f0  73 74 72 75 6d 65 6e 74  25 28 63 68 61 6e 25 2c  |strument%(chan%,|
00002a00  31 29 20 3d 20 76 25 0d  0e 74 22 20 20 20 20 20  |1) = v%..t"     |
00002a10  20 f2 55 70 64 61 74 65  49 63 6f 6e 28 57 25 2c  | .UpdateIcon(W%,|
00002a20  20 49 25 2c 20 30 2c 30  29 0d 0e 7e 09 20 20 20  | I%, 0,0)..~.   |
00002a30  20 cc 0d 0e 88 10 20 20  20 20 63 68 61 6e 25 2d  | .....    chan%-|
00002a40  3d 38 0d 0e 92 13 20 20  20 20 e7 20 63 68 61 6e  |=8....    . chan|
00002a50  25 3c 38 20 8c 0d 0e 9c  1c 20 20 20 20 20 20 76  |%<8 .....      v|
00002a60  25 3d 56 6f 6c 75 6d 65  73 25 28 63 68 61 6e 25  |%=Volumes%(chan%|
00002a70  29 0d 0e a6 3d 20 20 20  20 20 20 76 25 2b 3d 69  |)...=      v%+=i|
00002a80  6e 63 25 20 3a 20 e7 20  76 25 3e 4e 56 6f 6c 75  |nc% : . v%>NVolu|
00002a90  6d 65 73 25 20 76 25 3d  4e 56 6f 6c 75 6d 65 73  |mes% v%=NVolumes|
00002aa0  25 20 8b e7 20 76 25 3c  30 20 76 25 3d 30 0d 0e  |% .. v%<0 v%=0..|
00002ab0  b0 1c 20 20 20 20 20 20  56 6f 6c 75 6d 65 73 25  |..      Volumes%|
00002ac0  28 63 68 61 6e 25 29 3d  76 25 0d 0e ba 43 20 20  |(chan%)=v%...C  |
00002ad0  20 20 20 20 24 28 56 6f  6c 75 6d 65 53 74 72 25  |    $(VolumeStr%|
00002ae0  28 63 68 61 6e 25 29 29  3d c0 56 6f 6c 75 6d 65  |(chan%))=.Volume|
00002af0  24 28 56 6f 6c 75 6d 65  73 25 28 63 68 61 6e 25  |$(Volumes%(chan%|
00002b00  29 29 2c 20 56 6f 6c 53  69 7a 65 25 29 0d 0e c4  |)), VolSize%)...|
00002b10  22 20 20 20 20 20 20 f2  55 70 64 61 74 65 49 63  |"      .UpdateIc|
00002b20  6f 6e 28 57 25 2c 20 49  25 2c 20 30 2c 30 29 0d  |on(W%, I%, 0,0).|
00002b30  0e ce 09 20 20 20 20 cc  0d 0e d8 10 20 20 20 20  |...    .....    |
00002b40  63 68 61 6e 25 2d 3d 38  0d 0e e2 13 20 20 20 20  |chan%-=8....    |
00002b50  e7 20 63 68 61 6e 25 3c  38 20 8c 0d 0e ec 24 20  |. chan%<8 ....$ |
00002b60  20 20 20 20 20 76 25 3d  53 74 65 72 65 6f 5f 50  |     v%=Stereo_P|
00002b70  6f 73 69 74 69 6f 6e 25  28 63 68 61 6e 25 29 0d  |osition%(chan%).|
00002b80  0e f6 48 20 20 20 20 20  20 76 25 2b 3d 69 6e 63  |..H      v%+=inc|
00002b90  25 20 3a 20 e7 20 76 25  3e 4e 53 74 65 72 65 6f  |% : . v%>NStereo|
00002ba0  73 25 20 76 25 3d 4e 53  74 65 72 65 6f 73 25 20  |s% v%=NStereos% |
00002bb0  8b e7 20 76 25 3c 30 20  76 25 3d 30 3a 20 f4 20  |.. v%<0 v%=0: . |
00002bc0  6e 6f 20 77 72 61 70 0d  0f 00 24 20 20 20 20 20  |no wrap...$     |
00002bd0  20 53 74 65 72 65 6f 5f  50 6f 73 69 74 69 6f 6e  | Stereo_Position|
00002be0  25 28 63 68 61 6e 25 29  3d 76 25 0d 0f 0a 42 20  |%(chan%)=v%...B |
00002bf0  20 20 20 20 20 c8 99 20  53 6f 75 6e 64 5f 53 74  |     .. Sound_St|
00002c00  65 72 65 6f 2c 63 68 61  6e 25 2b 31 2c 53 74 65  |ereo,chan%+1,Ste|
00002c10  72 65 6f 25 28 53 74 65  72 65 6f 5f 50 6f 73 69  |reo%(Stereo_Posi|
00002c20  74 69 6f 6e 25 28 63 68  61 6e 25 29 29 0d 0f 14  |tion%(chan%))...|
00002c30  51 20 20 20 20 20 20 24  28 53 74 65 72 65 6f 53  |Q      $(StereoS|
00002c40  74 72 25 28 63 68 61 6e  25 29 29 20 3d 20 c0 53  |tr%(chan%)) = .S|
00002c50  74 65 72 65 6f 24 28 53  74 65 72 65 6f 5f 50 6f  |tereo$(Stereo_Po|
00002c60  73 69 74 69 6f 6e 25 28  63 68 61 6e 25 29 2c 20  |sition%(chan%), |
00002c70  30 29 2c 20 53 74 65 72  53 69 7a 65 25 29 0d 0f  |0), SterSize%)..|
00002c80  1e 22 20 20 20 20 20 20  f2 55 70 64 61 74 65 49  |."      .UpdateI|
00002c90  63 6f 6e 28 57 25 2c 20  49 25 2c 20 30 2c 30 29  |con(W%, I%, 0,0)|
00002ca0  0d 0f 28 09 20 20 20 20  cc 0d 0f 32 18 20 20 20  |..(.    ...2.   |
00002cb0  20 e7 20 4d 49 44 49 70  72 65 73 65 6e 74 25 20  | . MIDIpresent% |
00002cc0  8c 0d 0f 3c 12 20 20 20  20 20 20 63 68 61 6e 25  |...<.      chan%|
00002cd0  2d 3d 38 0d 0f 46 15 20  20 20 20 20 20 e7 20 63  |-=8..F.      . c|
00002ce0  68 61 6e 25 3c 38 20 8c  0d 0f 50 22 20 20 20 20  |han%<8 ...P"    |
00002cf0  20 20 20 20 76 25 3d 4d  49 44 49 43 68 61 6e 6e  |    v%=MIDIChann|
00002d00  65 6c 25 28 63 68 61 6e  25 29 0d 0f 5a 49 20 20  |el%(chan%)..ZI  |
00002d10  20 20 20 20 20 20 76 25  2b 3d 69 6e 63 25 20 3a  |      v%+=inc% :|
00002d20  20 e7 20 76 25 3e 4e 4d  49 44 49 43 68 61 6e 6e  | . v%>NMIDIChann|
00002d30  65 6c 73 25 20 76 25 3d  31 20 8b e7 20 76 25 3c  |els% v%=1 .. v%<|
00002d40  31 20 76 25 3d 4e 4d 49  44 49 43 68 61 6e 6e 65  |1 v%=NMIDIChanne|
00002d50  6c 73 25 0d 0f 64 22 20  20 20 20 20 20 20 20 4d  |ls%..d"        M|
00002d60  49 44 49 43 68 61 6e 6e  65 6c 25 28 63 68 61 6e  |IDIChannel%(chan|
00002d70  25 29 3d 76 25 0d 0f 6e  39 20 20 20 20 20 20 20  |%)=v%..n9       |
00002d80  20 24 28 4d 49 44 49 43  68 53 74 72 25 28 63 68  | $(MIDIChStr%(ch|
00002d90  61 6e 25 29 29 20 3d 20  c3 28 4d 49 44 49 43 68  |an%)) = .(MIDICh|
00002da0  61 6e 6e 65 6c 25 28 63  68 61 6e 25 29 29 0d 0f  |annel%(chan%))..|
00002db0  78 24 20 20 20 20 20 20  20 20 f2 55 70 64 61 74  |x$        .Updat|
00002dc0  65 49 63 6f 6e 28 57 25  2c 20 49 25 2c 20 30 2c  |eIcon(W%, I%, 0,|
00002dd0  30 29 0d 0f 82 0d 20 20  20 20 20 20 20 20 cd 0d  |0)....        ..|
00002de0  0f 8c 0b 20 20 20 20 20  20 cd 0d 0f 96 09 20 20  |...      .....  |
00002df0  20 20 cd 0d 0f a0 09 20  20 20 20 cd 0d 0f aa 09  |  .....    .....|
00002e00  20 20 20 20 cd 0d 0f b4  09 20 20 20 20 cd 0d 0f  |    .....    ...|
00002e10  be 0d c9 20 53 61 76 65  5f 68 25 0d 0f c8 12 20  |... Save_h%.... |
00002e20  20 f2 53 74 6f 70 53 63  6f 72 69 6e 67 0d 0f d2  | .StopScoring...|
00002e30  40 20 20 e7 20 49 25 3d  30 20 f2 73 61 76 65 5f  |@  . I%=0 .save_|
00002e40  6d 75 73 69 63 28 a4 47  65 74 53 74 72 28 53 61  |music(.GetStr(Sa|
00002e50  76 65 54 65 78 74 29 29  20 20 20 20 20 20 20 3a  |veText))       :|
00002e60  20 20 20 f4 20 30 20 69  73 20 4f 4b 2e 0d 0f dc  |   . 0 is OK....|
00002e70  0e 20 20 e7 20 49 25 3d  32 20 8c 0d 0f e6 3b 20  |.  . I%=2 ....; |
00002e80  20 20 20 ea 20 78 25 2c  20 79 25 20 20 20 20 20  |   . x%, y%     |
00002e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ea0  20 20 20 20 20 3a 20 f4  20 64 72 61 67 67 69 6e  |     : . draggin|
00002eb0  67 20 69 63 6f 6e 0d 0f  f0 1a 20 20 20 20 57 69  |g icon....    Wi|
00002ec0  6e 64 6f 77 25 21 68 61  6e 64 6c 65 25 3d 57 25  |ndow%!handle%=W%|
00002ed0  0d 0f fa 2b 20 20 20 20  c8 99 20 47 65 74 57 69  |...+    .. GetWi|
00002ee0  6e 64 6f 77 53 74 61 74  65 25 2c 2c 57 69 6e 64  |ndowState%,,Wind|
00002ef0  6f 77 25 2b 68 61 6e 64  6c 65 25 0d 10 04 26 20  |ow%+handle%...& |
00002f00  20 20 20 79 73 69 7a 65  25 3d 57 69 6e 64 6f 77  |   ysize%=Window|
00002f10  25 21 79 31 25 2d 57 69  6e 64 6f 77 25 21 79 30  |%!y1%-Window%!y0|
00002f20  25 0d 10 0e 16 20 20 20  20 78 25 3d 57 69 6e 64  |%....    x%=Wind|
00002f30  6f 77 25 21 78 30 25 0d  10 18 16 20 20 20 20 79  |ow%!x0%....    y|
00002f40  25 3d 57 69 6e 64 6f 77  25 21 79 30 25 0d 10 22  |%=Window%!y0%.."|
00002f50  15 20 20 20 20 21 57 69  6e 64 6f 77 25 20 3d 20  |.    !Window% = |
00002f60  57 25 0d 10 2c 16 20 20  20 20 57 69 6e 64 6f 77  |W%..,.    Window|
00002f70  25 21 34 20 3d 20 49 25  0d 10 36 52 20 20 20 20  |%!4 = I%..6R    |
00002f80  c8 99 20 47 65 74 49 63  6f 6e 49 6e 66 6f 25 2c  |.. GetIconInfo%,|
00002f90  20 2c 57 69 6e 64 6f 77  25 20 3a 20 f4 20 72 65  | ,Window% : . re|
00002fa0  74 75 72 6e 73 20 69 63  6f 6e 20 62 6f 78 20 69  |turns icon box i|
00002fb0  6e 20 72 69 67 68 74 20  70 6c 61 63 65 20 66 6f  |n right place fo|
00002fc0  72 20 64 72 61 67 20 62  6f 78 0d 10 40 18 20 20  |r drag box..@.  |
00002fd0  20 20 57 69 6e 64 6f 77  25 21 38 20 20 2b 3d 20  |  Window%!8  += |
00002fe0  78 25 0d 10 4a 21 20 20  20 20 57 69 6e 64 6f 77  |x%..J!    Window|
00002ff0  25 21 31 32 20 2b 3d 20  79 25 20 2b 20 79 73 69  |%!12 += y% + ysi|
00003000  7a 65 25 0d 10 54 18 20  20 20 20 57 69 6e 64 6f  |ze%..T.    Windo|
00003010  77 25 21 31 36 20 2b 3d  20 78 25 0d 10 5e 21 20  |w%!16 += x%..^! |
00003020  20 20 20 57 69 6e 64 6f  77 25 21 32 30 20 2b 3d  |   Window%!20 +=|
00003030  20 79 25 20 2b 20 79 73  69 7a 65 25 0d 10 68 47  | y% + ysize%..hG|
00003040  f4 20 67 65 74 20 73 69  7a 65 20 69 6e 20 61 70  |. get size in ap|
00003050  70 72 6f 70 72 69 61 74  65 20 70 61 72 74 20 6f  |propriate part o|
00003060  66 20 62 6c 6f 63 6b 3a  20 70 61 72 65 6e 74 20  |f block: parent |
00003070  62 6f 78 3d 73 63 72 65  65 6e 20 62 6f 75 6e 64  |box=screen bound|
00003080  61 72 79 0d 10 72 16 20  20 20 20 57 69 6e 64 6f  |ary..r.    Windo|
00003090  77 25 21 32 34 20 3d 20  30 0d 10 7c 16 20 20 20  |w%!24 = 0..|.   |
000030a0  20 57 69 6e 64 6f 77 25  21 32 38 20 3d 20 30 0d  | Window%!28 = 0.|
000030b0  10 86 1d 20 20 20 20 57  69 6e 64 6f 77 25 21 33  |...    Window%!3|
000030c0  32 20 3d 20 53 5f 57 69  64 74 68 25 0d 10 90 1e  |2 = S_Width%....|
000030d0  20 20 20 20 57 69 6e 64  6f 77 25 21 33 36 20 3d  |    Window%!36 =|
000030e0  20 53 5f 48 65 69 67 68  74 25 0d 10 9a 12 20 20  | S_Height%....  |
000030f0  20 20 21 57 69 6e 64 6f  77 25 3d 30 0d 10 a4 2a  |  !Window%=0...*|
00003100  20 20 20 20 57 69 6e 64  6f 77 25 21 34 3d 35 3a  |    Window%!4=5:|
00003110  20 f4 20 66 69 78 65 64  20 73 69 7a 65 20 64 72  | . fixed size dr|
00003120  61 67 20 62 6f 78 0d 10  ae 11 20 20 20 20 53 41  |ag box....    SA|
00003130  56 49 4e 47 25 3d b9 0d  10 b8 13 20 20 20 20 44  |VING%=.....    D|
00003140  52 41 47 47 49 4e 47 25  3d b9 0d 10 c2 1c 20 20  |RAGGING%=.....  |
00003150  20 20 c8 99 20 44 72 61  67 42 6f 78 2c 20 2c 57  |  .. DragBox, ,W|
00003160  69 6e 64 6f 77 25 0d 10  cc 07 20 20 cc 0d 10 d6  |indow%....  ....|
00003170  1d 20 20 20 20 f2 43 6c  6f 73 65 57 69 6e 64 6f  |.    .CloseWindo|
00003180  77 28 53 61 76 65 5f 68  25 29 0d 10 e0 12 20 20  |w(Save_h%)....  |
00003190  20 20 f2 43 6c 6f 73 65  4d 65 6e 75 0d 10 ea 09  |  .CloseMenu....|
000031a0  20 20 20 20 cd 0d 10 f4  0d c9 20 4c 6f 61 64 5f  |    ...... Load_|
000031b0  68 25 0d 10 fe 12 20 20  f2 53 74 6f 70 53 63 6f  |h%....  .StopSco|
000031c0  72 69 6e 67 0d 11 08 40  20 20 e7 20 49 25 3d 30  |ring...@  . I%=0|
000031d0  20 f2 6c 6f 61 64 5f 6d  75 73 69 63 28 a4 47 65  | .load_music(.Ge|
000031e0  74 53 74 72 28 4c 6f 61  64 54 65 78 74 29 29 20  |tStr(LoadText)) |
000031f0  20 20 20 20 20 20 3a 20  20 20 f4 20 30 20 69 73  |      :   . 0 is|
00003200  20 4f 4b 2e 0d 11 12 1b  20 20 f2 43 6c 6f 73 65  | OK.....  .Close|
00003210  57 69 6e 64 6f 77 28 4c  6f 61 64 5f 68 25 29 0d  |Window(Load_h%).|
00003220  11 1c 10 20 20 f2 43 6c  6f 73 65 4d 65 6e 75 0d  |...  .CloseMenu.|
00003230  11 26 10 c9 20 54 69 6d  65 53 69 67 5f 68 25 0d  |.&.. TimeSig_h%.|
00003240  11 30 0d 20 20 c8 8e 20  49 25 20 ca 0d 11 3a 0a  |.0.  .. I% ...:.|
00003250  20 20 20 c9 20 30 0d 11  44 30 20 20 20 20 54 49  |   . 0..D0    TI|
00003260  4d 45 5f 53 49 47 25 28  30 29 3d 31 2b 28 54 49  |ME_SIG%(0)=1+(TI|
00003270  4d 45 5f 53 49 47 25 28  30 29 2b 69 6e 63 25 2b  |ME_SIG%(0)+inc%+|
00003280  31 34 29 83 31 35 0d 11  4e 25 20 20 20 20 24 42  |14).15..N%    $B|
00003290  61 72 4c 65 6e 67 74 68  25 3d c3 28 54 49 4d 45  |arLength%=.(TIME|
000032a0  5f 53 49 47 25 28 30 29  2b 31 29 0d 11 58 0a 20  |_SIG%(0)+1)..X. |
000032b0  20 20 c9 20 31 0d 11 62  2c 20 20 20 20 54 49 4d  |  . 1..b,    TIM|
000032c0  45 5f 53 49 47 25 28 31  29 3d 28 54 49 4d 45 5f  |E_SIG%(1)=(TIME_|
000032d0  53 49 47 25 28 31 29 2d  69 6e 63 25 29 83 34 2b  |SIG%(1)-inc%).4+|
000032e0  32 0d 11 6c 2a 20 20 20  20 24 4e 6f 74 65 56 61  |2..l*    $NoteVa|
000032f0  6c 75 65 25 3d c3 28 31  3c 3c 28 54 49 4d 45 5f  |lue%=.(1<<(TIME_|
00003300  53 49 47 25 28 31 29 2d  31 29 29 0d 11 76 09 20  |SIG%(1)-1))..v. |
00003310  20 20 20 cb 0d 11 80 2a  20 20 e7 20 49 25 3d 30  |   ....*  . I%=0|
00003320  20 84 20 49 25 3d 31 20  f2 55 70 64 61 74 65 49  | . I%=1 .UpdateI|
00003330  63 6f 6e 28 57 25 2c 49  25 2c 30 2c 30 29 0d 11  |con(W%,I%,0,0)..|
00003340  8a 05 cb 0d 11 94 05 cd  0d 11 9e 05 e1 0d 11 a8  |................|
00003350  04 0d 11 b2 1b dd 20 f2  43 68 65 63 6b 49 6e 73  |...... .CheckIns|
00003360  74 61 6c 6c 65 64 56 6f  69 63 65 73 0d 11 bc 2c  |talledVoices...,|
00003370  ea 20 4e 65 77 56 6f 69  63 65 24 2c 20 4e 65 77  |. NewVoice$, New|
00003380  4e 56 6f 69 63 65 73 25  2c 20 63 68 61 6e 67 65  |NVoices%, change|
00003390  64 56 6f 69 63 65 73 25  0d 11 c6 14 63 68 61 6e  |dVoices%....chan|
000033a0  67 65 64 56 6f 69 63 65  73 25 3d a3 0d 11 d0 39  |gedVoices%=....9|
000033b0  c8 99 20 53 6f 75 6e 64  5f 49 6e 73 74 61 6c 6c  |.. Sound_Install|
000033c0  56 6f 69 63 65 20 b8 20  49 24 2c 4e 65 77 4e 56  |Voice . I$,NewNV|
000033d0  6f 69 63 65 73 25 3a 4e  65 77 4e 56 6f 69 63 65  |oices%:NewNVoice|
000033e0  73 25 2d 3d 31 0d 11 da  3c e7 20 a4 61 73 73 65  |s%-=1...<. .asse|
000033f0  72 74 28 4e 56 6f 69 63  65 73 25 3e 30 2c 22 4e  |rt(NVoices%>0,"N|
00003400  6f 20 73 6f 75 6e 64 20  76 6f 69 63 65 73 20 61  |o sound voices a|
00003410  72 65 20 69 6e 73 74 61  6c 6c 65 64 2e 22 29 20  |re installed.") |
00003420  fa 0d 11 e4 71 e7 20 4d  49 44 49 70 72 65 73 65  |....q. MIDIprese|
00003430  6e 74 25 20 4e 65 77 4e  56 6f 69 63 65 73 25 2b  |nt% NewNVoices%+|
00003440  3d 31 3a 56 6f 69 63 65  24 28 4e 65 77 4e 56 6f  |=1:Voice$(NewNVo|
00003450  69 63 65 73 25 29 3d 22  22 3a f4 20 61 6c 6c 6f  |ices%)="":. allo|
00003460  77 20 61 20 4e 55 4c 4c  20 76 6f 69 63 65 20 74  |w a NULL voice t|
00003470  6f 20 70 65 72 6d 69 74  20 6a 75 73 74 20 4d 49  |o permit just MI|
00003480  44 49 20 6f 6e 20 74 68  69 73 20 63 68 61 6e 6e  |DI on this chann|
00003490  65 6c 0d 11 ee 1d e7 20  4e 65 77 4e 56 6f 69 63  |el..... NewNVoic|
000034a0  65 73 25 3c 3e 4e 56 6f  69 63 65 73 25 20 8c 0d  |es%<>NVoices% ..|
000034b0  11 f8 16 20 20 63 68 61  6e 67 65 64 56 6f 69 63  |...  changedVoic|
000034c0  65 73 25 3d b9 0d 12 02  1a 20 20 4e 56 6f 69 63  |es%=.....  NVoic|
000034d0  65 73 25 3d 4e 65 77 4e  56 6f 69 63 65 73 25 0d  |es%=NewNVoices%.|
000034e0  12 0c 07 20 20 cd 0d 12  16 2f e7 20 4e 56 6f 69  |...  ..../. NVoi|
000034f0  63 65 73 25 3e 4d 41 58  5f 56 6f 69 63 65 73 25  |ces%>MAX_Voices%|
00003500  20 4e 56 6f 69 63 65 73  25 3d 4d 41 58 5f 56 6f  | NVoices%=MAX_Vo|
00003510  69 63 65 73 25 0d 12 20  12 e3 52 25 3d 31 b8 4e  |ices%.. ..R%=1.N|
00003520  56 6f 69 63 65 73 25 0d  12 2a 24 e7 20 28 4d 49  |Voices%..*$. (MI|
00003530  44 49 70 72 65 73 65 6e  74 25 20 80 20 52 25 3d  |DIpresent% . R%=|
00003540  4e 56 6f 69 63 65 73 25  29 20 8c 0d 12 34 12 20  |NVoices%) ...4. |
00003550  56 6f 69 63 65 24 28 52  25 29 3d 22 22 0d 12 3e  |Voice$(R%)=""..>|
00003560  05 cc 0d 12 48 2b 20 c8  99 20 53 6f 75 6e 64 5f  |....H+ .. Sound_|
00003570  49 6e 73 74 61 6c 6c 56  6f 69 63 65 2c 30 2c 52  |InstallVoice,0,R|
00003580  25 20 b8 20 4e 65 77 56  6f 69 63 65 24 0d 12 52  |% . NewVoice$..R|
00003590  1e 20 e7 20 4e 65 77 56  6f 69 63 65 24 3c 3e 56  |. . NewVoice$<>V|
000035a0  6f 69 63 65 24 28 52 25  29 20 8c 0d 12 5c 16 20  |oice$(R%) ...\. |
000035b0  20 63 68 61 6e 67 65 64  56 6f 69 63 65 73 25 3d  | changedVoices%=|
000035c0  b9 0d 12 66 1a 20 20 56  6f 69 63 65 24 28 52 25  |...f.  Voice$(R%|
000035d0  29 3d 4e 65 77 56 6f 69  63 65 24 0d 12 70 07 20  |)=NewVoice$..p. |
000035e0  20 cd 0d 12 7a 06 20 cd  0d 12 84 28 ed 3a f4 20  | ...z. ....(.:. |
000035f0  66 69 6e 64 20 69 66 20  69 6e 73 74 72 75 6d 65  |find if instrume|
00003600  6e 74 73 20 68 61 76 65  20 63 68 61 6e 67 65 64  |nts have changed|
00003610  0d 12 8e 18 e7 20 ac 20  63 68 61 6e 67 65 64 56  |..... . changedV|
00003620  6f 69 63 65 73 25 20 e1  0d 12 98 0b e3 52 25 3d  |oices% ......R%=|
00003630  30 b8 37 0d 12 a2 27 c8  99 20 53 6f 75 6e 64 5f  |0.7...'.. Sound_|
00003640  41 74 74 61 63 68 56 6f  69 63 65 2c 52 25 2b 31  |AttachVoice,R%+1|
00003650  2c 30 20 b8 20 4c 25 2c  53 25 0d 12 ac 4a e7 53  |,0 . L%,S%...J.S|
00003660  25 3c 31 84 53 25 3e 4e  56 6f 69 63 65 73 25 20  |%<1.S%>NVoices% |
00003670  53 25 3d 31 3a f4 20 4d  61 6b 65 20 73 75 72 65  |S%=1:. Make sure|
00003680  20 61 20 76 6f 69 63 65  20 69 73 20 61 74 74 61  | a voice is atta|
00003690  63 68 65 64 20 74 6f 20  61 6c 6c 20 63 68 61 6e  |ched to all chan|
000036a0  6e 65 6c 73 0d 12 b6 1e  c8 99 20 53 6f 75 6e 64  |nels...... Sound|
000036b0  5f 41 74 74 61 63 68 56  6f 69 63 65 2c 4c 25 2c  |_AttachVoice,L%,|
000036c0  53 25 0d 12 c0 33 49 6e  73 74 72 75 6d 65 6e 74  |S%...3Instrument|
000036d0  25 28 52 25 2c 30 29 3d  53 5f 43 25 28 52 25 29  |%(R%,0)=S_C%(R%)|
000036e0  2b 31 3a f4 20 49 6e 73  74 72 75 6d 65 6e 74 20  |+1:. Instrument |
000036f0  73 74 61 76 65 0d 12 ca  2b 49 6e 73 74 72 75 6d  |stave...+Instrum|
00003700  65 6e 74 25 28 52 25 2c  31 29 3d 53 25 3a f4 20  |ent%(R%,1)=S%:. |
00003710  49 6e 73 74 72 75 6d 65  6e 74 20 76 6f 69 63 65  |Instrument voice|
00003720  0d 12 d4 2f 24 28 56 6f  69 63 65 53 74 72 25 28  |.../$(VoiceStr%(|
00003730  52 25 29 29 20 3d 20 c0  56 6f 69 63 65 24 28 53  |R%)) = .Voice$(S|
00003740  25 29 2c 20 56 6f 69 63  65 53 69 7a 65 25 29 0d  |%), VoiceSize%).|
00003750  12 de 28 f2 55 70 64 61  74 65 49 63 6f 6e 28 49  |..(.UpdateIcon(I|
00003760  6e 73 74 72 57 69 6e 64  5f 68 25 2c 20 52 25 2b  |nstrWind_h%, R%+|
00003770  38 2c 20 30 2c 30 29 0d  12 e8 23 ed 3a f4 20 47  |8, 0,0)...#.:. G|
00003780  65 74 20 64 65 74 61 69  6c 73 20 6f 66 20 65 61  |et details of ea|
00003790  63 68 20 63 68 61 6e 6e  65 6c 0d 12 f2 17 f2 53  |ch channel.....S|
000037a0  65 74 44 65 66 61 75 6c  74 43 68 61 6e 6e 65 6c  |etDefaultChannel|
000037b0  73 0d 12 fc 05 e1 0d 13  06 04 0d 13 10 47 dd 20  |s............G. |
000037c0  a4 41 74 74 61 63 68 56  6f 69 63 65 28 63 68 61  |.AttachVoice(cha|
000037d0  6e 25 2c 69 6e 63 25 29  20 3a f4 20 69 6e 63 25  |n%,inc%) :. inc%|
000037e0  20 69 73 20 2b 31 20 6f  72 20 2d 31 20 6f 72 20  | is +1 or -1 or |
000037f0  30 20 74 6f 20 66 69 6e  64 20 6e 65 61 72 65 73  |0 to find neares|
00003800  74 0d 13 1a 14 ea 20 73  74 6f 70 25 2c 76 25 2c  |t..... stop%,v%,|
00003810  70 65 72 63 25 0d 13 24  19 f2 43 68 65 63 6b 49  |perc%..$..CheckI|
00003820  6e 73 74 61 6c 6c 65 64  56 6f 69 63 65 73 0d 13  |nstalledVoices..|
00003830  2e 36 e7 20 4e 56 6f 69  63 65 73 25 3c 32 20 c8  |.6. NVoices%<2 .|
00003840  99 20 53 6f 75 6e 64 5f  41 74 74 61 63 68 56 6f  |. Sound_AttachVo|
00003850  69 63 65 2c 20 63 68 61  6e 25 2b 31 2c 20 31 20  |ice, chan%+1, 1 |
00003860  3a 20 3d 31 0d 13 38 65  f4 20 61 74 74 61 63 68  |: =1..8e. attach|
00003870  20 6e 65 78 74 20 76 6f  69 63 65 20 74 6f 20 63  | next voice to c|
00003880  68 61 6e 6e 65 6c 2e 20  41 74 74 61 63 68 20 70  |hannel. Attach p|
00003890  65 72 63 75 73 73 69 6f  6e 20 76 6f 69 63 65 20  |ercussion voice |
000038a0  6f 6e 6c 79 20 6f 6e 20  70 65 72 63 20 6c 69 6e  |only on perc lin|
000038b0  65 2c 20 61 6e 64 20 6e  6f 74 20 6f 6e 20 73 74  |e, and not on st|
000038c0  61 76 65 20 6c 69 6e 65  73 0d 13 42 47 70 65 72  |ave lines..BGper|
000038d0  63 25 3d 28 a7 24 53 74  61 76 65 53 74 72 25 28  |c%=(.$StaveStr%(|
000038e0  63 68 61 6e 25 29 2c 22  70 65 72 63 22 29 3e 30  |chan%),"perc")>0|
000038f0  29 20 3a f4 20 69 73 20  69 74 20 61 20 70 65 72  |) :. is it a per|
00003900  63 75 73 73 69 6f 6e 20  63 68 61 6e 6e 65 6c 3f  |cussion channel?|
00003910  0d 13 4c 28 c8 99 20 53  6f 75 6e 64 5f 41 74 74  |..L(.. Sound_Att|
00003920  61 63 68 56 6f 69 63 65  2c 20 63 68 61 6e 25 2b  |achVoice, chan%+|
00003930  31 20 b8 20 2c 20 76 25  0d 13 56 0f e7 20 76 25  |1 . , v%..V.. v%|
00003940  3d 30 20 76 25 3d 31 0d  13 60 34 c8 99 20 53 6f  |=0 v%=1..`4.. So|
00003950  75 6e 64 5f 41 74 74 61  63 68 56 6f 69 63 65 2c  |und_AttachVoice,|
00003960  20 63 68 61 6e 25 2b 31  2c 20 76 25 20 20 3a f4  | chan%+1, v%  :.|
00003970  20 72 65 73 74 6f 72 65  20 69 74 0d 13 6a 36 f4  | restore it..j6.|
00003980  20 63 68 65 63 6b 20 69  66 20 63 75 72 72 65 6e  | check if curren|
00003990  74 20 76 6f 69 63 65 20  69 73 20 76 61 6c 69 64  |t voice is valid|
000039a0  20 66 6f 72 20 74 68 69  73 20 63 68 61 6e 6e 65  | for this channe|
000039b0  6c 0d 13 74 38 e7 20 69  6e 63 25 3d 30 20 8c 20  |l..t8. inc%=0 . |
000039c0  e7 20 28 70 65 72 63 25  20 3d 20 28 a7 56 6f 69  |. (perc% = (.Voi|
000039d0  63 65 24 28 76 25 29 2c  22 50 65 72 63 22 29 3e  |ce$(v%),"Perc")>|
000039e0  30 29 29 20 8c 20 3d 76  25 0d 13 7e 1c f4 20 69  |0)) . =v%..~.. i|
000039f0  6e 63 20 6f 72 20 64 65  63 20 75 6e 74 69 6c 20  |nc or dec until |
00003a00  66 6f 75 6e 64 0d 13 88  19 e7 20 94 28 69 6e 63  |found..... .(inc|
00003a10  25 29 3c 3e 31 20 8c 20  69 6e 63 25 3d 31 0d 13  |%)<>1 . inc%=1..|
00003a20  92 0c 73 74 6f 70 25 3d  76 25 0d 13 9c 05 f5 0d  |..stop%=v%......|
00003a30  13 a6 36 20 76 25 2b 3d  69 6e 63 25 20 3a 20 e7  |..6 v%+=inc% : .|
00003a40  20 76 25 3e 4e 56 6f 69  63 65 73 25 20 76 25 3d  | v%>NVoices% v%=|
00003a50  31 20 8b e7 20 76 25 3c  31 20 76 25 3d 4e 56 6f  |1 .. v%<1 v%=NVo|
00003a60  69 63 65 73 25 0d 13 b0  62 20 e7 20 4d 49 44 49  |ices%...b . MIDI|
00003a70  70 72 65 73 65 6e 74 25  20 80 20 56 6f 69 63 65  |present% . Voice|
00003a80  24 28 76 25 29 3d 22 22  20 73 74 6f 70 25 3d 76  |$(v%)="" stop%=v|
00003a90  25 20 3a f4 20 70 65 72  6d 69 74 20 4e 55 4c 4c  |% :. permit NULL|
00003aa0  20 76 6f 69 63 65 20 6f  6e 20 61 6e 79 20 63 68  | voice on any ch|
00003ab0  61 6e 6e 65 6c 20 69 66  20 4d 49 44 49 20 69 6e  |annel if MIDI in|
00003ac0  73 74 61 6c 6c 65 64 0d  13 ba 33 20 fd 20 28 70  |stalled...3 . (p|
00003ad0  65 72 63 25 20 3d 20 28  a7 56 6f 69 63 65 24 28  |erc% = (.Voice$(|
00003ae0  76 25 29 2c 22 50 65 72  63 22 29 3e 30 29 29 20  |v%),"Perc")>0)) |
00003af0  84 20 73 74 6f 70 25 3d  76 25 0d 13 c4 07 3d 76  |. stop%=v%....=v|
00003b00  25 0d 13 ce 04 0d 13 d8  24 dd 20 f2 55 70 64 61  |%.......$. .Upda|
00003b10  74 65 49 63 6f 6e 28 57  25 2c 20 49 25 2c 20 73  |teIcon(W%, I%, s|
00003b20  74 25 2c 20 6d 73 6b 25  29 0d 13 e2 20 57 69 6e  |t%, msk%)... Win|
00003b30  64 6f 77 25 21 68 61 6e  64 6c 65 25 3d 57 25 3a  |dow%!handle%=W%:|
00003b40  21 49 63 6f 6e 25 3d 49  25 0d 13 ec 23 49 63 6f  |!Icon%=I%...#Ico|
00003b50  6e 25 21 73 74 61 74 65  3d 73 74 25 3a 49 63 6f  |n%!state=st%:Ico|
00003b60  6e 25 21 6d 61 73 6b 3d  6d 73 6b 25 0d 13 f6 3a  |n%!mask=msk%...:|
00003b70  c8 99 20 53 65 74 49 63  6f 6e 53 74 61 74 65 25  |.. SetIconState%|
00003b80  2c 2c 57 69 6e 64 6f 77  25 2b 68 61 6e 64 6c 65  |,,Window%+handle|
00003b90  25 20 3a 20 f4 20 75 70  64 61 74 65 20 69 63 6f  |% : . update ico|
00003ba0  6e 20 74 65 78 74 0d 14  00 05 e1 0d 14 0a 04 0d  |n text..........|
00003bb0  14 14 12 dd 20 f2 55 73  65 72 44 72 61 67 42 6f  |.... .UserDragBo|
00003bc0  78 0d 14 1e 0b ea 20 62  6c 6f 63 6b 0d 14 28 0f  |x..... block..(.|
00003bd0  44 52 41 47 47 49 4e 47  25 3d a3 0d 14 32 25 62  |DRAGGING%=...2%b|
00003be0  6c 6f 63 6b 3d 57 69 6e  64 6f 77 25 20 3a f4 20  |lock=Window% :. |
00003bf0  74 65 6d 70 6f 72 61 72  79 20 62 75 66 66 65 72  |temporary buffer|
00003c00  0d 14 3c 0f e7 20 53 41  56 49 4e 47 25 20 8c 0d  |..<.. SAVING% ..|
00003c10  14 46 20 20 20 c8 99 20  47 65 74 50 6f 69 6e 74  |.F   .. GetPoint|
00003c20  65 72 49 6e 66 6f 25 2c  20 2c 62 6c 6f 63 6b 0d  |erInfo%, ,block.|
00003c30  14 50 16 20 20 62 6c 6f  63 6b 21 33 32 3d 62 6c  |.P.  block!32=bl|
00003c40  6f 63 6b 21 34 0d 14 5a  15 20 20 62 6c 6f 63 6b  |ock!4..Z.  block|
00003c50  21 32 38 3d 21 62 6c 6f  63 6b 0d 14 64 17 20 20  |!28=!block..d.  |
00003c60  62 6c 6f 63 6b 21 32 34  3d 62 6c 6f 63 6b 21 31  |block!24=block!1|
00003c70  36 0d 14 6e 42 20 20 62  6c 6f 63 6b 21 32 30 3d  |6..nB  block!20=|
00003c80  62 6c 6f 63 6b 21 31 32  20 3a 20 f4 20 74 68 69  |block!12 : . thi|
00003c90  73 20 69 73 20 74 68 65  20 64 65 73 74 69 6e 61  |s is the destina|
00003ca0  74 69 6f 6e 20 77 69 6e  64 6f 77 20 68 61 6e 64  |tion window hand|
00003cb0  6c 65 25 0d 14 78 24 20  20 62 6c 6f 63 6b 21 31  |le%..x$  block!1|
00003cc0  36 3d 31 20 20 20 20 20  20 20 20 3a 20 f4 20 44  |6=1        : . D|
00003cd0  61 74 61 53 61 76 65 0d  14 82 10 20 20 62 6c 6f  |ataSave....  blo|
00003ce0  63 6b 21 31 32 3d 30 0d  14 8c 29 20 20 62 6c 6f  |ck!12=0...)  blo|
00003cf0  63 6b 21 33 36 3d 30 20  20 3a f4 20 64 6f 6e 27  |ck!36=0  :. don'|
00003d00  74 20 6b 6e 6f 77 20 66  69 6c 65 20 73 69 7a 65  |t know file size|
00003d10  0d 14 96 1d 20 20 62 6c  6f 63 6b 21 34 30 3d 4d  |....  block!40=M|
00003d20  75 73 69 63 46 69 6c 65  54 79 70 65 25 0d 14 a0  |usicFileType%...|
00003d30  28 20 20 24 28 62 6c 6f  63 6b 2b 34 34 29 3d a4  |(  $(block+44)=.|
00003d40  47 65 74 4c 65 61 66 4e  61 6d 65 28 53 61 76 65  |GetLeafName(Save|
00003d50  54 65 78 74 29 0d 14 aa  11 20 20 21 62 6c 6f 63  |Text)....  !bloc|
00003d60  6b 20 3d 20 36 30 0d 14  b4 29 20 20 c8 99 20 53  |k = 60...)  .. S|
00003d70  65 6e 64 4d 65 73 73 61  67 65 2c 20 31 37 2c 20  |endMessage, 17, |
00003d80  62 6c 6f 63 6b 2c 20 62  6c 6f 63 6b 21 32 30 0d  |block, block!20.|
00003d90  14 be 07 20 20 cd 0d 14  c8 05 e1 0d 14 d2 04 0d  |...  ...........|
00003da0  14 dc 48 dd 20 a4 53 65  74 42 69 74 28 74 65 73  |..H. .SetBit(tes|
00003db0  74 2c 20 77 6f 72 64 2c  20 62 69 74 6e 75 6d 29  |t, word, bitnum)|
00003dc0  20 3a 20 f4 20 73 65 74  20 6f 72 20 63 6c 65 61  | : . set or clea|
00003dd0  72 20 62 69 74 20 64 65  70 65 6e 64 69 6e 67 20  |r bit depending |
00003de0  6f 6e 20 74 65 73 74 0d  14 e6 0c e7 20 74 65 73  |on test..... tes|
00003df0  74 20 8c 0d 14 f0 1a 20  20 3d 20 77 6f 72 64 20  |t .....  = word |
00003e00  84 20 28 31 3c 3c 62 69  74 6e 75 6d 29 0d 14 fa  |. (1<<bitnum)...|
00003e10  05 cc 0d 15 04 1c 20 20  3d 20 77 6f 72 64 20 80  |......  = word .|
00003e20  20 ac 20 28 31 3c 3c 62  69 74 6e 75 6d 29 0d 15  | . (1<<bitnum)..|
00003e30  0e 05 cd 0d 15 18 04 0d  15 22 11 dd 20 f2 4d 65  |.........".. .Me|
00003e40  6e 75 53 65 6c 65 63 74  0d 15 2c 2a ea 20 69 74  |nuSelect..,*. it|
00003e50  65 6d 25 2c 20 6e 2c 20  73 65 6c 65 63 74 69 6f  |em%, n, selectio|
00003e60  6e 2c 20 53 6f 75 6e 64  45 6e 61 62 6c 65 25 2c  |n, SoundEnable%,|
00003e70  46 24 0d 15 36 1d 73 65  6c 65 63 74 69 6f 6e 3d  |F$..6.selection=|
00003e80  57 69 6e 64 6f 77 25 2b  68 61 6e 64 6c 65 25 0d  |Window%+handle%.|
00003e90  15 40 37 c8 99 20 44 65  63 6f 64 65 4d 65 6e 75  |.@7.. DecodeMenu|
00003ea0  2c 20 2c 43 75 72 72 65  6e 74 4d 65 6e 75 25 2c  |, ,CurrentMenu%,|
00003eb0  20 73 65 6c 65 63 74 69  6f 6e 2c 20 4d 65 6e 75  | selection, Menu|
00003ec0  53 74 72 69 6e 67 0d 15  4a 2b c8 8e 20 c0 24 4d  |String..J+.. .$M|
00003ed0  65 6e 75 53 74 72 69 6e  67 2c a7 24 4d 65 6e 75  |enuString,.$Menu|
00003ee0  53 74 72 69 6e 67 2c 20  22 2e 22 29 2d 31 29 20  |String, ".")-1) |
00003ef0  ca 0d 15 54 0e 20 20 c9  20 22 53 61 76 65 22 0d  |...T.  . "Save".|
00003f00  15 5e 1b 20 20 20 46 24  3d a4 47 65 74 53 74 72  |.^.   F$=.GetStr|
00003f10  28 53 61 76 65 54 65 78  74 29 0d 15 68 26 20 20  |(SaveText)..h&  |
00003f20  20 e7 20 28 20 a7 46 24  2c 22 2e 22 29 3d 30 20  | . ( .F$,".")=0 |
00003f30  80 20 a7 46 24 2c 22 3a  22 29 3d 30 20 29 20 8c  |. .F$,":")=0 ) .|
00003f40  0d 15 72 30 20 20 20 20  f2 4f 70 65 6e 57 69 6e  |..r0    .OpenWin|
00003f50  64 6f 77 28 53 61 76 65  5f 68 25 2c 20 4d 6f 75  |dow(Save_h%, Mou|
00003f60  73 65 5f 58 25 2c 20 4d  6f 75 73 65 5f 59 25 29  |se_X%, Mouse_Y%)|
00003f70  0d 15 7c 08 20 20 20 cc  0d 15 86 17 20 20 20 20  |..|.   .....    |
00003f80  f2 73 61 76 65 5f 6d 75  73 69 63 28 46 24 29 0d  |.save_music(F$).|
00003f90  15 90 08 20 20 20 cd 0d  15 9a 10 20 20 c9 20 22  |...   .....  . "|
00003fa0  53 74 61 76 65 73 22 0d  15 a4 18 20 20 20 c8 99  |Staves"....   ..|
00003fb0  20 22 48 6f 75 72 67 6c  61 73 73 5f 4f 6e 22 0d  | "Hourglass_On".|
00003fc0  15 ae 29 20 20 20 e7 20  c0 24 53 74 61 76 65 4e  |..)   . .$StaveN|
00003fd0  75 6d 25 2c 31 29 3d 22  22 20 24 53 74 61 76 65  |um%,1)="" $Stave|
00003fe0  4e 75 6d 25 3d 22 31 22  0d 15 b8 21 20 20 20 53  |Num%="1"...!   S|
00003ff0  54 41 56 45 25 3d bb 28  c0 24 53 74 61 76 65 4e  |TAVE%=.(.$StaveN|
00004000  75 6d 25 2c 31 29 29 2d  31 0d 15 c2 22 20 20 20  |um%,1))-1..."   |
00004010  e7 20 a7 24 4d 65 6e 75  53 74 72 69 6e 67 2c 22  |. .$MenuString,"|
00004020  2b 70 65 72 63 22 2c 36  29 20 8c 0d 15 cc 23 20  |+perc",6) ....# |
00004030  20 20 20 e7 20 50 45 52  43 25 3d 31 20 50 45 52  |   . PERC%=1 PER|
00004040  43 25 3d 30 20 8b 20 50  45 52 43 25 3d 31 0d 15  |C%=0 . PERC%=1..|
00004050  d6 09 20 20 20 20 cd 0d  15 e0 37 20 20 20 69 74  |..    ....7   it|
00004060  65 6d 25 20 3d 20 a4 46  69 6e 64 4d 65 6e 75 49  |em% = .FindMenuI|
00004070  74 65 6d 28 22 2b 70 65  72 63 75 73 73 69 6f 6e  |tem("+percussion|
00004080  22 2c 20 53 74 61 76 65  4d 65 6e 75 25 29 0d 15  |", StaveMenu%)..|
00004090  ea 4c 20 20 20 e7 20 28  69 74 65 6d 25 3e 3d 30  |.L   . (item%>=0|
000040a0  29 20 21 69 74 65 6d 25  20 3d 20 a4 53 65 74 42  |) !item% = .SetB|
000040b0  69 74 28 50 45 52 43 25  3d 31 2c 20 21 69 74 65  |it(PERC%=1, !ite|
000040c0  6d 25 2c 20 30 29 3a f4  20 73 65 74 20 6f 72 20  |m%, 0):. set or |
000040d0  63 6c 65 61 72 20 74 69  63 6b 0d 15 f4 13 20 20  |clear tick....  |
000040e0  20 f2 73 65 74 75 70 5f  73 63 6f 72 65 0d 15 fe  | .setup_score...|
000040f0  13 20 20 20 f2 73 74 61  72 74 5f 6d 75 73 69 63  |.   .start_music|
00004100  0d 16 08 12 20 20 20 f2  72 65 73 63 6f 72 65 28  |....   .rescore(|
00004110  30 29 0d 16 12 19 20 20  20 c8 99 20 22 48 6f 75  |0)....   .. "Hou|
00004120  72 67 6c 61 73 73 5f 4f  66 66 22 0d 16 1c 43 20  |rglass_Off"...C |
00004130  20 c9 20 22 49 6e 73 74  72 75 6d 65 6e 74 73 22  | . "Instruments"|
00004140  20 3a 20 f2 4f 70 65 6e  57 69 6e 64 6f 77 28 49  | : .OpenWindow(I|
00004150  6e 73 74 72 57 69 6e 64  5f 68 25 2c 4d 6f 75 73  |nstrWind_h%,Mous|
00004160  65 5f 58 25 2c 4d 6f 75  73 65 5f 59 25 29 0d 16  |e_X%,Mouse_Y%)..|
00004170  26 10 20 20 c9 20 22 56  6f 6c 75 6d 65 22 0d 16  |&.  . "Volume"..|
00004180  30 1a 20 20 20 20 e7 20  73 65 6c 65 63 74 69 6f  |0.    . selectio|
00004190  6e 21 34 3e 3d 30 20 8c  0d 16 3a 21 20 20 20 20  |n!4>=0 ...:!    |
000041a0  20 20 f2 53 65 74 56 6f  6c 75 6d 65 28 73 65 6c  |  .SetVolume(sel|
000041b0  65 63 74 69 6f 6e 21 34  29 0d 16 44 30 20 20 20  |ection!4)..D0   |
000041c0  20 20 20 f2 53 65 74 4d  65 6e 75 54 69 63 6b 28  |   .SetMenuTick(|
000041d0  56 6f 6c 75 6d 65 4d 65  6e 75 25 2c 20 73 65 6c  |VolumeMenu%, sel|
000041e0  65 63 74 69 6f 6e 21 34  29 0d 16 4e 0b 20 20 20  |ection!4)..N.   |
000041f0  20 20 20 cd 0d 16 58 0f  20 20 c9 20 22 54 65 6d  |   ...X.  . "Tem|
00004200  70 6f 22 0d 16 62 1a 20  20 20 20 e7 20 73 65 6c  |po"..b.    . sel|
00004210  65 63 74 69 6f 6e 21 34  3e 3d 30 20 8c 0d 16 6c  |ection!4>=0 ...l|
00004220  20 20 20 20 20 20 20 f2  53 65 74 54 65 6d 70 6f  |       .SetTempo|
00004230  28 73 65 6c 65 63 74 69  6f 6e 21 34 29 0d 16 76  |(selection!4)..v|
00004240  2f 20 20 20 20 20 20 f2  53 65 74 4d 65 6e 75 54  |/      .SetMenuT|
00004250  69 63 6b 28 54 65 6d 70  6f 4d 65 6e 75 25 2c 20  |ick(TempoMenu%, |
00004260  73 65 6c 65 63 74 69 6f  6e 21 34 29 0d 16 80 0b  |selection!4)....|
00004270  20 20 20 20 20 20 cd 0d  16 8a 32 20 20 c9 20 22  |      ....2  . "|
00004280  54 69 6d 65 20 73 69 67  22 20 3a 20 54 49 4d 45  |Time sig" : TIME|
00004290  5f 53 49 47 25 28 30 29  3d bb 28 24 42 61 72 4c  |_SIG%(0)=.($BarL|
000042a0  65 6e 67 74 68 25 29 2d  31 0d 16 94 11 20 20 c9  |ength%)-1....  .|
000042b0  20 22 4b 65 79 20 73 69  67 22 0d 16 9e 1a 20 20  | "Key sig"....  |
000042c0  20 20 e7 20 73 65 6c 65  63 74 69 6f 6e 21 34 3e  |  . selection!4>|
000042d0  3d 30 20 8c 0d 16 a8 2b  20 20 20 20 20 4b 45 59  |=0 ....+     KEY|
000042e0  5f 53 49 47 25 28 30 29  20 3d 20 28 28 73 65 6c  |_SIG%(0) = ((sel|
000042f0  65 63 74 69 6f 6e 21 38  29 3e 3d 37 29 2b 31 0d  |ection!8)>=7)+1.|
00004300  16 b2 29 20 20 20 20 20  4b 45 59 5f 53 49 47 25  |..)     KEY_SIG%|
00004310  28 31 29 20 3d 20 94 28  28 73 65 6c 65 63 74 69  |(1) = .((selecti|
00004320  6f 6e 21 38 29 2d 37 29  0d 16 bc 2e 20 20 20 20  |on!8)-7)....    |
00004330  20 f2 53 65 74 4d 65 6e  75 54 69 63 6b 28 4d 61  | .SetMenuTick(Ma|
00004340  6a 6f 72 4d 65 6e 75 25  2c 20 73 65 6c 65 63 74  |jorMenu%, select|
00004350  69 6f 6e 21 38 29 0d 16  c6 2e 20 20 20 20 20 f2  |ion!8)....     .|
00004360  53 65 74 4d 65 6e 75 54  69 63 6b 28 4d 69 6e 6f  |SetMenuTick(Mino|
00004370  72 4d 65 6e 75 25 2c 20  73 65 6c 65 63 74 69 6f  |rMenu%, selectio|
00004380  6e 21 38 29 0d 16 d0 86  20 20 20 20 20 e7 20 4b  |n!8)....     . K|
00004390  45 59 5f 53 49 47 25 28  31 29 20 6e 3d 61 63 63  |EY_SIG%(1) n=acc|
000043a0  69 64 65 6e 74 61 6c 25  2b 32 2b 4b 45 59 5f 53  |idental%+2+KEY_S|
000043b0  49 47 25 28 30 29 20 3a  20 58 25 28 6b 65 79 25  |IG%(0) : X%(key%|
000043c0  29 3d 28 78 25 28 6e 29  2b 58 25 28 6e 29 29 2a  |)=(x%(n)+X%(n))*|
000043d0  4b 45 59 5f 53 49 47 25  28 31 29 20 8b 20 58 25  |KEY_SIG%(1) . X%|
000043e0  28 6b 65 79 25 29 3d 78  25 28 61 63 63 69 64 65  |(key%)=x%(accide|
000043f0  6e 74 61 6c 25 2b 32 29  2b 58 25 28 61 63 63 69  |ntal%+2)+X%(acci|
00004400  64 65 6e 74 61 6c 25 2b  32 29 0d 16 da 0a 20 20  |dental%+2)....  |
00004410  20 20 20 cd 0d 16 e4 0e  20 20 c9 20 22 50 6c 61  |   .....  . "Pla|
00004420  79 22 0d 16 ee 6a 20 20  20 20 c8 99 20 53 6f 75  |y"...j    .. Sou|
00004430  6e 64 5f 45 6e 61 62 6c  65 2c 30 20 b8 20 53 6f  |nd_Enable,0 . So|
00004440  75 6e 64 45 6e 61 62 6c  65 25 3a f4 20 64 6f 6e  |undEnable%:. don|
00004450  74 20 70 72 65 74 65 6e  64 20 74 6f 20 62 65 20  |t pretend to be |
00004460  61 62 6c 65 20 74 6f 20  70 6c 61 79 20 69 66 20  |able to play if |
00004470  74 68 65 20 73 6f 75 6e  64 20 73 79 73 74 65 6d  |the sound system|
00004480  20 69 73 20 64 69 73 61  62 6c 65 64 0d 16 f8 1a  | is disabled....|
00004490  20 20 20 20 e7 20 53 6f  75 6e 64 45 6e 61 62 6c  |    . SoundEnabl|
000044a0  65 25 3d 32 20 8c 0d 17  02 13 20 20 20 20 20 53  |e%=2 .....     S|
000044b0  43 4f 52 49 4e 47 25 3d  a3 0d 17 0c 1c 20 20 20  |CORING%=.....   |
000044c0  20 20 50 4c 41 59 49 4e  47 25 3d ac 20 50 4c 41  |  PLAYING%=. PLA|
000044d0  59 49 4e 47 25 0d 17 16  1c 20 20 20 20 20 53 43  |YING%....     SC|
000044e0  52 4f 4c 4c 49 4e 47 25  3d 50 4c 41 59 49 4e 47  |ROLLING%=PLAYING|
000044f0  25 0d 17 20 2c 20 20 20  20 20 e7 20 50 4c 41 59  |%.. ,     . PLAY|
00004500  49 4e 47 25 20 f2 70 6c  61 79 5f 73 74 61 72 74  |ING% .play_start|
00004510  20 8b 20 f2 70 6c 61 79  5f 73 74 6f 70 0d 17 2a  | . .play_stop..*|
00004520  40 20 20 20 20 cc 20 6e  3d a4 43 68 65 63 6b 4f  |@    . n=.CheckO|
00004530  4b 28 22 53 6f 75 6e 64  20 69 73 20 6e 6f 74 20  |K("Sound is not |
00004540  65 6e 61 62 6c 65 64 2e  20 59 6f 75 20 63 61 6e  |enabled. You can|
00004550  6e 6f 74 20 70 6c 61 79  22 2c 20 31 29 0d 17 34  |not play", 1)..4|
00004560  0a 20 20 20 20 20 cd 0d  17 3e 0f 20 20 c9 20 22  |.     ...>.  . "|
00004570  43 6c 65 61 72 22 0d 17  48 4d 20 20 20 20 e7 20  |Clear"..HM    . |
00004580  43 48 41 4e 47 45 44 25  20 e7 20 ac 20 a4 43 68  |CHANGED% . . .Ch|
00004590  65 63 6b 4f 4b 28 22 41  72 65 20 79 6f 75 20 73  |eckOK("Are you s|
000045a0  75 72 65 3f 20 43 75 72  72 65 6e 74 20 6d 75 73  |ure? Current mus|
000045b0  69 63 20 69 73 20 75 6e  73 61 76 65 64 22 2c 33  |ic is unsaved",3|
000045c0  29 20 e1 0d 17 52 16 20  20 20 20 f2 43 6c 65 61  |) ...R.    .Clea|
000045d0  72 41 6c 6c 4d 75 73 69  63 0d 17 5c 24 20 20 20  |rAllMusic..\$   |
000045e0  20 57 69 6e 64 6f 77 25  21 68 61 6e 64 6c 65 25  | Window%!handle%|
000045f0  3d 53 63 6f 72 65 57 69  6e 64 5f 68 25 0d 17 66  |=ScoreWind_h%..f|
00004600  2b 20 20 20 20 c8 99 20  47 65 74 57 69 6e 64 6f  |+    .. GetWindo|
00004610  77 53 74 61 74 65 25 2c  2c 57 69 6e 64 6f 77 25  |wState%,,Window%|
00004620  2b 68 61 6e 64 6c 65 25  0d 17 70 16 20 20 20 20  |+handle%..p.    |
00004630  57 69 6e 64 6f 77 25 21  73 63 78 25 3d 30 0d 17  |Window%!scx%=0..|
00004640  7a 10 20 20 20 20 4c 48  42 41 52 25 3d 30 0d 17  |z.    LHBAR%=0..|
00004650  84 27 20 20 20 20 c8 99  20 4f 70 65 6e 57 69 6e  |.'    .. OpenWin|
00004660  64 6f 77 25 2c 2c 57 69  6e 64 6f 77 25 2b 68 61  |dow%,,Window%+ha|
00004670  6e 64 6c 65 25 0d 17 8e  2e 20 20 20 20 c8 99 20  |ndle%....    .. |
00004680  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 25 2c  |GetWindowState%,|
00004690  2c 53 63 6f 72 65 57 42  6c 6b 25 2b 68 61 6e 64  |,ScoreWBlk%+hand|
000046a0  6c 65 25 0d 17 98 3d 20  20 c9 20 22 49 6e 66 6f  |le%...=  . "Info|
000046b0  22 20 3a 20 f2 4f 70 65  6e 57 69 6e 64 6f 77 28  |" : .OpenWindow(|
000046c0  50 72 6f 67 49 6e 66 6f  5f 68 25 2c 20 4d 6f 75  |ProgInfo_h%, Mou|
000046d0  73 65 5f 58 25 2c 20 4d  6f 75 73 65 5f 59 25 29  |se_X%, Mouse_Y%)|
000046e0  0d 17 a2 4c 20 20 c9 20  22 51 75 69 74 22 20 3a  |...L  . "Quit" :|
000046f0  20 e7 20 43 48 41 4e 47  45 44 25 20 f2 4f 70 65  | . CHANGED% .Ope|
00004700  6e 41 62 6f 72 74 51 75  65 72 79 28 4d 6f 75 73  |nAbortQuery(Mous|
00004710  65 5f 58 25 2c 20 4d 6f  75 73 65 5f 59 25 29 20  |e_X%, Mouse_Y%) |
00004720  8b 20 f2 74 65 72 6d 69  6e 61 74 65 0d 17 ac 0e  |. .terminate....|
00004730  20 20 c9 20 22 47 6f 74  6f 22 0d 17 b6 24 20 20  |  . "Goto"...$  |
00004740  20 20 57 69 6e 64 6f 77  25 21 68 61 6e 64 6c 65  |  Window%!handle|
00004750  25 3d 53 63 6f 72 65 57  69 6e 64 5f 68 25 0d 17  |%=ScoreWind_h%..|
00004760  c0 2b 20 20 20 20 c8 99  20 47 65 74 57 69 6e 64  |.+    .. GetWind|
00004770  6f 77 53 74 61 74 65 25  2c 2c 57 69 6e 64 6f 77  |owState%,,Window|
00004780  25 2b 68 61 6e 64 6c 65  25 0d 17 ca 16 20 20 20  |%+handle%....   |
00004790  20 57 69 6e 64 6f 77 25  21 73 63 78 25 3d 30 0d  | Window%!scx%=0.|
000047a0  17 d4 3b 20 20 20 20 c8  99 20 4f 70 65 6e 57 69  |..;    .. OpenWi|
000047b0  6e 64 6f 77 25 2c 2c 57  69 6e 64 6f 77 25 2b 68  |ndow%,,Window%+h|
000047c0  61 6e 64 6c 65 25 20 3a  20 f4 20 73 65 74 20 73  |andle% : . set s|
000047d0  63 72 6f 6c 6c 20 74 6f  20 30 0d 17 de 2e 20 20  |croll to 0....  |
000047e0  20 20 c8 99 20 47 65 74  57 69 6e 64 6f 77 53 74  |  .. GetWindowSt|
000047f0  61 74 65 25 2c 2c 53 63  6f 72 65 57 42 6c 6b 25  |ate%,,ScoreWBlk%|
00004800  2b 68 61 6e 64 6c 65 25  0d 17 e8 3c 20 20 20 20  |+handle%...<    |
00004810  4c 48 42 41 52 25 3d 30  20 3a f4 20 74 68 65 20  |LHBAR%=0 :. the |
00004820  62 61 72 20 6e 75 6d 62  65 72 20 61 74 20 74 68  |bar number at th|
00004830  65 20 6c 65 66 74 20 6f  66 20 74 68 65 20 77 69  |e left of the wi|
00004840  6e 64 6f 77 0d 17 f2 07  20 20 cb 0d 17 fc 22 20  |ndow....  ...." |
00004850  20 e7 20 28 43 75 72 72  65 6e 74 4d 65 6e 75 25  | . (CurrentMenu%|
00004860  3d 4d 65 6e 75 53 74 61  72 74 29 20 8c 0d 18 06  |=MenuStart) ....|
00004870  21 20 20 20 c8 99 20 47  65 74 50 6f 69 6e 74 65  |!   .. GetPointe|
00004880  72 49 6e 66 6f 25 2c 2c  4d 6f 75 73 65 25 0d 18  |rInfo%,,Mouse%..|
00004890  10 3f 20 20 20 e7 20 25  30 30 31 20 80 20 4d 6f  |.?   . %001 . Mo|
000048a0  75 73 65 25 21 62 75 74  74 6f 6e 73 20 f2 4f 70  |use%!buttons .Op|
000048b0  65 6e 4d 61 69 6e 4d 65  6e 75 20 3a f4 20 70 65  |enMainMenu :. pe|
000048c0  72 73 69 73 74 65 6e 74  20 6d 65 6e 75 0d 18 1a  |rsistent menu...|
000048d0  08 20 20 20 cd 0d 18 24  05 e1 0d 18 2e 04 0d 18  |.   ...$........|
000048e0  38 20 dd 20 f2 53 65 74  4d 65 6e 75 54 69 63 6b  |8 . .SetMenuTick|
000048f0  28 6d 65 6e 75 25 2c 20  74 68 69 73 25 29 0d 18  |(menu%, this%)..|
00004900  42 2d f4 20 73 65 74 20  31 20 74 69 63 6b 20 69  |B-. set 1 tick i|
00004910  6e 20 6d 65 6e 75 20 61  6e 64 20 63 6c 65 61 72  |n menu and clear|
00004920  20 61 6c 6c 20 6f 74 68  65 72 73 0d 18 4c 0e ea  | all others..L..|
00004930  20 6e 2c 20 69 74 65 6d  25 0d 18 56 09 6e 20 3d  | n, item%..V.n =|
00004940  20 30 0d 18 60 12 69 74  65 6d 25 3d 6d 65 6e 75  | 0..`.item%=menu|
00004950  25 2b 32 38 0d 18 6a 3e  21 69 74 65 6d 25 20 3d  |%+28..j>!item% =|
00004960  20 a4 53 65 74 42 69 74  28 6e 3d 74 68 69 73 25  | .SetBit(n=this%|
00004970  2c 20 21 69 74 65 6d 25  2c 20 30 29 20 20 3a f4  |, !item%, 0)  :.|
00004980  20 73 65 74 20 6f 72 20  63 6c 65 61 72 20 74 69  | set or clear ti|
00004990  63 6b 0d 18 74 05 f5 0d  18 7e 10 20 69 74 65 6d  |ck..t....~. item|
000049a0  25 20 2b 3d 20 32 34 0d  18 88 0b 20 6e 20 2b 3d  |% += 24.... n +=|
000049b0  20 31 0d 18 92 3f 20 21  69 74 65 6d 25 20 3d 20  | 1...? !item% = |
000049c0  a4 53 65 74 42 69 74 28  6e 3d 74 68 69 73 25 2c  |.SetBit(n=this%,|
000049d0  20 21 69 74 65 6d 25 2c  20 30 29 20 20 3a f4 20  | !item%, 0)  :. |
000049e0  73 65 74 20 6f 72 20 63  6c 65 61 72 20 74 69 63  |set or clear tic|
000049f0  6b 0d 18 9c 15 20 fd 20  28 21 69 74 65 6d 25 20  |k.... . (!item% |
00004a00  80 20 26 38 30 29 0d 18  a6 05 e1 0d 18 b0 04 0d  |. &80)..........|
00004a10  18 ba 11 dd 20 f2 4b 65  79 50 72 65 73 73 65 64  |.... .KeyPressed|
00004a20  0d 18 c4 11 ea 20 54 68  69 73 57 69 6e 64 6f 77  |..... ThisWindow|
00004a30  25 0d 18 ce 20 e7 20 21  28 57 69 6e 64 6f 77 25  |%... . !(Window%|
00004a40  2b 68 61 6e 64 6c 65 25  2b 32 34 29 3d 31 33 20  |+handle%+24)=13 |
00004a50  8c 0d 18 d8 21 20 20 54  68 69 73 57 69 6e 64 6f  |....!  ThisWindo|
00004a60  77 25 3d 57 69 6e 64 6f  77 25 21 68 61 6e 64 6c  |w%=Window%!handl|
00004a70  65 25 0d 18 e2 18 20 20  c8 8e 20 28 54 68 69 73  |e%....  .. (This|
00004a80  57 69 6e 64 6f 77 25 29  20 ca 0d 18 ec 49 20 20  |Window%) ....I  |
00004a90  20 20 c9 20 53 61 76 65  5f 68 25 20 3a 20 f2 73  |  . Save_h% : .s|
00004aa0  61 76 65 5f 6d 75 73 69  63 28 a4 47 65 74 53 74  |ave_music(.GetSt|
00004ab0  72 28 53 61 76 65 54 65  78 74 29 29 20 3a 20 f4  |r(SaveText)) : .|
00004ac0  20 63 2f 72 20 69 6e 20  73 61 76 65 20 77 69 6e  | c/r in save win|
00004ad0  64 6f 77 0d 18 f6 49 20  20 20 20 c9 20 4c 6f 61  |dow...I    . Loa|
00004ae0  64 5f 68 25 20 3a 20 f2  6c 6f 61 64 5f 6d 75 73  |d_h% : .load_mus|
00004af0  69 63 28 a4 47 65 74 53  74 72 28 4c 6f 61 64 54  |ic(.GetStr(LoadT|
00004b00  65 78 74 29 29 20 3a 20  f4 20 63 2f 72 20 69 6e  |ext)) : . c/r in|
00004b10  20 6c 6f 61 64 20 77 69  6e 64 6f 77 0d 19 00 10  | load window....|
00004b20  20 20 20 20 c9 20 42 61  72 5f 68 25 0d 19 0a 19  |    . Bar_h%....|
00004b30  20 20 20 20 20 42 41 52  25 3d bb 28 24 42 61 72  |     BAR%=.($Bar|
00004b40  4e 75 6d 25 29 0d 19 14  33 20 20 20 20 20 e7 20  |Num%)...3     . |
00004b50  42 41 52 25 3e 4e 42 61  72 73 25 20 42 41 52 25  |BAR%>NBars% BAR%|
00004b60  3d 4e 42 61 72 73 25 20  8b e7 20 42 41 52 25 3c  |=NBars% .. BAR%<|
00004b70  30 20 42 41 52 25 3d 30  0d 19 1e 25 20 20 20 20  |0 BAR%=0...%    |
00004b80  20 57 69 6e 64 6f 77 25  21 68 61 6e 64 6c 65 25  | Window%!handle%|
00004b90  3d 53 63 6f 72 65 57 69  6e 64 5f 68 25 0d 19 28  |=ScoreWind_h%..(|
00004ba0  2c 20 20 20 20 20 c8 99  20 47 65 74 57 69 6e 64  |,     .. GetWind|
00004bb0  6f 77 53 74 61 74 65 25  2c 2c 57 69 6e 64 6f 77  |owState%,,Window|
00004bc0  25 2b 68 61 6e 64 6c 65  25 0d 19 32 25 20 20 20  |%+handle%..2%   |
00004bd0  20 20 57 69 6e 64 6f 77  25 21 73 63 78 25 3d 50  |  Window%!scx%=P|
00004be0  58 25 28 50 58 6e 25 28  42 41 52 25 29 29 0d 19  |X%(PXn%(BAR%))..|
00004bf0  3c 4f 20 20 20 20 20 c8  99 20 4f 70 65 6e 57 69  |<O     .. OpenWi|
00004c00  6e 64 6f 77 25 2c 2c 57  69 6e 64 6f 77 25 2b 68  |ndow%,,Window%+h|
00004c10  61 6e 64 6c 65 25 20 3a  20 f4 20 73 65 74 20 73  |andle% : . set s|
00004c20  63 72 6f 6c 6c 20 74 6f  20 72 65 71 75 65 73 74  |croll to request|
00004c30  65 64 20 62 61 72 20 6e  75 6d 62 65 72 0d 19 46  |ed bar number..F|
00004c40  2f 20 20 20 20 20 c8 99  20 47 65 74 57 69 6e 64  |/     .. GetWind|
00004c50  6f 77 53 74 61 74 65 25  2c 2c 53 63 6f 72 65 57  |owState%,,ScoreW|
00004c60  42 6c 6b 25 2b 68 61 6e  64 6c 65 25 0d 19 50 55  |Blk%+handle%..PU|
00004c70  20 20 20 20 20 4c 48 42  41 52 25 3d a4 46 69 6e  |     LHBAR%=.Fin|
00004c80  64 42 61 72 28 53 63 6f  72 65 57 42 6c 6b 25 21  |dBar(ScoreWBlk%!|
00004c90  73 63 78 25 29 20 3a f4  20 74 68 65 20 62 61 72  |scx%) :. the bar|
00004ca0  20 6e 75 6d 62 65 72 20  61 74 20 74 68 65 20 6c  | number at the l|
00004cb0  65 66 74 20 6f 66 20 74  68 65 20 77 69 6e 64 6f  |eft of the windo|
00004cc0  77 0d 19 5a 55 20 20 20  7f 20 3a 20 c8 99 20 22  |w..ZU   . : .. "|
00004cd0  57 69 6d 70 5f 50 72 6f  63 65 73 73 4b 65 79 22  |Wimp_ProcessKey"|
00004ce0  2c 21 28 57 69 6e 64 6f  77 25 2b 68 61 6e 64 6c  |,!(Window%+handl|
00004cf0  65 25 2b 32 34 29 20 3a  20 f4 20 20 69 65 2e 20  |e%+24) : .  ie. |
00004d00  70 61 73 73 20 6f 6e 20  6b 65 79 20 63 6f 64 65  |pass on key code|
00004d10  20 69 6e 20 52 30 0d 19  64 08 20 20 20 cb 0d 19  | in R0..d.   ...|
00004d20  6e 1f 20 20 f2 43 6c 6f  73 65 57 69 6e 64 6f 77  |n.  .CloseWindow|
00004d30  28 54 68 69 73 57 69 6e  64 6f 77 25 29 0d 19 78  |(ThisWindow%)..x|
00004d40  10 20 20 f2 43 6c 6f 73  65 4d 65 6e 75 0d 19 82  |.  .CloseMenu...|
00004d50  07 20 20 cc 0d 19 8c 4f  20 20 c8 99 20 22 57 69  |.  ....O  .. "Wi|
00004d60  6d 70 5f 50 72 6f 63 65  73 73 4b 65 79 22 2c 21  |mp_ProcessKey",!|
00004d70  28 57 69 6e 64 6f 77 25  2b 68 61 6e 64 6c 65 25  |(Window%+handle%|
00004d80  2b 32 34 29 20 3a 20 f4  20 69 65 2e 20 70 61 73  |+24) : . ie. pas|
00004d90  73 20 6f 6e 20 6b 65 79  20 63 6f 64 65 20 69 6e  |s on key code in|
00004da0  20 52 30 0d 19 96 07 20  20 cd 0d 19 a0 05 e1 0d  | R0....  .......|
00004db0  19 aa 04 0d 19 b4 26 dd  20 f2 53 63 72 6f 6c 6c  |......&. .Scroll|
00004dc0  52 65 71 28 78 5f 73 63  72 6f 6c 6c 25 2c 20 79  |Req(x_scroll%, y|
00004dd0  5f 73 63 72 6f 6c 6c 25  29 0d 19 be 47 f4 20 69  |_scroll%)...G. i|
00004de0  66 20 62 61 64 20 6d 6f  64 65 20 64 69 73 61 6c  |f bad mode disal|
00004df0  6c 6f 77 20 73 63 72 6f  6c 6c 20 74 6f 20 70 72  |low scroll to pr|
00004e00  65 76 65 6e 74 20 6d 6f  64 65 20 77 61 72 6e 69  |event mode warni|
00004e10  6e 67 20 62 65 69 6e 67  20 67 61 72 62 6c 65 64  |ng being garbled|
00004e20  0d 19 c8 10 e7 20 42 41  44 4d 4f 44 45 25 20 e1  |..... BADMODE% .|
00004e30  0d 19 d2 24 e7 20 57 69  6e 64 6f 77 25 21 68 61  |...$. Window%!ha|
00004e40  6e 64 6c 65 25 3d 53 63  6f 72 65 57 69 6e 64 5f  |ndle%=ScoreWind_|
00004e50  68 25 20 8c 0d 19 dc 21  20 20 e7 20 50 4c 41 59  |h% ....!  . PLAY|
00004e60  49 4e 47 25 80 28 78 5f  73 63 72 6f 6c 6c 25 3c  |ING%.(x_scroll%<|
00004e70  3e 30 29 20 e1 0d 19 e6  17 20 20 c8 8e 20 94 28  |>0) .....  .. .(|
00004e80  78 5f 73 63 72 6f 6c 6c  25 29 20 ca 0d 19 f0 2b  |x_scroll%) ....+|
00004e90  20 20 20 20 c9 20 31 3a  57 69 6e 64 6f 77 25 21  |    . 1:Window%!|
00004ea0  73 63 78 25 2b 3d 78 5f  73 63 72 6f 6c 6c 25 2a  |scx%+=x_scroll%*|
00004eb0  34 2a 50 67 61 70 25 0d  19 fa 41 20 20 20 20 c9  |4*Pgap%...A    .|
00004ec0  20 32 3a 57 69 6e 64 6f  77 25 21 73 63 78 25 2b  | 2:Window%!scx%+|
00004ed0  3d 28 78 5f 73 63 72 6f  6c 6c 25 2f 32 29 2a 28  |=(x_scroll%/2)*(|
00004ee0  57 69 6e 64 6f 77 25 21  78 31 25 2d 57 69 6e 64  |Window%!x1%-Wind|
00004ef0  6f 77 25 21 78 30 25 29  0d 1a 04 09 20 20 20 20  |ow%!x0%)....    |
00004f00  cb 0d 1a 0e 17 20 20 c8  8e 20 94 28 79 5f 73 63  |.....  .. .(y_sc|
00004f10  72 6f 6c 6c 25 29 20 ca  0d 1a 18 2d 20 20 20 20  |roll%) ....-    |
00004f20  c9 20 31 3a 57 69 6e 64  6f 77 25 21 73 63 79 25  |. 1:Window%!scy%|
00004f30  2b 3d 79 5f 73 63 72 6f  6c 6c 25 2a 43 5f 48 65  |+=y_scroll%*C_He|
00004f40  69 67 68 74 25 0d 1a 22  41 20 20 20 20 c9 20 32  |ight%.."A    . 2|
00004f50  3a 57 69 6e 64 6f 77 25  21 73 63 79 25 2b 3d 28  |:Window%!scy%+=(|
00004f60  79 5f 73 63 72 6f 6c 6c  25 2f 32 29 2a 28 57 69  |y_scroll%/2)*(Wi|
00004f70  6e 64 6f 77 25 21 79 31  25 2d 57 69 6e 64 6f 77  |ndow%!y1%-Window|
00004f80  25 21 79 30 25 29 0d 1a  2c 09 20 20 20 20 cb 0d  |%!y0%)..,.    ..|
00004f90  1a 36 26 20 20 c8 99 20  4f 70 65 6e 57 69 6e 64  |.6&  .. OpenWind|
00004fa0  6f 77 25 2c 20 2c 57 69  6e 64 6f 77 25 2b 68 61  |ow%, ,Window%+ha|
00004fb0  6e 64 6c 65 25 0d 1a 40  2c 20 20 c8 99 20 47 65  |ndle%..@,  .. Ge|
00004fc0  74 57 69 6e 64 6f 77 53  74 61 74 65 25 2c 2c 53  |tWindowState%,,S|
00004fd0  63 6f 72 65 57 42 6c 6b  25 2b 68 61 6e 64 6c 65  |coreWBlk%+handle|
00004fe0  25 0d 1a 4a 14 20 20 53  63 6f 72 65 43 6c 6f 73  |%..J.  ScoreClos|
00004ff0  65 64 25 3d a3 0d 1a 54  52 20 20 4c 48 42 41 52  |ed%=...TR  LHBAR|
00005000  25 3d a4 46 69 6e 64 42  61 72 28 53 63 6f 72 65  |%=.FindBar(Score|
00005010  57 42 6c 6b 25 21 73 63  78 25 29 20 3a f4 20 74  |WBlk%!scx%) :. t|
00005020  68 65 20 62 61 72 20 6e  75 6d 62 65 72 20 61 74  |he bar number at|
00005030  20 74 68 65 20 6c 65 66  74 20 6f 66 20 74 68 65  | the left of the|
00005040  20 77 69 6e 64 6f 77 0d  1a 5e 07 20 20 cd 0d 1a  | window..^.  ...|
00005050  68 05 e1 0d 1a 72 04 0d  1a 7c 13 dd 20 f2 4f 70  |h....r...|.. .Op|
00005060  65 6e 4d 61 69 6e 4d 65  6e 75 0d 1a 86 0b ea 20  |enMainMenu..... |
00005070  69 74 65 6d 25 0d 1a 90  2c 69 74 65 6d 25 20 3d  |item%...,item% =|
00005080  20 a4 46 69 6e 64 4d 65  6e 75 49 74 65 6d 28 22  | .FindMenuItem("|
00005090  50 6c 61 79 22 2c 20 4d  65 6e 75 53 74 61 72 74  |Play", MenuStart|
000050a0  29 0d 1a 9a 36 e7 20 28  69 74 65 6d 25 3e 3d 30  |)...6. (item%>=0|
000050b0  29 20 21 69 74 65 6d 25  20 3d 20 a4 53 65 74 42  |) !item% = .SetB|
000050c0  69 74 28 50 4c 41 59 49  4e 47 25 2c 20 21 69 74  |it(PLAYING%, !it|
000050d0  65 6d 25 2c 20 30 29 0d  1a a4 17 f4 20 73 65 74  |em%, 0)..... set|
000050e0  20 6f 72 20 63 6c 65 61  72 20 74 69 63 6b 0d 1a  | or clear tick..|
000050f0  ae 2c 69 74 65 6d 25 20  3d 20 a4 46 69 6e 64 4d  |.,item% = .FindM|
00005100  65 6e 75 49 74 65 6d 28  22 47 6f 74 6f 22 2c 20  |enuItem("Goto", |
00005110  4d 65 6e 75 53 74 61 72  74 29 0d 1a b8 39 e7 20  |MenuStart)...9. |
00005120  28 69 74 65 6d 25 3e 3d  30 29 20 69 74 65 6d 25  |(item%>=0) item%|
00005130  21 38 20 3d 20 a4 53 65  74 42 69 74 28 50 4c 41  |!8 = .SetBit(PLA|
00005140  59 49 4e 47 25 2c 20 69  74 65 6d 25 21 38 2c 20  |YING%, item%!8, |
00005150  32 32 29 0d 1a c2 2b f4  20 73 68 61 64 65 64 20  |22)...+. shaded |
00005160  62 69 74 2e 20 64 69 73  61 62 6c 65 20 47 6f 74  |bit. disable Got|
00005170  6f 20 77 68 65 6e 20 70  6c 61 79 69 6e 67 0d 1a  |o when playing..|
00005180  cc 48 c8 99 20 43 72 65  61 74 65 4d 65 6e 75 2c  |.H.. CreateMenu,|
00005190  20 2c 4d 65 6e 75 53 74  61 72 74 2c 20 4d 6f 75  | ,MenuStart, Mou|
000051a0  73 65 5f 58 25 2d 43 5f  57 69 64 74 68 25 2a 34  |se_X%-C_Width%*4|
000051b0  2c 20 4d 6f 75 73 65 5f  59 25 2b 43 5f 48 65 69  |, Mouse_Y%+C_Hei|
000051c0  67 68 74 25 2a 34 0d 1a  d6 1a 43 75 72 72 65 6e  |ght%*4....Curren|
000051d0  74 4d 65 6e 75 25 3d 4d  65 6e 75 53 74 61 72 74  |tMenu%=MenuStart|
000051e0  0d 1a e0 19 f2 43 6c 6f  73 65 57 69 6e 64 6f 77  |.....CloseWindow|
000051f0  28 53 61 76 65 5f 68 25  29 0d 1a ea 19 f2 43 6c  |(Save_h%).....Cl|
00005200  6f 73 65 57 69 6e 64 6f  77 28 4c 6f 61 64 5f 68  |oseWindow(Load_h|
00005210  25 29 0d 1a f4 05 e1 0d  1a fe 04 0d 1b 08 16 dd  |%)..............|
00005220  20 f2 4f 70 65 6e 4d 65  6e 75 28 4d 65 6e 75 25  | .OpenMenu(Menu%|
00005230  29 0d 1b 12 19 e7 20 28  4d 65 6e 75 25 3d 49 63  |)..... (Menu%=Ic|
00005240  6f 6e 4d 65 6e 75 25 29  20 8c 0d 1b 1c 5d 20 20  |onMenu%) ....]  |
00005250  c8 99 20 43 72 65 61 74  65 4d 65 6e 75 2c 20 2c  |.. CreateMenu, ,|
00005260  49 63 6f 6e 4d 65 6e 75  25 2c 20 4d 6f 75 73 65  |IconMenu%, Mouse|
00005270  5f 58 25 2d 43 5f 57 69  64 74 68 25 2a 34 2c 20  |_X%-C_Width%*4, |
00005280  31 31 32 2b 43 5f 48 65  69 67 68 74 25 2a 32 3a  |112+C_Height%*2:|
00005290  f4 20 79 20 61 64 6a 75  73 74 65 64 20 74 6f 20  |. y adjusted to |
000052a0  6c 69 6e 65 20 75 70 0d  1b 26 05 cc 0d 1b 30 44  |line up..&....0D|
000052b0  20 20 c8 99 20 43 72 65  61 74 65 4d 65 6e 75 2c  |  .. CreateMenu,|
000052c0  20 2c 4d 65 6e 75 25 2c  20 4d 6f 75 73 65 5f 58  | ,Menu%, Mouse_X|
000052d0  25 2d 43 5f 57 69 64 74  68 25 2a 34 2c 20 4d 6f  |%-C_Width%*4, Mo|
000052e0  75 73 65 5f 59 25 2b 43  5f 48 65 69 67 68 74 25  |use_Y%+C_Height%|
000052f0  0d 1b 3a 05 cd 0d 1b 44  16 43 75 72 72 65 6e 74  |..:....D.Current|
00005300  4d 65 6e 75 25 3d 4d 65  6e 75 25 0d 1b 4e 19 f2  |Menu%=Menu%..N..|
00005310  43 6c 6f 73 65 57 69 6e  64 6f 77 28 53 61 76 65  |CloseWindow(Save|
00005320  5f 68 25 29 0d 1b 58 19  f2 43 6c 6f 73 65 57 69  |_h%)..X..CloseWi|
00005330  6e 64 6f 77 28 4c 6f 61  64 5f 68 25 29 0d 1b 62  |ndow(Load_h%)..b|
00005340  05 e1 0d 1b 6c 04 0d 1b  76 10 dd 20 f2 43 6c 6f  |....l...v.. .Clo|
00005350  73 65 4d 65 6e 75 0d 1b  80 16 c8 99 20 43 72 65  |seMenu...... Cre|
00005360  61 74 65 4d 65 6e 75 2c  20 2c 2d 31 0d 1b 8a 19  |ateMenu, ,-1....|
00005370  f2 43 6c 6f 73 65 57 69  6e 64 6f 77 28 53 61 76  |.CloseWindow(Sav|
00005380  65 5f 68 25 29 0d 1b 94  19 f2 43 6c 6f 73 65 57  |e_h%).....CloseW|
00005390  69 6e 64 6f 77 28 4c 6f  61 64 5f 68 25 29 0d 1b  |indow(Load_h%)..|
000053a0  9e 05 e1 0d 1b a8 04 0d  1b b2 15 dd 20 f2 73 79  |............ .sy|
000053b0  6d 62 6f 6c 5f 70 6f 69  6e 74 65 72 0d 1b bc 1e  |mbol_pointer....|
000053c0  c8 99 20 47 65 74 50 6f  69 6e 74 65 72 49 6e 66  |.. GetPointerInf|
000053d0  6f 25 2c 2c 4d 6f 75 73  65 25 0d 1b c6 41 e7 20  |o%,,Mouse%...A. |
000053e0  28 4d 6f 75 73 65 25 21  77 69 6e 64 6f 77 3d 53  |(Mouse%!window=S|
000053f0  63 6f 72 65 57 69 6e 64  5f 68 25 29 20 f2 73 63  |coreWind_h%) .sc|
00005400  72 69 62 65 28 4d 6f 75  73 65 25 21 78 30 25 2c  |ribe(Mouse%!x0%,|
00005410  4d 6f 75 73 65 25 21 79  30 25 29 0d 1b d0 05 e1  |Mouse%!y0%).....|
00005420  0d 1b da 04 0d 1b e4 12  dd 20 f2 53 74 6f 70 53  |......... .StopS|
00005430  63 6f 72 69 6e 67 0d 1b  ee 12 73 74 6f 70 53 43  |coring....stopSC|
00005440  4f 52 49 4e 47 25 3d b9  0d 1b f8 0c f2 72 65 6c  |ORING%=......rel|
00005450  65 61 73 65 0d 1c 02 4a  f2 55 70 64 61 74 65 49  |ease...J.UpdateI|
00005460  63 6f 6e 28 53 65 6c 57  25 2c 20 53 65 6c 49 25  |con(SelW%, SelI%|
00005470  2c 20 30 2c 20 31 3c 3c  32 29 20 3a f4 20 72 65  |, 0, 1<<2) :. re|
00005480  6d 6f 76 65 20 68 69 67  68 6c 69 67 68 74 20 6f  |move highlight o|
00005490  6e 20 69 63 6f 6e 20 69  6e 20 70 61 6e 65 0d 1c  |n icon in pane..|
000054a0  0c 05 e1 0d 1c 16 04 0d  1c 20 16 dd 20 f2 55 70  |......... .. .Up|
000054b0  64 61 74 65 54 69 74 6c  65 28 54 24 29 0d 1c 2a  |dateTitle(T$)..*|
000054c0  0d ea 20 61 2c 62 2c 63  2c 64 0d 1c 34 18 24 53  |.. a,b,c,d..4.$S|
000054d0  63 6f 72 65 54 69 74 6c  65 25 3d 54 24 2b bd 28  |coreTitle%=T$+.(|
000054e0  30 29 0d 1c 3e 20 57 69  6e 64 6f 77 25 21 68 61  |0)..> Window%!ha|
000054f0  6e 64 6c 65 25 3d 53 63  6f 72 65 57 69 6e 64 5f  |ndle%=ScoreWind_|
00005500  68 25 0d 1c 48 27 c8 99  20 47 65 74 57 69 6e 64  |h%..H'.. GetWind|
00005510  6f 77 53 74 61 74 65 25  2c 2c 57 69 6e 64 6f 77  |owState%,,Window|
00005520  25 2b 68 61 6e 64 6c 65  25 0d 1c 52 54 61 3d 57  |%+handle%..RTa=W|
00005530  69 6e 64 6f 77 25 21 78  30 25 20 3a 20 62 3d 57  |indow%!x0% : b=W|
00005540  69 6e 64 6f 77 25 21 79  31 25 20 3a 20 63 3d 57  |indow%!y1% : c=W|
00005550  69 6e 64 6f 77 25 21 78  31 25 20 3a f4 20 67 65  |indow%!x1% :. ge|
00005560  74 20 74 69 74 6c 65 20  61 72 65 61 20 61 6e 64  |t title area and|
00005570  20 66 6f 72 63 65 20 72  65 64 72 61 77 0d 1c 5c  | force redraw..\|
00005580  28 c8 99 20 47 65 74 57  69 6e 64 6f 77 4f 75 74  |(.. GetWindowOut|
00005590  6c 69 6e 65 2c 2c 57 69  6e 64 6f 77 25 2b 68 61  |line,,Window%+ha|
000055a0  6e 64 6c 65 25 0d 1c 66  11 64 3d 57 69 6e 64 6f  |ndle%..f.d=Windo|
000055b0  77 25 21 79 31 25 0d 1c  70 2d c8 99 20 46 6f 72  |w%!y1%..p-.. For|
000055c0  63 65 52 65 64 72 61 77  2c 2d 31 2c 61 2b 48 69  |ceRedraw,-1,a+Hi|
000055d0  25 2c 62 2b 56 69 25 2c  63 2d 48 69 25 2c 64 2b  |%,b+Vi%,c-Hi%,d+|
000055e0  56 69 25 0d 1c 7a 05 e1  0d 1c 84 04 0d 1c 8e 1d  |Vi%..z..........|
000055f0  dd 20 f2 4f 70 65 6e 57  69 6e 64 6f 77 28 68 25  |. .OpenWindow(h%|
00005600  2c 20 78 25 2c 20 79 25  29 0d 1c 98 14 ea 20 78  |, x%, y%)..... x|
00005610  73 69 7a 65 25 2c 20 79  73 69 7a 65 25 0d 1c a2  |size%, ysize%...|
00005620  18 57 69 6e 64 6f 77 25  21 68 61 6e 64 6c 65 25  |.Window%!handle%|
00005630  20 3d 20 68 25 0d 1c ac  28 c8 99 20 47 65 74 57  | = h%...(.. GetW|
00005640  69 6e 64 6f 77 53 74 61  74 65 25 2c 20 2c 57 69  |indowState%, ,Wi|
00005650  6e 64 6f 77 25 2b 68 61  6e 64 6c 65 25 0d 1c b6  |ndow%+handle%...|
00005660  22 78 73 69 7a 65 25 3d  57 69 6e 64 6f 77 25 21  |"xsize%=Window%!|
00005670  78 31 25 2d 57 69 6e 64  6f 77 25 21 78 30 25 0d  |x1%-Window%!x0%.|
00005680  1c c0 22 79 73 69 7a 65  25 3d 57 69 6e 64 6f 77  |.."ysize%=Window|
00005690  25 21 79 31 25 2d 57 69  6e 64 6f 77 25 21 79 30  |%!y1%-Window%!y0|
000056a0  25 0d 1c ca 15 57 69 6e  64 6f 77 25 21 75 6e 64  |%....Window%!und|
000056b0  65 72 25 3d 2d 31 0d 1c  d4 12 57 69 6e 64 6f 77  |er%=-1....Window|
000056c0  25 21 78 30 25 3d 78 25  0d 1c de 22 57 69 6e 64  |%!x0%=x%..."Wind|
000056d0  6f 77 25 21 78 31 25 3d  57 69 6e 64 6f 77 25 21  |ow%!x1%=Window%!|
000056e0  78 30 25 2b 78 73 69 7a  65 25 0d 1c e8 12 57 69  |x0%+xsize%....Wi|
000056f0  6e 64 6f 77 25 21 79 30  25 3d 79 25 0d 1c f2 22  |ndow%!y0%=y%..."|
00005700  57 69 6e 64 6f 77 25 21  79 31 25 3d 57 69 6e 64  |Window%!y1%=Wind|
00005710  6f 77 25 21 79 30 25 2b  79 73 69 7a 65 25 0d 1c  |ow%!y0%+ysize%..|
00005720  fc 24 c8 99 20 4f 70 65  6e 57 69 6e 64 6f 77 25  |.$.. OpenWindow%|
00005730  2c 20 2c 57 69 6e 64 6f  77 25 2b 68 61 6e 64 6c  |, ,Window%+handl|
00005740  65 25 0d 1d 06 05 e1 0d  1d 10 04 0d 1d 1a 16 dd  |e%..............|
00005750  20 f2 43 6c 6f 73 65 57  69 6e 64 6f 77 28 68 25  | .CloseWindow(h%|
00005760  29 0d 1d 24 16 57 69 6e  64 6f 77 25 21 68 61 6e  |)..$.Window%!han|
00005770  64 6c 65 25 3d 68 25 0d  1d 2e 25 c8 99 20 43 6c  |dle%=h%...%.. Cl|
00005780  6f 73 65 57 69 6e 64 6f  77 25 2c 20 2c 57 69 6e  |oseWindow%, ,Win|
00005790  64 6f 77 25 2b 68 61 6e  64 6c 65 25 0d 1d 38 05  |dow%+handle%..8.|
000057a0  e1 0d 1d 42 04 0d 1d 4c  14 dd 20 f2 53 65 74 45  |...B...L.. .SetE|
000057b0  78 74 65 6e 74 28 57 25  29 0d 1d 56 13 53 63 6f  |xtent(W%)..V.Sco|
000057c0  72 65 5f 57 69 64 74 68  25 3d 57 25 0d 1d 60 11  |re_Width%=W%..`.|
000057d0  57 69 6e 64 6f 77 25 21  78 30 25 3d 30 0d 1d 6a  |Window%!x0%=0..j|
000057e0  2a 57 69 6e 64 6f 77 25  21 79 30 25 3d 2d 53 63  |*Window%!y0%=-Sc|
000057f0  6f 72 65 5f 48 65 69 67  68 74 25 2d 50 61 6e 65  |ore_Height%-Pane|
00005800  48 65 69 67 68 74 25 0d  1d 74 1c 57 69 6e 64 6f  |Height%..t.Windo|
00005810  77 25 21 78 31 25 3d 53  63 6f 72 65 5f 57 69 64  |w%!x1%=Score_Wid|
00005820  74 68 25 0d 1d 7e 1b 57  69 6e 64 6f 77 25 21 79  |th%..~.Window%!y|
00005830  31 25 3d 50 61 6e 65 48  65 69 67 68 74 25 0d 1d  |1%=PaneHeight%..|
00005840  88 25 c8 99 20 53 65 74  45 78 74 65 6e 74 2c 53  |.%.. SetExtent,S|
00005850  63 6f 72 65 57 69 6e 64  5f 68 25 2c 57 69 6e 64  |coreWind_h%,Wind|
00005860  6f 77 25 0d 1d 92 05 e1  0d 1d 9c 04 0d 1d a6 2e  |ow%.............|
00005870  dd 20 a4 47 65 74 4c 65  61 66 4e 61 6d 65 28 6e  |. .GetLeafName(n|
00005880  61 6d 65 25 29 20 3a f4  20 72 65 74 75 72 6e 73  |ame%) :. returns|
00005890  20 6c 65 61 66 20 6e 61  6d 65 0d 1d b0 12 ea 20  | leaf name..... |
000058a0  63 68 24 2c 6e 25 2c 6e  61 6d 65 24 0d 1d ba 18  |ch$,n%,name$....|
000058b0  6e 61 6d 65 24 3d a4 47  65 74 53 74 72 28 6e 61  |name$=.GetStr(na|
000058c0  6d 65 25 29 0d 1d c4 33  e7 20 28 20 28 a7 6e 61  |me%)...3. ( (.na|
000058d0  6d 65 24 2c 22 2e 22 29  3d 30 29 20 80 20 28 a7  |me$,".")=0) . (.|
000058e0  6e 61 6d 65 24 2c 22 3a  22 29 3d 30 29 20 29 20  |name$,":")=0) ) |
000058f0  8c 3d 6e 61 6d 65 24 0d  1d ce 0f 6e 25 3d a9 28  |.=name$....n%=.(|
00005900  6e 61 6d 65 24 29 0d 1d  d8 2b f4 20 73 63 61 6e  |name$)...+. scan|
00005910  20 73 74 72 69 6e 67 20  74 6f 20 66 69 6e 64 20  | string to find |
00005920  6c 65 61 66 20 6e 61 6d  65 20 6f 66 20 66 69 6c  |leaf name of fil|
00005930  65 0d 1d e2 05 f5 0d 1d  ec 19 20 20 63 68 24 3d  |e.........  ch$=|
00005940  20 c1 6e 61 6d 65 24 2c  20 6e 25 2c 20 31 29 0d  | .name$, n%, 1).|
00005950  1d f6 0b 20 20 6e 25 2d  3d 31 0d 1e 00 23 20 20  |...  n%-=1...#  |
00005960  fd 20 28 6e 25 3c 3d 30  20 84 20 63 68 24 3d 22  |. (n%<=0 . ch$="|
00005970  2e 22 20 84 20 63 68 24  3d 22 3a 22 29 0d 1e 0a  |." . ch$=":")...|
00005980  24 e7 20 6e 25 3e 30 20  8c 20 3d c2 6e 61 6d 65  |$. n%>0 . =.name|
00005990  24 2c 20 a9 28 6e 61 6d  65 24 29 2d 6e 25 2d 31  |$, .(name$)-n%-1|
000059a0  29 0d 1e 14 04 0d 1e 1e  20 dd 20 a4 47 65 74 53  |)....... . .GetS|
000059b0  74 72 28 73 25 29 20 3a  20 f4 20 67 65 74 20 73  |tr(s%) : . get s|
000059c0  74 72 69 6e 67 0d 1e 28  08 ea 20 6e 24 0d 1e 32  |tring..(.. n$..2|
000059d0  1a c8 95 3f 73 25 3a 6e  24 2b 3d bd 3f 73 25 3a  |...?s%:n$+=.?s%:|
000059e0  73 25 2b 3d 31 3a ce 0d  1e 3c 07 3d 6e 24 0d 1e  |s%+=1:...<.=n$..|
000059f0  46 04 0d 1e 50 14 dd 20  f2 53 65 74 56 6f 6c 75  |F...P.. .SetVolu|
00005a00  6d 65 28 52 25 29 0d 1e  5a 1f c8 99 20 53 6f 75  |me(R%)..Z... Sou|
00005a10  6e 64 5f 56 6f 6c 75 6d  65 2c 56 6f 6c 75 6d 65  |nd_Volume,Volume|
00005a20  25 28 52 25 29 0d 1e 64  05 e1 0d 1e 6e 04 0d 1e  |%(R%)..d....n...|
00005a30  78 19 dd 20 f2 53 65 74  44 65 66 61 75 6c 74 43  |x.. .SetDefaultC|
00005a40  68 61 6e 6e 65 6c 73 0d  1e 82 0a ea 53 25 2c 50  |hannels.....S%,P|
00005a50  25 0d 1e 8c 2d f4 20 6f  6e 6c 79 20 31 20 70 65  |%...-. only 1 pe|
00005a60  72 63 75 73 73 69 6f 6e  20 63 68 61 6e 6e 65 6c  |rcussion channel|
00005a70  20 70 65 72 6d 69 74 74  65 64 20 6e 6f 77 0d 1e  | permitted now..|
00005a80  96 5f e3 53 25 3d 30 b8  37 3a 53 5f 43 25 28 53  |._.S%=0.7:S_C%(S|
00005a90  25 29 3d 53 74 61 76 65  5f 43 68 61 6e 6e 65 6c  |%)=Stave_Channel|
00005aa0  73 25 28 53 54 41 56 45  25 2c 53 25 29 3a ed 3a  |s%(STAVE%,S%):.:|
00005ab0  f4 20 43 68 61 6e 6e 65  6c 20 61 73 73 69 67 6e  |. Channel assign|
00005ac0  6d 65 6e 74 20 63 68 61  6e 67 65 73 20 69 66 20  |ment changes if |
00005ad0  73 74 61 76 65 73 20 63  68 61 6e 67 65 0d 1e a0  |staves change...|
00005ae0  41 e7 20 50 45 52 43 25  20 53 5f 43 25 28 37 29  |A. PERC% S_C%(7)|
00005af0  3d 53 54 41 56 45 25 2b  31 3a f4 20 53 74 65 61  |=STAVE%+1:. Stea|
00005b00  6c 20 63 68 61 6e 6e 65  6c 20 66 6f 72 20 70 65  |l channel for pe|
00005b10  72 63 75 73 73 69 6f 6e  20 6c 69 6e 65 73 0d 1e  |rcussion lines..|
00005b20  aa 0b e3 53 25 3d 30 b8  37 0d 1e b4 20 49 6e 73  |...S%=0.7... Ins|
00005b30  74 72 75 6d 65 6e 74 25  28 53 25 2c 30 29 3d 53  |trument%(S%,0)=S|
00005b40  5f 43 25 28 53 25 29 2b  31 0d 1e be 83 24 53 74  |_C%(S%)+1....$St|
00005b50  61 76 65 53 74 72 25 28  53 25 29 3d 4e 74 68 24  |aveStr%(S%)=Nth$|
00005b60  28 49 6e 73 74 72 75 6d  65 6e 74 25 28 53 25 2c  |(Instrument%(S%,|
00005b70  30 29 2b 28 53 54 41 56  45 25 2d 33 29 2a 28 28  |0)+(STAVE%-3)*((|
00005b80  49 6e 73 74 72 75 6d 65  6e 74 25 28 53 25 2c 30  |Instrument%(S%,0|
00005b90  29 2d 31 29 3e 53 54 41  56 45 25 29 29 2b 22 3b  |)-1)>STAVE%))+";|
00005ba0  22 20 3a f4 20 73 65 74  20 75 70 20 73 74 61 76  |" :. set up stav|
00005bb0  65 20 6e 61 6d 65 73 20  69 6e 20 69 6e 73 74 72  |e names in instr|
00005bc0  75 6d 65 6e 74 20 77 69  6d 64 6f 77 0d 1e c8 3c  |ument wimdow...<|
00005bd0  f2 55 70 64 61 74 65 49  63 6f 6e 28 49 6e 73 74  |.UpdateIcon(Inst|
00005be0  72 57 69 6e 64 5f 68 25  2c 53 25 2c 30 2c 30 29  |rWind_h%,S%,0,0)|
00005bf0  20 3a f4 20 75 70 64 61  74 65 20 74 65 78 74 20  | :. update text |
00005c00  69 6e 20 69 63 6f 6e 73  0d 1e d2 19 76 25 3d a4  |in icons....v%=.|
00005c10  41 74 74 61 63 68 56 6f  69 63 65 28 53 25 2c 30  |AttachVoice(S%,0|
00005c20  29 0d 1e dc 20 c8 99 20  53 6f 75 6e 64 5f 41 74  |)... .. Sound_At|
00005c30  74 61 63 68 56 6f 69 63  65 2c 53 25 2b 31 2c 76  |tachVoice,S%+1,v|
00005c40  25 0d 1e e6 2d 24 28 56  6f 69 63 65 53 74 72 25  |%...-$(VoiceStr%|
00005c50  28 53 25 29 29 3d c0 56  6f 69 63 65 24 28 76 25  |(S%))=.Voice$(v%|
00005c60  29 2c 20 56 6f 69 63 65  53 69 7a 65 25 29 0d 1e  |), VoiceSize%)..|
00005c70  f0 1a 49 6e 73 74 72 75  6d 65 6e 74 25 28 53 25  |..Instrument%(S%|
00005c80  2c 31 29 20 3d 20 76 25  0d 1e fa 27 f2 55 70 64  |,1) = v%...'.Upd|
00005c90  61 74 65 49 63 6f 6e 28  49 6e 73 74 72 57 69 6e  |ateIcon(InstrWin|
00005ca0  64 5f 68 25 2c 53 25 2b  38 2c 20 30 2c 30 29 0d  |d_h%,S%+8, 0,0).|
00005cb0  1f 04 1d ed 3a f4 20 49  6e 73 74 72 75 6d 65 6e  |....:. Instrumen|
00005cc0  74 20 61 6c 6c 6f 63 61  74 69 6f 6e 0d 1f 0e 47  |t allocation...G|
00005cd0  e7 20 50 45 52 43 25 20  24 53 74 61 76 65 53 74  |. PERC% $StaveSt|
00005ce0  72 25 28 37 29 3d 4e 74  68 24 28 35 29 2b 22 3b  |r%(7)=Nth$(5)+";|
00005cf0  22 20 3a f4 20 73 74 65  61 6c 20 31 20 63 68 61  |" :. steal 1 cha|
00005d00  6e 6e 65 6c 20 66 6f 72  20 70 65 72 63 75 73 73  |nnel for percuss|
00005d10  69 6f 6e 0d 1f 18 05 e1  0d 1f 22 04 0d 1f 2c 12  |ion......."...,.|
00005d20  dd 20 f2 73 65 74 75 70  5f 73 63 6f 72 65 0d 1f  |. .setup_score..|
00005d30  36 0a ea 53 25 2c 50 25  0d 1f 40 2d f4 20 6f 6e  |6..S%,P%..@-. on|
00005d40  6c 79 20 31 20 70 65 72  63 75 73 73 69 6f 6e 20  |ly 1 percussion |
00005d50  63 68 61 6e 6e 65 6c 20  70 65 72 6d 69 74 74 65  |channel permitte|
00005d60  64 20 6e 6f 77 0d 1f 4a  31 f2 73 65 74 75 70 5f  |d now..J1.setup_|
00005d70  73 74 61 76 65 73 3a f4  20 43 61 6c 63 75 6c 61  |staves:. Calcula|
00005d80  74 65 20 6e 65 77 20 73  74 61 76 65 20 70 6f 73  |te new stave pos|
00005d90  69 74 69 6f 6e 73 0d 1f  54 17 f2 53 65 74 44 65  |itions..T..SetDe|
00005da0  66 61 75 6c 74 43 68 61  6e 6e 65 6c 73 0d 1f 5e  |faultChannels..^|
00005db0  05 e1 0d 1f 68 04 0d 1f  72 16 dd 20 a4 47 65 74  |....h...r.. .Get|
00005dc0  46 69 6c 65 49 6e 66 6f  28 46 24 29 0d 1f 7c 26  |FileInfo(F$)..|&|
00005dd0  ea 54 25 2c 4c 25 2c 41  25 2c 4d 24 2c 74 69 6d  |.T%,L%,A%,M$,tim|
00005de0  65 25 2c 46 69 6c 65 54  79 70 65 24 2c 72 32 2c  |e%,FileType$,r2,|
00005df0  72 33 0d 1f 86 35 e7 20  46 24 3c 3e 22 22 20 c8  |r3...5. F$<>"" .|
00005e00  99 4f 53 5f 46 69 6c 65  2c 35 2c 46 24 20 b8 20  |.OS_File,5,F$ . |
00005e10  54 25 2c 2c 6c 61 64 64  72 25 2c 65 61 64 64 72  |T%,,laddr%,eaddr|
00005e20  25 2c 4c 25 2c 41 25 0d  1f 90 32 e7 20 28 46 24  |%,L%,A%...2. (F$|
00005e30  3d 22 22 29 20 84 20 28  28 54 25 3d 31 29 20 80  |="") . ((T%=1) .|
00005e40  20 28 41 25 20 80 20 31  29 20 80 20 28 4c 25 3e  | (A% . 1) . (L%>|
00005e50  38 29 29 20 3d 20 30 20  8c 0d 1f 9a 20 24 54 68  |8)) = 0 .... $Th|
00005e60  69 73 46 69 6c 65 25 3d  22 3c 75 6e 74 69 74 6c  |isFile%="<untitl|
00005e70  65 64 3e 22 2b bd 28 30  29 0d 1f a4 11 24 46 69  |ed>"+.(0)....$Fi|
00005e80  6c 65 53 69 7a 65 25 3d  22 22 0d 1f ae 11 24 46  |leSize%=""....$F|
00005e90  69 6c 65 54 79 70 65 25  3d 22 22 0d 1f b8 11 24  |ileType%=""....$|
00005ea0  46 69 6c 65 44 61 74 65  25 3d 22 22 0d 1f c2 06  |FileDate%=""....|
00005eb0  3d a3 0d 1f cc 05 cc 0d  1f d6 11 24 54 68 69 73  |=..........$This|
00005ec0  46 69 6c 65 25 3d 46 24  0d 1f e0 14 24 46 69 6c  |File%=F$....$Fil|
00005ed0  65 53 69 7a 65 25 3d c3  28 4c 25 29 0d 1f ea 20  |eSize%=.(L%)... |
00005ee0  e7 20 28 28 6c 61 64 64  72 25 3e 3e 32 30 29 80  |. ((laddr%>>20).|
00005ef0  26 46 46 46 29 3d 26 46  46 46 20 8c 0d 1f f4 2d  |&FFF)=&FFF ....-|
00005f00  20 20 e7 20 28 6c 61 64  64 72 25 3e 3e 38 20 80  |  . (laddr%>>8 .|
00005f10  20 26 46 46 46 29 20 3d  20 4d 75 73 69 63 46 69  | &FFF) = MusicFi|
00005f20  6c 65 54 79 70 65 25 20  8c 0d 1f fe 1c 20 20 20  |leType% .....   |
00005f30  20 46 69 6c 65 54 79 70  65 24 3d 20 22 4d 75 73  | FileType$= "Mus|
00005f40  69 63 20 20 22 0d 20 08  07 20 20 cc 0d 20 12 38  |ic  ". ..  .. .8|
00005f50  20 20 20 20 c8 99 20 22  4f 53 5f 46 53 43 6f 6e  |    .. "OS_FSCon|
00005f60  74 72 6f 6c 22 2c 31 38  2c 2c 6c 61 64 64 72 25  |trol",18,,laddr%|
00005f70  3e 3e 38 20 80 20 26 46  46 46 20 b8 20 2c 2c 72  |>>8 . &FFF . ,,r|
00005f80  32 2c 72 33 0d 20 1c 58  20 20 20 20 46 69 6c 65  |2,r3. .X    File|
00005f90  54 79 70 65 24 3d bd 28  72 32 20 80 20 26 46 46  |Type$=.(r2 . &FF|
00005fa0  29 20 2b 20 bd 28 28 72  32 3e 3e 38 29 20 80 20  |) + .((r2>>8) . |
00005fb0  26 46 46 29 20 2b 20 bd  28 28 72 32 3e 3e 31 36  |&FF) + .((r2>>16|
00005fc0  29 20 80 20 26 46 46 29  20 2b 20 bd 28 28 72 32  |) . &FF) + .((r2|
00005fd0  3e 3e 32 34 29 20 80 20  26 46 46 29 0d 20 26 5b  |>>24) . &FF). &[|
00005fe0  20 20 20 20 46 69 6c 65  54 79 70 65 24 20 2b 3d  |    FileType$ +=|
00005ff0  20 bd 28 72 33 20 80 20  26 46 46 29 20 2b 20 bd  | .(r3 . &FF) + .|
00006000  28 28 72 33 3e 3e 38 29  20 80 20 26 46 46 29 20  |((r3>>8) . &FF) |
00006010  2b 20 bd 28 28 72 33 3e  3e 31 36 29 20 80 20 26  |+ .((r3>>16) . &|
00006020  46 46 29 20 2b 20 bd 28  28 72 33 3e 3e 32 34 29  |FF) + .((r3>>24)|
00006030  20 80 20 26 46 46 29 0d  20 30 09 20 20 20 20 cd  | . &FF). 0.    .|
00006040  0d 20 3a 2f 20 20 24 46  69 6c 65 54 79 70 65 25  |. :/  $FileType%|
00006050  3d 46 69 6c 65 54 79 70  65 24 2b c3 7e 28 6c 61  |=FileType$+.~(la|
00006060  64 64 72 25 3e 3e 38 20  80 20 26 46 46 46 29 0d  |ddr%>>8 . &FFF).|
00006070  20 44 2a 20 20 74 69 6d  65 25 3d 57 69 6e 64 6f  | D*  time%=Windo|
00006080  77 25 20 3a f4 20 61 20  63 6f 6e 76 65 6e 69 65  |w% :. a convenie|
00006090  6e 74 20 62 75 66 66 65  72 0d 20 4e 3b f4 20 6c  |nt buffer. N;. l|
000060a0  6f 61 64 20 61 6e 64 20  65 78 65 63 75 74 69 6f  |oad and executio|
000060b0  6e 20 61 64 64 72 65 73  73 65 73 20 61 72 65 2c  |n addresses are,|
000060c0  20 69 6e 20 66 61 63 74  2c 20 74 69 6d 65 20 73  | in fact, time s|
000060d0  74 61 6d 70 0d 20 58 1a  20 20 74 69 6d 65 25 3f  |tamp. X.  time%?|
000060e0  34 3d 6c 61 64 64 72 25  20 80 20 26 46 46 0d 20  |4=laddr% . &FF. |
000060f0  62 1e 20 20 74 69 6d 65  25 3f 33 3d 65 61 64 64  |b.  time%?3=eadd|
00006100  72 25 3e 3e 32 34 20 80  20 26 46 46 0d 20 6c 1e  |r%>>24 . &FF. l.|
00006110  20 20 74 69 6d 65 25 3f  32 3d 65 61 64 64 72 25  |  time%?2=eaddr%|
00006120  3e 3e 31 36 20 80 20 26  46 46 0d 20 76 1e 20 20  |>>16 . &FF. v.  |
00006130  74 69 6d 65 25 3f 31 3d  65 61 64 64 72 25 3e 3e  |time%?1=eaddr%>>|
00006140  38 20 20 80 20 26 46 46  0d 20 80 1e 20 20 74 69  |8  . &FF. ..  ti|
00006150  6d 65 25 3f 30 3d 65 61  64 64 72 25 20 20 20 20  |me%?0=eaddr%    |
00006160  20 80 20 26 46 46 0d 20  8a 3e 20 20 c8 99 20 22  | . &FF. .>  .. "|
00006170  4f 53 5f 43 6f 6e 76 65  72 74 53 74 61 6e 64 61  |OS_ConvertStanda|
00006180  72 64 44 61 74 65 41 6e  64 54 69 6d 65 22 2c 20  |rdDateAndTime", |
00006190  74 69 6d 65 25 2c 20 46  69 6c 65 44 61 74 65 25  |time%, FileDate%|
000061a0  2c 20 32 38 0d 20 94 33  20 20 f4 20 70 75 74 20  |, 28. .3  . put |
000061b0  74 69 6d 65 73 74 61 6d  70 20 6f 66 20 66 69 6c  |timestamp of fil|
000061c0  65 20 69 6e 74 6f 20 66  69 6c 65 20 69 6e 66 6f  |e into file info|
000061d0  20 77 69 6e 64 6f 77 0d  20 9e 07 20 20 cd 0d 20  | window. ..  .. |
000061e0  a8 05 cd 0d 20 b2 06 3d  b9 0d 20 bc 04 0d 20 c6  |.... ..=.. ... .|
000061f0  15 dd 20 f2 6c 6f 61 64  5f 6d 75 73 69 63 28 46  |.. .load_music(F|
00006200  24 29 0d 20 d0 0b ea 20  46 25 2c 4d 24 0d 20 da  |$). ... F%,M$. .|
00006210  07 ea 20 85 0d 20 e4 49  e7 20 43 48 41 4e 47 45  |.. .. .I. CHANGE|
00006220  44 25 20 e7 20 ac 20 a4  43 68 65 63 6b 4f 4b 28  |D% . . .CheckOK(|
00006230  22 41 72 65 20 79 6f 75  20 73 75 72 65 3f 20 43  |"Are you sure? C|
00006240  75 72 72 65 6e 74 20 6d  75 73 69 63 20 69 73 20  |urrent music is |
00006250  75 6e 73 61 76 65 64 22  2c 33 29 20 e1 0d 20 ee  |unsaved",3) .. .|
00006260  0e 53 43 4f 52 49 4e 47  25 3d a3 0d 20 f8 19 e7  |.SCORING%=.. ...|
00006270  20 50 4c 41 59 49 4e 47  25 20 f2 70 6c 61 79 5f  | PLAYING% .play_|
00006280  73 74 6f 70 0d 21 02 10  53 43 52 4f 4c 4c 49 4e  |stop.!..SCROLLIN|
00006290  47 25 3d a3 0d 21 0c 38  e7 20 a9 46 24 3d 30 20  |G%=..!.8. .F$=0 |
000062a0  8c 20 ef 37 20 3a 20 54  25 3d a4 43 68 65 63 6b  |. .7 : T%=.Check|
000062b0  4f 4b 28 22 49 6e 76 61  6c 69 64 20 66 69 6c 65  |OK("Invalid file|
000062c0  6e 61 6d 65 22 2c 31 29  20 3a 20 e1 0d 21 16 15  |name",1) : ..!..|
000062d0  c8 99 20 22 48 6f 75 72  67 6c 61 73 73 5f 4f 6e  |.. "Hourglass_On|
000062e0  22 0d 21 20 59 ee 20 85  20 ea 20 ef 37 3a 20 ff  |".! Y. . . .7: .|
000062f0  28 22 46 58 20 32 32 39  2c 31 22 29 20 3a 20 f2  |("FX 229,1") : .|
00006300  43 6c 65 61 72 41 6c 6c  4d 75 73 69 63 20 3a 20  |ClearAllMusic : |
00006310  c8 99 20 22 48 6f 75 72  67 6c 61 73 73 5f 4f 66  |.. "Hourglass_Of|
00006320  66 22 20 3a 20 54 25 3d  a4 43 68 65 63 6b 4f 4b  |f" : T%=.CheckOK|
00006330  28 f6 24 2c 31 29 20 3a  20 e1 0d 21 2a 26 ff 28  |(.$,1) : ..!*&.(|
00006340  22 46 58 20 32 32 39 2c  30 22 29 20 3a f4 20 65  |"FX 229,0") :. e|
00006350  6e 61 62 6c 65 20 65 73  63 61 70 65 20 6b 65 79  |nable escape key|
00006360  0d 21 34 0d 46 49 4c 45  25 3d 8e 46 24 0d 21 3e  |.!4.FILE%=.F$.!>|
00006370  20 4d 24 3d 22 22 3a e3  52 25 3d 31 b8 37 3a 4d  | M$="":.R%=1.7:M|
00006380  24 2b 3d bd 9a 23 46 49  4c 45 25 3a ed 0d 21 48  |$+=..#FILE%:..!H|
00006390  0e 42 25 3d 9a 23 46 49  4c 45 25 0d 21 52 13 e7  |.B%=.#FILE%.!R..|
000063a0  4d 24 3d 22 4d 61 65 73  74 72 6f 22 20 8c 0d 21  |M$="Maestro" ..!|
000063b0  5c 15 24 4c 6f 61 64 54  65 78 74 3d 46 24 2b bd  |\.$LoadText=F$+.|
000063c0  28 30 29 0d 21 66 15 24  53 61 76 65 54 65 78 74  |(0).!f.$SaveText|
000063d0  3d 46 24 2b bd 28 30 29  0d 21 70 6e e7 20 ac 20  |=F$+.(0).!pn. . |
000063e0  a4 47 65 74 46 69 6c 65  49 6e 66 6f 28 46 24 29  |.GetFileInfo(F$)|
000063f0  20 8c 20 ef 37 20 3a ff  28 22 46 58 20 32 32 39  | . .7 :.("FX 229|
00006400  2c 31 22 29 20 3a 20 c8  99 20 22 48 6f 75 72 67  |,1") : .. "Hourg|
00006410  6c 61 73 73 5f 4f 66 66  22 20 3a 54 25 3d a4 43  |lass_Off" :T%=.C|
00006420  68 65 63 6b 4f 4b 28 22  49 6e 76 61 6c 69 64 20  |heckOK("Invalid |
00006430  6f 72 20 6c 6f 63 6b 65  64 20 66 69 6c 65 22 2c  |or locked file",|
00006440  31 29 20 3a 20 e1 0d 21  7a 08 54 25 3d b9 0d 21  |1) : ..!z.T%=..!|
00006450  84 0c 4e 42 61 72 73 25  3d 30 0d 21 8e 10 c8 8e  |..NBars%=0.!....|
00006460  20 9a 23 46 49 4c 45 25  20 ca 0d 21 98 0c c9 20  | .#FILE% ..!... |
00006470  30 3a 54 25 3d a3 0d 21  a2 07 c9 20 31 0d 21 ac  |0:T%=..!... 1.!.|
00006480  2a f2 6c 54 65 6d 70 6f  3a f2 6c 49 6e 73 74 72  |*.lTempo:.lInstr|
00006490  75 6d 65 6e 74 73 3a f2  6c 53 74 61 76 65 73 3a  |uments:.lStaves:|
000064a0  f2 6c 4d 75 73 69 63 0d  21 b6 22 7f f4 20 46 69  |.lMusic.!.".. Fi|
000064b0  6c 65 20 69 64 20 76 65  72 73 69 6f 6e 20 32 20  |le id version 2 |
000064c0  61 6e 64 20 61 62 6f 76  65 0d 21 c0 08 41 25 3d  |and above.!..A%=|
000064d0  a3 0d 21 ca 05 f5 0d 21  d4 4e ee 20 9a 23 46 49  |..!....!.N. .#FI|
000064e0  4c 45 25 20 f2 6c 4d 75  73 69 63 2c f2 6c 53 74  |LE% .lMusic,.lSt|
000064f0  61 76 65 73 2c f2 6c 49  6e 73 74 72 75 6d 65 6e  |aves,.lInstrumen|
00006500  74 73 2c f2 6c 56 6f 6c  75 6d 65 73 2c f2 6c 53  |ts,.lVolumes,.lS|
00006510  74 65 72 65 6f 73 2c f2  6c 54 65 6d 70 6f 20 8b  |tereos,.lTempo .|
00006520  41 25 3d b9 0d 21 de 0f  fd c5 23 46 49 4c 45 25  |A%=..!....#FILE%|
00006530  84 41 25 0d 21 e8 05 cb  0d 21 f2 13 d9 23 46 49  |.A%.!....!...#FI|
00006540  4c 45 25 3a 46 49 4c 45  25 3d a3 0d 21 fc 11 ff  |LE%:FILE%=..!...|
00006550  28 22 46 58 20 32 32 39  2c 31 22 29 0d 22 06 12  |("FX 229,1")."..|
00006560  24 55 70 64 61 74 65 64  25 3d 22 4e 4f 22 0d 22  |$Updated%="NO"."|
00006570  10 14 f2 55 70 64 61 74  65 54 69 74 6c 65 28 46  |...UpdateTitle(F|
00006580  24 29 0d 22 1a 16 c8 99  20 22 48 6f 75 72 67 6c  |$).".... "Hourgl|
00006590  61 73 73 5f 4f 66 66 22  0d 22 24 15 c8 99 20 22  |ass_Off"."$... "|
000065a0  48 6f 75 72 67 6c 61 73  73 5f 4f 6e 22 0d 22 2e  |Hourglass_On".".|
000065b0  09 e7 54 25 20 8c 0d 22  38 15 20 f2 70 6f 73 69  |..T% .."8. .posi|
000065c0  74 69 6f 6e 5f 73 74 61  76 65 73 0d 22 42 11 20  |tion_staves."B. |
000065d0  f2 73 74 61 72 74 5f 6d  75 73 69 63 0d 22 4c 12  |.start_music."L.|
000065e0  20 f2 73 65 74 5f 73 63  6f 72 65 28 30 29 0d 22  | .set_score(0)."|
000065f0  56 17 20 f2 53 65 74 75  70 42 61 72 53 74 61 72  |V. .SetupBarStar|
00006600  74 73 28 30 29 0d 22 60  11 20 f2 73 65 74 75 70  |ts(0)."`. .setup|
00006610  5f 73 63 6f 72 65 0d 22  6a 33 20 f2 75 70 64 61  |_score."j3 .upda|
00006620  74 65 5f 73 63 6f 72 65  28 30 2c 2d 53 63 6f 72  |te_score(0,-Scor|
00006630  65 5f 48 65 69 67 68 74  25 2c 53 63 6f 72 65 5f  |e_Height%,Score_|
00006640  57 69 64 74 68 25 2c 30  29 0d 22 74 11 20 f2 53  |Width%,0)."t. .S|
00006650  74 6f 70 53 63 6f 72 69  6e 67 0d 22 7e 0f 20 43  |topScoring."~. C|
00006660  48 41 4e 47 45 44 25 3d  a3 0d 22 88 06 20 cd 0d  |HANGED%=..".. ..|
00006670  22 92 05 cc 0d 22 9c 11  ff 28 22 46 58 20 32 32  |"...."...("FX 22|
00006680  39 2c 31 22 29 0d 22 a6  08 54 25 3d a3 0d 22 b0  |9,1")."..T%=..".|
00006690  05 cd 0d 22 ba 35 e7 20  ac 20 54 25 20 8c 20 ef  |...".5. . T% . .|
000066a0  37 20 3a 20 54 25 3d a4  43 68 65 63 6b 4f 4b 28  |7 : T%=.CheckOK(|
000066b0  22 49 6e 76 61 6c 69 64  20 6d 75 73 69 63 20 66  |"Invalid music f|
000066c0  69 6c 65 22 2c 31 29 0d  22 c4 16 c8 99 20 22 48  |ile",1).".... "H|
000066d0  6f 75 72 67 6c 61 73 73  5f 4f 66 66 22 0d 22 ce  |ourglass_Off".".|
000066e0  05 e1 0d 22 d8 04 0d 22  e2 0d dd 20 f2 6c 4d 75  |..."..."... .lMu|
000066f0  73 69 63 0d 22 ec 0a ea  43 25 2c 42 25 0d 22 f6  |sic."...C%,B%.".|
00006700  1f e8 23 46 49 4c 45 25  2c 47 41 54 45 25 3a 47  |..#FILE%,GATE%:G|
00006710  41 54 45 25 2b 3d 4d 55  53 49 43 25 0d 23 00 0b  |ATE%+=MUSIC%.#..|
00006720  e3 43 25 3d 30 b8 37 0d  23 0a 2b e8 23 46 49 4c  |.C%=0.7.#.+.#FIL|
00006730  45 25 2c 46 49 4e 45 25  28 43 25 29 3a 46 49 4e  |E%,FINE%(C%):FIN|
00006740  45 25 28 43 25 29 2b 3d  4d 55 53 49 43 25 28 43  |E%(C%)+=MUSIC%(C|
00006750  25 29 0d 23 14 05 ed 0d  23 1e 2c 42 25 3d 4d 55  |%).#....#.,B%=MU|
00006760  53 49 43 25 3a c8 95 42  25 3c 47 41 54 45 25 3a  |SIC%:..B%<GATE%:|
00006770  3f 42 25 3d 9a 23 46 49  4c 45 25 3a 42 25 2b 3d  |?B%=.#FILE%:B%+=|
00006780  31 3a ce 0d 23 28 0b e3  43 25 3d 30 b8 37 0d 23  |1:..#(..C%=0.7.#|
00006790  32 34 42 25 3d 4d 55 53  49 43 25 28 43 25 29 3a  |24B%=MUSIC%(C%):|
000067a0  c8 95 42 25 3c 46 49 4e  45 25 28 43 25 29 3a 3f  |..B%<FINE%(C%):?|
000067b0  42 25 3d 9a 23 46 49 4c  45 25 3a 42 25 2b 3d 31  |B%=.#FILE%:B%+=1|
000067c0  3a ce 0d 23 3c 05 ed 0d  23 46 1c 50 50 25 3d 4d  |:..#<...#F.PP%=M|
000067d0  55 53 49 43 25 3a 50 25  28 29 3d 4d 55 53 49 43  |USIC%:P%()=MUSIC|
000067e0  25 28 29 0d 23 50 05 e1  0d 23 5a 04 0d 23 64 0e  |%().#P...#Z..#d.|
000067f0  dd 20 f2 6c 53 74 61 76  65 73 0d 23 6e 0b ea 20  |. .lStaves.#n.. |
00006800  69 74 65 6d 25 0d 23 78  12 53 54 41 56 45 25 3d  |item%.#x.STAVE%=|
00006810  9a 23 46 49 4c 45 25 0d  23 82 1e 24 53 74 61 76  |.#FILE%.#..$Stav|
00006820  65 4e 75 6d 25 3d c0 c3  28 53 54 41 56 45 25 2b  |eNum%=..(STAVE%+|
00006830  31 29 2c 31 29 0d 23 8c  11 50 45 52 43 25 3d 9a  |1),1).#..PERC%=.|
00006840  23 46 49 4c 45 25 0d 23  96 34 69 74 65 6d 25 20  |#FILE%.#.4item% |
00006850  3d 20 a4 46 69 6e 64 4d  65 6e 75 49 74 65 6d 28  |= .FindMenuItem(|
00006860  22 2b 70 65 72 63 75 73  73 69 6f 6e 22 2c 20 53  |"+percussion", S|
00006870  74 61 76 65 4d 65 6e 75  25 29 0d 23 a0 45 e7 20  |taveMenu%).#.E. |
00006880  69 74 65 6d 25 3e 30 20  21 69 74 65 6d 25 3d a4  |item%>0 !item%=.|
00006890  53 65 74 42 69 74 28 50  45 52 43 25 3d 31 2c 20  |SetBit(PERC%=1, |
000068a0  21 69 74 65 6d 25 2c 20  30 29 20 3a f4 20 73 65  |!item%, 0) :. se|
000068b0  74 20 6f 72 20 63 6c 65  61 72 20 74 69 63 6b 0d  |t or clear tick.|
000068c0  23 aa 05 e1 0d 23 b4 04  0d 23 be 13 dd 20 f2 6c  |#....#...#... .l|
000068d0  49 6e 73 74 72 75 6d 65  6e 74 73 0d 23 c8 11 ea  |Instruments.#...|
000068e0  43 25 2c 20 63 68 61 6e  25 2c 76 25 0d 23 d2 0b  |C%, chan%,v%.#..|
000068f0  e3 43 25 3d 30 b8 37 0d  23 dc 1b 63 68 61 6e 25  |.C%=0.7.#..chan%|
00006900  3d 9a 23 46 49 4c 45 25  3a f4 20 43 68 61 6e 6e  |=.#FILE%:. Chann|
00006910  65 6c 0d 23 e6 4b 76 25  3d 9a 23 46 49 4c 45 25  |el.#.Kv%=.#FILE%|
00006920  83 28 4e 56 6f 69 63 65  73 25 2b 31 29 3a f4 20  |.(NVoices%+1):. |
00006930  57 72 69 74 65 20 76 6f  69 63 65 20 6e 75 6d 62  |Write voice numb|
00006940  65 72 73 20 61 6c 6c 6f  63 61 74 65 64 20 74 6f  |ers allocated to|
00006950  20 65 61 63 68 20 63 68  61 6e 6e 65 6c 0d 23 f0  | each channel.#.|
00006960  0f e7 20 76 25 3d 30 20  76 25 3d 31 0d 23 fa 25  |.. v%=0 v%=1.#.%|
00006970  c8 99 20 53 6f 75 6e 64  5f 41 74 74 61 63 68 56  |.. Sound_AttachV|
00006980  6f 69 63 65 2c 20 63 68  61 6e 25 2b 31 2c 20 76  |oice, chan%+1, v|
00006990  25 0d 24 04 3d 76 25 3d  a4 41 74 74 61 63 68 56  |%.$.=v%=.AttachV|
000069a0  6f 69 63 65 28 63 68 61  6e 25 2c 20 30 29 20 3a  |oice(chan%, 0) :|
000069b0  f4 20 63 68 65 63 6b 20  69 66 20 69 74 20 69 73  |. check if it is|
000069c0  20 61 20 76 61 6c 69 64  20 76 6f 69 63 65 0d 24  | a valid voice.$|
000069d0  0e 25 c8 99 20 53 6f 75  6e 64 5f 41 74 74 61 63  |.%.. Sound_Attac|
000069e0  68 56 6f 69 63 65 2c 20  63 68 61 6e 25 2b 31 2c  |hVoice, chan%+1,|
000069f0  20 76 25 0d 24 18 1d 49  6e 73 74 72 75 6d 65 6e  | v%.$..Instrumen|
00006a00  74 25 28 63 68 61 6e 25  2c 31 29 20 3d 20 76 25  |t%(chan%,1) = v%|
00006a10  0d 24 22 30 24 28 56 6f  69 63 65 53 74 72 25 28  |.$"0$(VoiceStr%(|
00006a20  63 68 61 6e 25 29 29 3d  c0 56 6f 69 63 65 24 28  |chan%))=.Voice$(|
00006a30  76 25 29 2c 20 56 6f 69  63 65 53 69 7a 65 25 29  |v%), VoiceSize%)|
00006a40  0d 24 2c 2b f2 55 70 64  61 74 65 49 63 6f 6e 28  |.$,+.UpdateIcon(|
00006a50  49 6e 73 74 72 57 69 6e  64 5f 68 25 2c 20 63 68  |InstrWind_h%, ch|
00006a60  61 6e 25 2b 38 2c 20 30  2c 30 29 0d 24 36 05 ed  |an%+8, 0,0).$6..|
00006a70  0d 24 40 05 e1 0d 24 4a  04 0d 24 54 0f dd 20 f2  |.$@...$J..$T.. .|
00006a80  6c 56 6f 6c 75 6d 65 73  0d 24 5e 07 ea 43 25 0d  |lVolumes.$^..C%.|
00006a90  24 68 0b e3 43 25 3d 30  b8 37 0d 24 72 18 56 6f  |$h..C%=0.7.$r.Vo|
00006aa0  6c 75 6d 65 73 25 28 43  25 29 3d 9a 23 46 49 4c  |lumes%(C%)=.#FIL|
00006ab0  45 25 0d 24 7c 22 e7 56  6f 6c 75 6d 65 73 25 28  |E%.$|".Volumes%(|
00006ac0  43 25 29 3e 37 20 56 6f  6c 75 6d 65 73 25 28 43  |C%)>7 Volumes%(C|
00006ad0  25 29 3d 37 0d 24 86 22  e7 56 6f 6c 75 6d 65 73  |%)=7.$.".Volumes|
00006ae0  25 28 43 25 29 3c 30 20  56 6f 6c 75 6d 65 73 25  |%(C%)<0 Volumes%|
00006af0  28 43 25 29 3d 30 0d 24  90 37 24 28 56 6f 6c 75  |(C%)=0.$.7$(Volu|
00006b00  6d 65 53 74 72 25 28 43  25 29 29 3d c0 56 6f 6c  |meStr%(C%))=.Vol|
00006b10  75 6d 65 24 28 56 6f 6c  75 6d 65 73 25 28 43 25  |ume$(Volumes%(C%|
00006b20  29 29 2c 20 56 6f 6c 53  69 7a 65 25 29 0d 24 9a  |)), VolSize%).$.|
00006b30  4f f2 55 70 64 61 74 65  49 63 6f 6e 28 49 6e 73  |O.UpdateIcon(Ins|
00006b40  74 72 57 69 6e 64 5f 68  25 2c 20 43 25 2b 31 36  |trWind_h%, C%+16|
00006b50  2c 20 30 2c 30 29 20 20  20 3a f4 20 75 70 64 61  |, 0,0)   :. upda|
00006b60  74 65 20 69 63 6f 6e 20  69 6e 20 69 6e 73 74 72  |te icon in instr|
00006b70  75 6d 65 6e 74 20 77 69  6e 64 6f 77 0d 24 a4 05  |ument window.$..|
00006b80  ed 0d 24 ae 05 e1 0d 24  b8 04 0d 24 c2 0f dd 20  |..$....$...$... |
00006b90  f2 6c 53 74 65 72 65 6f  73 0d 24 cc 07 ea 43 25  |.lStereos.$...C%|
00006ba0  0d 24 d6 0b e3 43 25 3d  30 b8 37 0d 24 e0 20 53  |.$...C%=0.7.$. S|
00006bb0  74 65 72 65 6f 5f 50 6f  73 69 74 69 6f 6e 25 28  |tereo_Position%(|
00006bc0  43 25 29 3d 9a 23 46 49  4c 45 25 0d 24 ea 36 c8  |C%)=.#FILE%.$.6.|
00006bd0  99 20 53 6f 75 6e 64 5f  53 74 65 72 65 6f 2c 43  |. Sound_Stereo,C|
00006be0  25 2b 31 2c 53 74 65 72  65 6f 25 28 53 74 65 72  |%+1,Stereo%(Ster|
00006bf0  65 6f 5f 50 6f 73 69 74  69 6f 6e 25 28 43 25 29  |eo_Position%(C%)|
00006c00  29 0d 24 f4 45 24 28 53  74 65 72 65 6f 53 74 72  |).$.E$(StereoStr|
00006c10  25 28 43 25 29 29 20 3d  20 c0 53 74 65 72 65 6f  |%(C%)) = .Stereo|
00006c20  24 28 53 74 65 72 65 6f  5f 50 6f 73 69 74 69 6f  |$(Stereo_Positio|
00006c30  6e 25 28 43 25 29 2c 20  30 29 2c 20 53 74 65 72  |n%(C%), 0), Ster|
00006c40  53 69 7a 65 25 29 0d 24  fe 29 f2 55 70 64 61 74  |Size%).$.).Updat|
00006c50  65 49 63 6f 6e 28 49 6e  73 74 72 57 69 6e 64 5f  |eIcon(InstrWind_|
00006c60  68 25 2c 20 43 25 2b 32  34 2c 20 30 2c 30 29 0d  |h%, C%+24, 0,0).|
00006c70  25 08 05 ed 0d 25 12 05  e1 0d 25 1c 04 0d 25 26  |%....%....%...%&|
00006c80  0d dd 20 f2 6c 54 65 6d  70 6f 0d 25 30 07 ea 20  |.. .lTempo.%0.. |
00006c90  74 0d 25 3a 0d 74 3d 9a  23 46 49 4c 45 25 0d 25  |t.%:.t=.#FILE%.%|
00006ca0  44 10 f2 53 65 74 54 65  6d 70 6f 28 74 29 0d 25  |D..SetTempo(t).%|
00006cb0  4e 1f f2 53 65 74 4d 65  6e 75 54 69 63 6b 28 54  |N..SetMenuTick(T|
00006cc0  65 6d 70 6f 4d 65 6e 75  25 2c 20 74 29 0d 25 58  |empoMenu%, t).%X|
00006cd0  05 e1 0d 25 62 04 0d 25  6c 15 dd 20 f2 73 61 76  |...%b..%l.. .sav|
00006ce0  65 5f 6d 75 73 69 63 28  46 24 29 0d 25 76 0d ea  |e_music(F$).%v..|
00006cf0  20 62 6c 6f 63 6b 2c 6e  0d 25 80 07 ea 20 85 0d  | block,n.%... ..|
00006d00  25 8a 11 62 6c 6f 63 6b  3d 57 69 6e 64 6f 77 25  |%..block=Window%|
00006d10  0d 25 94 15 24 53 61 76  65 54 65 78 74 3d 46 24  |.%..$SaveText=F$|
00006d20  2b bd 28 30 29 0d 25 9e  15 24 4c 6f 61 64 54 65  |+.(0).%..$LoadTe|
00006d30  78 74 3d 46 24 2b bd 28  30 29 0d 25 a8 36 f4 20  |xt=F$+.(0).%.6. |
00006d40  73 69 6d 70 6c 65 20 63  68 65 63 6b 20 66 6f 72  |simple check for|
00006d50  20 70 61 74 68 6e 61 6d  65 20 72 61 74 68 65 72  | pathname rather|
00006d60  20 74 68 61 6e 20 6c 6f  63 61 6c 20 6e 61 6d 65  | than local name|
00006d70  0d 25 b2 23 e7 20 28 20  a7 46 24 2c 22 2e 22 29  |.%.#. ( .F$,".")|
00006d80  3d 30 20 80 20 a7 46 24  2c 22 3a 22 29 3d 30 20  |=0 . .F$,":")=0 |
00006d90  29 20 8c 0d 25 bc 42 20  6e 3d a4 43 68 65 63 6b  |) ..%.B n=.Check|
00006da0  4f 4b 28 22 54 6f 20 73  61 76 65 2c 20 64 72 61  |OK("To save, dra|
00006db0  67 20 74 68 65 20 69 63  6f 6e 20 74 6f 20 61 20  |g the icon to a |
00006dc0  64 69 72 65 63 74 6f 72  79 20 76 69 65 77 65 72  |directory viewer|
00006dd0  2e 22 2c 31 29 0d 25 c6  06 20 e1 0d 25 d0 06 20  |.",1).%.. ..%.. |
00006de0  cd 0d 25 da 15 c8 99 20  22 48 6f 75 72 67 6c 61  |..%.... "Hourgla|
00006df0  73 73 5f 4f 6e 22 0d 25  e4 44 ee 20 85 20 ea 20  |ss_On".%.D. . . |
00006e00  ff 28 22 46 58 20 32 32  39 2c 31 22 29 20 3a 20  |.("FX 229,1") : |
00006e10  c8 99 20 22 48 6f 75 72  67 6c 61 73 73 5f 4f 66  |.. "Hourglass_Of|
00006e20  66 22 20 3a 20 54 25 3d  a4 43 68 65 63 6b 4f 4b  |f" : T%=.CheckOK|
00006e30  28 f6 24 2c 31 29 20 3a  20 e1 0d 25 ee 26 ff 28  |(.$,1) : ..%.&.(|
00006e40  22 46 58 20 32 32 39 2c  30 22 29 20 3a f4 20 65  |"FX 229,0") :. e|
00006e50  6e 61 62 6c 65 20 65 73  63 61 70 65 20 6b 65 79  |nable escape key|
00006e60  0d 25 f8 31 e7 20 43 48  41 4e 47 45 44 25 20 20  |.%.1. CHANGED%  |
00006e70  84 20 28 28 28 6c 61 64  64 72 25 3e 3e 32 30 29  |. (((laddr%>>20)|
00006e80  80 26 46 46 46 29 20 3c  3e 20 26 46 46 46 29 20  |.&FFF) <> &FFF) |
00006e90  8c 0d 26 02 2a 20 20 f4  20 66 69 6c 65 20 63 68  |..&.*  . file ch|
00006ea0  61 6e 67 65 64 20 6f 72  20 77 61 73 6e 27 74 20  |anged or wasn't |
00006eb0  74 69 6d 65 73 74 61 6d  70 65 64 0d 26 0c 18 20  |timestamped.&.. |
00006ec0  20 f4 20 67 65 74 20 63  75 72 72 65 6e 74 20 74  | . get current t|
00006ed0  69 6d 65 0d 26 16 26 20  20 62 6c 6f 63 6b 3f 30  |ime.&.&  block?0|
00006ee0  3d 33 3a c8 99 20 22 4f  53 5f 57 6f 72 64 22 2c  |=3:.. "OS_Word",|
00006ef0  26 30 45 2c 62 6c 6f 63  6b 0d 26 20 14 20 20 6c  |&0E,block.& .  l|
00006f00  61 64 64 72 25 3d 62 6c  6f 63 6b 3f 34 0d 26 2a  |addr%=block?4.&*|
00006f10  14 20 20 65 61 64 64 72  25 3d 62 6c 6f 63 6b 21  |.  eaddr%=block!|
00006f20  30 0d 26 34 07 20 20 cd  0d 26 3e 33 f4 20 66 6f  |0.&4.  ..&>3. fo|
00006f30  72 63 65 20 6d 75 73 69  63 20 66 69 6c 65 20 74  |rce music file t|
00006f40  79 70 65 2c 20 61 6e 64  20 70 72 65 73 65 72 76  |ype, and preserv|
00006f50  65 20 74 69 6d 65 73 74  61 6d 70 0d 26 48 3c 6c  |e timestamp.&H<l|
00006f60  61 64 64 72 25 3d 28 6c  61 64 64 72 25 20 80 20  |addr%=(laddr% . |
00006f70  26 46 46 29 20 84 20 28  26 46 46 46 3c 3c 32 30  |&FF) . (&FFF<<20|
00006f80  29 20 84 20 28 4d 75 73  69 63 46 69 6c 65 54 79  |) . (MusicFileTy|
00006f90  70 65 25 3c 3c 38 29 0d  26 52 37 f4 20 49 20 64  |pe%<<8).&R7. I d|
00006fa0  6f 6e 27 74 20 6b 6e 6f  77 20 77 68 61 74 20 74  |on't know what t|
00006fb0  68 65 20 6c 65 6e 67 74  68 20 77 69 6c 6c 20 62  |he length will b|
00006fc0  65 2c 20 73 6f 20 75 73  65 20 7a 65 72 6f 0d 26  |e, so use zero.&|
00006fd0  5c 2f c8 99 20 22 4f 53  5f 46 69 6c 65 22 2c 20  |\/.. "OS_File", |
00006fe0  26 30 37 2c 20 46 24 2c  20 6c 61 64 64 72 25 2c  |&07, F$, laddr%,|
00006ff0  20 65 61 64 64 72 25 2c  20 30 2c 20 30 0d 26 66  | eaddr%, 0, 0.&f|
00007000  2d f4 20 4f 50 45 4e 55  50 2c 20 65 72 72 6f 72  |-. OPENUP, error|
00007010  20 69 66 20 64 69 72 65  63 74 6f 72 79 20 6f 72  | if directory or|
00007020  20 6e 6f 74 20 66 6f 75  6e 64 0d 26 70 21 c8 99  | not found.&p!..|
00007030  20 22 4f 53 5f 46 69 6e  64 22 2c 20 26 43 43 2c  | "OS_Find", &CC,|
00007040  20 46 24 20 b8 20 46 49  4c 45 25 0d 26 7a 3a f4  | F$ . FILE%.&z:.|
00007050  20 74 69 6d 65 73 74 61  6d 70 20 69 73 20 61 75  | timestamp is au|
00007060  74 6f 6d 61 74 69 63 61  6c 6c 79 20 75 70 64 61  |tomatically upda|
00007070  74 65 64 20 6f 6e 20 31  73 74 20 62 79 74 65 20  |ted on 1st byte |
00007080  77 72 69 74 65 0d 26 84  15 d5 23 46 49 4c 45 25  |write.&...#FILE%|
00007090  2c 22 4d 61 65 73 74 72  6f 22 0d 26 8e 0d d5 23  |,"Maestro".&...#|
000070a0  46 49 4c 45 25 2c 32 0d  26 98 0b f2 73 4d 75 73  |FILE%,2.&...sMus|
000070b0  69 63 0d 26 a2 0c f2 73  53 74 61 76 65 73 0d 26  |ic.&...sStaves.&|
000070c0  ac 11 f2 73 49 6e 73 74  72 75 6d 65 6e 74 73 0d  |...sInstruments.|
000070d0  26 b6 0d f2 73 56 6f 6c  75 6d 65 73 0d 26 c0 0d  |&...sVolumes.&..|
000070e0  f2 73 53 74 65 72 65 6f  73 0d 26 ca 0b f2 73 54  |.sStereos.&...sT|
000070f0  65 6d 70 6f 0d 26 d4 13  d9 23 46 49 4c 45 25 3a  |empo.&...#FILE%:|
00007100  46 49 4c 45 25 3d a3 0d  26 de 36 e7 20 28 ac 20  |FILE%=..&.6. (. |
00007110  43 48 41 4e 47 45 44 25  29 20 20 80 20 28 28 28  |CHANGED%)  . (((|
00007120  6c 61 64 64 72 25 3e 3e  32 30 29 20 80 20 26 46  |laddr%>>20) . &F|
00007130  46 46 29 20 3d 20 26 46  46 46 29 20 8c 0d 26 e8  |FF) = &FFF) ..&.|
00007140  2c 20 20 f4 20 66 69 6c  65 20 6e 6f 74 20 63 68  |,  . file not ch|
00007150  61 6e 67 65 64 20 61 6e  64 20 77 61 73 20 74 69  |anged and was ti|
00007160  6d 65 73 74 61 6d 70 65  64 0d 26 f2 23 20 20 f4  |mestamped.&.#  .|
00007170  20 70 72 65 73 65 72 76  65 20 6f 72 69 67 69 6e  | preserve origin|
00007180  61 6c 20 74 69 6d 65 73  74 61 6d 70 0d 26 fc 37  |al timestamp.&.7|
00007190  20 20 c8 99 20 4f 53 5f  46 69 6c 65 2c 32 2c 46  |  .. OS_File,2,F|
000071a0  24 2c 6c 61 64 64 72 25  20 3a f4 20 72 65 2d 73  |$,laddr% :. re-s|
000071b0  74 61 6d 70 20 77 69 74  68 20 6f 6c 64 20 73 74  |tamp with old st|
000071c0  61 6d 70 0d 27 06 30 20  20 c8 99 20 4f 53 5f 46  |amp.'.0  .. OS_F|
000071d0  69 6c 65 2c 33 2c 46 24  2c 2c 65 61 64 64 72 25  |ile,3,F$,,eaddr%|
000071e0  20 3a f4 20 6e 62 20 65  61 64 64 72 25 20 69 6e  | :. nb eaddr% in|
000071f0  20 72 33 0d 27 10 07 20  20 cd 0d 27 1a 11 ff 28  | r3.'..  ..'...(|
00007200  22 46 58 20 32 32 39 2c  31 22 29 0d 27 24 17 46  |"FX 229,1").'$.F|
00007210  25 3d a4 47 65 74 46 69  6c 65 49 6e 66 6f 28 46  |%=.GetFileInfo(F|
00007220  24 29 0d 27 2e 0e 43 48  41 4e 47 45 44 25 3d a3  |$).'..CHANGED%=.|
00007230  0d 27 38 12 24 55 70 64  61 74 65 64 25 3d 22 4e  |.'8.$Updated%="N|
00007240  4f 22 0d 27 42 14 f2 55  70 64 61 74 65 54 69 74  |O".'B..UpdateTit|
00007250  6c 65 28 46 24 29 0d 27  4c 35 e7 20 ac 20 54 25  |le(F$).'L5. . T%|
00007260  20 8c 20 ef 37 20 3a 20  54 25 3d a4 43 68 65 63  | . .7 : T%=.Chec|
00007270  6b 4f 4b 28 22 49 6e 76  61 6c 69 64 20 6d 75 73  |kOK("Invalid mus|
00007280  69 63 20 66 69 6c 65 22  2c 31 29 0d 27 56 16 c8  |ic file",1).'V..|
00007290  99 20 22 48 6f 75 72 67  6c 61 73 73 5f 4f 66 66  |. "Hourglass_Off|
000072a0  22 0d 27 60 05 e1 0d 27  6a 04 0d 27 74 0d dd 20  |".'`...'j..'t.. |
000072b0  f2 73 4d 75 73 69 63 0d  27 7e 0a ea 43 25 2c 42  |.sMusic.'~..C%,B|
000072c0  25 0d 27 88 0d d5 23 46  49 4c 45 25 2c 31 0d 27  |%.'...#FILE%,1.'|
000072d0  92 18 f1 23 46 49 4c 45  25 2c 47 41 54 45 25 2d  |...#FILE%,GATE%-|
000072e0  4d 55 53 49 43 25 0d 27  9c 0b e3 43 25 3d 30 b8  |MUSIC%.'...C%=0.|
000072f0  37 0d 27 a6 20 f1 23 46  49 4c 45 25 2c 46 49 4e  |7.'. .#FILE%,FIN|
00007300  45 25 28 43 25 29 2d 4d  55 53 49 43 25 28 43 25  |E%(C%)-MUSIC%(C%|
00007310  29 0d 27 b0 05 ed 0d 27  ba 2c 42 25 3d 4d 55 53  |).'....'.,B%=MUS|
00007320  49 43 25 3a c8 95 42 25  3c 47 41 54 45 25 3a d5  |IC%:..B%<GATE%:.|
00007330  23 46 49 4c 45 25 2c 3f  42 25 3a 42 25 2b 3d 31  |#FILE%,?B%:B%+=1|
00007340  3a ce 0d 27 c4 0b e3 43  25 3d 30 b8 37 0d 27 ce  |:..'...C%=0.7.'.|
00007350  34 42 25 3d 4d 55 53 49  43 25 28 43 25 29 3a c8  |4B%=MUSIC%(C%):.|
00007360  95 42 25 3c 46 49 4e 45  25 28 43 25 29 3a d5 23  |.B%<FINE%(C%):.#|
00007370  46 49 4c 45 25 2c 3f 42  25 3a 42 25 2b 3d 31 3a  |FILE%,?B%:B%+=1:|
00007380  ce 0d 27 d8 05 ed 0d 27  e2 05 e1 0d 27 ec 04 0d  |..'....'....'...|
00007390  27 f6 0e dd 20 f2 73 53  74 61 76 65 73 0d 28 00  |'... .sStaves.(.|
000073a0  0d d5 23 46 49 4c 45 25  2c 32 0d 28 0a 12 d5 23  |..#FILE%,2.(...#|
000073b0  46 49 4c 45 25 2c 53 54  41 56 45 25 0d 28 14 11  |FILE%,STAVE%.(..|
000073c0  d5 23 46 49 4c 45 25 2c  50 45 52 43 25 0d 28 1e  |.#FILE%,PERC%.(.|
000073d0  05 e1 0d 28 28 04 0d 28  32 13 dd 20 f2 73 49 6e  |...((..(2.. .sIn|
000073e0  73 74 72 75 6d 65 6e 74  73 0d 28 3c 07 ea 43 25  |struments.(<..C%|
000073f0  0d 28 46 0d d5 23 46 49  4c 45 25 2c 33 0d 28 50  |.(F..#FILE%,3.(P|
00007400  0b e3 43 25 3d 30 b8 37  0d 28 5a 0e d5 23 46 49  |..C%=0.7.(Z..#FI|
00007410  4c 45 25 2c 43 25 0d 28  64 1d d5 23 46 49 4c 45  |LE%,C%.(d..#FILE|
00007420  25 2c 49 6e 73 74 72 75  6d 65 6e 74 25 28 43 25  |%,Instrument%(C%|
00007430  2c 31 29 0d 28 6e 05 ed  0d 28 78 05 e1 0d 28 82  |,1).(n...(x...(.|
00007440  04 0d 28 8c 0f dd 20 f2  73 56 6f 6c 75 6d 65 73  |..(... .sVolumes|
00007450  0d 28 96 07 ea 43 25 0d  28 a0 0d d5 23 46 49 4c  |.(...C%.(...#FIL|
00007460  45 25 2c 34 0d 28 aa 0b  e3 43 25 3d 30 b8 37 0d  |E%,4.(...C%=0.7.|
00007470  28 b4 18 d5 23 46 49 4c  45 25 2c 56 6f 6c 75 6d  |(...#FILE%,Volum|
00007480  65 73 25 28 43 25 29 0d  28 be 05 ed 0d 28 c8 05  |es%(C%).(....(..|
00007490  e1 0d 28 d2 04 0d 28 dc  0f dd 20 f2 73 53 74 65  |..(...(... .sSte|
000074a0  72 65 6f 73 0d 28 e6 07  ea 43 25 0d 28 f0 0d d5  |reos.(...C%.(...|
000074b0  23 46 49 4c 45 25 2c 35  0d 28 fa 0b e3 43 25 3d  |#FILE%,5.(...C%=|
000074c0  30 b8 37 0d 29 04 20 d5  23 46 49 4c 45 25 2c 53  |0.7.). .#FILE%,S|
000074d0  74 65 72 65 6f 5f 50 6f  73 69 74 69 6f 6e 25 28  |tereo_Position%(|
000074e0  43 25 29 0d 29 0e 05 ed  0d 29 18 05 e1 0d 29 22  |C%).)....)....)"|
000074f0  04 0d 29 2c 0d dd 20 f2  73 54 65 6d 70 6f 0d 29  |..),.. .sTempo.)|
00007500  36 0d d5 23 46 49 4c 45  25 2c 36 0d 29 40 12 d5  |6..#FILE%,6.)@..|
00007510  23 46 49 4c 45 25 2c 54  65 6d 70 6f 25 0d 29 4a  |#FILE%,Tempo%.)J|
00007520  05 e1 0d 29 54 04 0d 29  5e 37 dd 20 f2 73 70 72  |...)T..)^7. .spr|
00007530  69 74 65 28 73 25 2c 58  25 2c 59 25 29 20 3a 20  |ite(s%,X%,Y%) : |
00007540  f4 20 70 6c 6f 74 20 73  70 72 69 74 65 20 53 25  |. plot sprite S%|
00007550  28 73 25 29 20 61 74 20  58 25 2c 59 25 0d 29 68  |(s%) at X%,Y%.)h|
00007560  58 c8 99 20 53 70 72 69  74 65 4f 70 25 2c 20 53  |X.. SpriteOp%, S|
00007570  70 72 50 6c 6f 74 25 2c  20 53 70 72 42 6c 6b 25  |prPlot%, SprBlk%|
00007580  2c 20 53 25 28 73 25 29  2c 20 58 25 2d 78 25 28  |, S%(s%), X%-x%(|
00007590  73 25 29 2c 59 25 2d 79  25 28 73 25 29 2c 20 38  |s%),Y%-y%(s%), 8|
000075a0  2c 20 66 61 63 74 6f 72  73 25 2c 20 70 69 78 74  |, factors%, pixt|
000075b0  72 61 6e 73 25 0d 29 72  34 f4 20 6f 76 65 72 77  |rans%.)r4. overw|
000075c0  72 69 74 65 20 73 63 72  65 65 6e 20 63 6f 6c 6f  |rite screen colo|
000075d0  75 72 2c 20 62 75 74 20  75 73 69 6e 67 20 73 70  |ur, but using sp|
000075e0  72 69 74 65 20 6d 61 73  6b 0d 29 7c 05 e1 0d 29  |rite mask.)|...)|
000075f0  86 04 0d 29 90 16 dd 20  f2 66 6c 6f 61 74 28 73  |...)... .float(s|
00007600  25 2c 58 25 2c 59 25 29  0d 29 9a 07 ea 52 25 0d  |%,X%,Y%).)...R%.|
00007610  29 a4 20 57 69 6e 64 6f  77 25 21 68 61 6e 64 6c  |). Window%!handl|
00007620  65 25 3d 53 63 6f 72 65  57 69 6e 64 5f 68 25 0d  |e%=ScoreWind_h%.|
00007630  29 ae 19 57 69 6e 64 6f  77 25 21 78 31 25 3d 58  |)..Window%!x1%=X|
00007640  25 2b 58 25 28 73 25 29  0d 29 b8 0e 58 25 2d 3d  |%+X%(s%).)..X%-=|
00007650  78 25 28 73 25 29 0d 29  c2 12 57 69 6e 64 6f 77  |x%(s%).)..Window|
00007660  25 21 78 30 25 3d 58 25  0d 29 cc 19 57 69 6e 64  |%!x0%=X%.)..Wind|
00007670  6f 77 25 21 79 31 25 3d  59 25 2b 59 25 28 73 25  |ow%!y1%=Y%+Y%(s%|
00007680  29 0d 29 d6 0e 59 25 2d  3d 79 25 28 73 25 29 0d  |).)..Y%-=y%(s%).|
00007690  29 e0 12 57 69 6e 64 6f  77 25 21 79 30 25 3d 59  |)..Window%!y0%=Y|
000076a0  25 0d 29 ea 2a c8 99 20  55 70 64 61 74 65 57 69  |%.).*.. UpdateWi|
000076b0  6e 64 6f 77 25 2c 2c 57  69 6e 64 6f 77 25 2b 68  |ndow%,,Window%+h|
000076c0  61 6e 64 6c 65 25 20 b8  20 52 25 0d 29 f4 20 58  |andle% . R%.). X|
000076d0  25 2b 3d 57 69 6e 64 6f  77 25 21 78 30 25 2d 57  |%+=Window%!x0%-W|
000076e0  69 6e 64 6f 77 25 21 73  63 78 25 0d 29 fe 20 59  |indow%!scx%.). Y|
000076f0  25 2b 3d 57 69 6e 64 6f  77 25 21 79 31 25 2d 57  |%+=Window%!y1%-W|
00007700  69 6e 64 6f 77 25 21 73  63 79 25 0d 2a 08 14 43  |indow%!scy%.*..C|
00007710  68 53 70 72 69 74 65 25  3d 53 25 28 73 25 29 0d  |hSprite%=S%(s%).|
00007720  2a 12 09 c8 95 20 52 25  0d 2a 1c 0e 20 20 c8 8e  |*.... R%.*..  ..|
00007730  20 73 25 20 20 ca 0d 2a  26 2e 20 20 20 20 c9 20  | s%  ..*&.    . |
00007740  6b 65 79 25 20 20 3a 20  f2 66 6c 6f 61 74 5f 6b  |key%  : .float_k|
00007750  65 79 5f 73 69 67 28 58  25 2c 59 25 2b 79 25 28  |ey_sig(X%,Y%+y%(|
00007760  73 25 29 29 0d 2a 30 28  20 20 20 20 c9 20 74 69  |s%)).*0(    . ti|
00007770  6d 65 25 20 3a 20 f2 66  6c 6f 61 74 5f 74 69 6d  |me% : .float_tim|
00007780  65 5f 73 69 67 28 58 25  2c 59 25 29 0d 2a 3a 34  |e_sig(X%,Y%).*:4|
00007790  20 20 20 20 7f 20 20 3a  20 70 69 78 74 72 61 6e  |    .  : pixtran|
000077a0  73 25 3f 31 20 3d 20 70  69 78 74 72 61 6e 73 25  |s%?1 = pixtrans%|
000077b0  3f 30 20 82 20 70 69 78  74 72 61 6e 73 25 3f 31  |?0 . pixtrans%?1|
000077c0  0d 2a 44 5f 20 20 20 20  20 20 20 20 20 20 20 20  |.*D_            |
000077d0  20 20 20 20 20 c8 99 20  53 70 72 69 74 65 4f 70  |     .. SpriteOp|
000077e0  25 2c 20 53 70 72 50 6c  6f 74 25 2c 20 53 70 72  |%, SprPlot%, Spr|
000077f0  42 6c 6b 25 2c 20 43 68  53 70 72 69 74 65 25 2c  |Blk%, ChSprite%,|
00007800  20 58 25 2c 59 25 2c 20  31 31 2c 20 66 61 63 74  | X%,Y%, 11, fact|
00007810  6f 72 73 25 2c 20 70 69  78 74 72 61 6e 73 25 0d  |ors%, pixtrans%.|
00007820  2a 4e 3c 20 20 20 20 20  20 20 20 20 20 20 20 20  |*N<             |
00007830  20 20 20 20 70 69 78 74  72 61 6e 73 25 3f 31 20  |    pixtrans%?1 |
00007840  3d 20 70 69 78 74 72 61  6e 73 25 3f 30 20 82 20  |= pixtrans%?0 . |
00007850  70 69 78 74 72 61 6e 73  25 3f 31 0d 2a 58 09 20  |pixtrans%?1.*X. |
00007860  20 20 20 cb 0d 2a 62 2c  20 20 c8 99 20 47 65 74  |   ..*b,  .. Get|
00007870  52 65 63 74 61 6e 67 6c  65 25 2c 2c 57 69 6e 64  |Rectangle%,,Wind|
00007880  6f 77 25 2b 68 61 6e 64  6c 65 25 20 b8 20 52 25  |ow%+handle% . R%|
00007890  0d 2a 6c 07 20 20 ce 0d  2a 76 05 e1 0d 2a 80 04  |.*l.  ..*v...*..|
000078a0  0d 2a 8a 1b dd 20 f2 66  6c 6f 61 74 5f 6b 65 79  |.*... .float_key|
000078b0  5f 73 69 67 28 58 25 2c  59 25 29 0d 2a 94 10 ea  |_sig(X%,Y%).*...|
000078c0  49 25 2c 41 25 2c 43 25  2c 57 25 0d 2a 9e 12 e7  |I%,A%,C%,W%.*...|
000078d0  4b 45 59 5f 53 49 47 25  28 31 29 20 8c 0d 2a a8  |KEY_SIG%(1) ..*.|
000078e0  16 43 25 3d 53 43 52 49  42 45 25 28 73 63 6c 65  |.C%=SCRIBE%(scle|
000078f0  66 25 29 0d 2a b2 12 41  25 3d 4b 45 59 5f 53 49  |f%).*..A%=KEY_SI|
00007900  47 25 28 30 29 0d 2a bc  17 49 25 3d 61 63 63 69  |G%(0).*..I%=acci|
00007910  64 65 6e 74 61 6c 25 2b  32 2b 41 25 0d 2a c6 1f  |dental%+2+A%.*..|
00007920  57 25 3d 78 25 28 49 25  29 2b 58 25 28 49 25 29  |W%=x%(I%)+X%(I%)|
00007930  3a 59 25 2d 3d 79 25 28  49 25 29 0d 2a d0 14 43  |:Y%-=y%(I%).*..C|
00007940  68 53 70 72 69 74 65 25  3d 53 25 28 49 25 29 0d  |hSprite%=S%(I%).|
00007950  2a da 1a e3 20 49 25 3d  30 20 b8 20 4b 45 59 5f  |*... I%=0 . KEY_|
00007960  53 49 47 25 28 31 29 2d  31 0d 2a e4 63 c8 99 20  |SIG%(1)-1.*.c.. |
00007970  53 70 72 69 74 65 4f 70  25 2c 20 53 70 72 50 6c  |SpriteOp%, SprPl|
00007980  6f 74 25 2c 20 53 70 72  42 6c 6b 25 2c 20 43 68  |ot%, SprBlk%, Ch|
00007990  53 70 72 69 74 65 25 2c  20 58 25 2c 20 59 25 2b  |Sprite%, X%, Y%+|
000079a0  4c 69 25 2a 4b 65 79 5f  59 25 28 43 25 2c 41 25  |Li%*Key_Y%(C%,A%|
000079b0  2c 49 25 29 2c 20 33 2c  20 66 61 63 74 6f 72 73  |,I%), 3, factors|
000079c0  25 2c 20 70 69 78 74 72  61 6e 73 25 0d 2a ee 0a  |%, pixtrans%.*..|
000079d0  58 25 2b 3d 57 25 0d 2a  f8 05 ed 0d 2b 02 05 cc  |X%+=W%.*....+...|
000079e0  0d 2b 0c 55 c8 99 20 53  70 72 69 74 65 4f 70 25  |.+.U.. SpriteOp%|
000079f0  2c 20 53 70 72 50 6c 6f  74 25 2c 20 53 70 72 42  |, SprPlot%, SprB|
00007a00  6c 6b 25 2c 20 43 68 53  70 72 69 74 65 25 2c 20  |lk%, ChSprite%, |
00007a10  58 25 2c 20 59 25 2d 79  25 28 73 25 29 2c 20 33  |X%, Y%-y%(s%), 3|
00007a20  2c 20 66 61 63 74 6f 72  73 25 2c 20 70 69 78 74  |, factors%, pixt|
00007a30  72 61 6e 73 25 0d 2b 16  05 cd 0d 2b 20 05 e1 0d  |rans%.+....+ ...|
00007a40  2b 2a 04 0d 2b 34 1c dd  20 f2 66 6c 6f 61 74 5f  |+*..+4.. .float_|
00007a50  74 69 6d 65 5f 73 69 67  28 58 25 2c 59 25 29 0d  |time_sig(X%,Y%).|
00007a60  2b 3e 1a c8 99 20 53 65  74 43 6f 6c 6f 75 72 2c  |+>... SetColour,|
00007a70  20 37 20 84 20 33 3c 3c  34 0d 2b 48 52 e7 20 a9  | 7 . 3<<4.+HR. .|
00007a80  28 24 4e 6f 74 65 56 61  6c 75 65 25 29 3e 31 20  |($NoteValue%)>1 |
00007a90  ec 20 58 25 2b 43 5f 57  69 64 74 68 25 81 32 2c  |. X%+C_Width%.2,|
00007aa0  20 59 25 2b 43 5f 48 65  69 67 68 74 25 20 8b 20  | Y%+C_Height% . |
00007ab0  ec 20 58 25 2b 43 5f 57  69 64 74 68 25 2c 20 59  |. X%+C_Width%, Y|
00007ac0  25 2b 43 5f 48 65 69 67  68 74 25 0d 2b 52 11 f1  |%+C_Height%.+R..|
00007ad0  20 24 4e 6f 74 65 56 61  6c 75 65 25 0d 2b 5c 56  | $NoteValue%.+\V|
00007ae0  e7 20 a9 28 24 42 61 72  4c 65 6e 67 74 68 25 29  |. .($BarLength%)|
00007af0  3e 31 20 ec 20 58 25 2b  43 5f 57 69 64 74 68 25  |>1 . X%+C_Width%|
00007b00  81 32 2c 20 59 25 2b 32  2a 43 5f 48 65 69 67 68  |.2, Y%+2*C_Heigh|
00007b10  74 25 20 8b 20 ec 20 58  25 2b 43 5f 57 69 64 74  |t% . . X%+C_Widt|
00007b20  68 25 2c 20 59 25 2b 32  2a 43 5f 48 65 69 67 68  |h%, Y%+2*C_Heigh|
00007b30  74 25 0d 2b 66 11 f1 20  24 42 61 72 4c 65 6e 67  |t%.+f.. $BarLeng|
00007b40  74 68 25 0d 2b 70 05 e1  0d 2b 7a 04 0d 2b 84 51  |th%.+p...+z..+.Q|
00007b50  f4 20 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |. **************|
00007b60  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00007b90  2a 2a 2a 2a 2a 2a 2a 2a  2a 20 52 45 4d 0d 2b 8e  |********* REM.+.|
00007ba0  51 f4 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |Q.              |
00007bb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00007be0  20 20 20 20 20 20 20 20  20 20 20 52 45 4d 0d 2b  |           REM.+|
00007bf0  98 51 f4 20 20 20 20 20  20 20 20 20 4d 20 55 20  |.Q.         M U |
00007c00  53 20 49 20 43 20 20 20  54 20 52 20 41 20 4e 20  |S I C   T R A N |
00007c10  53 20 43 20 52 20 49 20  50 20 54 20 49 20 4f 20  |S C R I P T I O |
00007c20  4e 20 20 20 52 20 4f 20  55 20 54 20 49 20 4e 20  |N   R O U T I N |
00007c30  45 20 53 20 20 20 20 20  20 20 20 20 52 45 4d 0d  |E S         REM.|
00007c40  2b a2 51 f4 20 20 20 20  20 20 20 20 20 20 20 20  |+.Q.            |
00007c50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00007c80  20 20 20 20 20 20 20 20  20 20 20 20 20 52 45 4d  |             REM|
00007c90  0d 2b ac 51 f4 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |.+.Q. **********|
00007ca0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00007cd0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 20 52 45  |************* RE|
00007ce0  4d 0d 2b b6 06 3a 3a 0d  2b c0 1e f4 20 20 20 50  |M.+..::.+...   P|
00007cf0  52 4f 43 45 44 55 52 45  3a 20 73 74 61 72 74 5f  |ROCEDURE: start_|
00007d00  6d 75 73 69 63 0d 2b ca  05 f4 0d 2b d4 2f f4 20  |music.+....+./. |
00007d10  44 45 53 43 52 49 50 54  49 4f 4e 3a 20 49 6e 69  |DESCRIPTION: Ini|
00007d20  74 69 61 6c 69 73 65 20  74 6f 20 73 74 61 72 74  |tialise to start|
00007d30  20 6f 66 20 6d 75 73 69  63 0d 2b de 05 3a 0d 2b  | of music.+..:.+|
00007d40  e8 12 dd 20 f2 73 74 61  72 74 5f 6d 75 73 69 63  |... .start_music|
00007d50  0d 2b f2 08 ea 20 6e 25  0d 2b fc 19 42 41 52 25  |.+... n%.+..BAR%|
00007d60  3d 30 20 3a f4 20 63 75  72 72 65 6e 74 20 62 61  |=0 :. current ba|
00007d70  72 0d 2c 06 45 47 50 25  3d 4d 55 53 49 43 25 3a  |r.,.EGP%=MUSIC%:|
00007d80  f4 20 53 65 74 20 63 75  72 72 65 6e 74 20 67 61  |. Set current ga|
00007d90  74 65 20 70 6f 69 6e 74  65 72 20 74 6f 20 73 74  |te pointer to st|
00007da0  61 72 74 20 6f 66 20 64  69 73 70 6c 61 79 65 64  |art of displayed|
00007db0  20 6d 75 73 69 63 0d 2c  10 11 4e 25 28 29 3d 4d  | music.,..N%()=M|
00007dc0  55 53 49 43 25 28 29 0d  2c 1a 31 43 4c 45 46 25  |USIC%().,.1CLEF%|
00007dd0  28 29 3d 30 3a f4 20 53  74 61 72 74 20 77 69 74  |()=0:. Start wit|
00007de0  68 20 62 61 73 65 20 63  6c 65 66 73 20 28 4e 4f  |h base clefs (NO|
00007df0  54 20 42 41 53 53 21 29  0d 2c 24 36 53 49 47 25  |T BASS!).,$6SIG%|
00007e00  28 30 29 3d 25 30 31 31  30 30 31 31 31 3a f4 20  |(0)=%01100111:. |
00007e10  28 44 65 66 61 75 6c 74  20 74 69 6d 65 20 73 69  |(Default time si|
00007e20  67 20 6f 66 20 34 2f 34  20 74 69 6d 65 29 0d 2c  |g of 4/4 time).,|
00007e30  2e 56 53 49 47 25 28 31  29 3d 25 30 30 30 30 30  |.VSIG%(1)=%00000|
00007e40  30 31 30 3a f4 20 28 44  65 66 61 75 6c 74 20 6f  |010:. (Default o|
00007e50  66 20 43 20 4d 61 6a 6f  72 29 20 46 69 72 73 74  |f C Major) First|
00007e60  20 64 69 73 70 6c 61 79  65 64 20 73 69 67 6e 61  | displayed signa|
00007e70  74 75 72 65 73 20 61 74  74 72 69 62 75 74 65 20  |tures attribute |
00007e80  62 79 74 65 0d 2c 38 09  50 58 25 3d 30 0d 2c 42  |byte.,8.PX%=0.,B|
00007e90  12 f2 50 75 74 42 61 72  49 6e 66 6f 28 30 29 0d  |..PutBarInfo(0).|
00007ea0  2c 4c 05 e1 0d 2c 56 04  0d 2c 60 31 f4 20 20 20  |,L...,V..,`1.   |
00007eb0  50 52 4f 43 45 44 55 52  45 3a 20 6e 6f 74 65 5f  |PROCEDURE: note_|
00007ec0  74 79 70 65 28 43 68 61  6e 6e 65 6c 20 43 25 2c  |type(Channel C%,|
00007ed0  20 54 79 70 65 20 54 25  29 0d 2c 6a 04 0d 2c 74  | Type T%).,j..,t|
00007ee0  17 dd 20 f2 6e 6f 74 65  5f 74 79 70 65 28 43 25  |.. .note_type(C%|
00007ef0  2c 54 25 29 0d 2c 7e 20  4e 25 28 43 25 29 3f 31  |,T%).,~ N%(C%)?1|
00007f00  3d 4e 25 28 43 25 29 3f  31 80 26 31 46 20 84 54  |=N%(C%)?1.&1F .T|
00007f10  25 3c 3c 35 0d 2c 88 05  e1 0d 2c 92 04 0d 2c 9c  |%<<5.,....,...,.|
00007f20  17 dd 20 f2 6e 6f 74 65  5f 64 6f 74 73 28 43 25  |.. .note_dots(C%|
00007f30  2c 44 25 29 0d 2c a6 20  4e 25 28 43 25 29 3f 31  |,D%).,. N%(C%)?1|
00007f40  3d 4e 25 28 43 25 29 3f  31 80 26 45 37 20 84 44  |=N%(C%)?1.&E7 .D|
00007f50  25 3c 3c 33 0d 2c b0 05  e1 0d 2c ba 04 0d 2c c4  |%<<3.,....,...,.|
00007f60  1d dd 20 f2 6e 6f 74 65  5f 61 63 63 69 64 65 6e  |.. .note_acciden|
00007f70  74 61 6c 28 43 25 2c 41  25 29 0d 2c ce 1d 4e 25  |tal(C%,A%).,..N%|
00007f80  28 43 25 29 3f 31 3d 4e  25 28 43 25 29 3f 31 80  |(C%)?1=N%(C%)?1.|
00007f90  26 46 38 20 84 41 25 0d  2c d8 05 e1 0d 2c e2 04  |&F8 .A%.,....,..|
00007fa0  0d 2c ec 37 f4 20 20 20  50 52 4f 43 45 44 55 52  |.,.7.   PROCEDUR|
00007fb0  45 3a 20 6e 6f 74 65 5f  6c 69 6e 65 28 43 68 61  |E: note_line(Cha|
00007fc0  6e 6e 65 6c 20 43 25 2c  20 53 74 61 76 65 20 6c  |nnel C%, Stave l|
00007fd0  69 6e 65 20 4c 25 29 0d  2c f6 05 f4 0d 2d 00 63  |ine L%).,....-.c|
00007fe0  f4 20 20 20 20 20 20 20  20 4e 4f 54 45 3a 20 49  |.        NOTE: I|
00007ff0  66 20 61 20 6e 6f 74 65  27 73 20 70 6f 73 69 74  |f a note's posit|
00008000  69 6f 6e 20 69 73 20 6e  6f 74 20 64 65 66 69 6e  |ion is not defin|
00008010  65 64 20 6f 72 20 73 70  65 63 69 66 69 65 64 20  |ed or specified |
00008020  61 73 20 2d 31 36 2c 20  69 74 20 69 73 20 74 72  |as -16, it is tr|
00008030  65 61 74 65 64 20 61 73  20 61 20 72 65 73 74 0d  |eated as a rest.|
00008040  2d 0a 04 0d 2d 14 17 dd  20 f2 6e 6f 74 65 5f 6c  |-...-... .note_l|
00008050  69 6e 65 28 43 25 2c 4c  25 29 0d 2d 1e 21 3f 4e  |ine(C%,L%).-.!?N|
00008060  25 28 43 25 29 3d 3f 4e  25 28 43 25 29 80 37 20  |%(C%)=?N%(C%).7 |
00008070  84 28 31 36 2b 4c 25 29  3c 3c 33 0d 2d 28 05 e1  |.(16+L%)<<3.-(..|
00008080  0d 2d 32 04 0d 2d 3c 16  dd 20 f2 6e 6f 74 65 5f  |.-2..-<.. .note_|
00008090  74 69 65 28 43 25 2c 54  25 29 0d 2d 46 22 3f 4e  |tie(C%,T%).-F"?N|
000080a0  25 28 43 25 29 3d 3f 4e  25 28 43 25 29 80 26 46  |%(C%)=?N%(C%).&F|
000080b0  42 20 84 28 54 25 3c 3e  30 29 80 34 0d 2d 50 05  |B .(T%<>0).4.-P.|
000080c0  e1 0d 2d 5a 04 0d 2d 64  17 dd 20 f2 6e 6f 74 65  |..-Z..-d.. .note|
000080d0  5f 6a 6f 69 6e 28 43 25  2c 4a 25 29 0d 2d 6e 22  |_join(C%,J%).-n"|
000080e0  3f 4e 25 28 43 25 29 3d  3f 4e 25 28 43 25 29 80  |?N%(C%)=?N%(C%).|
000080f0  26 46 44 20 84 28 4a 25  3c 3e 30 29 80 32 0d 2d  |&FD .(J%<>0).2.-|
00008100  78 05 e1 0d 2d 82 04 0d  2d 8c 17 dd 20 f2 6e 6f  |x...-...-... .no|
00008110  74 65 5f 73 74 65 6d 28  43 25 2c 44 25 29 0d 2d  |te_stem(C%,D%).-|
00008120  96 23 3f 4e 25 28 43 25  29 3d 3f 4e 25 28 43 25  |.#?N%(C%)=?N%(C%|
00008130  29 80 26 46 45 20 84 28  44 25 3c 3e 30 29 80 25  |).&FE .(D%<>0).%|
00008140  31 0d 2d a0 05 e1 0d 2d  aa 04 0d 2d b4 15 dd 20  |1.-....-...-... |
00008150  f2 6e 6f 74 65 5f 63 6c  65 61 72 28 43 25 29 0d  |.note_clear(C%).|
00008160  2d be 18 3f 4e 25 28 43  25 29 3d 30 3a 4e 25 28  |-..?N%(C%)=0:N%(|
00008170  43 25 29 3f 31 3d 30 0d  2d c8 05 e1 0d 2d d2 04  |C%)?1=0.-....-..|
00008180  0d 2d dc 3e f4 20 20 20  50 52 4f 43 45 44 55 52  |.-.>.   PROCEDUR|
00008190  45 3a 20 74 69 6d 65 5f  73 69 67 28 4e 75 6d 62  |E: time_sig(Numb|
000081a0  65 72 20 6f 66 20 62 65  61 74 73 2d 31 20 4e 25  |er of beats-1 N%|
000081b0  2c 42 65 61 74 20 74 79  70 65 20 42 25 29 0d 2d  |,Beat type B%).-|
000081c0  e6 04 0d 2d f0 16 dd 20  f2 74 69 6d 65 5f 73 69  |...-... .time_si|
000081d0  67 28 4e 25 2c 42 25 29  0d 2d fa 22 3f 47 50 25  |g(N%,B%).-."?GP%|
000081e0  3d 30 3a 47 50 25 3f 31  3d 54 69 6d 65 25 84 4e  |=0:GP%?1=Time%.N|
000081f0  25 3c 3c 31 84 42 25 3c  3c 35 0d 2e 04 05 e1 0d  |%<<1.B%<<5......|
00008200  2e 0e 04 0d 2e 18 22 f4  20 20 20 50 52 4f 43 45  |......".   PROCE|
00008210  44 55 52 45 3a 20 6b 65  79 5f 73 69 67 28 4b 65  |DURE: key_sig(Ke|
00008220  79 20 4b 25 29 0d 2e 22  04 0d 2e 2c 15 dd 20 f2  |y K%).."...,.. .|
00008230  6b 65 79 5f 73 69 67 28  41 25 2c 4e 25 29 0d 2e  |key_sig(A%,N%)..|
00008240  36 21 3f 47 50 25 3d 30  3a 47 50 25 3f 31 3d 4b  |6!?GP%=0:GP%?1=K|
00008250  65 79 25 84 41 25 3c 3c  32 84 4e 25 3c 3c 33 0d  |ey%.A%<<2.N%<<3.|
00008260  2e 40 05 e1 0d 2e 4a 04  0d 2e 54 2a f4 20 20 20  |.@....J...T*.   |
00008270  50 52 4f 43 45 44 55 52  45 3a 20 63 6c 65 66 28  |PROCEDURE: clef(|
00008280  53 74 61 76 65 20 53 25  2c 20 43 6c 65 66 20 43  |Stave S%, Clef C|
00008290  25 29 0d 2e 5e 04 0d 2e  68 12 dd 20 f2 63 6c 65  |%)..^...h.. .cle|
000082a0  66 28 53 25 2c 43 25 29  0d 2e 72 22 3f 47 50 25  |f(S%,C%)..r"?GP%|
000082b0  3d 30 3a 47 50 25 3f 31  3d 43 6c 65 66 25 84 43  |=0:GP%?1=Clef%.C|
000082c0  25 3c 3c 33 84 53 25 3c  3c 36 0d 2e 7c 05 e1 0d  |%<<3.S%<<6..|...|
000082d0  2e 86 04 0d 2e 90 0a dd  20 f2 62 61 72 0d 2e 9a  |........ .bar...|
000082e0  15 3f 47 50 25 3d 30 3a  47 50 25 3f 31 3d 42 61  |.?GP%=0:GP%?1=Ba|
000082f0  72 25 0d 2e a4 05 e1 0d  2e ae 04 0d 2e b8 16 dd  |r%..............|
00008300  20 f2 69 6e 73 65 72 74  5f 67 61 74 65 28 57 25  | .insert_gate(W%|
00008310  29 0d 2e c2 07 ea 47 25  0d 2e cc 10 e7 47 50 25  |).....G%.....GP%|
00008320  3c 47 41 54 45 25 20 8c  0d 2e d6 43 e3 47 25 3d  |<GATE% ....C.G%=|
00008330  47 41 54 45 25 2d 57 25  b8 47 50 25 88 2d 34 3a  |GATE%-W%.GP%.-4:|
00008340  47 25 21 57 25 3d 21 47  25 3a ed 3a f4 20 53 68  |G%!W%=!G%:.:. Sh|
00008350  69 66 74 20 75 70 20 62  79 20 57 25 20 66 72 6f  |ift up by W% fro|
00008360  6d 20 69 6e 73 65 72 74  69 6f 6e 0d 2e e0 23 47  |m insertion...#G|
00008370  25 2b 3d 33 3a f4 20 42  79 74 65 20 62 65 66 6f  |%+=3:. Byte befo|
00008380  72 65 20 6c 61 73 74 20  63 6f 70 69 65 64 0d 2e  |re last copied..|
00008390  ea 36 c8 95 47 25 3e 3d  47 50 25 3a 47 25 3f 57  |.6..G%>=GP%:G%?W|
000083a0  25 3d 3f 47 25 3a 47 25  2b 3d b9 3a ce 3a f4 20  |%=?G%:G%+=.:.:. |
000083b0  43 6c 65 61 72 20 75 70  20 69 6e 20 6f 64 64 20  |Clear up in odd |
000083c0  77 6f 72 64 0d 2e f4 05  cd 0d 2e fe 36 47 41 54  |word........6GAT|
000083d0  45 25 2b 3d 57 25 3a f4  20 49 6e 73 65 72 74 20  |E%+=W%:. Insert |
000083e0  67 61 74 65 20 6f 66 20  73 69 7a 65 20 57 25 20  |gate of size W% |
000083f0  69 6e 74 6f 20 67 61 74  65 20 71 75 65 75 65 0d  |into gate queue.|
00008400  2f 08 40 45 50 25 2b 3d  57 25 3a f4 20 54 68 69  |/.@EP%+=W%:. Thi|
00008410  73 20 61 73 73 75 6d 65  73 20 67 61 74 65 73 20  |s assumes gates |
00008420  77 69 6c 6c 20 6f 6e 6c  79 20 62 65 20 69 6e 73  |will only be ins|
00008430  65 72 74 65 64 20 62 65  6c 6f 77 20 45 50 25 0d  |erted below EP%.|
00008440  2f 12 2f 3f 47 50 25 3d  30 3a 47 50 25 3f 28 57  |/./?GP%=0:GP%?(W|
00008450  25 2d 31 29 3d 30 3a f4  20 5a 65 72 6f 69 73 65  |%-1)=0:. Zeroise|
00008460  20 69 6e 73 65 72 74 65  64 20 67 61 74 65 0d 2f  | inserted gate./|
00008470  1c 05 e1 0d 2f 26 04 0d  2f 30 16 dd 20 f2 69 6e  |..../&../0.. .in|
00008480  73 65 72 74 5f 6e 6f 74  65 28 43 25 29 0d 2f 3a  |sert_note(C%)./:|
00008490  07 ea 4e 25 0d 2f 44 17  e7 4e 25 28 43 25 29 3c  |..N%./D..N%(C%)<|
000084a0  46 49 4e 45 25 28 43 25  29 20 8c 0d 2f 4e 42 e3  |FINE%(C%) ../NB.|
000084b0  4e 25 3d 46 49 4e 45 25  28 43 25 29 2d 32 b8 4e  |N%=FINE%(C%)-2.N|
000084c0  25 28 43 25 29 88 2d 34  3a 4e 25 21 32 3d 21 4e  |%(C%).-4:N%!2=!N|
000084d0  25 3a ed 3a f4 20 53 68  69 66 74 20 75 70 20 66  |%:.:. Shift up f|
000084e0  72 6f 6d 20 69 6e 73 65  72 74 69 6f 6e 0d 2f 58  |rom insertion./X|
000084f0  1c 4e 25 2b 3d 33 3a f4  20 4c 61 73 74 20 63 6f  |.N%+=3:. Last co|
00008500  70 69 65 64 20 77 6f 72  64 0d 2f 62 38 c8 95 4e  |pied word./b8..N|
00008510  25 3e 3d 4e 25 28 43 25  29 3a 4e 25 3f 32 3d 3f  |%>=N%(C%):N%?2=?|
00008520  4e 25 3a 4e 25 2b 3d b9  3a ce 3a f4 20 43 6c 65  |N%:N%+=.:.:. Cle|
00008530  61 72 20 75 70 20 69 6e  20 6f 64 64 20 77 6f 72  |ar up in odd wor|
00008540  64 0d 2f 6c 05 cd 0d 2f  76 35 46 49 4e 45 25 28  |d./l.../v5FINE%(|
00008550  43 25 29 2b 3d 32 3a f4  20 49 6e 73 65 72 74 20  |C%)+=2:. Insert |
00008560  61 20 6e 6f 74 65 20 77  6f 72 64 20 69 6e 74 6f  |a note word into|
00008570  20 74 68 69 73 20 71 75  65 75 65 0d 2f 80 23 3f  | this queue./.#?|
00008580  47 50 25 3d 3f 47 50 25  84 25 31 3c 3c 43 25 3a  |GP%=?GP%.%1<<C%:|
00008590  f4 20 4d 61 72 6b 20 69  6e 20 67 61 74 65 0d 2f  |. Mark in gate./|
000085a0  8a 13 f2 6e 6f 74 65 5f  63 6c 65 61 72 28 43 25  |...note_clear(C%|
000085b0  29 0d 2f 94 05 e1 0d 2f  9e 06 3a 3a 0d 2f a8 16  |)./..../..::./..|
000085c0  dd 20 f2 64 65 6c 65 74  65 5f 67 61 74 65 28 57  |. .delete_gate(W|
000085d0  25 29 0d 2f b2 07 ea 47  25 0d 2f bc 0d 47 41 54  |%)./...G%./..GAT|
000085e0  45 25 2d 3d 57 25 0d 2f  c6 2a e7 47 50 25 3c 47  |E%-=W%./.*.GP%<G|
000085f0  41 54 45 25 20 e3 47 25  3d 47 50 25 b8 47 41 54  |ATE% .G%=GP%.GAT|
00008600  45 25 88 34 3a 21 47 25  3d 47 25 21 57 25 3a ed  |E%.4:!G%=G%!W%:.|
00008610  0d 2f d0 3f 45 50 25 2d  3d 57 25 3a f4 20 54 68  |./.?EP%-=W%:. Th|
00008620  69 73 20 61 73 73 75 6d  65 73 20 67 61 74 65 73  |is assumes gates|
00008630  20 77 69 6c 6c 20 6f 6e  6c 79 20 62 65 20 64 65  | will only be de|
00008640  6c 65 74 65 64 20 62 65  6c 6f 77 20 45 50 25 0d  |leted below EP%.|
00008650  2f da 05 e1 0d 2f e4 06  3a 3a 0d 2f ee 16 dd 20  |/..../..::./... |
00008660  f2 64 65 6c 65 74 65 5f  6e 6f 74 65 28 43 25 29  |.delete_note(C%)|
00008670  0d 2f f8 07 ea 4e 25 0d  30 02 10 46 49 4e 45 25  |./...N%.0..FINE%|
00008680  28 43 25 29 2d 3d 32 0d  30 0c 37 e7 4e 25 28 43  |(C%)-=2.0.7.N%(C|
00008690  25 29 3c 46 49 4e 45 25  28 43 25 29 20 e3 4e 25  |%)<FINE%(C%) .N%|
000086a0  3d 4e 25 28 43 25 29 b8  46 49 4e 45 25 28 43 25  |=N%(C%).FINE%(C%|
000086b0  29 88 34 3a 21 4e 25 3d  4e 25 21 32 3a ed 0d 30  |).4:!N%=N%!2:..0|
000086c0  16 17 3f 47 50 25 3d 3f  47 50 25 80 ac 28 25 31  |..?GP%=?GP%..(%1|
000086d0  3c 3c 43 25 29 0d 30 20  05 e1 0d 30 2a 04 0d 30  |<<C%).0 ...0*..0|
000086e0  34 1b dd 20 a4 61 6c 6c  6f 63 61 74 65 5f 63 68  |4.. .allocate_ch|
000086f0  61 6e 6e 65 6c 28 53 25  29 0d 30 3e 0d ea 43 25  |annel(S%).0>..C%|
00008700  2c 63 25 2c 47 25 0d 30  48 0b 47 25 3d 3f 47 50  |,c%,G%.0H.G%=?GP|
00008710  25 0d 30 52 0e 43 25 3d  2d 31 3a 63 25 3d 37 0d  |%.0R.C%=-1:c%=7.|
00008720  30 5c 05 f5 0d 30 66 1d  c8 95 63 25 3e 3d 30 80  |0\...0f...c%>=0.|
00008730  47 25 80 25 31 3c 3c 63  25 3a 63 25 2b 3d b9 3a  |G%.%1<<c%:c%+=.:|
00008740  ce 0d 30 70 1d e7 63 25  3e 3d 30 20 e7 53 5f 43  |..0p..c%>=0 .S_C|
00008750  25 28 63 25 29 3d 53 25  20 43 25 3d 63 25 0d 30  |%(c%)=S% C%=c%.0|
00008760  7a 09 63 25 2b 3d b9 0d  30 84 09 fd 63 25 3c 30  |z.c%+=..0...c%<0|
00008770  0d 30 8e 07 3d 43 25 0d  30 98 04 0d 30 a2 18 dd  |.0..=C%.0...0...|
00008780  20 f2 61 72 72 61 6e 67  65 5f 73 74 61 76 65 28  | .arrange_stave(|
00008790  53 25 29 0d 30 ac 0a ea  43 25 2c 42 25 0d 30 b6  |S%).0...C%,B%.0.|
000087a0  0d 42 25 3d b9 3a 43 25  3d b9 0d 30 c0 23 e7 3f  |.B%=.:C%=..0.#.?|
000087b0  47 50 25 20 8b f5 47 50  25 2b 3d 32 3a fd 3f 47  |GP% ..GP%+=2:.?G|
000087c0  50 25 84 47 50 25 3e 3d  47 41 54 45 25 0d 30 ca  |P%.GP%>=GATE%.0.|
000087d0  12 c8 95 42 25 80 47 50  25 3c 47 41 54 45 25 0d  |...B%.GP%<GATE%.|
000087e0  30 d4 14 43 25 3d 43 25  84 a4 73 6f 72 74 5f 67  |0..C%=C%..sort_g|
000087f0  61 74 65 0d 30 de 1c f2  73 6b 69 70 5f 6e 6f 74  |ate.0...skip_not|
00008800  65 73 28 3f 47 50 25 29  3a 47 50 25 2b 3d 31 0d  |es(?GP%):GP%+=1.|
00008810  30 e8 2e e7 3f 47 50 25  20 8b 42 25 3d 43 25 3a  |0...?GP% .B%=C%:|
00008820  43 25 3d a3 3a f5 47 50  25 2b 3d 32 3a fd 3f 47  |C%=.:.GP%+=2:.?G|
00008830  50 25 84 47 50 25 3e 3d  47 41 54 45 25 0d 30 f2  |P%.GP%>=GATE%.0.|
00008840  05 ce 0d 30 fc 05 e1 0d  31 06 04 0d 31 10 10 dd  |...0....1...1...|
00008850  20 a4 73 6f 72 74 5f 67  61 74 65 0d 31 1a 30 ea  | .sort_gate.1.0.|
00008860  43 25 2c 4e 43 25 2c 4e  4e 25 2c 47 25 2c 67 25  |C%,NC%,NN%,G%,g%|
00008870  2c 70 67 25 2c 64 25 2c  73 68 6f 72 74 65 73 74  |,pg%,d%,shortest|
00008880  25 2c 47 63 68 61 6e 67  65 64 25 0d 31 24 11 73  |%,Gchanged%.1$.s|
00008890  68 6f 72 74 65 73 74 25  3d 32 35 35 0d 31 2e 0b  |hortest%=255.1..|
000088a0  47 25 3d 3f 47 50 25 0d  31 38 1a 67 25 3d a4 70  |G%=?GP%.18.g%=.p|
000088b0  72 65 76 69 6f 75 73 5f  67 61 74 65 28 47 50 25  |revious_gate(GP%|
000088c0  29 0d 31 42 1c 70 67 25  3d a4 70 72 65 63 65 64  |).1B.pg%=.preced|
000088d0  69 6e 67 5f 67 61 74 65  28 47 50 25 29 0d 31 4c  |ing_gate(GP%).1L|
000088e0  0a 4e 43 25 3d 2d 31 0d  31 56 0a 4e 4e 25 3d 2d  |.NC%=-1.1V.NN%=-|
000088f0  31 0d 31 60 0b e3 43 25  3d 30 b8 37 0d 31 6a 12  |1.1`..C%=0.7.1j.|
00008900  e7 53 5f 43 25 28 43 25  29 3d 53 25 20 8c 0d 31  |.S_C%(C%)=S% ..1|
00008910  74 32 4e 43 25 2b 3d 31  3a 6e 25 28 4e 43 25 29  |t2NC%+=1:n%(NC%)|
00008920  3d 43 25 3a e7 47 25 80  25 31 3c 3c 43 25 20 4e  |=C%:.G%.%1<<C% N|
00008930  4e 25 2b 3d 31 3a 43 25  28 4e 4e 25 29 3d 43 25  |N%+=1:C%(NN%)=C%|
00008940  0d 31 7e 41 e7 70 67 25  80 25 31 3c 3c 43 25 20  |.1~A.pg%.%1<<C% |
00008950  64 25 3d 4e 25 28 43 25  29 3f 2d 31 3e 3e 33 82  |d%=N%(C%)?-1>>3.|
00008960  25 31 31 31 30 30 3a e7  64 25 3c 73 68 6f 72 74  |%11100:.d%<short|
00008970  65 73 74 25 20 73 68 6f  72 74 65 73 74 25 3d 64  |est% shortest%=d|
00008980  25 0d 31 88 05 cd 0d 31  92 05 ed 0d 31 9c 1e 73  |%.1....1....1..s|
00008990  68 6f 72 74 65 73 74 25  3d 73 68 6f 72 74 65 73  |hortest%=shortes|
000089a0  74 25 82 25 31 31 31 30  30 0d 31 a6 1a e7 67 25  |t%.%11100.1...g%|
000089b0  80 4e 43 25 3e 30 80 4e  4e 25 3e 3d 30 20 f2 73  |.NC%>0.NN%>=0 .s|
000089c0  6f 72 74 0d 31 b0 0e 3d  47 63 68 61 6e 67 65 64  |ort.1..=Gchanged|
000089d0  25 0d 31 ba 04 0d 31 c4  0b dd 20 f2 73 6f 72 74  |%.1...1... .sort|
000089e0  0d 31 ce 0a ea 4e 25 2c  4d 25 0d 31 d8 0b 63 25  |.1...N%,M%.1..c%|
000089f0  28 29 3d 2d 31 0d 31 e2  0d e3 4d 25 3d 30 b8 4e  |()=-1.1...M%=0.N|
00008a00  43 25 0d 31 ec 0d e3 4e  25 3d 30 b8 4e 4e 25 0d  |C%.1...N%=0.NN%.|
00008a10  31 f6 2d e7 a4 73 61 6d  65 5f 70 69 74 63 68 28  |1.-..same_pitch(|
00008a20  6e 25 28 4d 25 29 2c 43  25 28 4e 25 29 29 20 63  |n%(M%),C%(N%)) c|
00008a30  25 28 4e 25 29 3d 6e 25  28 4d 25 29 0d 32 00 05  |%(N%)=n%(M%).2..|
00008a40  ed 0d 32 0a 05 ed 0d 32  14 0d e3 4e 25 3d 30 b8  |..2....2...N%=0.|
00008a50  4e 4e 25 0d 32 1e 1a e7  63 25 28 4e 25 29 3c 30  |NN%.2...c%(N%)<0|
00008a60  20 63 25 28 4e 25 29 3d  a4 62 65 73 74 0d 32 28  | c%(N%)=.best.2(|
00008a70  05 ed 0d 32 32 0d e3 4e  25 3d 30 b8 4e 4e 25 0d  |...22..N%=0.NN%.|
00008a80  32 3c 5d e7 43 25 28 4e  25 29 3d 63 25 28 4e 25  |2<].C%(N%)=c%(N%|
00008a90  29 20 8b 47 63 68 61 6e  67 65 64 25 3d b9 3a 4d  |) .Gchanged%=.:M|
00008aa0  25 3d a4 69 6e 28 63 25  28 4e 25 29 2c 43 25 28  |%=.in(c%(N%),C%(|
00008ab0  29 29 3a e7 4d 25 3e 4e  25 20 f2 73 77 61 70 5f  |)):.M%>N% .swap_|
00008ac0  6e 6f 74 65 73 28 4e 25  2c 4d 25 29 20 8b f2 6d  |notes(N%,M%) ..m|
00008ad0  6f 76 65 5f 6e 6f 74 65  28 4e 25 29 0d 32 46 05  |ove_note(N%).2F.|
00008ae0  ed 0d 32 50 05 e1 0d 32  5a 04 0d 32 64 18 dd 20  |..2P...2Z..2d.. |
00008af0  f2 73 77 61 70 5f 6e 6f  74 65 73 28 4e 25 2c 4d  |.swap_notes(N%,M|
00008b00  25 29 0d 32 6e 0a ea 73  25 2c 64 25 0d 32 78 17  |%).2n..s%,d%.2x.|
00008b10  73 25 3d 43 25 28 4e 25  29 3a 64 25 3d 63 25 28  |s%=C%(N%):d%=c%(|
00008b20  4e 25 29 0d 32 82 13 c8  94 43 25 28 4e 25 29 2c  |N%).2....C%(N%),|
00008b30  43 25 28 4d 25 29 0d 32  8c 15 c8 94 3f 4e 25 28  |C%(M%).2....?N%(|
00008b40  73 25 29 2c 3f 4e 25 28  64 25 29 0d 32 96 17 c8  |s%),?N%(d%).2...|
00008b50  94 4e 25 28 73 25 29 3f  31 2c 4e 25 28 64 25 29  |.N%(s%)?1,N%(d%)|
00008b60  3f 31 0d 32 a0 05 e1 0d  32 aa 04 0d 32 b4 14 dd  |?1.2....2...2...|
00008b70  20 f2 6d 6f 76 65 5f 6e  6f 74 65 28 4e 25 29 0d  | .move_note(N%).|
00008b80  32 be 0a ea 73 25 2c 64  25 0d 32 c8 17 73 25 3d  |2...s%,d%.2..s%=|
00008b90  43 25 28 4e 25 29 3a 64  25 3d 63 25 28 4e 25 29  |C%(N%):d%=c%(N%)|
00008ba0  0d 32 d2 14 f2 69 6e 73  65 72 74 5f 6e 6f 74 65  |.2...insert_note|
00008bb0  28 64 25 29 0d 32 dc 13  3f 4e 25 28 64 25 29 3d  |(d%).2..?N%(d%)=|
00008bc0  3f 4e 25 28 73 25 29 0d  32 e6 15 4e 25 28 64 25  |?N%(s%).2..N%(d%|
00008bd0  29 3f 31 3d 4e 25 28 73  25 29 3f 31 0d 32 f0 14  |)?1=N%(s%)?1.2..|
00008be0  f2 64 65 6c 65 74 65 5f  6e 6f 74 65 28 73 25 29  |.delete_note(s%)|
00008bf0  0d 32 fa 05 e1 0d 33 04  04 0d 33 0e 0b dd 20 a4  |.2....3...3... .|
00008c00  62 65 73 74 0d 33 18 0a  ea 4e 25 2c 43 25 0d 33  |best.3...N%,C%.3|
00008c10  22 23 ea 20 73 68 6f 72  74 25 2c 66 72 65 65 25  |"#. short%,free%|
00008c20  2c 72 65 73 74 25 2c 61  6e 79 25 2c 74 69 65 64  |,rest%,any%,tied|
00008c30  25 0d 33 2c 11 e3 20 4e  25 3d 4e 43 25 b8 30 88  |%.3,.. N%=NC%.0.|
00008c40  2d 31 0d 33 36 0d 43 25  3d 6e 25 28 4e 25 29 0d  |-1.36.C%=n%(N%).|
00008c50  33 40 15 e7 a4 69 6e 28  43 25 2c 63 25 28 29 29  |3@...in(C%,c%())|
00008c60  3c 30 20 8c 0d 33 4a 12  e7 4e 25 28 43 25 29 3f  |<0 ..3J..N%(C%)?|
00008c70  2d 32 80 34 20 8c 0d 33  54 0e 74 69 65 64 25 3d  |-2.4 ..3T.tied%=|
00008c80  43 25 2b 31 0d 33 5e 05  cc 0d 33 68 11 e7 70 67  |C%+1.3^...3h..pg|
00008c90  25 80 25 31 3c 3c 43 25  20 8c 0d 33 72 29 e7 28  |%.%1<<C% ..3r).(|
00008ca0  4e 25 28 43 25 29 3f 2d  31 3e 3e 33 29 3d 73 68  |N%(C%)?-1>>3)=sh|
00008cb0  6f 72 74 65 73 74 25 20  73 68 6f 72 74 25 3d 43  |ortest% short%=C|
00008cc0  25 2b 31 0d 33 7c 1e e7  4e 25 28 43 25 29 3f 2d  |%+1.3|..N%(C%)?-|
00008cd0  32 80 26 46 38 20 8b 72  65 73 74 25 3d 43 25 2b  |2.&F8 .rest%=C%+|
00008ce0  31 0d 33 86 05 cc 0d 33  90 0e 66 72 65 65 25 3d  |1.3....3..free%=|
00008cf0  43 25 2b 31 0d 33 9a 05  cd 0d 33 a4 0d 61 6e 79  |C%+1.3....3..any|
00008d00  25 3d 43 25 2b 31 0d 33  ae 05 cd 0d 33 b8 05 cd  |%=C%+1.3....3...|
00008d10  0d 33 c2 05 ed 0d 33 cc  50 e7 73 68 6f 72 74 25  |.3....3.P.short%|
00008d20  20 43 25 3d 73 68 6f 72  74 25 20 8b e7 66 72 65  | C%=short% ..fre|
00008d30  65 25 20 43 25 3d 66 72  65 65 25 20 8b e7 72 65  |e% C%=free% ..re|
00008d40  73 74 25 20 43 25 3d 72  65 73 74 25 20 8b e7 61  |st% C%=rest% ..a|
00008d50  6e 79 25 20 43 25 3d 61  6e 79 25 20 8b 43 25 3d  |ny% C%=any% .C%=|
00008d60  74 69 65 64 25 0d 33 d6  09 3d 43 25 2d 31 0d 33  |tied%.3..=C%-1.3|
00008d70  e0 04 0d 33 ea 12 dd 20  a4 69 6e 28 55 25 2c 55  |...3... .in(U%,U|
00008d80  25 28 29 29 0d 33 f4 0e  ea 49 25 3a 49 25 3d 4e  |%()).3...I%:I%=N|
00008d90  4e 25 0d 33 fe 1b c8 95  49 25 80 55 25 3c 3e 55  |N%.3....I%.U%<>U|
00008da0  25 28 49 25 29 3a 49 25  2d 3d 31 3a ce 0d 34 08  |%(I%):I%-=1:..4.|
00008db0  14 3d 49 25 2b 28 55 25  3c 3e 55 25 28 49 25 29  |.=I%+(U%<>U%(I%)|
00008dc0  29 0d 34 12 04 0d 34 1c  89 dd 20 a4 73 61 6d 65  |).4...4... .same|
00008dd0  5f 70 69 74 63 68 28 63  25 2c 43 25 29 3a ea 52  |_pitch(c%,C%):.R|
00008de0  25 2c 72 25 3a 52 25 3d  3f 4e 25 28 43 25 29 80  |%,r%:R%=?N%(C%).|
00008df0  26 46 38 3a 72 25 3d 4e  25 28 63 25 29 3f 2d 32  |&F8:r%=N%(c%)?-2|
00008e00  80 26 46 38 3a 3d 4e 25  28 63 25 29 2d 32 3e 3d  |.&F8:=N%(c%)-2>=|
00008e10  4d 55 53 49 43 25 28 63  25 29 80 28 67 25 84 28  |MUSIC%(c%).(g%.(|
00008e20  4e 25 28 63 25 29 3f 2d  32 80 34 29 3d 34 29 80  |N%(c%)?-2.4)=4).|
00008e30  25 31 3c 3c 63 25 80 28  52 25 82 72 25 29 3d a3  |%1<<c%.(R%.r%)=.|
00008e40  20 80 28 a3 3c 3e 52 25  82 72 25 3d a3 29 0d 34  | .(.<>R%.r%=.).4|
00008e50  26 04 0d 34 30 1a dd 20  a4 70 72 65 63 65 64 69  |&..40.. .precedi|
00008e60  6e 67 5f 67 61 74 65 28  67 70 25 29 0d 34 3a 0b  |ng_gate(gp%).4:.|
00008e70  ea 43 25 2c 67 6d 25 0d  34 44 27 e3 43 25 3d 30  |.C%,gm%.4D'.C%=0|
00008e80  b8 37 3a e7 53 5f 43 25  28 43 25 29 3d 53 25 20  |.7:.S_C%(C%)=S% |
00008e90  67 6d 25 3d 67 6d 25 84  25 31 3c 3c 43 25 0d 34  |gm%=gm%.%1<<C%.4|
00008ea0  4e 05 ed 0d 34 58 05 f5  0d 34 62 0a 67 70 25 2d  |N...4X...4b.gp%-|
00008eb0  3d 31 0d 34 6c 23 fd 67  6d 25 80 3f 67 70 25 84  |=1.4l#.gm%.?gp%.|
00008ec0  67 70 25 3c 4d 55 53 49  43 25 2b 32 84 67 70 25  |gp%<MUSIC%+2.gp%|
00008ed0  3f 2d 31 3d a3 0d 34 76  20 3d 3f 67 70 25 80 67  |?-1=..4v =?gp%.g|
00008ee0  70 25 3e 4d 55 53 49 43  25 2b 31 80 67 70 25 3f  |p%>MUSIC%+1.gp%?|
00008ef0  2d 31 3c 3e a3 0d 34 80  04 0d 34 8a 19 dd 20 a4  |-1<>..4...4... .|
00008f00  70 72 65 76 69 6f 75 73  5f 67 61 74 65 28 67 70  |previous_gate(gp|
00008f10  25 29 0d 34 94 0b ea 43  25 2c 67 6d 25 0d 34 9e  |%).4...C%,gm%.4.|
00008f20  27 e3 43 25 3d 30 b8 37  3a e7 53 5f 43 25 28 43  |'.C%=0.7:.S_C%(C|
00008f30  25 29 3d 53 25 20 67 6d  25 3d 67 6d 25 84 25 31  |%)=S% gm%=gm%.%1|
00008f40  3c 3c 43 25 0d 34 a8 05  ed 0d 34 b2 05 f5 0d 34  |<<C%.4....4....4|
00008f50  bc 0a 67 70 25 2d 3d 31  0d 34 c6 22 c8 95 67 70  |..gp%-=1.4."..gp|
00008f60  25 3e 4d 55 53 49 43 25  80 67 70 25 3f 2d 31 3d  |%>MUSIC%.gp%?-1=|
00008f70  a3 3a 67 70 25 2d 3d 32  3a ce 0d 34 d0 1a fd 67  |.:gp%-=2:..4...g|
00008f80  6d 25 80 3f 67 70 25 84  67 70 25 3c 4d 55 53 49  |m%.?gp%.gp%<MUSI|
00008f90  43 25 2b 32 0d 34 da 16  3d 3f 67 70 25 80 67 70  |C%+2.4..=?gp%.gp|
00008fa0  25 3e 4d 55 53 49 43 25  2b 31 0d 34 e4 04 0d 34  |%>MUSIC%+1.4...4|
00008fb0  ee 19 dd 20 a4 63 6f 6e  66 6c 69 63 74 28 54 25  |... .conflict(T%|
00008fc0  2c 53 25 2c 4c 25 29 0d  34 f8 0b ea 43 25 2c 63  |,S%,L%).4...C%,c|
00008fd0  6f 25 0d 35 02 0a 4c 25  2b 3d 31 36 0d 35 0c 08  |o%.5..L%+=16.5..|
00008fe0  43 25 3d 37 0d 35 16 05  f5 0d 35 20 2f 63 6f 25  |C%=7.5....5 /co%|
00008ff0  3d 3f 47 50 25 80 25 31  3c 3c 43 25 80 53 5f 43  |=?GP%.%1<<C%.S_C|
00009000  25 28 43 25 29 3d 53 25  80 28 3f 4e 25 28 43 25  |%(C%)=S%.(?N%(C%|
00009010  29 3e 3e 33 29 3d 4c 25  0d 35 2a 09 43 25 2b 3d  |)>>3)=L%.5*.C%+=|
00009020  b9 0d 35 34 0d fd 63 6f  25 84 43 25 3c a3 0d 35  |..54..co%.C%<..5|
00009030  3e 10 3d 43 25 2d 28 63  6f 25 3c 3e 30 29 0d 35  |>.=C%-(co%<>0).5|
00009040  48 04 0d 35 52 51 f4 20  2a 2a 2a 2a 2a 2a 2a 2a  |H..5RQ. ********|
00009050  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00009080  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 20  |*************** |
00009090  52 45 4d 0d 35 5c 51 f4  20 20 20 20 20 20 20 20  |REM.5\Q.        |
000090a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000090e0  20 52 45 4d 0d 35 66 51  f4 20 20 20 20 20 20 20  | REM.5fQ.       |
000090f0  20 20 20 20 4d 20 55 20  53 20 49 20 43 20 20 20  |    M U S I C   |
00009100  54 20 59 20 50 20 45 20  53 20 45 20 54 20 54 20  |T Y P E S E T T |
00009110  49 20 4e 20 47 20 20 20  52 20 4f 20 55 20 54 20  |I N G   R O U T |
00009120  49 20 4e 20 45 20 53 20  20 20 20 20 20 20 20 20  |I N E S         |
00009130  20 20 52 45 4d 0d 35 70  51 f4 20 20 20 20 20 20  |  REM.5pQ.      |
00009140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00009180  20 20 20 52 45 4d 0d 35  7a 51 f4 20 2a 2a 2a 2a  |   REM.5zQ. ****|
00009190  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000091d0  2a 2a 2a 20 52 45 4d 0d  35 84 06 3a 3a 0d 35 8e  |*** REM.5..::.5.|
000091e0  33 f4 20 20 20 50 52 4f  43 45 44 55 52 45 3a 20  |3.   PROCEDURE: |
000091f0  73 65 74 5f 73 63 6f 72  65 28 53 74 61 72 74 69  |set_score(Starti|
00009200  6e 67 20 70 6f 73 69 74  69 6f 6e 20 50 58 25 29  |ng position PX%)|
00009210  0d 35 98 05 f4 0d 35 a2  4e f4 20 44 45 53 43 52  |.5....5.N. DESCR|
00009220  49 50 54 49 4f 4e 3a 20  54 79 70 65 73 65 74 20  |IPTION: Typeset |
00009230  6d 75 73 69 63 20 73 63  6f 72 65 20 66 72 6f 6d  |music score from|
00009240  20 63 75 72 72 65 6e 74  20 62 61 72 20 74 6f 20  | current bar to |
00009250  65 6e 64 20 6f 66 20 6d  75 73 69 63 2f 73 63 72  |end of music/scr|
00009260  65 65 6e 0d 35 ac 4b f4  20 20 20 20 20 20 20 20  |een.5.K.        |
00009270  20 20 20 20 20 20 4e 6f  20 64 72 61 77 69 6e 67  |      No drawing|
00009280  20 69 73 20 64 6f 6e 65  20 61 73 20 6f 6e 6c 79  | is done as only|
00009290  20 74 68 65 20 70 6f 73  69 74 69 6f 6e 73 20 61  | the positions a|
000092a0  72 65 20 63 61 6c 63 75  6c 61 74 65 64 2e 0d 35  |re calculated..5|
000092b0  b6 05 f4 0d 35 c0 46 f4  20 20 20 20 20 45 46 46  |....5.F.     EFF|
000092c0  45 43 54 53 3a 20 53 74  6f 72 65 73 20 67 61 74  |ECTS: Stores gat|
000092d0  65 20 58 20 70 6f 73 69  74 69 6f 6e 73 20 26 20  |e X positions & |
000092e0  74 79 70 65 73 20 69 6e  20 50 58 25 28 29 20 26  |types in PX%() &|
000092f0  20 50 54 59 50 45 25 28  29 0d 35 ca 05 3a 0d 35  | PTYPE%().5..:.5|
00009300  d4 15 dd 20 f2 73 65 74  5f 73 63 6f 72 65 28 50  |... .set_score(P|
00009310  58 25 29 0d 35 de 10 c8  95 20 47 50 25 3c 47 41  |X%).5.... GP%<GA|
00009320  54 45 25 0d 35 e8 3f e7  3f 47 50 25 20 f2 73 65  |TE%.5.?.?GP% .se|
00009330  74 5f 6e 6f 74 65 73 28  3f 47 50 25 29 3a 47 50  |t_notes(?GP%):GP|
00009340  25 2b 3d 31 20 8b f2 73  65 74 5f 61 74 74 72 69  |%+=1 ..set_attri|
00009350  62 75 74 65 28 47 50 25  3f 31 29 3a 47 50 25 2b  |bute(GP%?1):GP%+|
00009360  3d 32 0d 35 f2 2c ce 3a  f4 20 55 6e 74 69 6c 20  |=2.5.,.:. Until |
00009370  65 64 67 65 20 6f 66 20  73 63 72 65 65 6e 20 6f  |edge of screen o|
00009380  72 20 65 6e 64 20 6f 66  20 6d 75 73 69 63 0d 35  |r end of music.5|
00009390  fc 35 45 50 25 3d 47 50  25 3a f4 20 4c 61 73 74  |.5EP%=GP%:. Last|
000093a0  20 47 50 25 2c 20 70 6f  69 6e 74 65 72 20 74 6f  | GP%, pointer to|
000093b0  20 66 69 72 73 74 20 75  6e 64 72 61 77 6e 20 67  | first undrawn g|
000093c0  61 74 65 0d 36 06 2e 45  58 25 3d 50 58 25 3a f4  |ate.6..EX%=PX%:.|
000093d0  20 4c 61 73 74 20 50 58  25 2c 20 69 6e 64 65 78  | Last PX%, index|
000093e0  20 74 6f 20 6c 61 73 74  20 70 6f 73 69 74 69 6f  | to last positio|
000093f0  6e 0d 36 10 4f 50 58 25  28 50 58 25 2b 31 29 3d  |n.6.OPX%(PX%+1)=|
00009400  50 58 25 28 50 58 25 29  2b 50 57 25 28 50 58 25  |PX%(PX%)+PW%(PX%|
00009410  29 2b 50 67 61 70 25 3a  f4 20 41 70 70 65 6e 64  |)+Pgap%:. Append|
00009420  61 74 69 6f 6e 20 70 6f  73 69 74 69 6f 6e 20 61  |ation position a|
00009430  66 74 65 72 20 6c 61 73  74 20 73 79 6d 62 6f 6c  |fter last symbol|
00009440  0d 36 1a 4f e7 20 50 58  25 28 50 58 25 2b 31 29  |.6.O. PX%(PX%+1)|
00009450  3e 53 5f 57 69 64 74 68  25 20 f2 53 65 74 45 78  |>S_Width% .SetEx|
00009460  74 65 6e 74 28 50 58 25  28 50 58 25 2b 31 29 2b  |tent(PX%(PX%+1)+|
00009470  31 30 30 2a 48 69 25 29  20 8b 20 f2 53 65 74 45  |100*Hi%) . .SetE|
00009480  78 74 65 6e 74 28 53 5f  57 69 64 74 68 25 29 0d  |xtent(S_Width%).|
00009490  36 24 14 50 58 6e 25 28  4e 42 61 72 73 25 29 3d  |6$.PXn%(NBars%)=|
000094a0  50 58 25 0d 36 2e 2e 50  54 59 50 45 25 28 50 58  |PX%.6..PTYPE%(PX|
000094b0  25 2b 31 29 3d 4e 6f 74  65 25 3a f4 20 4e 6f 74  |%+1)=Note%:. Not|
000094c0  65 20 74 79 70 65 20 62  79 20 64 65 66 61 75 6c  |e type by defaul|
000094d0  74 0d 36 38 05 e1 0d 36  42 06 3a 3a 0d 36 4c 72  |t.68...6B.::.6Lr|
000094e0  f4 20 4e 4f 54 45 3a 20  54 68 65 20 6b 65 79 20  |. NOTE: The key |
000094f0  73 69 67 6e 61 74 75 72  65 20 69 73 20 74 68 65  |signature is the|
00009500  20 6f 6e 6c 79 20 61 74  74 72 69 62 75 74 65 20  | only attribute |
00009510  74 68 61 74 20 6d 75 73  74 20 62 65 20 6b 65 70  |that must be kep|
00009520  74 20 74 72 61 63 6b 20  6f 66 20 69 6e 20 6f 72  |t track of in or|
00009530  64 65 72 20 74 6f 20 65  6e 73 75 72 65 20 63 6f  |der to ensure co|
00009540  72 72 65 63 74 20 73 65  74 74 69 6e 67 2e 0d 36  |rrect setting..6|
00009550  56 89 f4 20 20 20 20 20  20 20 54 68 69 73 20 69  |V..       This i|
00009560  73 20 62 65 63 61 75 73  65 20 61 20 6e 61 74 75  |s because a natu|
00009570  72 61 6c 69 73 69 6e 67  20 73 69 67 6e 61 74 75  |ralising signatu|
00009580  72 65 20 63 6f 6e 73 69  73 74 73 20 6f 66 20 74  |re consists of t|
00009590  68 65 20 73 61 6d 65 20  6e 75 6d 62 65 72 20 6f  |he same number o|
000095a0  66 20 6e 61 74 75 72 61  6c 73 20 61 73 20 61 63  |f naturals as ac|
000095b0  63 69 64 65 6e 74 61 6c  73 20 69 6e 20 74 68 65  |cidentals in the|
000095c0  20 70 72 65 76 69 6f 75  73 20 6b 65 79 20 73 69  | previous key si|
000095d0  67 6e 61 74 75 72 65 0d  36 60 05 3a 0d 36 6a 18  |gnature.6`.:.6j.|
000095e0  dd 20 f2 73 65 74 5f 61  74 74 72 69 62 75 74 65  |. .set_attribute|
000095f0  28 41 25 29 0d 36 74 28  e7 41 25 80 50 54 59 50  |(A%).6t(.A%.PTYP|
00009600  45 25 28 50 58 25 29 2b  b9 20 8b e7 41 25 80 50  |E%(PX%)+. ..A%.P|
00009610  54 59 50 45 25 28 50 58  25 29 20 e1 0d 36 7e 26  |TYPE%(PX%) ..6~&|
00009620  ea 54 25 3a 54 25 3d 25  31 3a e7 41 25 80 25 31  |.T%:T%=%1:.A%.%1|
00009630  20 8b f5 54 25 3d 54 25  3c 3c 31 3a fd 41 25 80  | ..T%=T%<<1:.A%.|
00009640  54 25 0d 36 88 26 50 58  25 28 50 58 25 2b 31 29  |T%.6.&PX%(PX%+1)|
00009650  3d 50 58 25 28 50 58 25  29 2b 50 57 25 28 50 58  |=PX%(PX%)+PW%(PX|
00009660  25 29 2b 50 67 61 70 25  0d 36 92 0a 50 58 25 2b  |%)+Pgap%.6..PX%+|
00009670  3d 31 0d 36 9c 12 50 54  59 50 45 25 28 50 58 25  |=1.6..PTYPE%(PX%|
00009680  29 3d 54 25 0d 36 a6 0b  c8 8e 20 54 25 20 ca 0d  |)=T%.6.... T% ..|
00009690  36 b0 1a c9 54 69 6d 65  25 3a 50 57 25 28 50 58  |6...Time%:PW%(PX|
000096a0  25 29 3d 32 30 2a 48 69  25 0d 36 ba 09 c9 4b 65  |%)=20*Hi%.6...Ke|
000096b0  79 25 0d 36 c4 63 e7 41  25 80 35 36 20 54 25 3d  |y%.6.c.A%.56 T%=|
000096c0  61 63 63 69 64 65 6e 74  61 6c 25 2b 28 41 25 3e  |accidental%+(A%>|
000096d0  3e 32 80 25 31 29 2b 32  3a 53 49 47 25 28 31 29  |>2.%1)+2:SIG%(1)|
000096e0  3d 41 25 20 8b 54 25 3d  61 63 63 69 64 65 6e 74  |=A% .T%=accident|
000096f0  61 6c 25 2b 31 3a c8 94  41 25 2c 53 49 47 25 28  |al%+1:..A%,SIG%(|
00009700  31 29 3a e7 41 25 80 35  36 20 8b 41 25 3d 38 3a  |1):.A%.56 .A%=8:|
00009710  54 25 2b 3d 31 0d 36 ce  26 50 57 25 28 50 58 25  |T%+=1.6.&PW%(PX%|
00009720  29 3d 28 41 25 3e 3e 33  80 37 29 2a 28 78 25 28  |)=(A%>>3.7)*(x%(|
00009730  54 25 29 2b 58 25 28 54  25 29 29 0d 36 d8 2b c9  |T%)+X%(T%)).6.+.|
00009740  43 6c 65 66 25 3a 50 57  25 28 50 58 25 29 3d 78  |Clef%:PW%(PX%)=x|
00009750  25 28 63 6c 65 66 25 2b  33 29 2b 58 25 28 63 6c  |%(clef%+3)+X%(cl|
00009760  65 66 25 2b 33 29 0d 36  e2 18 c9 42 61 72 25 3a  |ef%+3).6...Bar%:|
00009770  50 57 25 28 50 58 25 29  3d 48 69 25 2a 34 0d 36  |PW%(PX%)=Hi%*4.6|
00009780  ec 05 cb 0d 36 f6 05 e1  0d 37 00 04 0d 37 0a 14  |....6....7...7..|
00009790  dd 20 f2 73 65 74 5f 6e  6f 74 65 73 28 47 25 29  |. .set_notes(G%)|
000097a0  0d 37 14 18 ea 6c 78 30  25 2c 6c 78 31 25 2c 6c  |.7...lx0%,lx1%,l|
000097b0  79 30 25 2c 6c 79 31 25  0d 37 1e 42 ea 43 25 2c  |y0%,ly1%.7.B.C%,|
000097c0  50 25 2c 52 25 2c 73 25  3a f4 20 43 68 61 6e 6e  |P%,R%,s%:. Chann|
000097d0  65 6c 2c 20 4e 6f 74 65  20 70 72 65 66 69 78 20  |el, Note prefix |
000097e0  26 20 72 65 6d 61 69 6e  64 65 72 20 77 69 64 74  |& remainder widt|
000097f0  68 73 2c 20 53 70 72 69  74 65 0d 37 28 09 43 25  |hs, Sprite.7(.C%|
00009800  3d 2d 31 0d 37 32 05 f5  0d 37 3c 15 f5 43 25 2d  |=-1.72...7<..C%-|
00009810  3d b9 3a fd 47 25 80 25  31 3c 3c 43 25 0d 37 46  |=.:.G%.%1<<C%.7F|
00009820  18 f2 62 6f 75 6e 64 5f  6e 6f 74 65 28 21 4e 25  |..bound_note(!N%|
00009830  28 43 25 29 29 0d 37 50  25 e7 6c 78 30 25 3e 50  |(C%)).7P%.lx0%>P|
00009840  25 20 50 25 3d 6c 78 30  25 3a f4 20 4d 61 78 69  |% P%=lx0%:. Maxi|
00009850  6d 75 6d 20 70 72 65 66  69 78 0d 37 5a 28 e7 6c  |mum prefix.7Z(.l|
00009860  78 31 25 3e 52 25 20 52  25 3d 6c 78 31 25 3a f4  |x1%>R% R%=lx1%:.|
00009870  20 4d 61 78 69 6d 75 6d  20 72 65 6d 61 69 6e 64  | Maximum remaind|
00009880  65 72 0d 37 64 24 4e 25  28 43 25 29 2b 3d 32 3a  |er.7d$N%(C%)+=2:|
00009890  f4 20 50 75 6c 6c 20 66  72 6f 6d 20 6e 6f 74 65  |. Pull from note|
000098a0  20 71 75 65 75 65 0d 37  6e 2e fd 28 32 3c 3c 43  | queue.7n..(2<<C|
000098b0  25 29 3e 47 25 3a f4 20  55 6e 74 69 6c 20 6e 6f  |%)>G%:. Until no|
000098c0  20 6d 6f 72 65 20 6e 6f  74 65 73 20 28 31 20 62  | more notes (1 b|
000098d0  69 74 73 29 0d 37 78 6e  50 58 25 28 50 58 25 2b  |its).7xnPX%(PX%+|
000098e0  31 29 3d 50 58 25 28 50  58 25 29 2b 50 57 25 28  |1)=PX%(PX%)+PW%(|
000098f0  50 58 25 29 2b 50 67 61  70 25 2b 50 25 3a f4 20  |PX%)+Pgap%+P%:. |
00009900  4e 65 78 74 20 70 6f 73  69 74 69 6f 6e 20 69 73  |Next position is|
00009910  20 70 72 65 76 69 6f 75  73 20 70 6f 73 69 74 69  | previous positi|
00009920  6f 6e 20 2b 20 77 69 64  74 68 2b 67 61 70 2b 70  |on + width+gap+p|
00009930  72 65 66 69 78 20 6f 66  20 6e 65 78 74 20 6e 6f  |refix of next no|
00009940  74 65 0d 37 82 25 50 58  25 2b 3d 31 3a f4 20 6e  |te.7.%PX%+=1:. n|
00009950  65 78 74 20 6e 6f 74 65  20 70 6f 73 69 74 69 6f  |ext note positio|
00009960  6e 20 69 6e 64 65 78 0d  37 8c 23 50 57 25 28 50  |n index.7.#PW%(P|
00009970  58 25 29 3d 52 25 3a f4  20 57 69 64 74 68 20 6f  |X%)=R%:. Width o|
00009980  66 20 6e 65 77 20 6e 6f  74 65 0d 37 96 21 50 54  |f new note.7.!PT|
00009990  59 50 45 25 28 50 58 25  29 3d 4e 6f 74 65 25 3a  |YPE%(PX%)=Note%:|
000099a0  f4 20 4e 6f 74 65 20 74  79 70 65 0d 37 a0 05 e1  |. Note type.7...|
000099b0  0d 37 aa 04 0d 37 b4 15  dd 20 f2 62 6f 75 6e 64  |.7...7... .bound|
000099c0  5f 6e 6f 74 65 28 4c 25  29 0d 37 be 0d ea 48 25  |_note(L%).7...H%|
000099d0  2c 53 25 2c 73 25 0d 37  c8 10 48 25 3d 4c 25 3e  |,S%,s%.7..H%=L%>|
000099e0  3e 38 80 26 46 46 0d 37  d2 3f e7 4c 25 80 26 46  |>8.&FF.7.?.L%.&F|
000099f0  38 20 53 25 3d 48 25 3e  3e 35 84 4c 25 3c 3c 33  |8 S%=H%>>5.L%<<3|
00009a00  80 38 20 8b 53 25 3d 72  65 73 74 25 84 48 25 3e  |.8 .S%=rest%.H%>|
00009a10  3e 35 3a f4 20 4e 6f 74  65 2f 72 65 73 74 20 73  |>5:. Note/rest s|
00009a20  70 72 69 74 65 0d 37 dc  1e 6c 78 30 25 3d 78 25  |prite.7..lx0%=x%|
00009a30  28 53 25 29 3a f4 20 50  72 65 66 69 78 20 77 69  |(S%):. Prefix wi|
00009a40  64 74 68 0d 37 e6 1e 6c  78 31 25 3d 58 25 28 53  |dth.7..lx1%=X%(S|
00009a50  25 29 3a f4 20 53 75 66  66 69 78 20 77 69 64 74  |%):. Suffix widt|
00009a60  68 0d 37 f0 21 6c 79 30  25 3d 79 25 28 53 25 29  |h.7.!ly0%=y%(S%)|
00009a70  3a f4 20 44 65 63 65 6e  64 65 72 20 68 65 69 67  |:. Decender heig|
00009a80  68 74 0d 37 fa 21 6c 79  31 25 3d 59 25 28 53 25  |ht.7.!ly1%=Y%(S%|
00009a90  29 3a f4 20 41 73 63 65  6e 64 65 72 20 68 65 69  |):. Ascender hei|
00009aa0  67 68 74 0d 38 04 0b e7  48 25 80 37 20 8c 0d 38  |ght.8...H%.7 ..8|
00009ab0  0e 17 73 25 3d 61 63 63  69 64 65 6e 74 61 6c 25  |..s%=accidental%|
00009ac0  84 48 25 80 37 0d 38 18  27 6c 78 30 25 2b 3d 78  |.H%.7.8.'lx0%+=x|
00009ad0  25 28 73 25 29 3a f4 20  41 64 64 20 61 63 63 69  |%(s%):. Add acci|
00009ae0  64 65 6e 74 61 6c 20 77  69 64 74 68 0d 38 22 26  |dental width.8"&|
00009af0  e7 79 25 28 73 25 29 3e  6c 79 30 25 20 6c 79 30  |.y%(s%)>ly0% ly0|
00009b00  25 3d 79 25 28 73 25 29  3a f4 20 4c 6f 77 65 72  |%=y%(s%):. Lower|
00009b10  20 3f 0d 38 2c 27 e7 59  25 28 73 25 29 3e 6c 79  | ?.8,'.Y%(s%)>ly|
00009b20  31 25 20 6c 79 31 25 3d  59 25 28 73 25 29 3a f4  |1% ly1%=Y%(s%):.|
00009b30  20 48 69 67 68 65 72 20  3f 0d 38 36 05 cd 0d 38  | Higher ?.86...8|
00009b40  40 6b e7 48 25 80 32 34  20 73 25 3d 64 6f 74 25  |@k.H%.24 s%=dot%|
00009b50  2b 28 48 25 3e 3e 33 80  33 29 3a 6c 78 31 25 3d  |+(H%>>3.3):lx1%=|
00009b60  78 25 28 53 25 29 2b 58  25 28 73 25 29 3a e7 79  |x%(S%)+X%(s%):.y|
00009b70  25 28 73 25 29 3e 6c 79  30 25 20 6c 79 30 25 3d  |%(s%)>ly0% ly0%=|
00009b80  79 25 28 73 25 29 3a f4  20 44 6f 74 20 61 64 64  |y%(s%):. Dot add|
00009b90  73 20 73 75 66 66 69 78  20 61 6e 64 20 6d 61 79  |s suffix and may|
00009ba0  20 62 65 20 6c 6f 77 65  72 0d 38 4a 05 e1 0d 38  | be lower.8J...8|
00009bb0  54 06 3a 3a 0d 38 5e 16  dd 20 f2 70 6f 73 69 74  |T.::.8^.. .posit|
00009bc0  69 6f 6e 5f 73 74 61 76  65 73 0d 38 68 0b ea 20  |ion_staves.8h.. |
00009bd0  59 25 2c 53 25 0d 38 72  38 53 63 6f 72 65 5f 48  |Y%,S%.8r8Score_H|
00009be0  65 69 67 68 74 25 3d 28  50 45 52 43 25 2b 31 2b  |eight%=(PERC%+1+|
00009bf0  33 2a 28 53 54 41 56 45  25 2b 31 29 2b 31 29 2a  |3*(STAVE%+1)+1)*|
00009c00  53 74 61 76 65 5f 48 65  69 67 68 74 25 0d 38 7c  |Stave_Height%.8||
00009c10  25 59 25 3d 2d 53 63 6f  72 65 5f 48 65 69 67 68  |%Y%=-Score_Heigh|
00009c20  74 25 2d 53 74 61 76 65  5f 48 65 69 67 68 74 25  |t%-Stave_Height%|
00009c30  81 32 0d 38 86 44 e7 50  45 52 43 25 20 e3 53 25  |.2.8.D.PERC% .S%|
00009c40  3d 50 45 52 43 25 b8 31  88 2d 31 3a 59 25 2b 3d  |=PERC%.1.-1:Y%+=|
00009c50  53 74 61 76 65 5f 48 65  69 67 68 74 25 3a 59 5f  |Stave_Height%:Y_|
00009c60  53 54 41 56 45 25 28 53  54 41 56 45 25 2b 53 25  |STAVE%(STAVE%+S%|
00009c70  29 3d 59 25 3a ed 0d 38  90 3a e3 20 53 25 3d 53  |)=Y%:..8.:. S%=S|
00009c80  54 41 56 45 25 b8 30 88  2d 31 3a 59 25 2b 3d 33  |TAVE%.0.-1:Y%+=3|
00009c90  2a 53 74 61 76 65 5f 48  65 69 67 68 74 25 3a 59  |*Stave_Height%:Y|
00009ca0  5f 53 54 41 56 45 25 28  53 25 29 3d 59 25 3a ed  |_STAVE%(S%)=Y%:.|
00009cb0  0d 38 9a 05 e1 0d 38 a4  04 0d 38 ae 13 dd 20 f2  |.8....8...8... .|
00009cc0  73 65 74 75 70 5f 73 74  61 76 65 73 0d 38 b8 08  |setup_staves.8..|
00009cd0  ea 20 4f 25 0d 38 c2 14  f2 70 6f 73 69 74 69 6f  |. O%.8...positio|
00009ce0  6e 5f 73 74 61 76 65 73  0d 38 cc 23 53 63 6f 72  |n_staves.8.#Scor|
00009cf0  65 57 42 6c 6b 25 21 68  61 6e 64 6c 65 25 3d 53  |eWBlk%!handle%=S|
00009d00  63 6f 72 65 57 69 6e 64  5f 68 25 0d 38 d6 2a c8  |coreWind_h%.8.*.|
00009d10  99 20 47 65 74 57 69 6e  64 6f 77 53 74 61 74 65  |. GetWindowState|
00009d20  25 2c 2c 53 63 6f 72 65  57 42 6c 6b 25 2b 68 61  |%,,ScoreWBlk%+ha|
00009d30  6e 64 6c 65 25 0d 38 e0  3b 53 63 6f 72 65 57 42  |ndle%.8.;ScoreWB|
00009d40  6c 6b 25 21 79 30 25 3d  53 63 6f 72 65 57 42 6c  |lk%!y0%=ScoreWBl|
00009d50  6b 25 21 79 31 25 2d 53  63 6f 72 65 5f 48 65 69  |k%!y1%-Score_Hei|
00009d60  67 68 74 25 2d 50 61 6e  65 48 65 69 67 68 74 25  |ght%-PaneHeight%|
00009d70  0d 38 ea 33 53 63 6f 72  65 57 42 6c 6b 25 21 73  |.8.3ScoreWBlk%!s|
00009d80  63 78 25 3d 30 3a 53 63  6f 72 65 57 42 6c 6b 25  |cx%=0:ScoreWBlk%|
00009d90  21 73 63 79 25 3d 50 61  6e 65 48 65 69 67 68 74  |!scy%=PaneHeight|
00009da0  25 2f 32 0d 38 f4 18 53  63 6f 72 65 57 42 6c 6b  |%/2.8..ScoreWBlk|
00009db0  25 21 75 6e 64 65 72 25  3d 2d 31 0d 38 fe 26 c8  |%!under%=-1.8.&.|
00009dc0  99 20 4f 70 65 6e 57 69  6e 64 6f 77 25 2c 2c 53  |. OpenWindow%,,S|
00009dd0  63 6f 72 65 57 42 6c 6b  25 2b 68 61 6e 64 6c 65  |coreWBlk%+handle|
00009de0  25 0d 39 08 0c 4c 48 42  41 52 25 3d 30 0d 39 12  |%.9..LHBAR%=0.9.|
00009df0  12 53 63 6f 72 65 43 6c  6f 73 65 64 25 3d a3 0d  |.ScoreClosed%=..|
00009e00  39 1c 20 57 69 6e 64 6f  77 25 21 68 61 6e 64 6c  |9. Window%!handl|
00009e10  65 25 3d 53 63 6f 72 65  57 69 6e 64 5f 68 25 0d  |e%=ScoreWind_h%.|
00009e20  39 26 27 c8 99 20 47 65  74 57 69 6e 64 6f 77 53  |9&'.. GetWindowS|
00009e30  74 61 74 65 25 2c 2c 57  69 6e 64 6f 77 25 2b 68  |tate%,,Window%+h|
00009e40  61 6e 64 6c 65 25 0d 39  30 3f e7 20 54 52 41 4e  |andle%.90?. TRAN|
00009e50  53 43 52 49 42 45 25 20  f2 70 6c 61 63 65 5f 74  |SCRIBE% .place_t|
00009e60  6f 70 5f 70 61 6e 65 73  28 2d 31 29 3a 20 f2 70  |op_panes(-1): .p|
00009e70  6c 61 63 65 5f 62 6f 74  74 6f 6d 5f 70 61 6e 65  |lace_bottom_pane|
00009e80  73 28 2d 31 29 0d 39 3a  1b e7 20 50 4c 41 59 49  |s(-1).9:.. PLAYI|
00009e90  4e 47 25 20 f2 43 68 65  63 6b 53 63 72 6f 6c 6c  |NG% .CheckScroll|
00009ea0  0d 39 44 05 e1 0d 39 4e  04 0d 39 58 44 dd 20 f2  |.9D...9N..9XD. .|
00009eb0  75 70 64 61 74 65 5f 73  63 6f 72 65 28 57 69 6e  |update_score(Win|
00009ec0  64 6f 77 25 21 78 30 25  2c 57 69 6e 64 6f 77 25  |dow%!x0%,Window%|
00009ed0  21 79 30 25 2c 57 69 6e  64 6f 77 25 21 78 31 25  |!y0%,Window%!x1%|
00009ee0  2c 57 69 6e 64 6f 77 25  21 79 31 25 29 0d 39 62  |,Window%!y1%).9b|
00009ef0  20 57 69 6e 64 6f 77 25  21 68 61 6e 64 6c 65 25  | Window%!handle%|
00009f00  3d 53 63 6f 72 65 57 69  6e 64 5f 68 25 0d 39 6c  |=ScoreWind_h%.9l|
00009f10  2a c8 99 20 55 70 64 61  74 65 57 69 6e 64 6f 77  |*.. UpdateWindow|
00009f20  25 2c 2c 57 69 6e 64 6f  77 25 2b 68 61 6e 64 6c  |%,,Window%+handl|
00009f30  65 25 20 b8 20 52 25 0d  39 76 09 c8 95 20 52 25  |e% . R%.9v... R%|
00009f40  0d 39 80 12 da 3a f2 64  72 61 77 5f 73 74 61 76  |.9...:.draw_stav|
00009f50  65 73 0d 39 8a 2a c8 99  20 47 65 74 52 65 63 74  |es.9.*.. GetRect|
00009f60  61 6e 67 6c 65 25 2c 2c  57 69 6e 64 6f 77 25 2b  |angle%,,Window%+|
00009f70  68 61 6e 64 6c 65 25 20  b8 20 52 25 0d 39 94 05  |handle% . R%.9..|
00009f80  ce 0d 39 9e 05 e1 0d 39  a8 04 0d 39 b2 1e f4 20  |..9....9...9... |
00009f90  20 20 50 52 4f 43 45 44  55 52 45 3a 20 64 72 61  |  PROCEDURE: dra|
00009fa0  77 5f 73 74 61 76 65 73  0d 39 bc 05 f4 0d 39 c6  |w_staves.9....9.|
00009fb0  2f f4 20 44 45 53 43 52  49 50 54 49 4f 4e 3a 20  |/. DESCRIPTION: |
00009fc0  44 72 61 77 20 63 75 72  72 65 6e 74 20 73 74 61  |Draw current sta|
00009fd0  76 65 20 73 74 72 75 63  74 75 72 65 0d 39 d0 26  |ve structure.9.&|
00009fe0  f4 20 20 20 20 20 20 20  20 20 20 20 20 20 20 31  |.              1|
00009ff0  20 73 74 61 76 65 20 66  6f 72 20 31 20 76 6f 69  | stave for 1 voi|
0000a000  63 65 0d 39 da 28 f4 20  20 20 20 20 20 20 20 20  |ce.9.(.         |
0000a010  20 20 20 20 20 32 20 73  74 61 76 65 73 20 66 6f  |     2 staves fo|
0000a020  72 20 6b 65 79 62 6f 61  72 64 0d 39 e4 34 f4 20  |r keyboard.9.4. |
0000a030  20 20 20 20 20 20 20 20  20 20 20 20 20 33 20 73  |             3 s|
0000a040  74 61 76 65 73 20 66 6f  72 20 31 20 76 6f 69 63  |taves for 1 voic|
0000a050  65 20 61 6e 64 20 6b 65  79 62 6f 61 72 64 0d 39  |e and keyboard.9|
0000a060  ee 2e f4 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
0000a070  20 34 20 73 74 61 76 65  73 20 66 6f 72 20 34 20  | 4 staves for 4 |
0000a080  76 6f 69 63 65 20 63 68  6f 72 75 73 0d 39 f8 05  |voice chorus.9..|
0000a090  3a 0d 3a 02 12 dd 20 f2  64 72 61 77 5f 73 74 61  |:.:... .draw_sta|
0000a0a0  76 65 73 0d 3a 0c 63 ea  20 59 25 2c 54 25 2c 42  |ves.:.c. Y%,T%,B|
0000a0b0  25 2c 53 25 2c 4c 25 3a  f4 20 59 25 2c 54 25 2c  |%,S%,L%:. Y%,T%,|
0000a0c0  42 25 3d 50 6f 73 69 74  69 6f 6e 20 26 20 59 20  |B%=Position & Y |
0000a0d0  62 6f 75 6e 64 73 20 6f  66 20 65 61 63 68 20 73  |bounds of each s|
0000a0e0  74 61 76 65 2c 20 53 25  3d 53 74 61 76 65 20 69  |tave, S%=Stave i|
0000a0f0  6e 64 65 78 2c 20 4c 25  3d 4c 69 6e 65 20 70 6f  |ndex, L%=Line po|
0000a100  73 69 74 69 6f 6e 0d 3a  16 51 ea 20 78 25 2c 79  |sition.:.Q. x%,y|
0000a110  25 2c 6c 78 31 25 3a f4  20 56 69 72 74 75 61 6c  |%,lx1%:. Virtual|
0000a120  20 63 6f 6f 72 64 69 6e  61 74 65 73 20 6f 66 20  | coordinates of |
0000a130  62 6f 74 74 6f 6d 20 6c  65 66 74 20 26 20 74 6f  |bottom left & to|
0000a140  70 20 72 69 67 68 74 20  6f 66 20 73 63 6f 72 65  |p right of score|
0000a150  20 77 69 6e 64 6f 77 0d  3a 20 36 ea 20 63 25 2c  | window.: 6. c%,|
0000a160  74 25 2c 62 25 3a f4 20  4c 65 66 74 20 65 64 67  |t%,b%:. Left edg|
0000a170  65 20 6f 66 20 63 6c 69  70 20 77 69 6e 64 6f 77  |e of clip window|
0000a180  20 61 6e 64 20 59 20 62  6f 75 6e 64 73 0d 3a 2a  | and Y bounds.:*|
0000a190  1f 79 25 3d 57 69 6e 64  6f 77 25 21 79 31 25 2d  |.y%=Window%!y1%-|
0000a1a0  57 69 6e 64 6f 77 25 21  73 63 79 25 0d 3a 34 1f  |Window%!scy%.:4.|
0000a1b0  78 25 3d 57 69 6e 64 6f  77 25 21 78 30 25 2d 57  |x%=Window%!x0%-W|
0000a1c0  69 6e 64 6f 77 25 21 73  63 78 25 0d 3a 3e 38 6c  |indow%!scx%.:>8l|
0000a1d0  78 31 25 3d 78 25 2b 53  63 6f 72 65 5f 57 69 64  |x1%=x%+Score_Wid|
0000a1e0  74 68 25 3a e7 20 6c 78  31 25 3e 43 6c 69 70 25  |th%:. lx1%>Clip%|
0000a1f0  21 78 31 25 20 6c 78 31  25 3d 43 6c 69 70 25 21  |!x1% lx1%=Clip%!|
0000a200  78 31 25 0d 3a 48 25 63  25 3d 43 6c 69 70 25 21  |x1%.:H%c%=Clip%!|
0000a210  78 30 25 3a e7 63 25 3c  78 25 2b 48 69 25 20 63  |x0%:.c%<x%+Hi% c|
0000a220  25 3d 78 25 2b 48 69 25  0d 3a 52 1d 62 25 3d 43  |%=x%+Hi%.:R.b%=C|
0000a230  6c 69 70 25 21 79 30 25  3a 74 25 3d 43 6c 69 70  |lip%!y0%:t%=Clip|
0000a240  25 21 79 31 25 0d 3a 5c  0c e7 50 45 52 43 25 20  |%!y1%.:\..PERC% |
0000a250  8c 0d 3a 66 1e e3 20 53  25 3d 53 54 41 56 45 25  |..:f.. S%=STAVE%|
0000a260  2b 31 b8 53 54 41 56 45  25 2b 50 45 52 43 25 0d  |+1.STAVE%+PERC%.|
0000a270  3a 70 16 59 25 3d 79 25  2b 59 5f 53 54 41 56 45  |:p.Y%=y%+Y_STAVE|
0000a280  25 28 53 25 29 0d 3a 7a  21 e7 62 25 3c 3d 59 25  |%(S%).:z!.b%<=Y%|
0000a290  80 74 25 3e 3d 59 25 20  86 63 25 2c 59 25 2c 6c  |.t%>=Y% .c%,Y%,l|
0000a2a0  78 31 25 2c 59 25 0d 3a  84 05 ed 0d 3a 8e 05 cd  |x1%,Y%.:....:...|
0000a2b0  0d 3a 98 13 e3 20 53 25  3d 30 20 b8 20 53 54 41  |.:... S%=0 . STA|
0000a2c0  56 45 25 0d 3a a2 40 59  25 3d 79 25 2b 59 5f 53  |VE%.:.@Y%=y%+Y_S|
0000a2d0  54 41 56 45 25 28 53 25  29 3a 54 25 3d 59 25 2b  |TAVE%(S%):T%=Y%+|
0000a2e0  53 74 61 76 65 5f 48 65  69 67 68 74 25 81 32 3a  |Stave_Height%.2:|
0000a2f0  42 25 3d 54 25 2d 53 74  61 76 65 5f 48 65 69 67  |B%=T%-Stave_Heig|
0000a300  68 74 25 0d 3a ac 14 e7  62 25 3c 3d 54 25 80 74  |ht%.:...b%<=T%.t|
0000a310  25 3e 3d 42 25 20 8c 0d  3a b6 29 86 63 25 2c 59  |%>=B% ..:.).c%,Y|
0000a320  25 2c 6c 78 31 25 2c 59  25 3a f4 20 50 6c 6f 74  |%,lx1%,Y%:. Plot|
0000a330  20 63 65 6e 74 72 65 20  62 61 72 20 6c 69 6e 65  | centre bar line|
0000a340  0d 3a c0 15 e3 4c 25 3d  4c 69 25 2a 32 b8 4c 25  |.:...L%=Li%*2.L%|
0000a350  2a 32 88 4c 25 0d 3a ca  2a 86 63 25 2c 59 25 2b  |*2.L%.:.*.c%,Y%+|
0000a360  4c 25 2c 6c 78 31 25 2c  59 25 2b 4c 25 3a f4 20  |L%,lx1%,Y%+L%:. |
0000a370  50 6c 6f 74 20 75 70 70  65 72 20 6c 69 6e 65 0d  |Plot upper line.|
0000a380  3a d4 2a 86 63 25 2c 59  25 2d 4c 25 2c 6c 78 31  |:.*.c%,Y%-L%,lx1|
0000a390  25 2c 59 25 2d 4c 25 3a  f4 20 50 6c 6f 74 20 6c  |%,Y%-L%:. Plot l|
0000a3a0  6f 77 65 72 20 6c 69 6e  65 0d 3a de 05 ed 0d 3a  |ower line.:....:|
0000a3b0  e8 05 cd 0d 3a f2 05 ed  0d 3a fc 13 42 25 3d 53  |....:....:..B%=S|
0000a3c0  63 6f 72 65 5f 57 69 64  74 68 25 0d 3b 06 2e 54  |core_Width%.;..T|
0000a3d0  25 3d 43 6c 69 70 25 21  78 31 25 2d 78 25 3a e7  |%=Clip%!x1%-x%:.|
0000a3e0  54 25 3c 42 25 20 42 25  3d 54 25 3a f4 20 52 69  |T%<B% B%=T%:. Ri|
0000a3f0  67 68 74 20 62 6f 75 6e  64 0d 3b 10 2b 54 25 3d  |ght bound.;.+T%=|
0000a400  43 6c 69 70 25 21 78 30  25 2d 78 25 3a e7 54 25  |Clip%!x0%-x%:.T%|
0000a410  3c 30 20 54 25 3d 30 3a  f4 20 4c 65 66 74 20 62  |<0 T%=0:. Left b|
0000a420  6f 75 6e 64 0d 3b 1a 12  e7 20 ac 20 42 41 44 4d  |ound.;... . BADM|
0000a430  4f 44 45 25 20 8c 0d 3b  24 36 20 20 f2 64 72 61  |ODE% ..;$6  .dra|
0000a440  77 5f 73 63 6f 72 65 28  78 25 2c 79 25 2c 54 25  |w_score(x%,y%,T%|
0000a450  2c 42 25 29 3a f4 20 44  72 61 77 20 73 79 6d 62  |,B%):. Draw symb|
0000a460  6f 6c 73 20 6f 6e 20 73  74 61 76 65 0d 3b 2e 05  |ols on stave.;..|
0000a470  cc 0d 3b 38 24 20 20 ec  20 57 69 6e 64 6f 77 25  |..;8$  . Window%|
0000a480  21 78 30 25 2c 20 57 69  6e 64 6f 77 25 21 79 31  |!x0%, Window%!y1|
0000a490  25 2d 31 30 30 0d 3b 42  38 20 20 f1 20 22 43 61  |%-100.;B8  . "Ca|
0000a4a0  6e 6e 6f 74 20 64 69 73  70 6c 61 79 20 73 63 6f  |nnot display sco|
0000a4b0  72 65 20 69 6e 20 74 68  69 73 20 28 32 35 36 2d  |re in this (256-|
0000a4c0  63 6f 6c 6f 75 72 29 20  6d 6f 64 65 22 0d 3b 4c  |colour) mode".;L|
0000a4d0  07 20 20 cd 0d 3b 56 05  e1 0d 3b 60 06 3a 3a 0d  |.  ..;V...;`.::.|
0000a4e0  3b 6a 3b f4 20 20 20 50  52 4f 43 45 44 55 52 45  |;j;.   PROCEDURE|
0000a4f0  3a 20 64 72 61 77 5f 73  63 6f 72 65 28 42 61 73  |: draw_score(Bas|
0000a500  65 64 20 58 25 2c 59 25  2c 20 50 58 20 62 6f 75  |ed X%,Y%, PX bou|
0000a510  6e 64 73 20 41 25 2c 42  25 29 0d 3b 74 05 f4 0d  |nds A%,B%).;t...|
0000a520  3b 7e 4f f4 20 44 45 53  43 52 49 50 54 49 4f 4e  |;~O. DESCRIPTION|
0000a530  3a 20 57 72 69 74 65 20  63 75 72 72 65 6e 74 20  |: Write current |
0000a540  73 65 63 74 69 6f 6e 20  6f 66 20 6d 75 73 69 63  |section of music|
0000a550  20 73 63 6f 72 65 20 74  68 61 74 20 61 70 70 65  | score that appe|
0000a560  61 72 73 20 62 65 74 77  65 65 6e 20 41 25 0d 3b  |ars between A%.;|
0000a570  88 19 f4 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
0000a580  20 61 6e 64 20 42 25 0d  3b 92 05 3a 0d 3b 9c 1e  | and B%.;..:.;..|
0000a590  dd 20 f2 64 72 61 77 5f  73 63 6f 72 65 28 58 25  |. .draw_score(X%|
0000a5a0  2c 59 25 2c 41 25 2c 42  25 29 0d 3b a6 08 ea 50  |,Y%,A%,B%).;...P|
0000a5b0  58 25 0d 3b b0 0a 42 41  52 25 3d 30 0d 3b ba 74  |X%.;..BAR%=0.;.t|
0000a5c0  f4 20 6d 75 73 74 20 62  65 20 73 75 62 74 6c 65  |. must be subtle|
0000a5d0  20 61 62 6f 75 74 20 72  65 64 72 61 77 69 6e 67  | about redrawing|
0000a5e0  20 6c 61 73 74 20 6e 6f  74 65 20 28 6f 72 20 6f  | last note (or o|
0000a5f0  74 68 65 72 20 69 74 65  6d 29 20 6f 66 20 73 63  |ther item) of sc|
0000a600  6f 72 65 20 74 6f 20 70  72 65 76 65 6e 74 20 70  |ore to prevent p|
0000a610  69 63 6b 69 6e 67 20 75  70 20 72 75 62 62 69 73  |icking up rubbis|
0000a620  68 20 64 61 74 61 20 61  66 74 65 72 20 65 6e 64  |h data after end|
0000a630  0d 3b c4 1c e7 20 41 25  3e 50 58 25 28 50 58 6e  |.;... A%>PX%(PXn|
0000a640  25 28 4e 42 61 72 73 25  29 29 20 8c 0d 3b ce 3d  |%(NBars%)) ..;.=|
0000a650  20 20 e7 20 41 25 3e 50  58 25 28 50 58 6e 25 28  |  . A%>PX%(PXn%(|
0000a660  4e 42 61 72 73 25 29 29  2b 32 2a 50 67 61 70 25  |NBars%))+2*Pgap%|
0000a670  20 e1 20 8b 20 41 25 3d  50 58 25 28 50 58 6e 25  | . . A%=PX%(PXn%|
0000a680  28 4e 42 61 72 73 25 29  29 0d 3b d8 07 20 20 cd  |(NBars%)).;..  .|
0000a690  0d 3b e2 54 f4 20 65 6e  73 75 72 65 20 62 61 72  |.;.T. ensure bar|
0000a6a0  20 6e 75 6d 62 65 72 73  20 61 72 65 20 61 6c 77  | numbers are alw|
0000a6b0  61 79 73 20 63 6f 6d 70  6c 65 74 65 6c 79 20 75  |ays completely u|
0000a6c0  70 64 61 74 65 64 3b 20  62 75 74 20 64 6f 6e 27  |pdated; but don'|
0000a6d0  74 20 6c 6f 73 65 20 31  73 74 2d 6e 6f 74 65 20  |t lose 1st-note |
0000a6e0  64 72 61 77 0d 3b ec 10  e7 20 4e 42 61 72 73 25  |draw.;... NBars%|
0000a6f0  3e 32 20 8c 0d 3b f6 2c  c8 95 20 50 58 25 28 50  |>2 ..;.,.. PX%(P|
0000a700  58 6e 25 28 42 41 52 25  2b 32 29 29 3c 41 25 20  |Xn%(BAR%+2))<A% |
0000a710  80 20 42 41 52 25 3c 3d  4e 42 61 72 73 25 2d 31  |. BAR%<=NBars%-1|
0000a720  0d 3c 00 0c 20 42 41 52  25 2b 3d 31 0d 3c 0a 23  |.<.. BAR%+=1.<.#|
0000a730  20 ce 20 20 3a f4 20 67  65 74 20 74 6f 20 64 72  | .  :. get to dr|
0000a740  61 77 73 74 61 72 74 20  71 75 69 63 6b 6c 79 0d  |awstart quickly.|
0000a750  3c 14 14 20 e7 20 42 41  52 25 3e 4e 42 61 72 73  |<.. . BAR%>NBars|
0000a760  25 20 e1 0d 3c 1e 16 20  f2 47 65 74 42 61 72 49  |% ..<.. .GetBarI|
0000a770  6e 66 6f 28 42 41 52 25  29 0d 3c 28 13 20 e7 20  |nfo(BAR%).<(. . |
0000a780  47 50 25 3e 3d 47 41 54  45 25 20 e1 0d 3c 32 1c  |GP%>=GATE% ..<2.|
0000a790  20 c8 95 50 58 25 28 50  58 25 2b 33 29 3c 41 25  | ..PX%(PX%+3)<A%|
0000a7a0  80 50 58 25 3c 45 58 25  0d 3c 3c 10 20 20 f2 73  |.PX%<EX%.<<.  .s|
0000a7b0  6b 69 70 5f 67 61 74 65  0d 3c 46 1d 20 20 ce 3a  |kip_gate.<F.  .:|
0000a7c0  f4 20 53 6b 69 70 20 6d  75 73 69 63 20 75 6e 74  |. Skip music unt|
0000a7d0  69 6c 20 41 25 0d 3c 50  05 cc 0d 3c 5a 11 20 f2  |il A%.<P...<Z. .|
0000a7e0  73 74 61 72 74 5f 6d 75  73 69 63 0d 3c 64 05 cd  |start_music.<d..|
0000a7f0  0d 3c 6e 1c c8 95 50 58  25 28 50 58 25 29 3c 3d  |.<n...PX%(PX%)<=|
0000a800  42 25 80 47 50 25 3c 47  41 54 45 25 0d 3c 78 54  |B%.GP%<GATE%.<xT|
0000a810  e7 3f 47 50 25 20 f2 64  72 61 77 5f 6e 6f 74 65  |.?GP% .draw_note|
0000a820  73 28 3f 47 50 25 29 3a  47 50 25 2b 3d 31 20 8b  |s(?GP%):GP%+=1 .|
0000a830  f2 64 72 61 77 5f 61 74  74 72 69 62 75 74 65 28  |.draw_attribute(|
0000a840  47 50 25 3f 31 29 3a 47  50 25 2b 3d 32 3a e7 20  |GP%?1):GP%+=2:. |
0000a850  50 4c 41 59 49 4e 47 25  20 f2 43 68 65 63 6b 51  |PLAYING% .CheckQ|
0000a860  0d 3c 82 05 ce 0d 3c 8c  05 e1 0d 3c 96 04 0d 3c  |.<....<....<...<|
0000a870  a0 26 f4 20 20 20 50 52  4f 43 45 44 55 52 45 3a  |.&.   PROCEDURE:|
0000a880  20 64 72 61 77 5f 6e 6f  74 65 73 28 47 61 74 65  | draw_notes(Gate|
0000a890  20 47 25 29 0d 3c aa 05  f4 0d 3c b4 4b f4 20 44  | G%).<....<.K. D|
0000a8a0  45 53 43 52 49 50 54 49  4f 4e 3a 20 47 65 74 20  |ESCRIPTION: Get |
0000a8b0  6e 6f 74 65 73 20 66 72  6f 6d 20 74 68 65 20 69  |notes from the i|
0000a8c0  6e 64 69 63 61 74 65 64  20 63 68 61 6e 6e 65 6c  |ndicated channel|
0000a8d0  20 71 75 65 75 65 73 20  61 6e 64 20 64 72 61 77  | queues and draw|
0000a8e0  20 74 68 65 0d 3c be 4f  f4 20 20 20 20 20 20 20  | the.<.O.       |
0000a8f0  20 20 20 20 20 20 20 70  61 72 74 69 63 75 6c 61  |       particula|
0000a900  72 20 74 79 70 65 73 20  6f 66 20 6e 6f 74 65 20  |r types of note |
0000a910  69 6e 20 74 68 65 20 63  6f 72 72 65 63 74 20 70  |in the correct p|
0000a920  6c 61 63 65 73 20 6f 6e  20 74 68 65 20 73 74 61  |laces on the sta|
0000a930  76 65 2e 0d 3c c8 51 f4  20 20 20 20 20 20 20 20  |ve..<.Q.        |
0000a940  20 20 20 20 20 20 4f 6e  65 20 6d 61 79 20 62 65  |      One may be|
0000a950  20 61 20 72 65 73 74 2c  20 6d 61 79 20 68 61 76  | a rest, may hav|
0000a960  65 20 61 63 63 69 64 65  6e 74 61 6c 73 20 70 72  |e accidentals pr|
0000a970  65 63 65 64 69 6e 67 20  69 74 2c 20 6d 61 79 20  |eceding it, may |
0000a980  68 61 76 65 0d 3c d2 31  f4 20 20 20 20 20 20 20  |have.<.1.       |
0000a990  20 20 20 20 20 20 20 64  6f 74 73 20 66 6f 6c 6c  |       dots foll|
0000a9a0  6f 77 69 6e 67 20 69 74  2c 20 6d 61 79 20 62 65  |owing it, may be|
0000a9b0  20 74 69 65 64 0d 3c dc  05 f4 0d 3c e6 23 f4 20  | tied.<....<.#. |
0000a9c0  41 53 53 55 4d 50 54 49  4f 4e 53 3a 20 47 61 74  |ASSUMPTIONS: Gat|
0000a9d0  65 20 69 73 20 6e 6f 6e  2d 7a 65 72 6f 0d 3c f0  |e is non-zero.<.|
0000a9e0  05 f4 0d 3c fa 16 f4 20  4a 6f 69 6e 3d 3f 4e 25  |...<... Join=?N%|
0000a9f0  28 43 25 29 41 4e 44 32  0d 3d 04 05 3a 0d 3d 0e  |(C%)AND2.=..:.=.|
0000aa00  15 dd 20 f2 64 72 61 77  5f 6e 6f 74 65 73 28 47  |.. .draw_notes(G|
0000aa10  25 29 0d 3d 18 33 ea 20  43 25 2c 78 25 2c 79 25  |%).=.3. C%,x%,y%|
0000aa20  2c 73 25 2c 6c 25 2c 4e  43 30 25 2c 4e 43 31 25  |,s%,l%,NC0%,NC1%|
0000aa30  2c 6c 61 73 74 79 25 2c  63 68 65 63 6b 73 74 61  |,lasty%,checksta|
0000aa40  67 67 65 72 25 0d 3d 22  25 50 58 25 2b 3d 31 3a  |gger%.="%PX%+=1:|
0000aa50  f4 20 4d 6f 76 65 20 6f  6e 20 74 6f 20 6e 65 78  |. Move on to nex|
0000aa60  74 20 70 6f 73 69 74 69  6f 6e 0d 3d 2c 51 78 25  |t position.=,Qx%|
0000aa70  3d 58 25 2b 50 58 25 28  50 58 25 29 3a f4 20 43  |=X%+PX%(PX%):. C|
0000aa80  61 6c 63 75 6c 61 74 65  20 67 61 74 65 20 63 6f  |alculate gate co|
0000aa90  6c 75 6d 6e 20 58 20 28  63 6f 6e 76 65 72 74 20  |lumn X (convert |
0000aaa0  66 72 6f 6d 20 77 6f 72  6b 2d 20 74 6f 20 73 63  |from work- to sc|
0000aab0  72 65 65 6e 2d 63 6f 6f  72 64 29 0d 3d 36 13 63  |reen-coord).=6.c|
0000aac0  68 65 63 6b 73 74 61 67  67 65 72 25 3d a3 0d 3d  |heckstagger%=..=|
0000aad0  40 09 43 25 3d 2d 31 0d  3d 4a 05 f5 0d 3d 54 15  |@.C%=-1.=J...=T.|
0000aae0  f5 43 25 2d 3d b9 3a fd  47 25 80 25 31 3c 3c 43  |.C%-=.:.G%.%1<<C|
0000aaf0  25 0d 3d 5e 33 4e 43 30  25 3d 3f 4e 25 28 43 25  |%.=^3NC0%=?N%(C%|
0000ab00  29 20 3a 20 4e 43 31 25  3d 4e 25 28 43 25 29 3f  |) : NC1%=N%(C%)?|
0000ab10  31 20 3a f4 20 66 61 73  74 20 6c 6f 63 61 6c 20  |1 :. fast local |
0000ab20  76 61 72 73 0d 3d 68 1c  79 25 3d 59 25 2b 59 5f  |vars.=h.y%=Y%+Y_|
0000ab30  53 54 41 56 45 25 28 53  5f 43 25 28 43 25 29 29  |STAVE%(S_C%(C%))|
0000ab40  0d 3d 72 0f e7 4e 43 30  25 80 26 46 38 20 8c 0d  |.=r..NC0%.&F8 ..|
0000ab50  3d 7c 13 6c 25 3d 28 4e  43 30 25 3e 3e 33 29 2d  |=|.l%=(NC0%>>3)-|
0000ab60  31 36 0d 3d 86 35 e7 94  6c 25 3e 35 20 f2 73 70  |16.=.5..l%>5 .sp|
0000ab70  72 69 74 65 28 6c 65 64  67 65 72 25 2b 6c 25 81  |rite(ledger%+l%.|
0000ab80  32 2c 78 25 2c 79 25 29  3a f4 20 4c 65 64 67 65  |2,x%,y%):. Ledge|
0000ab90  72 20 6c 69 6e 65 73 0d  3d 90 0e 79 25 2b 3d 4c  |r lines.=..y%+=L|
0000aba0  69 25 2a 6c 25 0d 3d 9a  18 73 25 3d 4e 43 31 25  |i%*l%.=..s%=NC1%|
0000abb0  3e 3e 35 84 4e 43 30 25  3c 3c 33 80 38 0d 3d a4  |>>5.NC0%<<3.8.=.|
0000abc0  15 e7 20 63 68 65 63 6b  73 74 61 67 67 65 72 25  |.. checkstagger%|
0000abd0  20 8c 0d 3d ae 31 f4 20  73 74 61 67 67 65 72 20  | ..=.1. stagger |
0000abe0  6e 65 78 74 20 6e 6f 74  65 20 69 66 20 74 6f 6f  |next note if too|
0000abf0  20 63 6c 6f 73 65 20 74  6f 20 6f 6e 65 20 62 65  | close to one be|
0000ac00  6c 6f 77 0d 3d b8 54 f4  20 73 74 61 67 67 65 72  |low.=.T. stagger|
0000ac10  20 66 61 69 6c 73 20 73  6f 6d 65 74 69 6d 65 73  | fails sometimes|
0000ac20  20 69 66 20 63 68 61 6e  6e 65 6c 73 20 6f 66 20  | if channels of |
0000ac30  32 20 61 64 6a 61 63 65  6e 74 20 6e 6f 74 65 73  |2 adjacent notes|
0000ac40  20 61 72 65 20 6e 6f 74  20 69 6e 20 64 72 61 77  | are not in draw|
0000ac50  20 6f 72 64 65 72 3f 0d  3d c2 55 20 e7 20 94 28  | order?.=.U . .(|
0000ac60  6c 61 73 74 79 25 2d 79  25 29 3c 32 2a 4c 69 25  |lasty%-y%)<2*Li%|
0000ac70  20 f2 73 70 72 69 74 65  28 73 25 2c 78 25 2b 50  | .sprite(s%,x%+P|
0000ac80  67 61 70 25 2c 79 25 29  3a 63 68 65 63 6b 73 74  |gap%,y%):checkst|
0000ac90  61 67 67 65 72 25 3d a3  20 8b 20 f2 73 70 72 69  |agger%=. . .spri|
0000aca0  74 65 28 73 25 2c 78 25  2c 79 25 29 0d 3d cc 05  |te(s%,x%,y%).=..|
0000acb0  cc 0d 3d d6 26 20 f2 73  70 72 69 74 65 28 73 25  |..=.& .sprite(s%|
0000acc0  2c 78 25 2c 79 25 29 3a  63 68 65 63 6b 73 74 61  |,x%,y%):checksta|
0000acd0  67 67 65 72 25 3d b9 0d  3d e0 06 20 cd 0d 3d ea  |gger%=..=.. ..=.|
0000ace0  0d 6c 61 73 74 79 25 3d  79 25 0d 3d f4 34 e7 4e  |.lasty%=y%.=.4.N|
0000acf0  43 31 25 80 37 20 f2 73  70 72 69 74 65 28 61 63  |C1%.7 .sprite(ac|
0000ad00  63 69 64 65 6e 74 61 6c  25 84 4e 43 31 25 80 37  |cidental%.NC1%.7|
0000ad10  2c 78 25 2d 78 25 28 73  25 29 2c 79 25 29 0d 3d  |,x%-x%(s%),y%).=|
0000ad20  fe 05 cc 0d 3e 08 14 73  25 3d 72 65 73 74 25 84  |....>..s%=rest%.|
0000ad30  4e 43 31 25 3e 3e 35 0d  3e 12 15 f2 73 70 72 69  |NC1%>>5.>...spri|
0000ad40  74 65 28 73 25 2c 78 25  2c 79 25 29 0d 3e 1c 05  |te(s%,x%,y%).>..|
0000ad50  cd 0d 3e 26 33 e7 4e 43  31 25 80 32 34 20 f2 73  |..>&3.NC1%.24 .s|
0000ad60  70 72 69 74 65 28 64 6f  74 25 2b 28 4e 43 31 25  |prite(dot%+(NC1%|
0000ad70  3e 3e 33 80 33 29 2c 78  25 2b 78 25 28 73 25 29  |>>3.3),x%+x%(s%)|
0000ad80  2c 79 25 29 0d 3e 30 1f  e7 4e 43 30 25 80 34 20  |,y%).>0..NC0%.4 |
0000ad90  f2 73 70 72 69 74 65 28  74 69 65 25 2c 78 25 2c  |.sprite(tie%,x%,|
0000ada0  79 25 29 0d 3e 3a 24 4e  25 28 43 25 29 2b 3d 32  |y%).>:$N%(C%)+=2|
0000adb0  3a f4 20 50 75 6c 6c 20  66 72 6f 6d 20 6e 6f 74  |:. Pull from not|
0000adc0  65 20 71 75 65 75 65 0d  3e 44 2e fd 28 32 3c 3c  |e queue.>D..(2<<|
0000add0  43 25 29 3e 47 25 3a f4  20 55 6e 74 69 6c 20 6e  |C%)>G%:. Until n|
0000ade0  6f 20 6d 6f 72 65 20 6e  6f 74 65 73 20 28 31 20  |o more notes (1 |
0000adf0  62 69 74 73 29 0d 3e 4e  05 e1 0d 3e 58 06 3a 3a  |bits).>N...>X.::|
0000ae00  0d 3e 62 19 dd 20 f2 64  72 61 77 5f 61 74 74 72  |.>b.. .draw_attr|
0000ae10  69 62 75 74 65 28 41 25  29 0d 3e 6c 0a ea 78 25  |ibute(A%).>l..x%|
0000ae20  2c 4e 25 0d 3e 76 1a 4e  25 3d b9 3a f5 4e 25 2d  |,N%.>v.N%=.:.N%-|
0000ae30  3d b9 3a fd 41 25 80 25  31 3c 3c 4e 25 0d 3e 80  |=.:.A%.%1<<N%.>.|
0000ae40  1e e7 50 54 59 50 45 25  28 50 58 25 29 82 25 31  |..PTYPE%(PX%).%1|
0000ae50  3c 3c 4e 25 20 50 58 25  2b 3d 31 0d 3e 8a 12 78  |<<N% PX%+=1.>..x|
0000ae60  25 3d 58 25 2b 50 58 25  28 50 58 25 29 0d 3e 94  |%=X%+PX%(PX%).>.|
0000ae70  70 ee 4e 25 2b 31 20 f2  64 72 61 77 5f 74 69 6d  |p.N%+1 .draw_tim|
0000ae80  65 5f 73 69 67 28 41 25  29 2c f2 64 72 61 77 5f  |e_sig(A%),.draw_|
0000ae90  6b 65 79 5f 73 69 67 28  41 25 29 2c f2 64 72 61  |key_sig(A%),.dra|
0000aea0  77 5f 63 6c 65 66 28 41  25 29 2c f2 64 72 61 77  |w_clef(A%),.draw|
0000aeb0  5f 73 6c 75 72 28 41 25  29 2c f2 64 72 61 77 5f  |_slur(A%),.draw_|
0000aec0  6f 63 74 61 76 65 28 41  25 29 2c f2 64 72 61 77  |octave(A%),.draw|
0000aed0  5f 62 61 72 5f 6c 69 6e  65 28 41 25 29 0d 3e 9e  |_bar_line(A%).>.|
0000aee0  05 e1 0d 3e a8 04 0d 3e  b2 17 dd 20 f2 50 75 74  |...>...>... .Put|
0000aef0  42 61 72 49 6e 66 6f 28  62 61 72 25 29 0d 3e bc  |BarInfo(bar%).>.|
0000af00  43 f4 20 73 65 74 75 70  20 74 68 65 20 76 61 72  |C. setup the var|
0000af10  69 6f 75 73 20 70 6f 69  6e 74 65 72 73 20 74 6f  |ious pointers to|
0000af20  20 61 72 72 61 79 73 20  61 74 20 74 68 65 20 73  | arrays at the s|
0000af30  74 61 72 74 20 6f 66 20  74 68 69 73 20 62 61 72  |tart of this bar|
0000af40  0d 3e c6 0e e3 20 6e 25  3d 30 20 b8 20 37 0d 3e  |.>... n%=0 . 7.>|
0000af50  d0 19 20 42 50 6e 25 28  6e 25 2c 62 61 72 25 29  |.. BPn%(n%,bar%)|
0000af60  3d 4e 25 28 6e 25 29 0d  3e da 06 20 ed 0d 3e e4  |=N%(n%).>.. ..>.|
0000af70  12 50 58 6e 25 28 62 61  72 25 29 3d 50 58 25 0d  |.PXn%(bar%)=PX%.|
0000af80  3e ee 12 47 50 6e 25 28  62 61 72 25 29 3d 47 50  |>..GPn%(bar%)=GP|
0000af90  25 0d 3e f8 17 e3 20 6e  25 3d 30 20 b8 20 4d 61  |%.>... n%=0 . Ma|
0000afa0  78 5f 53 74 61 76 65 25  0d 3f 02 1e 20 43 4c 45  |x_Stave%.?.. CLE|
0000afb0  46 6e 25 28 6e 25 2c 62  61 72 25 29 3d 43 4c 45  |Fn%(n%,bar%)=CLE|
0000afc0  46 25 28 6e 25 29 0d 3f  0c 06 20 ed 0d 3f 16 19  |F%(n%).?.. ..?..|
0000afd0  53 49 47 6e 25 28 30 2c  62 61 72 25 29 3d 53 49  |SIGn%(0,bar%)=SI|
0000afe0  47 25 28 30 29 0d 3f 20  19 53 49 47 6e 25 28 31  |G%(0).? .SIGn%(1|
0000aff0  2c 62 61 72 25 29 3d 53  49 47 25 28 31 29 0d 3f  |,bar%)=SIG%(1).?|
0000b000  2a 05 e1 0d 3f 34 04 0d  3f 3e 17 dd 20 f2 47 65  |*...?4..?>.. .Ge|
0000b010  74 42 61 72 49 6e 66 6f  28 62 61 72 25 29 0d 3f  |tBarInfo(bar%).?|
0000b020  48 39 f4 20 67 65 74 20  74 68 65 20 76 61 6c 75  |H9. get the valu|
0000b030  65 73 20 6f 66 20 74 68  65 20 64 61 74 61 20 61  |es of the data a|
0000b040  74 20 74 68 65 20 73 74  61 72 74 20 6f 66 20 74  |t the start of t|
0000b050  68 69 73 20 62 61 72 0d  3f 52 0e e3 20 6e 25 3d  |his bar.?R.. n%=|
0000b060  30 20 b8 20 37 0d 3f 5c  19 20 4e 25 28 6e 25 29  |0 . 7.?\. N%(n%)|
0000b070  3d 42 50 6e 25 28 6e 25  2c 62 61 72 25 29 0d 3f  |=BPn%(n%,bar%).?|
0000b080  66 06 20 ed 0d 3f 70 12  50 58 25 3d 50 58 6e 25  |f. ..?p.PX%=PXn%|
0000b090  28 62 61 72 25 29 0d 3f  7a 12 47 50 25 3d 47 50  |(bar%).?z.GP%=GP|
0000b0a0  6e 25 28 62 61 72 25 29  0d 3f 84 17 e3 20 6e 25  |n%(bar%).?... n%|
0000b0b0  3d 30 20 b8 20 4d 61 78  5f 53 74 61 76 65 25 0d  |=0 . Max_Stave%.|
0000b0c0  3f 8e 1e 20 43 4c 45 46  25 28 6e 25 29 3d 43 4c  |?.. CLEF%(n%)=CL|
0000b0d0  45 46 6e 25 28 6e 25 2c  62 61 72 25 29 0d 3f 98  |EFn%(n%,bar%).?.|
0000b0e0  06 20 ed 0d 3f a2 19 53  49 47 25 28 30 29 3d 53  |. ..?..SIG%(0)=S|
0000b0f0  49 47 6e 25 28 30 2c 62  61 72 25 29 0d 3f ac 19  |IGn%(0,bar%).?..|
0000b100  53 49 47 25 28 31 29 3d  53 49 47 6e 25 28 31 2c  |SIG%(1)=SIGn%(1,|
0000b110  62 61 72 25 29 0d 3f b6  05 e1 0d 3f c0 04 0d 3f  |bar%).?....?...?|
0000b120  ca 1b dd 20 f2 53 65 74  75 70 42 61 72 53 74 61  |... .SetupBarSta|
0000b130  72 74 73 28 62 61 72 25  29 0d 3f d4 45 f4 20 66  |rts(bar%).?.E. f|
0000b140  69 6e 64 20 70 6f 69 6e  74 65 72 73 20 74 6f 20  |ind pointers to |
0000b150  76 61 72 69 6f 75 73 20  62 69 74 73 20 61 74 20  |various bits at |
0000b160  74 68 65 20 73 74 61 72  74 73 20 6f 66 20 61 6c  |the starts of al|
0000b170  6c 20 62 61 72 73 20 74  68 72 6f 75 67 68 0d 3f  |l bars through.?|
0000b180  de 1e f4 20 74 68 65 20  6d 75 73 69 63 2e 20 53  |... the music. S|
0000b190  74 61 72 74 20 61 74 20  62 61 72 25 0d 3f e8 45  |tart at bar%.?.E|
0000b1a0  f4 20 74 68 69 73 20 69  73 20 6a 75 73 74 20 74  |. this is just t|
0000b1b0  6f 20 73 70 65 65 64 20  75 70 20 72 65 64 72 61  |o speed up redra|
0000b1c0  77 2c 20 61 76 6f 69 64  69 6e 67 20 61 6c 6c 20  |w, avoiding all |
0000b1d0  74 68 65 20 6e 6f 74 65  2d 73 6b 69 70 70 69 6e  |the note-skippin|
0000b1e0  67 0d 3f f2 0b ea 20 6c  61 73 74 25 0d 3f fc 0d  |g.?... last%.?..|
0000b1f0  42 41 52 25 3d 62 61 72  25 0d 40 06 2d e7 20 62  |BAR%=bar%.@.-. b|
0000b200  61 72 25 3e 30 20 f2 47  65 74 42 61 72 49 6e 66  |ar%>0 .GetBarInf|
0000b210  6f 28 62 61 72 25 29 20  8b 20 f2 73 74 61 72 74  |o(bar%) . .start|
0000b220  5f 6d 75 73 69 63 0d 40  10 0e 6c 61 73 74 25 3d  |_music.@..last%=|
0000b230  42 41 52 25 0d 40 1a 15  f2 50 75 74 42 61 72 49  |BAR%.@...PutBarI|
0000b240  6e 66 6f 28 42 41 52 25  29 0d 40 24 10 c8 95 20  |nfo(BAR%).@$... |
0000b250  47 50 25 3c 47 41 54 45  25 0d 40 2e 0c 20 e7 3f  |GP%<GATE%.@.. .?|
0000b260  47 50 25 20 8c 0d 40 38  1e 20 20 f2 73 6b 69 70  |GP% ..@8.  .skip|
0000b270  5f 6e 6f 74 65 73 28 3f  47 50 25 29 3a 47 50 25  |_notes(?GP%):GP%|
0000b280  2b 3d 31 0d 40 42 06 20  cc 0d 40 4c 23 20 20 f2  |+=1.@B. ..@L#  .|
0000b290  73 6b 69 70 5f 61 74 74  72 69 62 75 74 65 28 47  |skip_attribute(G|
0000b2a0  50 25 3f 31 29 3a 47 50  25 2b 3d 32 0d 40 56 32  |P%?1):GP%+=2.@V2|
0000b2b0  20 20 e7 20 42 41 52 25  3c 3e 6c 61 73 74 25 20  |  . BAR%<>last% |
0000b2c0  6c 61 73 74 25 3d 42 41  52 25 20 3a 20 f2 50 75  |last%=BAR% : .Pu|
0000b2d0  74 42 61 72 49 6e 66 6f  28 42 41 52 25 29 0d 40  |tBarInfo(BAR%).@|
0000b2e0  60 06 20 cd 0d 40 6a 06  20 ce 0d 40 74 0b 42 41  |`. ..@j. ..@t.BA|
0000b2f0  52 25 2b 3d 31 0d 40 7e  15 f2 50 75 74 42 61 72  |R%+=1.@~..PutBar|
0000b300  49 6e 66 6f 28 42 41 52  25 29 0d 40 88 0f 4e 42  |Info(BAR%).@..NB|
0000b310  61 72 73 25 3d 42 41 52  25 0d 40 92 05 e1 0d 40  |ars%=BAR%.@....@|
0000b320  9c 04 0d 40 a6 10 dd 20  f2 73 6b 69 70 5f 67 61  |...@... .skip_ga|
0000b330  74 65 0d 40 b0 41 e7 3f  47 50 25 20 f2 73 6b 69  |te.@.A.?GP% .ski|
0000b340  70 5f 6e 6f 74 65 73 28  3f 47 50 25 29 3a 47 50  |p_notes(?GP%):GP|
0000b350  25 2b 3d 31 20 8b f2 73  6b 69 70 5f 61 74 74 72  |%+=1 ..skip_attr|
0000b360  69 62 75 74 65 28 47 50  25 3f 31 29 3a 47 50 25  |ibute(GP%?1):GP%|
0000b370  2b 3d 32 0d 40 ba 05 e1  0d 40 c4 04 0d 40 ce 15  |+=2.@....@...@..|
0000b380  dd 20 f2 73 6b 69 70 5f  6e 6f 74 65 73 28 47 25  |. .skip_notes(G%|
0000b390  29 0d 40 d8 0a 50 58 25  2b 3d 31 0d 40 e2 0d ea  |).@..PX%+=1.@...|
0000b3a0  43 25 3a 43 25 3d 2d 31  0d 40 ec 2c f5 f5 43 25  |C%:C%=-1.@.,..C%|
0000b3b0  2b 3d 31 3a fd 47 25 80  25 31 3c 3c 43 25 3a 4e  |+=1:.G%.%1<<C%:N|
0000b3c0  25 28 43 25 29 2b 3d 32  3a fd 28 32 3c 3c 43 25  |%(C%)+=2:.(2<<C%|
0000b3d0  29 3e 47 25 0d 40 f6 05  e1 0d 41 00 04 0d 41 0a  |)>G%.@....A...A.|
0000b3e0  19 dd 20 f2 73 6b 69 70  5f 61 74 74 72 69 62 75  |.. .skip_attribu|
0000b3f0  74 65 28 41 25 29 0d 41  14 07 ea 54 25 0d 41 1e  |te(A%).A...T%.A.|
0000b400  23 54 25 3d 25 31 3a e7  41 25 80 25 31 20 8b f5  |#T%=%1:.A%.%1 ..|
0000b410  54 25 3d 54 25 3c 3c 25  31 3a fd 41 25 80 54 25  |T%=T%<<%1:.A%.T%|
0000b420  0d 41 28 09 c8 8e 54 25  ca 0d 41 32 1d c9 54 69  |.A(...T%..A2..Ti|
0000b430  6d 65 25 2c 4b 65 79 25  3a 53 49 47 25 28 54 25  |me%,Key%:SIG%(T%|
0000b440  2d 31 29 3d 41 25 0d 41  3c 1f c9 43 6c 65 66 25  |-1)=A%.A<..Clef%|
0000b450  3a 43 4c 45 46 25 28 41  25 3e 3e 36 29 3d 41 25  |:CLEF%(A%>>6)=A%|
0000b460  3e 3e 33 80 33 0d 41 46  11 c9 42 61 72 25 3a 42  |>>3.3.AF..Bar%:B|
0000b470  41 52 25 2b 3d 31 0d 41  50 05 cb 0d 41 5a 1a e7  |AR%+=1.AP...AZ..|
0000b480  54 25 82 50 54 59 50 45  25 28 50 58 25 29 20 50  |T%.PTYPE%(PX%) P|
0000b490  58 25 2b 3d 31 0d 41 64  05 e1 0d 41 6e 04 0d 41  |X%+=1.Ad...An..A|
0000b4a0  78 10 dd 20 f2 62 61 63  6b 5f 67 61 74 65 0d 41  |x.. .back_gate.A|
0000b4b0  82 43 e7 47 50 25 3f 2d  32 20 47 50 25 2d 3d 31  |.C.GP%?-2 GP%-=1|
0000b4c0  3a f2 62 61 63 6b 5f 6e  6f 74 65 73 28 3f 47 50  |:.back_notes(?GP|
0000b4d0  25 29 20 8b 47 50 25 2d  3d 32 3a f2 62 61 63 6b  |%) .GP%-=2:.back|
0000b4e0  5f 61 74 74 72 69 62 75  74 65 28 47 50 25 3f 31  |_attribute(GP%?1|
0000b4f0  29 0d 41 8c 05 e1 0d 41  96 04 0d 41 a0 15 dd 20  |).A....A...A... |
0000b500  f2 62 61 63 6b 5f 6e 6f  74 65 73 28 47 25 29 0d  |.back_notes(G%).|
0000b510  41 aa 0a 50 58 25 2d 3d  31 0d 41 b4 0c ea 43 25  |A..PX%-=1.A...C%|
0000b520  3a 43 25 3d b9 0d 41 be  2c f5 f5 43 25 2d 3d b9  |:C%=..A.,..C%-=.|
0000b530  3a fd 47 25 80 25 31 3c  3c 43 25 3a 4e 25 28 43  |:.G%.%1<<C%:N%(C|
0000b540  25 29 2d 3d 32 3a fd 28  32 3c 3c 43 25 29 3e 47  |%)-=2:.(2<<C%)>G|
0000b550  25 0d 41 c8 05 e1 0d 41  d2 04 0d 41 dc 19 dd 20  |%.A....A...A... |
0000b560  f2 62 61 63 6b 5f 61 74  74 72 69 62 75 74 65 28  |.back_attribute(|
0000b570  41 25 29 0d 41 e6 14 e7  41 25 3d 42 61 72 25 20  |A%).A...A%=Bar% |
0000b580  42 41 52 25 2d 3d 31 0d  41 f0 2c e7 41 25 80 50  |BAR%-=1.A.,.A%.P|
0000b590  54 59 50 45 25 28 50 58  25 2b 31 29 2b b9 20 8b  |TYPE%(PX%+1)+. .|
0000b5a0  e7 41 25 80 50 54 59 50  45 25 28 50 58 25 2b 31  |.A%.PTYPE%(PX%+1|
0000b5b0  29 20 e1 0d 41 fa 0a 50  58 25 2d 3d 31 0d 42 04  |) ..A..PX%-=1.B.|
0000b5c0  05 e1 0d 42 0e 04 0d 42  18 18 dd 20 f2 64 72 61  |...B...B... .dra|
0000b5d0  77 5f 74 69 6d 65 5f 73  69 67 28 41 25 29 0d 42  |w_time_sig(A%).B|
0000b5e0  22 0e 53 49 47 25 28 30  29 3d 41 25 0d 42 2c 10  |".SIG%(0)=A%.B,.|
0000b5f0  ea 53 25 2c 42 24 2c 44  24 2c 77 25 0d 42 36 16  |.S%,B$,D$,w%.B6.|
0000b600  42 24 3d c3 28 28 41 25  3e 3e 31 80 31 35 29 2b  |B$=.((A%>>1.15)+|
0000b610  31 29 0d 42 40 17 44 24  3d c3 28 25 31 3c 3c 28  |1).B@.D$=.(%1<<(|
0000b620  41 25 3e 3e 35 29 2d 31  29 0d 42 4a 09 77 25 3d  |A%>>5)-1).BJ.w%=|
0000b630  78 25 0d 42 54 1a e7 a9  42 24 3c 32 20 77 25 2b  |x%.BT...B$<2 w%+|
0000b640  3d 50 57 25 28 50 58 25  29 3e 3e 32 0d 42 5e 1a  |=PW%(PX%)>>2.B^.|
0000b650  e7 a9 44 24 3c 32 20 78  25 2b 3d 50 57 25 28 50  |..D$<2 x%+=PW%(P|
0000b660  58 25 29 3e 3e 32 0d 42  68 16 e3 53 25 3d 30 b8  |X%)>>2.Bh..S%=0.|
0000b670  53 54 41 56 45 25 2b 50  45 52 43 25 0d 42 72 25  |STAVE%+PERC%.Br%|
0000b680  ec 77 25 2c 59 25 2b 59  5f 53 54 41 56 45 25 28  |.w%,Y%+Y_STAVE%(|
0000b690  53 25 29 2b 4c 69 25 2a  34 2d 56 69 25 3a f1 42  |S%)+Li%*4-Vi%:.B|
0000b6a0  24 0d 42 7c 1f ec 78 25  2c 59 25 2b 59 5f 53 54  |$.B|..x%,Y%+Y_ST|
0000b6b0  41 56 45 25 28 53 25 29  2d 56 69 25 3a f1 44 24  |AVE%(S%)-Vi%:.D$|
0000b6c0  0d 42 86 05 ed 0d 42 90  05 cd 0d 42 9a 05 e1 0d  |.B....B....B....|
0000b6d0  42 a4 04 0d 42 ae 17 dd  20 f2 64 72 61 77 5f 6b  |B...B... .draw_k|
0000b6e0  65 79 5f 73 69 67 28 41  25 29 0d 42 b8 13 ea 53  |ey_sig(A%).B...S|
0000b6f0  25 2c 43 25 2c 4e 25 2c  61 25 2c 57 25 0d 42 c2  |%,C%,N%,a%,W%.B.|
0000b700  6f e7 41 25 80 35 36 20  53 49 47 25 28 31 29 3d  |o.A%.56 SIG%(1)=|
0000b710  41 25 20 8b c8 94 41 25  2c 53 49 47 25 28 31 29  |A% ...A%,SIG%(1)|
0000b720  3a 61 25 3d 61 63 63 69  64 65 6e 74 61 6c 25 2b  |:a%=accidental%+|
0000b730  31 3a f4 20 43 68 61 6e  67 65 20 74 6f 20 43 20  |1:. Change to C |
0000b740  4d 61 6a 6f 72 20 75 73  65 73 20 6e 61 74 75 72  |Major uses natur|
0000b750  61 6c 73 20 69 6e 20 6f  6c 64 20 6b 65 79 20 73  |als in old key s|
0000b760  69 67 20 70 6f 73 69 74  69 6f 6e 73 0d 42 cc 12  |ig positions.B..|
0000b770  4e 25 3d 28 41 25 3e 3e  33 80 37 29 2d 31 0d 42  |N%=(A%>>3.7)-1.B|
0000b780  d6 0c e7 4e 25 3e 3d 30  20 8c 0d 42 e0 2d 41 25  |...N%>=0 ..B.-A%|
0000b790  3d 41 25 3e 3e 32 80 25  31 3a f4 20 30 2d 53 68  |=A%>>2.%1:. 0-Sh|
0000b7a0  61 72 70 20 6f 72 20 31  2d 66 6c 61 74 20 73 69  |arp or 1-flat si|
0000b7b0  67 6e 61 74 75 72 65 0d  42 ea 1c e7 61 25 20 8b  |gnature.B...a% .|
0000b7c0  61 25 3d 61 63 63 69 64  65 6e 74 61 6c 25 2b 32  |a%=accidental%+2|
0000b7d0  2b 41 25 0d 42 f4 14 57  25 3d 78 25 28 61 25 29  |+A%.B..W%=x%(a%)|
0000b7e0  2b 58 25 28 61 25 29 0d  42 fe 0e 78 25 2b 3d 78  |+X%(a%).B..x%+=x|
0000b7f0  25 28 61 25 29 0d 43 08  0f e3 20 43 25 3d 30 20  |%(a%).C... C%=0 |
0000b800  b8 20 4e 25 0d 43 12 11  e3 20 53 25 3d 30 b8 53  |. N%.C... S%=0.S|
0000b810  54 41 56 45 25 0d 43 1c  3e f2 73 70 72 69 74 65  |TAVE%.C.>.sprite|
0000b820  28 61 25 2c 78 25 2c 59  25 2b 59 5f 53 54 41 56  |(a%,x%,Y%+Y_STAV|
0000b830  45 25 28 53 25 29 2b 4c  69 25 2a 4b 65 79 5f 59  |E%(S%)+Li%*Key_Y|
0000b840  25 28 43 4c 45 46 25 28  53 25 29 2c 41 25 2c 43  |%(CLEF%(S%),A%,C|
0000b850  25 29 29 0d 43 26 05 ed  0d 43 30 0a 78 25 2b 3d  |%)).C&...C0.x%+=|
0000b860  57 25 0d 43 3a 05 ed 0d  43 44 05 cd 0d 43 4e 05  |W%.C:...CD...CN.|
0000b870  e1 0d 43 58 04 0d 43 62  14 dd 20 f2 64 72 61 77  |..CX..Cb.. .draw|
0000b880  5f 63 6c 65 66 28 41 25  29 0d 43 6c 07 ea 53 25  |_clef(A%).Cl..S%|
0000b890  0d 43 76 0c 53 25 3d 41  25 3e 3e 36 0d 43 80 15  |.Cv.S%=A%>>6.C..|
0000b8a0  43 4c 45 46 25 28 53 25  29 3d 41 25 3e 3e 33 80  |CLEF%(S%)=A%>>3.|
0000b8b0  33 0d 43 8a 3b e7 53 25  3c 3d 53 54 41 56 45 25  |3.C.;.S%<=STAVE%|
0000b8c0  20 f2 73 70 72 69 74 65  28 63 6c 65 66 25 2b 43  | .sprite(clef%+C|
0000b8d0  4c 45 46 25 28 53 25 29  2c 78 25 2c 59 25 2b 59  |LEF%(S%),x%,Y%+Y|
0000b8e0  5f 53 54 41 56 45 25 28  53 25 29 29 0d 43 94 05  |_STAVE%(S%)).C..|
0000b8f0  e1 0d 43 9e 04 0d 43 a8  14 dd 20 f2 64 72 61 77  |..C...C... .draw|
0000b900  5f 73 6c 75 72 28 41 25  29 0d 43 b2 05 e1 0d 43  |_slur(A%).C....C|
0000b910  bc 04 0d 43 c6 16 dd 20  f2 64 72 61 77 5f 6f 63  |...C... .draw_oc|
0000b920  74 61 76 65 28 41 25 29  0d 43 d0 05 e1 0d 43 da  |tave(A%).C....C.|
0000b930  04 0d 43 e4 18 dd 20 f2  64 72 61 77 5f 62 61 72  |..C... .draw_bar|
0000b940  5f 6c 69 6e 65 28 41 25  29 0d 43 ee 0b 42 41 52  |_line(A%).C..BAR|
0000b950  25 2b 3d 31 0d 43 f8 16  e3 53 25 3d 30 b8 53 54  |%+=1.C...S%=0.ST|
0000b960  41 56 45 25 2b 50 45 52  43 25 0d 44 02 24 f2 73  |AVE%+PERC%.D.$.s|
0000b970  70 72 69 74 65 28 62 61  72 25 2c 78 25 2c 59 25  |prite(bar%,x%,Y%|
0000b980  2b 59 5f 53 54 41 56 45  25 28 53 25 29 29 0d 44  |+Y_STAVE%(S%)).D|
0000b990  0c 05 ed 0d 44 16 10 e7  20 42 41 52 25 83 35 3d  |....D... BAR%.5=|
0000b9a0  30 20 8c 0d 44 20 31 20  20 ec 20 78 25 2b 48 69  |0 ..D 1  . x%+Hi|
0000b9b0  25 2c 59 25 2b 59 5f 53  54 41 56 45 25 28 30 29  |%,Y%+Y_STAVE%(0)|
0000b9c0  2b 53 74 61 76 65 5f 48  65 69 67 68 74 25 2b 32  |+Stave_Height%+2|
0000b9d0  2a 56 69 25 0d 44 2a 0f  20 20 f1 20 c3 28 42 41  |*Vi%.D*.  . .(BA|
0000b9e0  52 25 29 0d 44 34 07 20  20 cd 0d 44 3e 13 e7 28  |R%).D4.  ..D>..(|
0000b9f0  53 54 41 56 45 25 2b 31  29 80 32 20 8c 0d 44 48  |STAVE%+1).2 ..DH|
0000ba00  08 ea 20 79 25 0d 44 52  2f ec 78 25 2b 48 69 25  |.. y%.DR/.x%+Hi%|
0000ba10  2c 59 25 2b 59 5f 53 54  41 56 45 25 28 53 54 41  |,Y%+Y_STAVE%(STA|
0000ba20  56 45 25 29 2b 53 74 61  76 65 5f 48 65 69 67 68  |VE%)+Stave_Heigh|
0000ba30  74 25 81 32 0d 44 5c 38  79 25 3d 59 5f 53 54 41  |t%.2.D\8y%=Y_STA|
0000ba40  56 45 25 28 53 54 41 56  45 25 2d 31 29 2d 59 5f  |VE%(STAVE%-1)-Y_|
0000ba50  53 54 41 56 45 25 28 53  54 41 56 45 25 29 2d 53  |STAVE%(STAVE%)-S|
0000ba60  74 61 76 65 5f 48 65 69  67 68 74 25 0d 44 66 43  |tave_Height%.DfC|
0000ba70  df 20 42 59 20 30 2c 79  25 20 3a 20 ec 20 42 59  |. BY 0,y% : . BY|
0000ba80  20 48 69 25 2c 30 20 3a  20 df 20 42 59 20 30 2c  | Hi%,0 : . BY 0,|
0000ba90  2d 79 25 20 3a 20 f4 20  43 6f 6e 6e 65 63 74 20  |-y% : . Connect |
0000baa0  6b 65 79 62 6f 61 72 64  20 73 74 61 76 65 73 0d  |keyboard staves.|
0000bab0  44 70 05 cd 0d 44 7a 05  e1 0d 44 84 04 0d 44 8e  |Dp...Dz...D...D.|
0000bac0  0f dd 20 f2 70 75 74 5f  64 6f 77 6e 0d 44 98 17  |.. .put_down.D..|
0000bad0  ea 43 25 2c 50 58 25 2c  58 25 2c 59 25 2c 53 25  |.C%,PX%,X%,Y%,S%|
0000bae0  2c 73 25 0d 44 a2 15 c8  99 20 22 48 6f 75 72 67  |,s%.D.... "Hourg|
0000baf0  6c 61 73 73 5f 4f 6e 22  0d 44 ac 15 47 50 25 3d  |lass_On".D..GP%=|
0000bb00  53 43 52 49 42 45 25 28  73 67 70 25 29 0d 44 b6  |SCRIBE%(sgp%).D.|
0000bb10  20 e3 43 25 3d 30 b8 37  3a 4e 25 28 43 25 29 3d  | .C%=0.7:N%(C%)=|
0000bb20  53 43 52 49 42 45 25 28  43 25 29 3a ed 0d 44 c0  |SCRIBE%(C%):..D.|
0000bb30  16 50 58 25 3d 53 43 52  49 42 45 25 28 70 6f 73  |.PX%=SCRIBE%(pos|
0000bb40  78 25 29 0d 44 ca 13 58  25 3d 53 43 52 49 42 45  |x%).D..X%=SCRIBE|
0000bb50  25 28 73 78 25 29 0d 44  d4 13 59 25 3d 53 43 52  |%(sx%).D..Y%=SCR|
0000bb60  49 42 45 25 28 73 79 25  29 0d 44 de 17 73 25 3d  |IBE%(sy%).D..s%=|
0000bb70  53 43 52 49 42 45 25 28  73 70 72 69 74 65 25 29  |SCRIBE%(sprite%)|
0000bb80  0d 44 e8 16 53 25 3d 53  43 52 49 42 45 25 28 73  |.D..S%=SCRIBE%(s|
0000bb90  74 61 76 65 25 29 0d 44  f2 13 43 25 3d 53 43 52  |tave%).D..C%=SCR|
0000bba0  49 42 45 25 28 73 63 25  29 0d 44 fc 2a f2 72 65  |IBE%(sc%).D.*.re|
0000bbb0  6c 65 61 73 65 3a f4 20  75 6e 64 72 61 77 20 73  |lease:. undraw s|
0000bbc0  70 72 69 74 65 20 62 65  69 6e 67 20 64 72 61 67  |prite being drag|
0000bbd0  67 65 64 0d 45 06 a4 e7  73 25 3c 61 63 63 69 64  |ged.E...s%<accid|
0000bbe0  65 6e 74 61 6c 25 20 f2  70 75 74 5f 6e 6f 74 65  |ental% .put_note|
0000bbf0  20 8b e7 73 25 3c 63 6c  65 66 25 20 f2 70 75 74  | ..s%<clef% .put|
0000bc00  5f 61 63 63 69 64 65 6e  74 61 6c 20 8b e7 73 25  |_accidental ..s%|
0000bc10  3c 64 6f 74 25 20 f2 70  75 74 5f 63 6c 65 66 20  |<dot% .put_clef |
0000bc20  8b e7 73 25 3c 62 61 72  25 20 f2 70 75 74 5f 64  |..s%<bar% .put_d|
0000bc30  6f 74 20 8b e7 73 25 3c  74 69 6d 65 25 20 f2 70  |ot ..s%<time% .p|
0000bc40  75 74 5f 62 61 72 20 8b  e7 73 25 3c 6b 65 79 25  |ut_bar ..s%<key%|
0000bc50  20 f2 70 75 74 5f 74 69  6d 65 20 8b e7 73 25 3c  | .put_time ..s%<|
0000bc60  74 69 65 25 20 f2 70 75  74 5f 6b 65 79 20 8b f2  |tie% .put_key ..|
0000bc70  70 75 74 5f 74 69 65 0d  45 10 15 47 50 25 3d 53  |put_tie.E..GP%=S|
0000bc80  43 52 49 42 45 25 28 73  67 70 25 29 0d 45 1a 20  |CRIBE%(sgp%).E. |
0000bc90  e3 43 25 3d 30 b8 37 3a  4e 25 28 43 25 29 3d 53  |.C%=0.7:N%(C%)=S|
0000bca0  43 52 49 42 45 25 28 43  25 29 3a ed 0d 45 24 23  |CRIBE%(C%):..E$#|
0000bcb0  f2 61 72 72 61 6e 67 65  5f 73 74 61 76 65 28 53  |.arrange_stave(S|
0000bcc0  43 52 49 42 45 25 28 73  74 61 76 65 25 29 29 0d  |CRIBE%(stave%)).|
0000bcd0  45 2e 3c e7 20 50 58 25  28 45 58 25 29 2b 32 30  |E.<. PX%(EX%)+20|
0000bce0  30 2a 48 69 25 3e 53 5f  57 69 64 74 68 25 20 f2  |0*Hi%>S_Width% .|
0000bcf0  53 65 74 45 78 74 65 6e  74 28 50 58 25 28 45 58  |SetExtent(PX%(EX|
0000bd00  25 29 2b 32 30 30 2a 48  69 25 29 0d 45 38 12 e7  |%)+200*Hi%).E8..|
0000bd10  20 ac 20 43 48 41 4e 47  45 44 25 20 8c 0d 45 42  | . CHANGED% ..EB|
0000bd20  0f 20 43 48 41 4e 47 45  44 25 3d b9 0d 45 4c 14  |. CHANGED%=..EL.|
0000bd30  20 24 55 70 64 61 74 65  64 25 3d 22 59 45 53 22  | $Updated%="YES"|
0000bd40  0d 45 56 2c 20 f2 55 70  64 61 74 65 54 69 74 6c  |.EV, .UpdateTitl|
0000bd50  65 28 a4 47 65 74 53 74  72 28 53 63 6f 72 65 54  |e(.GetStr(ScoreT|
0000bd60  69 74 6c 65 25 29 2b 22  20 2a 22 29 0d 45 60 06  |itle%)+" *").E`.|
0000bd70  20 cd 0d 45 6a 16 c8 99  20 22 48 6f 75 72 67 6c  | ..Ej... "Hourgl|
0000bd80  61 73 73 5f 4f 66 66 22  0d 45 74 05 e1 0d 45 7e  |ass_Off".Et...E~|
0000bd90  04 0d 45 88 0f dd 20 f2  70 75 74 5f 6e 6f 74 65  |..E... .put_note|
0000bda0  0d 45 92 0a ea 4c 25 2c  45 25 0d 45 9c 15 4c 25  |.E...L%,E%.E..L%|
0000bdb0  3d 53 43 52 49 42 45 25  28 6c 69 6e 65 25 29 0d  |=SCRIBE%(line%).|
0000bdc0  45 a6 14 e7 58 25 3d 50  58 25 28 50 58 25 2b 31  |E...X%=PX%(PX%+1|
0000bdd0  29 20 8c 0d 45 b0 15 e7  73 25 3e 3d 72 65 73 74  |) ..E...s%>=rest|
0000bde0  25 20 4c 25 3d 2d 31 36  0d 45 ba 0e 45 25 3d 47  |% L%=-16.E..E%=G|
0000bdf0  50 25 3d 45 50 25 0d 45  c4 32 e7 45 25 20 f2 69  |P%=EP%.E.2.E% .i|
0000be00  6e 73 65 72 74 5f 67 61  74 65 28 31 29 20 8b 43  |nsert_gate(1) .C|
0000be10  25 3d a4 63 6f 6e 66 6c  69 63 74 28 4e 6f 74 65  |%=.conflict(Note|
0000be20  25 2c 53 25 2c 4c 25 29  0d 45 ce 0e e7 45 25 84  |%,S%,L%).E...E%.|
0000be30  43 25 3d b9 20 8c 0d 45  d8 1c 43 25 3d a4 61 6c  |C%=. ..E..C%=.al|
0000be40  6c 6f 63 61 74 65 5f 63  68 61 6e 6e 65 6c 28 53  |locate_channel(S|
0000be50  25 29 0d 45 e2 0c e7 43  25 3e 3d 30 20 8c 0d 45  |%).E...C%>=0 ..E|
0000be60  ec 14 f2 69 6e 73 65 72  74 5f 6e 6f 74 65 28 43  |...insert_note(C|
0000be70  25 29 0d 45 f6 17 f2 6e  6f 74 65 5f 74 79 70 65  |%).E...note_type|
0000be80  28 43 25 2c 73 25 80 37  29 0d 46 00 33 e7 73 25  |(C%,s%.7).F.3.s%|
0000be90  3c 72 65 73 74 25 20 f2  6e 6f 74 65 5f 6c 69 6e  |<rest% .note_lin|
0000bea0  65 28 43 25 2c 4c 25 29  3a f2 6e 6f 74 65 5f 73  |e(C%,L%):.note_s|
0000beb0  74 65 6d 28 43 25 2c 73  25 80 38 29 0d 46 0a 0e  |tem(C%,s%.8).F..|
0000bec0  73 25 3d 21 4e 25 28 43  25 29 0d 46 14 25 e7 45  |s%=!N%(C%).F.%.E|
0000bed0  25 20 f2 73 65 74 5f 73  63 6f 72 65 28 50 58 25  |% .set_score(PX%|
0000bee0  29 3a 58 25 3d 50 58 25  28 50 58 25 2b 31 29 0d  |):X%=PX%(PX%+1).|
0000bef0  46 1e 1d f2 75 70 64 61  74 65 5f 6e 6f 74 65 28  |F...update_note(|
0000bf00  53 25 2c 73 25 2c 58 25  2c 59 25 29 0d 46 28 05  |S%,s%,X%,Y%).F(.|
0000bf10  cd 0d 46 32 05 cc 0d 46  3c 0e 73 25 3d 21 4e 25  |..F2...F<.s%=!N%|
0000bf20  28 43 25 29 0d 46 46 14  f2 64 65 6c 65 74 65 5f  |(C%).FF..delete_|
0000bf30  6e 6f 74 65 28 43 25 29  0d 46 50 0b e7 3f 47 50  |note(C%).FP..?GP|
0000bf40  25 20 8c 0d 46 5a 1d f2  75 70 64 61 74 65 5f 6e  |% ..FZ..update_n|
0000bf50  6f 74 65 28 53 25 2c 73  25 2c 58 25 2c 59 25 29  |ote(S%,s%,X%,Y%)|
0000bf60  0d 46 64 05 cc 0d 46 6e  13 f2 64 65 6c 65 74 65  |.Fd...Fn..delete|
0000bf70  5f 67 61 74 65 28 31 29  0d 46 78 30 e7 47 50 25  |_gate(1).Fx0.GP%|
0000bf80  3f 2d 32 3d 30 20 c8 95  3f 47 50 25 3d 30 80 47  |?-2=0 ..?GP%=0.G|
0000bf90  50 25 3c 45 50 25 3a f2  64 65 6c 65 74 65 5f 67  |P%<EP%:.delete_g|
0000bfa0  61 74 65 28 32 29 3a ce  0d 46 82 11 f2 72 65 73  |ate(2):..F...res|
0000bfb0  63 6f 72 65 28 50 58 25  29 0d 46 8c 05 cd 0d 46  |core(PX%).F....F|
0000bfc0  96 05 cd 0d 46 a0 05 cc  0d 46 aa 1d e7 58 25 3e  |....F....F...X%>|
0000bfd0  50 58 25 28 50 58 25 2b  31 29 20 f2 73 6b 69 70  |PX%(PX%+1) .skip|
0000bfe0  5f 67 61 74 65 0d 46 b4  13 f2 69 6e 73 65 72 74  |_gate.F...insert|
0000bff0  5f 67 61 74 65 28 31 29  0d 46 be 1c 43 25 3d a4  |_gate(1).F..C%=.|
0000c000  61 6c 6c 6f 63 61 74 65  5f 63 68 61 6e 6e 65 6c  |allocate_channel|
0000c010  28 53 25 29 0d 46 c8 14  f2 69 6e 73 65 72 74 5f  |(S%).F...insert_|
0000c020  6e 6f 74 65 28 43 25 29  0d 46 d2 17 f2 6e 6f 74  |note(C%).F...not|
0000c030  65 5f 74 79 70 65 28 43  25 2c 73 25 80 37 29 0d  |e_type(C%,s%.7).|
0000c040  46 dc 33 e7 73 25 3c 72  65 73 74 25 20 f2 6e 6f  |F.3.s%<rest% .no|
0000c050  74 65 5f 6c 69 6e 65 28  43 25 2c 4c 25 29 3a f2  |te_line(C%,L%):.|
0000c060  6e 6f 74 65 5f 73 74 65  6d 28 43 25 2c 73 25 80  |note_stem(C%,s%.|
0000c070  38 29 0d 46 e6 11 f2 72  65 73 63 6f 72 65 28 50  |8).F...rescore(P|
0000c080  58 25 29 0d 46 f0 05 cd  0d 46 fa 05 e1 0d 47 04  |X%).F....F....G.|
0000c090  04 0d 47 0e 0e dd 20 f2  70 75 74 5f 74 69 65 0d  |..G... .put_tie.|
0000c0a0  47 18 10 e7 3f 4e 25 28  43 25 29 80 34 20 8c 0d  |G...?N%(C%).4 ..|
0000c0b0  47 22 13 f2 6e 6f 74 65  5f 74 69 65 28 43 25 2c  |G"..note_tie(C%,|
0000c0c0  a3 29 0d 47 2c 2a f2 75  70 64 61 74 65 5f 73 63  |.).G,*.update_sc|
0000c0d0  6f 72 65 28 58 25 2b 32  34 2c 59 25 2b 31 32 2c  |ore(X%+24,Y%+12,|
0000c0e0  58 25 2b 37 30 2c 59 25  2b 32 34 29 0d 47 36 05  |X%+70,Y%+24).G6.|
0000c0f0  cc 0d 47 40 07 ea 49 25  0d 47 4a 13 f2 6e 6f 74  |..G@..I%.GJ..not|
0000c100  65 5f 74 69 65 28 43 25  2c b9 29 0d 47 54 1c f2  |e_tie(C%,.).GT..|
0000c110  73 6b 69 70 5f 6e 6f 74  65 73 28 3f 47 50 25 29  |skip_notes(?GP%)|
0000c120  3a 47 50 25 2b 3d 31 0d  47 5e 16 f2 61 72 72 61  |:GP%+=1.G^..arra|
0000c130  6e 67 65 5f 73 74 61 76  65 28 53 25 29 0d 47 68  |nge_stave(S%).Gh|
0000c140  15 47 50 25 3d 53 43 52  49 42 45 25 28 73 67 70  |.GP%=SCRIBE%(sgp|
0000c150  25 29 0d 47 72 20 e3 49  25 3d 30 b8 37 3a 4e 25  |%).Gr .I%=0.7:N%|
0000c160  28 49 25 29 3d 53 43 52  49 42 45 25 28 49 25 29  |(I%)=SCRIBE%(I%)|
0000c170  3a ed 0d 47 7c 67 e7 4e  25 28 43 25 29 2b 32 3e  |:..G|g.N%(C%)+2>|
0000c180  3d 46 49 4e 45 25 28 43  25 29 84 28 3f 4e 25 28  |=FINE%(C%).(?N%(|
0000c190  43 25 29 82 4e 25 28 43  25 29 3f 32 29 80 26 46  |C%).N%(C%)?2).&F|
0000c1a0  38 20 f2 6e 6f 74 65 5f  74 69 65 28 43 25 2c a3  |8 .note_tie(C%,.|
0000c1b0  29 20 8b f2 75 70 64 61  74 65 5f 73 63 6f 72 65  |) ..update_score|
0000c1c0  28 58 25 2b 32 34 2c 59  25 2b 31 32 2c 58 25 2b  |(X%+24,Y%+12,X%+|
0000c1d0  37 30 2c 59 25 2b 32 34  29 0d 47 86 05 cd 0d 47  |70,Y%+24).G....G|
0000c1e0  90 05 e1 0d 47 9a 04 0d  47 a4 15 dd 20 f2 70 75  |....G...G... .pu|
0000c1f0  74 5f 61 63 63 69 64 65  6e 74 61 6c 0d 47 ae 0a  |t_accidental.G..|
0000c200  ea 41 25 2c 61 25 0d 47  b8 11 61 25 3d 4e 25 28  |.A%,a%.G..a%=N%(|
0000c210  43 25 29 3f 31 80 37 0d  47 c2 0b 41 25 3d 73 25  |C%)?1.7.G..A%=s%|
0000c220  80 37 0d 47 cc 0f e7 41  25 3d 61 25 20 41 25 3d  |.7.G...A%=a% A%=|
0000c230  30 0d 47 d6 1b f2 6e 6f  74 65 5f 61 63 63 69 64  |0.G...note_accid|
0000c240  65 6e 74 61 6c 28 43 25  2c 41 25 29 0d 47 e0 40  |ental(C%,A%).G.@|
0000c250  e7 41 25 2a 61 25 20 f2  75 70 64 61 74 65 5f 73  |.A%*a% .update_s|
0000c260  63 6f 72 65 28 58 25 2d  33 34 2c 59 25 2d 32 34  |core(X%-34,Y%-24|
0000c270  2c 58 25 2b 31 36 2c 59  25 2b 35 32 29 20 8b f2  |,X%+16,Y%+52) ..|
0000c280  72 65 73 63 6f 72 65 28  50 58 25 29 0d 47 ea 05  |rescore(PX%).G..|
0000c290  e1 0d 47 f4 04 0d 47 fe  0e dd 20 f2 70 75 74 5f  |..G...G... .put_|
0000c2a0  64 6f 74 0d 48 08 0a ea  44 25 2c 64 25 0d 48 12  |dot.H...D%,d%.H.|
0000c2b0  14 64 25 3d 4e 25 28 43  25 29 3f 31 3e 3e 33 80  |.d%=N%(C%)?1>>3.|
0000c2c0  33 0d 48 1c 0b 44 25 3d  73 25 80 33 0d 48 26 0f  |3.H..D%=s%.3.H&.|
0000c2d0  e7 44 25 3d 64 25 20 44  25 3d 30 0d 48 30 15 f2  |.D%=d% D%=0.H0..|
0000c2e0  6e 6f 74 65 5f 64 6f 74  73 28 43 25 2c 44 25 29  |note_dots(C%,D%)|
0000c2f0  0d 48 3a 0c e7 44 25 2a  64 25 20 8c 0d 48 44 39  |.H:..D%*d% ..HD9|
0000c300  73 25 3d 4e 25 28 43 25  29 3f 31 3e 3e 35 84 3f  |s%=N%(C%)?1>>5.?|
0000c310  4e 25 28 43 25 29 3c 3c  33 80 38 3a e7 3f 4e 25  |N%(C%)<<3.8:.?N%|
0000c320  28 43 25 29 80 26 46 38  20 8b 73 25 3d 73 25 84  |(C%).&F8 .s%=s%.|
0000c330  72 65 73 74 25 0d 48 4e  0e 58 25 2b 3d 78 25 28  |rest%.HN.X%+=x%(|
0000c340  73 25 29 0d 48 58 26 f2  75 70 64 61 74 65 5f 73  |s%).HX&.update_s|
0000c350  63 6f 72 65 28 58 25 2b  32 34 2c 59 25 2d 38 2c  |core(X%+24,Y%-8,|
0000c360  58 25 2b 35 30 2c 59 25  29 0d 48 62 05 cc 0d 48  |X%+50,Y%).Hb...H|
0000c370  6c 11 f2 72 65 73 63 6f  72 65 28 50 58 25 29 0d  |l..rescore(PX%).|
0000c380  48 76 05 cd 0d 48 80 05  e1 0d 48 8a 04 0d 48 94  |Hv...H....H...H.|
0000c390  0f dd 20 f2 70 75 74 5f  63 6c 65 66 0d 48 9e 07  |.. .put_clef.H..|
0000c3a0  ea 63 25 0d 48 a8 0b 63  25 3d 73 25 80 33 0d 48  |.c%.H..c%=s%.3.H|
0000c3b0  b2 27 e7 47 50 25 3d 45  50 25 84 3f 47 50 25 84  |.'.GP%=EP%.?GP%.|
0000c3c0  28 47 50 25 3f 31 80 25  31 31 31 29 3c 3e 43 6c  |(GP%?1.%111)<>Cl|
0000c3d0  65 66 25 20 8c 0d 48 bc  13 f2 69 6e 73 65 72 74  |ef% ..H...insert|
0000c3e0  5f 67 61 74 65 28 32 29  0d 48 c6 10 f2 63 6c 65  |_gate(2).H...cle|
0000c3f0  66 28 53 25 2c 63 25 29  0d 48 d0 05 cc 0d 48 da  |f(S%,c%).H....H.|
0000c400  37 c8 95 20 3f 47 50 25  3d 30 80 28 47 50 25 3f  |7.. ?GP%=0.(GP%?|
0000c410  31 80 25 31 31 31 29 3d  43 6c 65 66 25 80 28 47  |1.%111)=Clef%.(G|
0000c420  50 25 3f 31 3e 3e 36 29  3c 3e 53 25 80 47 50 25  |P%?1>>6)<>S%.GP%|
0000c430  3c 45 50 25 0d 48 e4 0e  f2 73 6b 69 70 5f 67 61  |<EP%.H...skip_ga|
0000c440  74 65 0d 48 ee 05 ce 0d  48 f8 36 e7 47 50 25 3c  |te.H....H.6.GP%<|
0000c450  45 50 25 80 3f 47 50 25  3d 30 80 28 47 50 25 3f  |EP%.?GP%=0.(GP%?|
0000c460  31 80 25 31 31 31 29 3d  43 6c 65 66 25 80 28 47  |1.%111)=Clef%.(G|
0000c470  50 25 3f 31 3e 3e 36 29  3d 53 25 20 8c 0d 49 02  |P%?1>>6)=S% ..I.|
0000c480  33 e7 28 47 50 25 3f 31  3e 3e 33 80 33 29 3c 3e  |3.(GP%?1>>3.3)<>|
0000c490  63 25 20 f2 63 6c 65 66  28 53 25 2c 63 25 29 20  |c% .clef(S%,c%) |
0000c4a0  8b f2 64 65 6c 65 74 65  5f 67 61 74 65 28 32 29  |..delete_gate(2)|
0000c4b0  0d 49 0c 05 cc 0d 49 16  13 f2 69 6e 73 65 72 74  |.I....I...insert|
0000c4c0  5f 67 61 74 65 28 32 29  0d 49 20 10 f2 63 6c 65  |_gate(2).I ..cle|
0000c4d0  66 28 53 25 2c 63 25 29  0d 49 2a 05 cd 0d 49 34  |f(S%,c%).I*...I4|
0000c4e0  05 cd 0d 49 3e 11 f2 72  65 73 63 6f 72 65 28 50  |...I>..rescore(P|
0000c4f0  58 25 29 0d 49 48 05 e1  0d 49 52 04 0d 49 5c 0e  |X%).IH...IR..I\.|
0000c500  dd 20 f2 70 75 74 5f 6b  65 79 0d 49 66 25 e7 47  |. .put_key.If%.G|
0000c510  50 25 3d 45 50 25 84 3f  47 50 25 84 28 47 50 25  |P%=EP%.?GP%.(GP%|
0000c520  3f 31 80 25 31 31 29 3c  3e 4b 65 79 25 20 8c 0d  |?1.%11)<>Key% ..|
0000c530  49 70 13 f2 69 6e 73 65  72 74 5f 67 61 74 65 28  |Ip..insert_gate(|
0000c540  32 29 0d 49 7a 25 f2 6b  65 79 5f 73 69 67 28 4b  |2).Iz%.key_sig(K|
0000c550  45 59 5f 53 49 47 25 28  30 29 2c 4b 45 59 5f 53  |EY_SIG%(0),KEY_S|
0000c560  49 47 25 28 31 29 29 0d  49 84 05 cc 0d 49 8e 78  |IG%(1)).I....I.x|
0000c570  e7 4b 45 59 5f 53 49 47  25 28 31 29 3e 30 80 28  |.KEY_SIG%(1)>0.(|
0000c580  47 50 25 3f 31 3e 3e 32  80 25 31 29 3c 3e 4b 45  |GP%?1>>2.%1)<>KE|
0000c590  59 5f 53 49 47 25 28 30  29 84 28 47 50 25 3f 31  |Y_SIG%(0).(GP%?1|
0000c5a0  3e 3e 33 29 3c 3e 4b 45  59 5f 53 49 47 25 28 31  |>>3)<>KEY_SIG%(1|
0000c5b0  29 20 f2 6b 65 79 5f 73  69 67 28 4b 45 59 5f 53  |) .key_sig(KEY_S|
0000c5c0  49 47 25 28 30 29 2c 4b  45 59 5f 53 49 47 25 28  |IG%(0),KEY_SIG%(|
0000c5d0  31 29 29 20 8b f2 64 65  6c 65 74 65 5f 67 61 74  |1)) ..delete_gat|
0000c5e0  65 28 32 29 0d 49 98 05  cd 0d 49 a2 11 f2 72 65  |e(2).I....I...re|
0000c5f0  73 63 6f 72 65 28 50 58  25 29 0d 49 ac 05 e1 0d  |score(PX%).I....|
0000c600  49 b6 04 0d 49 c0 0f dd  20 f2 70 75 74 5f 74 69  |I...I... .put_ti|
0000c610  6d 65 0d 49 ca 25 e7 47  50 25 3d 45 50 25 84 3f  |me.I.%.GP%=EP%.?|
0000c620  47 50 25 84 28 47 50 25  3f 31 80 25 31 29 3c 3e  |GP%.(GP%?1.%1)<>|
0000c630  54 69 6d 65 25 20 8c 0d  49 d4 13 f2 69 6e 73 65  |Time% ..I...inse|
0000c640  72 74 5f 67 61 74 65 28  32 29 0d 49 de 28 f2 74  |rt_gate(2).I.(.t|
0000c650  69 6d 65 5f 73 69 67 28  54 49 4d 45 5f 53 49 47  |ime_sig(TIME_SIG|
0000c660  25 28 30 29 2c 54 49 4d  45 5f 53 49 47 25 28 31  |%(0),TIME_SIG%(1|
0000c670  29 29 0d 49 e8 11 f2 72  65 73 63 6f 72 65 28 50  |)).I...rescore(P|
0000c680  58 25 29 0d 49 f2 05 cc  0d 49 fc 3b e7 28 47 50  |X%).I....I.;.(GP|
0000c690  25 3f 31 3e 3e 31 80 31  35 29 3c 3e 54 49 4d 45  |%?1>>1.15)<>TIME|
0000c6a0  5f 53 49 47 25 28 30 29  84 28 47 50 25 3f 31 3e  |_SIG%(0).(GP%?1>|
0000c6b0  3e 35 29 3c 3e 54 49 4d  45 5f 53 49 47 25 28 31  |>5)<>TIME_SIG%(1|
0000c6c0  29 20 8c 0d 4a 06 28 f2  74 69 6d 65 5f 73 69 67  |) ..J.(.time_sig|
0000c6d0  28 54 49 4d 45 5f 53 49  47 25 28 30 29 2c 54 49  |(TIME_SIG%(0),TI|
0000c6e0  4d 45 5f 53 49 47 25 28  31 29 29 0d 4a 10 2c f2  |ME_SIG%(1)).J.,.|
0000c6f0  75 70 64 61 74 65 5f 73  63 6f 72 65 28 58 25 2c  |update_score(X%,|
0000c700  2d 53 63 6f 72 65 5f 48  65 69 67 68 74 25 2c 58  |-Score_Height%,X|
0000c710  25 2b 34 38 2c 30 29 0d  4a 1a 05 cc 0d 4a 24 13  |%+48,0).J....J$.|
0000c720  f2 64 65 6c 65 74 65 5f  67 61 74 65 28 32 29 0d  |.delete_gate(2).|
0000c730  4a 2e 11 f2 72 65 73 63  6f 72 65 28 50 58 25 29  |J...rescore(PX%)|
0000c740  0d 4a 38 05 cd 0d 4a 42  05 cd 0d 4a 4c 05 e1 0d  |.J8...JB...JL...|
0000c750  4a 56 04 0d 4a 60 0e dd  20 f2 70 75 74 5f 62 61  |JV..J`.. .put_ba|
0000c760  72 0d 4a 6a 5a e7 28 3f  47 50 25 84 47 50 25 3f  |r.JjZ.(?GP%.GP%?|
0000c770  31 3c 3e 42 61 72 25 29  80 58 25 3e 50 58 25 28  |1<>Bar%).X%>PX%(|
0000c780  50 58 25 2b 31 29 80 47  50 25 3c 45 50 25 20 f2  |PX%+1).GP%<EP% .|
0000c790  73 6b 69 70 5f 67 61 74  65 20 8b e7 47 50 25 3f  |skip_gate ..GP%?|
0000c7a0  2d 32 3d 30 80 47 50 25  3f 2d 31 3d 42 61 72 25  |-2=0.GP%?-1=Bar%|
0000c7b0  20 f2 62 61 63 6b 5f 67  61 74 65 0d 4a 74 11 e7  | .back_gate.Jt..|
0000c7c0  47 50 25 3e 4d 55 53 49  43 25 20 8c 0d 4a 7e 20  |GP%>MUSIC% ..J~ |
0000c7d0  e7 47 50 25 3c 45 50 25  80 3f 47 50 25 3d 30 80  |.GP%<EP%.?GP%=0.|
0000c7e0  47 50 25 3f 31 3d 42 61  72 25 20 8c 0d 4a 88 13  |GP%?1=Bar% ..J..|
0000c7f0  f2 64 65 6c 65 74 65 5f  67 61 74 65 28 32 29 0d  |.delete_gate(2).|
0000c800  4a 92 0d 4e 42 61 72 73  25 2d 3d 31 0d 4a 9c 14  |J..NBars%-=1.J..|
0000c810  c8 95 3f 47 50 25 3d 30  80 47 50 25 3c 45 50 25  |..?GP%=0.GP%<EP%|
0000c820  0d 4a a6 13 f2 64 65 6c  65 74 65 5f 67 61 74 65  |.J...delete_gate|
0000c830  28 32 29 0d 4a b0 05 ce  0d 4a ba 11 f2 72 65 73  |(2).J....J...res|
0000c840  63 6f 72 65 28 50 58 25  29 0d 4a c4 05 cc 0d 4a  |core(PX%).J....J|
0000c850  ce 38 e7 47 50 25 3f 2d  32 20 f2 69 6e 73 65 72  |.8.GP%?-2 .inser|
0000c860  74 5f 67 61 74 65 28 32  29 3a f2 62 61 72 3a 4e  |t_gate(2):.bar:N|
0000c870  42 61 72 73 25 2b 3d 31  3a f2 72 65 73 63 6f 72  |Bars%+=1:.rescor|
0000c880  65 28 50 58 25 29 0d 4a  d8 05 cd 0d 4a e2 05 cd  |e(PX%).J....J...|
0000c890  0d 4a ec 05 e1 0d 4a f6  04 0d 4b 00 13 dd 20 f2  |.J....J...K... .|
0000c8a0  72 65 73 63 6f 72 65 28  70 78 25 29 0d 4b 0a 45  |rescore(px%).K.E|
0000c8b0  e7 70 78 25 20 8b f2 73  74 61 72 74 5f 6d 75 73  |.px% ..start_mus|
0000c8c0  69 63 3a f4 20 42 61 72  20 70 6f 73 69 74 69 6f  |ic:. Bar positio|
0000c8d0  6e 20 61 73 73 75 6d 65  64 20 73 65 74 2c 20 62  |n assumed set, b|
0000c8e0  75 74 20 72 65 73 65 74  20 69 66 20 70 78 25 3d  |ut reset if px%=|
0000c8f0  30 0d 4b 14 13 f2 73 65  74 5f 73 63 6f 72 65 28  |0.K...set_score(|
0000c900  70 78 25 29 0d 4b 1e 3f  e7 20 70 78 25 3d 30 20  |px%).K.?. px%=0 |
0000c910  f2 53 65 74 75 70 42 61  72 53 74 61 72 74 73 28  |.SetupBarStarts(|
0000c920  30 29 20 8b 20 f2 53 65  74 75 70 42 61 72 53 74  |0) . .SetupBarSt|
0000c930  61 72 74 73 28 a4 46 69  6e 64 42 61 72 28 70 78  |arts(.FindBar(px|
0000c940  25 29 29 0d 4b 28 39 f2  75 70 64 61 74 65 5f 73  |%)).K(9.update_s|
0000c950  63 6f 72 65 28 50 58 25  28 70 78 25 29 2c 2d 53  |core(PX%(px%),-S|
0000c960  63 6f 72 65 5f 48 65 69  67 68 74 25 2c 53 63 6f  |core_Height%,Sco|
0000c970  72 65 5f 57 69 64 74 68  25 2c 30 29 0d 4b 32 05  |re_Width%,0).K2.|
0000c980  e1 0d 4b 3c 04 0d 4b 46  1f dd 20 f2 75 70 64 61  |..K<..KF.. .upda|
0000c990  74 65 5f 6e 6f 74 65 28  53 25 2c 4e 25 2c 58 25  |te_note(S%,N%,X%|
0000c9a0  2c 59 25 29 0d 4b 50 18  ea 6c 78 30 25 2c 6c 78  |,Y%).KP..lx0%,lx|
0000c9b0  31 25 2c 6c 79 30 25 2c  6c 79 31 25 0d 4b 5a 3c  |1%,ly0%,ly1%.KZ<|
0000c9c0  f2 62 6f 75 6e 64 5f 6e  6f 74 65 28 4e 25 29 3a  |.bound_note(N%):|
0000c9d0  f4 20 47 65 74 20 6d 69  6e 69 6d 75 6d 20 62 6f  |. Get minimum bo|
0000c9e0  75 6e 64 69 6e 67 20 72  65 63 74 61 6e 67 6c 65  |unding rectangle|
0000c9f0  20 6f 66 20 6e 6f 74 65  0d 4b 64 7c e7 4e 25 80  | of note.Kd|.N%.|
0000ca00  34 20 6c 78 31 25 3d 58  25 28 74 69 65 25 29 3a  |4 lx1%=X%(tie%):|
0000ca10  e7 59 25 28 74 69 65 25  29 3e 6c 79 31 25 20 6c  |.Y%(tie%)>ly1% l|
0000ca20  79 31 25 3d 59 25 28 74  69 65 25 29 3a f4 20 54  |y1%=Y%(tie%):. T|
0000ca30  69 65 20 73 65 74 73 20  73 75 66 66 69 78 20 61  |ie sets suffix a|
0000ca40  6e 64 20 6d 61 79 20 62  65 20 68 69 67 68 65 72  |nd may be higher|
0000ca50  20 28 54 69 65 20 62 6f  75 6e 64 73 20 6f 6e 6c  | (Tie bounds onl|
0000ca60  79 20 61 70 70 6c 79 20  74 6f 20 75 70 64 61 74  |y apply to updat|
0000ca70  69 6e 67 29 0d 4b 6e 1f  e7 94 28 59 25 2d 59 5f  |ing).Kn...(Y%-Y_|
0000ca80  53 54 41 56 45 25 28 53  25 29 29 3e 4c 69 25 2a  |STAVE%(S%))>Li%*|
0000ca90  35 20 8c 0d 4b 78 20 e7  78 25 28 64 6f 74 25 29  |5 ..Kx .x%(dot%)|
0000caa0  3e 6c 78 30 25 20 6c 78  30 25 3d 78 25 28 64 6f  |>lx0% lx0%=x%(do|
0000cab0  74 25 29 0d 4b 82 3a e7  58 25 28 64 6f 74 25 29  |t%).K.:.X%(dot%)|
0000cac0  3e 6c 78 31 25 20 6c 78  31 25 3d 58 25 28 64 6f  |>lx1% lx1%=X%(do|
0000cad0  74 25 29 3a f4 20 45 78  74 65 6e 64 20 74 6f 20  |t%):. Extend to |
0000cae0  6c 65 64 67 65 72 20 65  78 74 65 6e 74 0d 4b 8c  |ledger extent.K.|
0000caf0  05 cd 0d 4b 96 38 6c 79  31 25 2b 3d 59 25 3a 59  |...K.8ly1%+=Y%:Y|
0000cb00  25 2d 3d 6c 79 30 25 3a  6c 79 30 25 3d 59 5f 53  |%-=ly0%:ly0%=Y_S|
0000cb10  54 41 56 45 25 28 53 25  29 3a f4 20 53 74 61 76  |TAVE%(S%):. Stav|
0000cb20  65 20 70 6f 73 69 74 69  6f 6e 0d 4b a0 81 e7 6c  |e position.K...l|
0000cb30  79 31 25 3c 6c 79 30 25  2d 4c 69 25 2a 35 20 6c  |y1%<ly0%-Li%*5 l|
0000cb40  79 31 25 3d 6c 79 30 25  2d 4c 69 25 2a 35 20 8b  |y1%=ly0%-Li%*5 .|
0000cb50  e7 59 25 3e 6c 79 30 25  2b 4c 69 25 2a 35 20 59  |.Y%>ly0%+Li%*5 Y|
0000cb60  25 3d 6c 79 30 25 2b 4c  69 25 2a 35 3a f4 20 49  |%=ly0%+Li%*5:. I|
0000cb70  66 20 6c 65 64 67 65 72  20 6c 69 6e 65 73 20 77  |f ledger lines w|
0000cb80  69 6c 6c 20 62 65 20 64  72 61 77 6e 20 69 6e 63  |ill be drawn inc|
0000cb90  72 65 61 73 65 20 76 65  72 74 69 63 61 6c 20 75  |rease vertical u|
0000cba0  70 64 61 74 65 20 73 70  61 63 65 0d 4b aa 46 f2  |pdate space.K.F.|
0000cbb0  75 70 64 61 74 65 5f 73  63 6f 72 65 28 58 25 2d  |update_score(X%-|
0000cbc0  6c 78 30 25 2c 59 25 2c  58 25 2b 6c 78 31 25 2b  |lx0%,Y%,X%+lx1%+|
0000cbd0  50 67 61 70 25 2c 6c 79  31 25 29 3a f4 20 55 70  |Pgap%,ly1%):. Up|
0000cbe0  64 61 74 65 20 73 79 6d  62 6f 6c 20 73 70 61 63  |date symbol spac|
0000cbf0  65 0d 4b b4 05 e1 0d 4b  be 04 0d 4b c8 14 dd 20  |e.K....K...K... |
0000cc00  f2 61 74 74 61 63 68 28  73 25 2c 56 25 29 0d 4b  |.attach(s%,V%).K|
0000cc10  d2 4b 53 43 52 49 42 45  25 28 73 78 25 29 3d b9  |.KSCRIBE%(sx%)=.|
0000cc20  3a f4 20 4e 65 77 20 70  6f 73 69 74 69 6f 6e 20  |:. New position |
0000cc30  28 4d 61 69 6e 74 61 69  6e 20 59 20 66 6f 72 20  |(Maintain Y for |
0000cc40  6f 72 69 65 6e 74 61 74  69 6f 6e 20 6d 61 69 6e  |orientation main|
0000cc50  74 61 69 6e 61 6e 63 65  29 0d 4b dc 15 53 43 52  |tainance).K..SCR|
0000cc60  49 42 45 25 28 64 72 61  77 6e 25 29 3d a3 0d 4b  |IBE%(drawn%)=..K|
0000cc70  e6 5b e7 73 25 3c 72 65  73 74 25 80 53 43 52 49  |.[.s%<rest%.SCRI|
0000cc80  42 45 25 28 73 70 72 69  74 65 25 29 3c 72 65 73  |BE%(sprite%)<res|
0000cc90  74 25 20 73 25 3d 73 25  80 37 84 53 43 52 49 42  |t% s%=s%.7.SCRIB|
0000cca0  45 25 28 73 70 72 69 74  65 25 29 80 38 3a f4 20  |E%(sprite%).8:. |
0000ccb0  4d 61 69 6e 74 61 69 6e  20 6e 6f 74 65 20 6f 72  |Maintain note or|
0000ccc0  69 65 6e 74 61 74 69 6f  6e 0d 4b f0 17 53 43 52  |ientation.K..SCR|
0000ccd0  49 42 45 25 28 73 70 72  69 74 65 25 29 3d 73 25  |IBE%(sprite%)=s%|
0000cce0  0d 4b fa 16 53 43 52 49  42 45 25 28 76 61 6c 69  |.K..SCRIBE%(vali|
0000ccf0  64 25 29 3d 56 25 0d 4c  04 0e 53 43 4f 52 49 4e  |d%)=V%.L..SCORIN|
0000cd00  47 25 3d b9 0d 4c 0e 05  e1 0d 4c 18 06 3a 3a 0d  |G%=..L....L..::.|
0000cd10  4c 22 0e dd 20 f2 72 65  6c 65 61 73 65 0d 4c 2c  |L".. .release.L,|
0000cd20  1f e7 53 43 4f 52 49 4e  47 25 80 53 43 52 49 42  |..SCORING%.SCRIB|
0000cd30  45 25 28 64 72 61 77 6e  25 29 20 8c 0d 4c 36 3f  |E%(drawn%) ..L6?|
0000cd40  ea 57 69 6e 64 6f 77 25  3a 57 69 6e 64 6f 77 25  |.Window%:Window%|
0000cd50  3d 49 63 6f 6e 25 2b 31  30 30 3a f4 20 44 6f 6e  |=Icon%+100:. Don|
0000cd60  27 74 20 63 6f 72 72 75  70 74 20 77 69 6e 64 6f  |'t corrupt windo|
0000cd70  77 20 77 6f 72 6b 73 70  61 63 65 0d 4c 40 46 f2  |w workspace.L@F.|
0000cd80  66 6c 6f 61 74 28 53 43  52 49 42 45 25 28 73 70  |float(SCRIBE%(sp|
0000cd90  72 69 74 65 25 29 2c 53  43 52 49 42 45 25 28 73  |rite%),SCRIBE%(s|
0000cda0  78 25 29 2c 53 43 52 49  42 45 25 28 73 79 25 29  |x%),SCRIBE%(sy%)|
0000cdb0  29 3a f4 20 55 6e 64 72  61 77 20 73 70 72 69 74  |):. Undraw sprit|
0000cdc0  65 0d 4c 4a 8c e7 53 43  52 49 42 45 25 28 73 70  |e.LJ..SCRIBE%(sp|
0000cdd0  72 69 74 65 25 29 3c 72  65 73 74 25 20 e7 94 53  |rite%)<rest% ..S|
0000cde0  43 52 49 42 45 25 28 6c  69 6e 65 25 29 3e 35 20  |CRIBE%(line%)>5 |
0000cdf0  f2 66 6c 6f 61 74 28 6c  65 64 67 65 72 25 2b 53  |.float(ledger%+S|
0000ce00  43 52 49 42 45 25 28 6c  69 6e 65 25 29 81 32 2c  |CRIBE%(line%).2,|
0000ce10  53 43 52 49 42 45 25 28  73 78 25 29 2c 59 5f 53  |SCRIBE%(sx%),Y_S|
0000ce20  54 41 56 45 25 28 53 43  52 49 42 45 25 28 73 74  |TAVE%(SCRIBE%(st|
0000ce30  61 76 65 25 29 29 29 3a  f4 20 55 6e 64 72 61 77  |ave%))):. Undraw|
0000ce40  20 6c 65 64 67 65 72 20  6c 69 6e 65 73 0d 4c 54  | ledger lines.LT|
0000ce50  2f 53 43 52 49 42 45 25  28 73 78 25 29 3d b9 3a  |/SCRIBE%(sx%)=.:|
0000ce60  f4 20 43 6f 6e 74 69 6e  75 65 20 64 72 61 77 69  |. Continue drawi|
0000ce70  6e 67 20 6f 66 20 73 79  6d 62 6f 6c 0d 4c 5e 15  |ng of symbol.L^.|
0000ce80  53 43 52 49 42 45 25 28  64 72 61 77 6e 25 29 3d  |SCRIBE%(drawn%)=|
0000ce90  a3 0d 4c 68 05 cd 0d 4c  72 05 e1 0d 4c 7c 06 3a  |..Lh...Lr...L|.:|
0000cea0  3a 0d 4c 86 23 f4 20 20  20 50 52 4f 43 45 44 55  |:.L.#.   PROCEDU|
0000ceb0  52 45 3a 20 73 63 72 69  62 65 28 41 74 20 58 25  |RE: scribe(At X%|
0000cec0  2c 59 25 29 0d 4c 90 05  f4 0d 4c 9a 4a f4 20 44  |,Y%).L....L.J. D|
0000ced0  45 53 43 52 49 50 54 49  4f 4e 3a 20 44 72 61 77  |ESCRIPTION: Draw|
0000cee0  20 63 75 72 72 65 6e 74  20 6d 75 73 69 63 20 73  | current music s|
0000cef0  79 6d 62 6f 6c 20 61 74  20 70 6f 73 69 74 69 6f  |ymbol at positio|
0000cf00  6e 20 6f 76 65 72 20 73  63 6f 72 65 20 77 69 6e  |n over score win|
0000cf10  64 6f 77 0d 4c a4 05 3a  0d 4c ae 14 dd 20 f2 73  |dow.L..:.L... .s|
0000cf20  63 72 69 62 65 28 58 25  2c 59 25 29 0d 4c b8 0d  |cribe(X%,Y%).L..|
0000cf30  ea 53 25 2c 4c 25 2c 43  25 0d 4c c2 20 57 69 6e  |.S%,L%,C%.L. Win|
0000cf40  64 6f 77 25 21 68 61 6e  64 6c 65 25 3d 53 63 6f  |dow%!handle%=Sco|
0000cf50  72 65 57 69 6e 64 5f 68  25 0d 4c cc 27 c8 99 20  |reWind_h%.L.'.. |
0000cf60  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 25 2c  |GetWindowState%,|
0000cf70  2c 57 69 6e 64 6f 77 25  2b 68 61 6e 64 6c 65 25  |,Window%+handle%|
0000cf80  0d 4c d6 20 58 25 2d 3d  57 69 6e 64 6f 77 25 21  |.L. X%-=Window%!|
0000cf90  78 30 25 2d 57 69 6e 64  6f 77 25 21 73 63 78 25  |x0%-Window%!scx%|
0000cfa0  0d 4c e0 20 59 25 2d 3d  57 69 6e 64 6f 77 25 21  |.L. Y%-=Window%!|
0000cfb0  79 31 25 2d 57 69 6e 64  6f 77 25 21 73 63 79 25  |y1%-Window%!scy%|
0000cfc0  0d 4c ea 1f f2 70 72 6f  78 69 6d 61 74 65 28 53  |.L...proximate(S|
0000cfd0  43 52 49 42 45 25 28 76  61 6c 69 64 25 29 29 0d  |CRIBE%(valid%)).|
0000cfe0  4c f4 28 e7 58 25 3c 3e  53 43 52 49 42 45 25 28  |L.(.X%<>SCRIBE%(|
0000cff0  73 78 25 29 84 59 25 3c  3e 53 43 52 49 42 45 25  |sx%).Y%<>SCRIBE%|
0000d000  28 73 79 25 29 20 8c 0d  4c fe 07 ea 41 25 0d 4d  |(sy%) ..L...A%.M|
0000d010  08 08 41 25 3d b9 0d 4d  12 55 e7 28 53 43 52 49  |..A%=..M.U.(SCRI|
0000d020  42 45 25 28 76 61 6c 69  64 25 29 80 31 31 32 29  |BE%(valid%).112)|
0000d030  3d 39 36 20 41 25 3d a3  3a e7 43 25 3e 3d 30 20  |=96 A%=.:.C%>=0 |
0000d040  41 25 3d 53 43 52 49 42  45 25 28 76 61 6c 69 64  |A%=SCRIBE%(valid|
0000d050  25 29 80 38 84 53 25 3c  3d 53 54 41 56 45 25 80  |%).8.S%<=STAVE%.|
0000d060  3f 4e 25 28 43 25 29 80  26 46 38 0d 4d 1c 09 e7  |?N%(C%).&F8.M...|
0000d070  41 25 20 8c 0d 4d 26 16  e7 53 43 52 49 42 45 25  |A% ..M&..SCRIBE%|
0000d080  28 64 72 61 77 6e 25 29  20 8c 0d 4d 30 36 f2 66  |(drawn%) ..M06.f|
0000d090  6c 6f 61 74 28 53 43 52  49 42 45 25 28 73 70 72  |loat(SCRIBE%(spr|
0000d0a0  69 74 65 25 29 2c 53 43  52 49 42 45 25 28 73 78  |ite%),SCRIBE%(sx|
0000d0b0  25 29 2c 53 43 52 49 42  45 25 28 73 79 25 29 29  |%),SCRIBE%(sy%))|
0000d0c0  0d 4d 3a 76 e7 53 43 52  49 42 45 25 28 73 70 72  |.M:v.SCRIBE%(spr|
0000d0d0  69 74 65 25 29 3c 72 65  73 74 25 20 e7 94 53 43  |ite%)<rest% ..SC|
0000d0e0  52 49 42 45 25 28 6c 69  6e 65 25 29 3e 35 20 f2  |RIBE%(line%)>5 .|
0000d0f0  66 6c 6f 61 74 28 6c 65  64 67 65 72 25 2b 53 43  |float(ledger%+SC|
0000d100  52 49 42 45 25 28 6c 69  6e 65 25 29 81 32 2c 53  |RIBE%(line%).2,S|
0000d110  43 52 49 42 45 25 28 73  78 25 29 2c 59 5f 53 54  |CRIBE%(sx%),Y_ST|
0000d120  41 56 45 25 28 53 43 52  49 42 45 25 28 73 74 61  |AVE%(SCRIBE%(sta|
0000d130  76 65 25 29 29 29 0d 4d  44 05 cc 0d 4d 4e 15 53  |ve%))).MD...MN.S|
0000d140  43 52 49 42 45 25 28 64  72 61 77 6e 25 29 3d b9  |CRIBE%(drawn%)=.|
0000d150  0d 4d 58 05 cd 0d 4d 62  1d e7 53 43 52 49 42 45  |.MX...Mb..SCRIBE|
0000d160  25 28 73 70 72 69 74 65  25 29 3c 72 65 73 74 25  |%(sprite%)<rest%|
0000d170  20 8c 0d 4d 6c 2f e7 94  4c 25 3e 35 20 f2 66 6c  | ..Ml/..L%>5 .fl|
0000d180  6f 61 74 28 6c 65 64 67  65 72 25 2b 4c 25 81 32  |oat(ledger%+L%.2|
0000d190  2c 58 25 2c 59 5f 53 54  41 56 45 25 28 53 25 29  |,X%,Y_STAVE%(S%)|
0000d1a0  29 0d 4d 76 4b e7 59 25  3c 3e 53 43 52 49 42 45  |).MvK.Y%<>SCRIBE|
0000d1b0  25 28 73 79 25 29 20 53  43 52 49 42 45 25 28 73  |%(sy%) SCRIBE%(s|
0000d1c0  70 72 69 74 65 25 29 3d  53 43 52 49 42 45 25 28  |prite%)=SCRIBE%(|
0000d1d0  73 70 72 69 74 65 25 29  80 37 84 38 80 59 25 3e  |sprite%).7.8.Y%>|
0000d1e0  53 43 52 49 42 45 25 28  73 79 25 29 0d 4d 80 05  |SCRIBE%(sy%).M..|
0000d1f0  cd 0d 4d 8a 13 53 43 52  49 42 45 25 28 73 78 25  |..M..SCRIBE%(sx%|
0000d200  29 3d 58 25 0d 4d 94 13  53 43 52 49 42 45 25 28  |)=X%.M..SCRIBE%(|
0000d210  73 79 25 29 3d 59 25 0d  4d 9e 16 53 43 52 49 42  |sy%)=Y%.M..SCRIB|
0000d220  45 25 28 73 74 61 76 65  25 29 3d 53 25 0d 4d a8  |E%(stave%)=S%.M.|
0000d230  50 e7 53 25 3c 3d 4d 61  78 5f 53 74 61 76 65 25  |P.S%<=Max_Stave%|
0000d240  20 53 43 52 49 42 45 25  28 73 63 6c 65 66 25 29  | SCRIBE%(sclef%)|
0000d250  3d 43 4c 45 46 25 28 53  25 29 20 8b 53 43 52 49  |=CLEF%(S%) .SCRI|
0000d260  42 45 25 28 73 63 6c 65  66 25 29 3d 43 4c 45 46  |BE%(sclef%)=CLEF|
0000d270  25 28 4d 61 78 5f 53 74  61 76 65 25 29 0d 4d b2  |%(Max_Stave%).M.|
0000d280  15 53 43 52 49 42 45 25  28 6c 69 6e 65 25 29 3d  |.SCRIBE%(line%)=|
0000d290  4c 25 0d 4d bc 16 53 43  52 49 42 45 25 28 70 6f  |L%.M..SCRIBE%(po|
0000d2a0  73 78 25 29 3d 50 58 25  0d 4d c6 15 53 43 52 49  |sx%)=PX%.M..SCRI|
0000d2b0  42 45 25 28 73 67 70 25  29 3d 47 50 25 0d 4d d0  |BE%(sgp%)=GP%.M.|
0000d2c0  13 53 43 52 49 42 45 25  28 73 63 25 29 3d 43 25  |.SCRIBE%(sc%)=C%|
0000d2d0  0d 4d da 20 e3 43 25 3d  30 b8 37 3a 53 43 52 49  |.M. .C%=0.7:SCRI|
0000d2e0  42 45 25 28 43 25 29 3d  4e 25 28 43 25 29 3a ed  |BE%(C%)=N%(C%):.|
0000d2f0  0d 4d e4 22 f2 66 6c 6f  61 74 28 53 43 52 49 42  |.M.".float(SCRIB|
0000d300  45 25 28 73 70 72 69 74  65 25 29 2c 58 25 2c 59  |E%(sprite%),X%,Y|
0000d310  25 29 0d 4d ee 05 cd 0d  4d f8 05 cd 0d 4e 02 05  |%).M....M....N..|
0000d320  e1 0d 4e 0c 06 3a 3a 0d  4e 16 35 f4 20 20 20 50  |..N..::.N.5.   P|
0000d330  52 4f 43 45 44 55 52 45  3a 20 70 72 6f 78 69 6d  |ROCEDURE: proxim|
0000d340  61 74 65 28 50 6f 73 69  74 69 6f 6e 73 20 76 61  |ate(Positions va|
0000d350  6c 69 64 20 6d 61 73 6b  20 56 25 29 0d 4e 20 05  |lid mask V%).N .|
0000d360  f4 0d 4e 2a 4f f4 20 44  45 53 43 52 49 50 54 49  |..N*O. DESCRIPTI|
0000d370  4f 4e 3a 20 57 69 6c 6c  20 73 65 74 20 58 25 2c  |ON: Will set X%,|
0000d380  59 25 20 74 6f 20 62 65  20 74 68 65 20 6e 65 61  |Y% to be the nea|
0000d390  72 65 73 74 20 76 61 6c  69 64 20 70 6f 73 69 74  |rest valid posit|
0000d3a0  69 6f 6e 20 74 6f 20 74  68 65 20 70 6f 69 6e 74  |ion to the point|
0000d3b0  0d 4e 34 4b f4 20 20 20  20 20 20 20 20 20 20 20  |.N4K.           |
0000d3c0  20 20 20 58 25 2c 59 25  20 73 75 70 70 6c 69 65  |   X%,Y% supplie|
0000d3d0  64 20 28 61 6c 6c 20 69  6e 20 73 74 61 76 65 20  |d (all in stave |
0000d3e0  63 6f 6f 72 64 69 6e 61  74 65 73 29 20 61 6e 64  |coordinates) and|
0000d3f0  20 72 65 74 75 72 6e 20  74 68 65 0d 4e 3e 31 f4  | return the.N>1.|
0000d400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 61 73  |              as|
0000d410  73 6f 63 69 61 74 65 64  20 70 6f 73 69 74 69 6f  |sociated positio|
0000d420  6e 20 69 6e 64 65 78 20  50 58 25 2e 0d 4e 48 05  |n index PX%..NH.|
0000d430  f4 0d 4e 52 46 f4 20 20  20 20 20 20 20 20 20 20  |..NRF.          |
0000d440  20 20 20 20 41 20 6d 61  73 6b 20 69 73 20 73 75  |    A mask is su|
0000d450  70 70 6c 69 65 64 20 74  6f 20 69 6e 64 69 63 61  |pplied to indica|
0000d460  74 65 20 74 68 65 20 76  61 6c 69 64 20 70 6f 73  |te the valid pos|
0000d470  69 74 69 6f 6e 73 3a 0d  4e 5c 3e f4 20 20 20 20  |itions:.N\>.    |
0000d480  20 20 20 20 20 20 20 20  20 20 56 25 20 62 69 74  |          V% bit|
0000d490  20 20 30 20 2d 3e 20 56  61 6c 69 64 20 54 69 6d  |  0 -> Valid Tim|
0000d4a0  65 20 73 69 67 6e 61 74  75 72 65 20 70 6f 73 69  |e signature posi|
0000d4b0  74 69 6f 6e 73 0d 4e 66  3d f4 20 20 20 20 20 20  |tions.Nf=.      |
0000d4c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d4d0  31 20 2d 3e 20 56 61 6c  69 64 20 4b 65 79 20 73  |1 -> Valid Key s|
0000d4e0  69 67 6e 61 74 75 72 65  20 70 6f 73 69 74 69 6f  |ignature positio|
0000d4f0  6e 73 0d 4e 70 34 f4 20  20 20 20 20 20 20 20 20  |ns.Np4.         |
0000d500  20 20 20 20 20 20 20 20  20 20 20 20 20 32 20 2d  |             2 -|
0000d510  3e 20 56 61 6c 69 64 20  43 6c 65 66 20 70 6f 73  |> Valid Clef pos|
0000d520  69 74 69 6f 6e 73 0d 4e  7a 31 f4 20 20 20 20 20  |itions.Nz1.     |
0000d530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d540  20 33 20 2d 3e 20 41 74  20 6e 6f 74 65 20 70 6f  | 3 -> At note po|
0000d550  73 69 74 69 6f 6e 73 0d  4e 84 30 f4 20 20 20 20  |sitions.N.0.    |
0000d560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d570  20 20 34 20 2d 3e 20 49  6e 20 62 65 74 77 65 65  |  4 -> In betwee|
0000d580  6e 20 6e 6f 74 65 73 0d  4e 8e 4a f4 20 20 20 20  |n notes.N.J.    |
0000d590  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d5a0  20 20 35 20 2d 3e 20 54  6f 20 6e 65 61 72 65 73  |  5 -> To neares|
0000d5b0  74 20 73 74 61 76 65 20  6c 69 6e 65 20 28 65 6c  |t stave line (el|
0000d5c0  73 65 20 6e 65 61 72 65  73 74 20 73 74 61 76 65  |se nearest stave|
0000d5d0  29 0d 4e 98 39 f4 20 20  20 20 20 20 20 20 20 20  |).N.9.          |
0000d5e0  20 20 20 20 20 20 20 20  20 20 20 20 36 20 2d 3e  |            6 ->|
0000d5f0  20 54 6f 20 6e 65 61 72  65 73 74 20 73 79 6d 62  | To nearest symb|
0000d600  6f 6c 20 70 72 65 73 65  6e 74 0d 4e a2 33 f4 20  |ol present.N.3. |
0000d610  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d620  20 20 20 20 20 37 20 2d  3e 20 4f 6e 20 62 61 72  |     7 -> On bar|
0000d630  20 6c 69 6e 65 20 69 66  20 6e 65 61 72 0d 4e ac  | line if near.N.|
0000d640  05 f4 0d 4e b6 84 f4 20  20 20 45 46 46 45 43 54  |...N...   EFFECT|
0000d650  53 3a 20 53 65 74 73 20  53 25 3d 53 74 61 76 65  |S: Sets S%=Stave|
0000d660  2c 20 4c 25 3d 4c 69 6e  65 28 2d 31 35 2e 2e 31  |, L%=Line(-15..1|
0000d670  35 29 2c 20 43 25 3d 43  68 61 6e 6e 65 6c 20 6f  |5), C%=Channel o|
0000d680  66 20 6e 6f 74 65 2c 20  47 50 25 2c 4e 25 28 29  |f note, GP%,N%()|
0000d690  3d 47 61 74 65 20 26 20  6e 6f 74 65 20 70 6f 69  |=Gate & note poi|
0000d6a0  6e 74 65 72 73 2c 20 50  58 25 3d 50 58 25 28 29  |nters, PX%=PX%()|
0000d6b0  20 69 6e 64 65 78 2c 20  58 25 2c 59 25 20 70 6f  | index, X%,Y% po|
0000d6c0  73 69 74 69 6f 6e 0d 4e  c0 05 3a 0d 4e ca 34 dd  |sition.N..:.N.4.|
0000d6d0  20 f2 70 72 6f 78 69 6d  61 74 65 28 56 25 29 3a  | .proximate(V%):|
0000d6e0  f4 20 28 56 25 2c 20 76  61 72 20 58 25 2c 59 25  |. (V%, var X%,Y%|
0000d6f0  29 20 3d 20 28 53 25 2c  4c 25 2c 50 58 25 29 0d  |) = (S%,L%,PX%).|
0000d700  4e d4 26 ea 64 25 2c 44  25 3a f4 20 44 69 73 74  |N.&.d%,D%:. Dist|
0000d710  61 6e 63 65 20 70 72 65  76 69 6f 75 73 26 63 75  |ance previous&cu|
0000d720  72 72 65 6e 74 0d 4e de  33 ea 70 78 25 2c 78 25  |rrent.N.3.px%,x%|
0000d730  3a f4 20 50 72 65 76 69  6f 75 73 20 50 58 25 2c  |:. Previous PX%,|
0000d740  20 42 65 74 77 65 65 6e  20 6e 6f 74 65 20 58 20  | Between note X |
0000d750  70 6f 73 69 74 69 6f 6e  0d 4e e8 29 ea 67 70 25  |position.N.).gp%|
0000d760  3a f4 20 50 72 65 76 69  6f 75 73 20 67 61 74 65  |:. Previous gate|
0000d770  20 70 6f 69 6e 74 65 72  2c 20 6b 65 79 20 73 69  | pointer, key si|
0000d780  67 0d 4e f2 25 e7 20 4e  42 61 72 73 25 3e 34 20  |g.N.%. NBars%>4 |
0000d790  8c 20 42 41 52 25 3d 4c  48 42 41 52 25 20 8b 20  |. BAR%=LHBAR% . |
0000d7a0  42 41 52 25 3d 30 0d 4e  fc 32 f2 47 65 74 42 61  |BAR%=0.N.2.GetBa|
0000d7b0  72 49 6e 66 6f 28 42 41  52 25 29 20 3a 20 f4 20  |rInfo(BAR%) : . |
0000d7c0  53 74 61 72 74 20 66 72  6f 6d 20 73 74 61 72 74  |Start from start|
0000d7d0  20 6f 66 20 70 61 67 65  0d 4f 06 31 44 25 3d 34  | of page.O.1D%=4|
0000d7e0  2a 53 5f 57 69 64 74 68  25 3a f4 20 41 20 73 75  |*S_Width%:. A su|
0000d7f0  69 74 61 62 6c 79 20 65  78 63 65 73 73 69 76 65  |itably excessive|
0000d800  20 64 69 73 74 61 6e 63  65 0d 4f 10 0c e7 20 56  | distance.O... V|
0000d810  25 80 37 20 8c 0d 4f 1a  13 ea 54 25 3a f4 20 54  |%.7 ..O...T%:. T|
0000d820  79 70 65 20 6d 61 73 6b  0d 4f 24 40 58 25 2d 3d  |ype mask.O$@X%-=|
0000d830  58 25 28 63 6c 65 66 25  29 3e 3e 31 3a f4 20 50  |X%(clef%)>>1:. P|
0000d840  6f 69 6e 74 65 72 20 70  6f 69 6e 74 73 20 74 6f  |ointer points to|
0000d850  20 63 65 6e 74 72 65 20  6f 66 20 43 6c 65 66 2f  | centre of Clef/|
0000d860  4b 65 79 2f 54 69 6d 65  0d 4f 2e 4a 54 25 3d 2d  |Key/Time.O.JT%=-|
0000d870  56 25 3c 3c 31 80 36 3a  f4 20 56 61 6c 69 64 20  |V%<<1.6:. Valid |
0000d880  43 6c 65 66 2f 4b 65 79  2f 54 69 6d 65 3a 20 57  |Clef/Key/Time: W|
0000d890  6f 72 6b 20 6f 75 74 20  74 79 70 65 73 20 74 6f  |ork out types to|
0000d8a0  20 69 67 6e 6f 72 65 20  61 66 74 65 72 20 62 61  | ignore after ba|
0000d8b0  72 73 0d 4f 38 05 f5 0d  4f 42 30 f2 73 61 76 70  |rs.O8...OB0.savp|
0000d8c0  3a f4 20 53 61 76 65 20  70 72 65 76 69 6f 75 73  |:. Save previous|
0000d8d0  20 64 69 73 74 61 6e 63  65 2c 20 70 6f 69 6e 74  | distance, point|
0000d8e0  65 72 73 20 65 74 63 0d  4f 4c 40 f5 f2 73 6b 69  |ers etc.OL@..ski|
0000d8f0  70 5f 67 61 74 65 3a fd  50 54 59 50 45 25 28 50  |p_gate:.PTYPE%(P|
0000d900  58 25 29 80 42 61 72 25  84 47 50 25 3d 45 50 25  |X%).Bar%.GP%=EP%|
0000d910  3a f4 20 4d 6f 76 65 20  74 6f 20 6e 65 78 74 20  |:. Move to next |
0000d920  62 61 72 20 50 58 25 0d  4f 56 17 e7 50 54 59 50  |bar PX%.OV..PTYP|
0000d930  45 25 28 50 58 25 29 80  42 61 72 25 20 8c 0d 4f  |E%(PX%).Bar% ..O|
0000d940  60 1e c8 95 50 54 59 50  45 25 28 50 58 25 2b 31  |`...PTYPE%(PX%+1|
0000d950  29 80 54 25 80 47 50 25  3c 45 50 25 0d 4f 6a 39  |).T%.GP%<EP%.Oj9|
0000d960  f5 f2 73 6b 69 70 5f 67  61 74 65 3a fd 47 50 25  |..skip_gate:.GP%|
0000d970  3d 45 50 25 84 47 50 25  3f 31 80 25 31 31 31 82  |=EP%.GP%?1.%111.|
0000d980  25 31 30 30 3a f4 20 53  6b 69 70 20 41 4c 4c 20  |%100:. Skip ALL |
0000d990  63 6c 65 66 73 0d 4f 74  1d ce 3a f4 20 53 6b 69  |clefs.Ot..:. Ski|
0000d9a0  70 70 69 6e 67 20 61 6e  79 20 54 25 20 74 79 70  |pping any T% typ|
0000d9b0  65 73 0d 4f 7e 3d 44 25  3d 94 28 58 25 2d 50 58  |es.O~=D%=.(X%-PX|
0000d9c0  25 28 50 58 25 2b 31 29  29 3a f4 20 43 61 6c 63  |%(PX%+1)):. Calc|
0000d9d0  75 6c 61 74 65 20 64 69  73 74 61 6e 63 65 20 74  |ulate distance t|
0000d9e0  6f 20 74 68 69 73 20 70  6f 73 69 74 69 6f 6e 0d  |o this position.|
0000d9f0  4f 88 05 cc 0d 4f 92 20  44 25 3d 32 2a 53 5f 57  |O....O. D%=2*S_W|
0000da00  69 64 74 68 25 3a f4 20  4e 6f 20 6d 6f 72 65 20  |idth%:. No more |
0000da10  62 61 72 73 0d 4f 9c 05  cd 0d 4f a6 42 fd 44 25  |bars.O....O.B.D%|
0000da20  3e 64 25 84 47 50 25 3d  45 50 25 3a f4 20 55 6e  |>d%.GP%=EP%:. Un|
0000da30  74 69 6c 20 64 69 73 74  61 6e 63 65 20 69 6e 63  |til distance inc|
0000da40  72 65 61 73 65 73 20 6f  72 20 6e 6f 20 6d 6f 72  |reases or no mor|
0000da50  65 20 70 6f 73 69 74 69  6f 6e 73 0d 4f b0 32 e7  |e positions.O.2.|
0000da60  64 25 3c 44 25 20 f2 72  73 74 70 3a f4 20 50 72  |d%<D% .rstp:. Pr|
0000da70  65 76 69 6f 75 73 20 70  6f 73 69 74 69 6f 6e 20  |evious position |
0000da80  6d 61 79 20 62 65 20 63  6c 6f 73 65 72 0d 4f ba  |may be closer.O.|
0000da90  23 58 25 3d 50 58 25 28  50 58 25 2b 31 29 3a f4  |#X%=PX%(PX%+1):.|
0000daa0  20 53 65 74 20 61 73 20  70 6f 73 69 74 69 6f 6e  | Set as position|
0000dab0  0d 4f c4 05 cc 0d 4f ce  33 58 25 2d 3d 58 25 28  |.O....O.3X%-=X%(|
0000dac0  32 29 3e 3e 31 3a f4 20  50 6f 69 6e 74 65 72 20  |2)>>1:. Pointer |
0000dad0  70 6f 69 6e 74 73 20 74  6f 20 63 65 6e 74 72 65  |points to centre|
0000dae0  20 6f 66 20 6e 6f 74 65  0d 4f d8 05 f5 0d 4f e2  | of note.O....O.|
0000daf0  30 f2 73 61 76 70 3a f4  20 53 61 76 65 20 70 72  |0.savp:. Save pr|
0000db00  65 76 69 6f 75 73 20 64  69 73 74 61 6e 63 65 2c  |evious distance,|
0000db10  20 70 6f 69 6e 74 65 72  73 20 65 74 63 0d 4f ec  | pointers etc.O.|
0000db20  1c f2 73 6b 69 70 5f 67  61 74 65 3a f4 20 4e 65  |..skip_gate:. Ne|
0000db30  78 74 20 73 79 6d 62 6f  6c 0d 4f f6 43 c8 95 50  |xt symbol.O.C..P|
0000db40  54 59 50 45 25 28 50 58  25 2b 31 29 80 47 50 25  |TYPE%(PX%+1).GP%|
0000db50  3c 45 50 25 3a f2 73 6b  69 70 5f 67 61 74 65 3a  |<EP%:.skip_gate:|
0000db60  ce 3a f4 20 53 6b 69 70  20 61 6e 79 20 61 74 74  |.:. Skip any att|
0000db70  72 69 62 75 74 65 20 74  79 70 65 73 0d 50 00 42  |ribute types.P.B|
0000db80  44 25 3d 94 28 58 25 2d  50 58 25 28 50 58 25 2b  |D%=.(X%-PX%(PX%+|
0000db90  31 29 29 3a f4 20 43 61  6c 63 75 6c 61 74 65 20  |1)):. Calculate |
0000dba0  64 69 73 74 61 6e 63 65  20 74 6f 20 74 68 69 73  |distance to this|
0000dbb0  20 6e 6f 74 65 20 70 6f  73 69 74 69 6f 6e 0d 50  | note position.P|
0000dbc0  0a 3e fd 44 25 3e 64 25  84 47 50 25 3d 45 50 25  |.>.D%>d%.GP%=EP%|
0000dbd0  3a f4 20 55 6e 74 69 6c  20 64 69 73 74 61 6e 63  |:. Until distanc|
0000dbe0  65 20 69 6e 63 72 65 61  73 65 73 20 6f 72 20 6e  |e increases or n|
0000dbf0  6f 20 6d 6f 72 65 20 6e  6f 74 65 73 0d 50 14 82  |o more notes.P..|
0000dc00  e7 64 25 3c 44 25 84 47  50 25 3d 45 50 25 80 56  |.d%<D%.GP%=EP%.V|
0000dc10  25 80 36 34 20 f2 72 73  74 70 3a f4 20 50 72 65  |%.64 .rstp:. Pre|
0000dc20  76 69 6f 75 73 20 70 6f  73 69 74 69 6f 6e 20 6d  |vious position m|
0000dc30  61 79 20 62 65 20 63 6c  6f 73 65 72 20 28 6f 72  |ay be closer (or|
0000dc40  20 74 68 65 20 6c 61 73  74 20 76 61 6c 69 64 20  | the last valid |
0000dc50  6e 6f 74 65 20 70 6f 73  69 74 69 6f 6e 20 66 6f  |note position fo|
0000dc60  72 20 61 6e 20 61 63 63  69 64 65 6e 74 61 6c 2f  |r an accidental/|
0000dc70  64 6f 74 20 74 6f 20 61  70 70 65 61 72 29 0d 50  |dot to appear).P|
0000dc80  1e 14 e7 56 25 80 31 36  80 47 50 25 3c 45 50 25  |...V%.16.GP%<EP%|
0000dc90  20 8c 0d 50 28 33 f4 20  56 61 6c 69 64 20 62 65  | ..P(3. Valid be|
0000dca0  74 77 65 65 6e 20 6e 6f  74 65 73 20 28 69 66 20  |tween notes (if |
0000dcb0  62 65 66 6f 72 65 20 6c  61 73 74 20 70 6f 73 69  |before last posi|
0000dcc0  74 69 6f 6e 29 0d 50 32  20 e7 58 25 3c 50 58 25  |tion).P2 .X%<PX%|
0000dcd0  28 50 58 25 2b 31 29 84  58 25 3e 50 58 25 28 45  |(PX%+1).X%>PX%(E|
0000dce0  58 25 29 20 8c 0d 50 3c  76 e7 50 54 59 50 45 25  |X%) ..P<v.PTYPE%|
0000dcf0  28 50 58 25 29 20 78 25  3d 50 58 25 28 50 58 25  |(PX%) x%=PX%(PX%|
0000dd00  29 2b 50 57 25 28 50 58  25 29 2d 58 25 28 32 29  |)+PW%(PX%)-X%(2)|
0000dd10  20 8b 78 25 3d 50 58 25  28 50 58 25 29 3a f4 20  | .x%=PX%(PX%):. |
0000dd20  42 65 66 6f 72 65 20 63  75 72 72 65 6e 74 3a 20  |Before current: |
0000dd30  62 65 74 77 65 65 6e 20  70 72 65 76 69 6f 75 73  |between previous|
0000dd40  2e 20 28 61 6c 73 6f 20  69 66 20 61 66 74 65 72  |. (also if after|
0000dd50  20 6c 61 73 74 20 6e 6f  74 65 29 0d 50 46 17 78  | last note).PF.x|
0000dd60  25 3d 78 25 2b 50 58 25  28 50 58 25 2b 31 29 3e  |%=x%+PX%(PX%+1)>|
0000dd70  3e 31 0d 50 50 33 e7 56  25 80 31 32 38 20 78 25  |>1.PP3.V%.128 x%|
0000dd80  2b 3d 48 69 25 2a 34 3a  e7 50 54 59 50 45 25 28  |+=Hi%*4:.PTYPE%(|
0000dd90  50 58 25 29 3d 42 61 72  25 20 78 25 3d 50 58 25  |PX%)=Bar% x%=PX%|
0000dda0  28 50 58 25 29 0d 50 5a  05 cc 0d 50 64 3e 78 25  |(PX%).PZ...Pd>x%|
0000ddb0  3d 50 58 25 28 50 58 25  2b 31 29 2b 50 58 25 28  |=PX%(PX%+1)+PX%(|
0000ddc0  50 58 25 2b 32 29 3e 3e  31 3a f4 20 41 66 74 65  |PX%+2)>>1:. Afte|
0000ddd0  72 20 63 75 72 72 65 6e  74 3a 20 62 65 74 77 65  |r current: betwe|
0000dde0  65 6e 20 6e 65 78 74 2e  0d 50 6e 37 e7 56 25 80  |en next..Pn7.V%.|
0000ddf0  31 32 38 20 78 25 2b 3d  48 69 25 2a 34 3a e7 50  |128 x%+=Hi%*4:.P|
0000de00  54 59 50 45 25 28 50 58  25 2b 32 29 3d 42 61 72  |TYPE%(PX%+2)=Bar|
0000de10  25 20 78 25 3d 50 58 25  28 50 58 25 2b 32 29 0d  |% x%=PX%(PX%+2).|
0000de20  50 78 05 cd 0d 50 82 6c  e7 56 25 80 38 80 94 28  |Px...P.l.V%.8..(|
0000de30  50 58 25 28 50 58 25 2b  31 29 2d 58 25 29 3c 94  |PX%(PX%+1)-X%)<.|
0000de40  28 78 25 2d 58 25 29 20  58 25 3d 50 58 25 28 50  |(x%-X%) X%=PX%(P|
0000de50  58 25 2b 31 29 20 8b 58  25 3d 78 25 3a f4 20 49  |X%+1) .X%=x%:. I|
0000de60  66 20 6f 6e 20 6e 6f 74  65 73 20 61 6c 73 6f 20  |f on notes also |
0000de70  76 61 6c 69 64 20 74 68  65 6e 20 66 69 6e 64 20  |valid then find |
0000de80  63 6c 6f 73 65 73 74 20  70 6f 73 69 74 69 6f 6e  |closest position|
0000de90  0d 50 8c 05 cc 0d 50 96  39 58 25 3d 50 58 25 28  |.P....P.9X%=PX%(|
0000dea0  50 58 25 2b 31 29 3a f4  20 4f 6e 6c 79 20 61 74  |PX%+1):. Only at|
0000deb0  20 6e 6f 74 65 73 20 76  61 6c 69 64 3a 20 63 6c  | notes valid: cl|
0000dec0  6f 73 65 73 74 20 70 6f  73 69 74 69 6f 6e 0d 50  |osest position.P|
0000ded0  a0 05 cd 0d 50 aa 05 cd  0d 50 b4 20 43 25 3d 2d  |....P....P. C%=-|
0000dee0  31 3a f4 20 49 6e 69 74  69 61 6c 6c 79 20 6e 6f  |1:. Initially no|
0000def0  20 63 68 61 6e 6e 65 6c  0d 50 be 20 4c 25 3d 30  | channel.P. L%=0|
0000df00  3a f4 20 49 6e 69 74 69  61 6c 6c 79 20 63 65 6e  |:. Initially cen|
0000df10  74 72 65 20 6c 69 6e 65  0d 50 c8 13 e7 56 25 80  |tre line.P...V%.|
0000df20  36 34 80 3f 47 50 25 3e  30 20 8c 0d 50 d2 3c f4  |64.?GP%>0 ..P.<.|
0000df30  20 54 6f 20 6e 65 61 72  65 73 74 20 73 79 6d 62  | To nearest symb|
0000df40  6f 6c 20 61 74 20 67 61  74 65 20 28 6a 75 73 74  |ol at gate (just|
0000df50  20 6e 6f 74 65 20 61 74  20 74 68 65 20 6d 6f 6d  | note at the mom|
0000df60  65 6e 74 20 21 21 29 0d  50 dc 35 ea 47 25 2c 63  |ent !!).P.5.G%,c|
0000df70  25 3a f4 20 47 61 74 65  20 6d 61 73 6b 20 63 6f  |%:. Gate mask co|
0000df80  70 79 2c 20 50 72 65 76  69 6f 75 73 20 63 68 61  |py, Previous cha|
0000df90  6e 6e 65 6c 20 63 6f 75  6e 74 65 72 0d 50 e6 09  |nnel counter.P..|
0000dfa0  63 25 3d 43 25 0d 50 f0  32 64 25 3d 32 2a 53 5f  |c%=C%.P.2d%=2*S_|
0000dfb0  48 65 69 67 68 74 25 3a  f4 20 41 20 73 75 69 74  |Height%:. A suit|
0000dfc0  61 62 6c 79 20 65 78 63  65 73 73 69 76 65 20 64  |ably excessive d|
0000dfd0  69 73 74 61 6e 63 65 0d  50 fa 0b 47 25 3d 3f 47  |istance.P..G%=?G|
0000dfe0  50 25 0d 51 04 05 f5 0d  51 0e 15 f5 43 25 2d 3d  |P%.Q....Q...C%-=|
0000dff0  b9 3a fd 47 25 80 25 31  3c 3c 43 25 0d 51 18 1c  |.:.G%.%1<<C%.Q..|
0000e000  44 25 3d 59 25 2d 59 5f  53 54 41 56 45 25 28 53  |D%=Y%-Y_STAVE%(S|
0000e010  5f 43 25 28 43 25 29 29  0d 51 22 4f e7 3f 4e 25  |_C%(C%)).Q"O.?N%|
0000e020  28 43 25 29 80 26 46 38  20 44 25 3d 94 28 44 25  |(C%).&F8 D%=.(D%|
0000e030  2d 4c 69 25 2a 28 28 3f  4e 25 28 43 25 29 3e 3e  |-Li%*((?N%(C%)>>|
0000e040  33 29 2d 31 36 29 29 20  8b 44 25 3d 94 44 25 3a  |3)-16)) .D%=.D%:|
0000e050  f4 20 44 69 73 74 61 6e  63 65 20 74 6f 20 6e 6f  |. Distance to no|
0000e060  74 65 2f 72 65 73 74 0d  51 2c 16 e7 44 25 3c 64  |te/rest.Q,..D%<d|
0000e070  25 20 64 25 3d 44 25 3a  63 25 3d 43 25 0d 51 36  |% d%=D%:c%=C%.Q6|
0000e080  0f fd 28 32 3c 3c 43 25  29 3e 47 25 0d 51 40 18  |..(2<<C%)>G%.Q@.|
0000e090  43 25 3d 63 25 3a f4 20  4e 65 61 72 65 73 74 20  |C%=c%:. Nearest |
0000e0a0  6e 6f 74 65 0d 51 4a 0f  53 25 3d 53 5f 43 25 28  |note.QJ.S%=S_C%(|
0000e0b0  43 25 29 0d 51 54 23 e7  3f 4e 25 28 43 25 29 80  |C%).QT#.?N%(C%).|
0000e0c0  26 46 38 20 4c 25 3d 28  3f 4e 25 28 43 25 29 3e  |&F8 L%=(?N%(C%)>|
0000e0d0  3e 33 29 2d 31 36 0d 51  5e 05 cc 0d 51 68 1f ea  |>3)-16.Q^...Qh..|
0000e0e0  4d 53 25 3a f4 20 48 69  67 68 65 73 74 20 73 74  |MS%:. Highest st|
0000e0f0  61 76 65 20 6e 75 6d 62  65 72 0d 51 72 40 4d 53  |ave number.Qr@MS|
0000e100  25 3d 53 54 41 56 45 25  3a e7 56 25 80 36 20 8b  |%=STAVE%:.V%.6 .|
0000e110  4d 53 25 2b 3d 50 45 52  43 25 3a f4 20 43 6c 65  |MS%+=PERC%:. Cle|
0000e120  66 20 26 20 4b 65 79 20  6e 6f 74 20 6f 6e 20 70  |f & Key not on p|
0000e130  65 72 63 75 73 73 69 6f  6e 2e 0d 51 7c 1e 53 25  |ercussion..Q|.S%|
0000e140  3d 2d 31 3a f4 20 42 65  66 6f 72 65 20 66 69 72  |=-1:. Before fir|
0000e150  73 74 20 73 74 61 76 65  0d 51 86 32 44 25 3d 32  |st stave.Q.2D%=2|
0000e160  2a 53 5f 48 65 69 67 68  74 25 3a f4 20 41 20 73  |*S_Height%:. A s|
0000e170  75 69 74 61 62 6c 79 20  65 78 63 65 73 73 69 76  |uitably excessiv|
0000e180  65 20 64 69 73 74 61 6e  63 65 0d 51 90 05 f5 0d  |e distance.Q....|
0000e190  51 9a 22 64 25 3d 44 25  3a f4 20 43 6f 70 79 20  |Q."d%=D%:. Copy |
0000e1a0  70 72 65 76 69 6f 75 73  20 64 69 73 74 61 6e 63  |previous distanc|
0000e1b0  65 0d 51 a4 16 53 25 2b  3d 31 3a f4 20 4e 65 78  |e.Q..S%+=1:. Nex|
0000e1c0  74 20 73 74 61 76 65 0d  51 ae 44 44 25 3d 94 28  |t stave.Q.DD%=.(|
0000e1d0  59 25 2d 59 5f 53 54 41  56 45 25 28 53 25 29 29  |Y%-Y_STAVE%(S%))|
0000e1e0  3a f4 20 44 69 73 74 61  6e 63 65 20 62 65 74 77  |:. Distance betw|
0000e1f0  65 65 6e 20 70 6f 69 6e  74 20 61 6e 64 20 63 75  |een point and cu|
0000e200  72 72 65 6e 74 20 73 74  61 76 65 0d 51 b8 3e fd  |rrent stave.Q.>.|
0000e210  44 25 3e 64 25 84 53 25  3d 4d 53 25 3a f4 20 55  |D%>d%.S%=MS%:. U|
0000e220  6e 74 69 6c 20 64 69 73  74 61 6e 63 65 20 69 6e  |ntil distance in|
0000e230  63 72 65 61 73 65 73 20  6f 72 20 6e 6f 20 6d 6f  |creases or no mo|
0000e240  72 65 20 73 74 61 76 65  73 0d 51 c2 4e 53 25 2b  |re staves.Q.NS%+|
0000e250  3d 64 25 3c 44 25 3a f4  20 50 72 65 76 69 6f 75  |=d%<D%:. Previou|
0000e260  73 20 73 74 61 76 65 20  77 61 73 20 63 6c 6f 73  |s stave was clos|
0000e270  65 73 74 20 75 6e 6c 65  73 73 20 6c 61 73 74 26  |est unless last&|
0000e280  63 75 72 72 65 6e 74 20  73 74 61 76 65 20 69 73  |current stave is|
0000e290  20 6e 65 61 72 65 72 0d  51 cc 0b e7 56 25 80 33  | nearer.Q...V%.3|
0000e2a0  32 8c 0d 51 d6 63 e7 53  25 3d 53 54 41 56 45 25  |2..Q.c.S%=STAVE%|
0000e2b0  2b 31 20 53 25 2b 3d 59  25 3e 3d 59 5f 53 54 41  |+1 S%+=Y%>=Y_STA|
0000e2c0  56 45 25 28 53 54 41 56  45 25 29 2d 4c 69 25 2a  |VE%(STAVE%)-Li%*|
0000e2d0  31 36 3a f4 20 4c 65 64  67 65 72 20 6c 69 6e 65  |16:. Ledger line|
0000e2e0  73 20 74 61 6b 65 20 70  72 69 6f 72 69 74 79 20  |s take priority |
0000e2f0  6f 76 65 72 20 70 65 72  63 75 73 73 69 6f 6e 20  |over percussion |
0000e300  6c 69 6e 65 73 0d 51 e0  11 e7 53 25 3c 3d 53 54  |lines.Q...S%<=ST|
0000e310  41 56 45 25 20 8c 0d 51  ea 51 4c 25 3d 28 59 25  |AVE% ..Q.QL%=(Y%|
0000e320  2d 59 5f 53 54 41 56 45  25 28 53 25 29 29 2f 4c  |-Y_STAVE%(S%))/L|
0000e330  69 25 2b 31 36 2e 37 35  3a 4c 25 2d 3d 31 36 3a  |i%+16.75:L%-=16:|
0000e340  f4 20 59 25 20 69 73 20  4c 25 20 4c 69 6e 65 73  |. Y% is L% Lines|
0000e350  20 61 77 61 79 20 66 72  6f 6d 20 63 65 6e 74 72  | away from centr|
0000e360  65 20 73 74 61 76 65 0d  51 f4 35 e7 94 4c 25 3e  |e stave.Q.5..L%>|
0000e370  31 35 20 4c 25 3d 31 35  2a b4 4c 25 3a f4 20 4e  |15 L%=15*.L%:. N|
0000e380  6f 20 66 75 72 74 68 65  72 20 74 68 61 6e 20 31  |o further than 1|
0000e390  35 20 6c 69 6e 65 73 20  61 77 61 79 0d 51 fe 05  |5 lines away.Q..|
0000e3a0  cd 0d 52 08 05 cd 0d 52  12 05 cd 0d 52 1c 31 59  |..R....R....R.1Y|
0000e3b0  25 3d 59 5f 53 54 41 56  45 25 28 53 25 29 2b 4c  |%=Y_STAVE%(S%)+L|
0000e3c0  25 2a 4c 69 25 3a f4 20  43 65 6e 74 72 65 20 6c  |%*Li%:. Centre l|
0000e3d0  69 6e 65 20 2b 20 6f 66  66 73 65 74 0d 52 26 05  |ine + offset.R&.|
0000e3e0  e1 0d 52 30 06 3a 3a 0d  52 3a 04 0d 52 44 4b dd  |..R0.::.R:..RDK.|
0000e3f0  20 f2 73 61 76 70 3a 6e  25 28 29 3d 4e 25 28 29  | .savp:n%()=N%()|
0000e400  3a 64 25 3d 44 25 3a 70  78 25 3d 50 58 25 3a 67  |:d%=D%:px%=PX%:g|
0000e410  70 25 3d 47 50 25 3a 63  6c 65 66 25 28 29 3d 43  |p%=GP%:clef%()=C|
0000e420  4c 45 46 25 28 29 3a 73  69 67 25 28 29 3d 53 49  |LEF%():sig%()=SI|
0000e430  47 25 28 29 3a e1 0d 52  4e 04 0d 52 58 45 dd 20  |G%():..RN..RXE. |
0000e440  f2 72 73 74 70 3a 4e 25  28 29 3d 6e 25 28 29 3a  |.rstp:N%()=n%():|
0000e450  50 58 25 3d 70 78 25 3a  47 50 25 3d 67 70 25 3a  |PX%=px%:GP%=gp%:|
0000e460  43 4c 45 46 25 28 29 3d  63 6c 65 66 25 28 29 3a  |CLEF%()=clef%():|
0000e470  53 49 47 25 28 29 3d 73  69 67 25 28 29 3a e1 0d  |SIG%()=sig%():..|
0000e480  52 62 04 0d 52 6c 13 dd  20 f2 53 65 74 54 65 6d  |Rb..Rl.. .SetTem|
0000e490  70 6f 28 54 25 29 0d 52  76 0d 54 65 6d 70 6f 25  |po(T%).Rv.Tempo%|
0000e4a0  3d 54 25 0d 52 80 2c c8  99 20 53 6f 75 6e 64 5f  |=T%.R.,.. Sound_|
0000e4b0  51 54 65 6d 70 6f 2c 54  65 6d 70 6f 25 28 54 25  |QTempo,Tempo%(T%|
0000e4c0  29 2a 31 32 38 2a 34 30  39 36 81 36 30 30 30 0d  |)*128*4096.6000.|
0000e4d0  52 8a 05 e1 0d 52 94 04  0d 52 9e 2c f4 20 67 69  |R....R...R.,. gi|
0000e4e0  76 65 6e 20 78 20 70 6f  73 69 74 69 6f 6e 2c 20  |ven x position, |
0000e4f0  72 65 74 75 72 6e 20 6e  75 6d 62 65 72 20 6f 66  |return number of|
0000e500  20 62 61 72 0d 52 a8 15  dd 20 a4 46 69 6e 64 42  | bar.R... .FindB|
0000e510  61 72 28 78 70 6f 73 25  29 0d 52 b2 0a ea 20 62  |ar(xpos%).R... b|
0000e520  61 72 25 0d 52 bc 0a 62  61 72 25 3d 30 0d 52 c6  |ar%.R..bar%=0.R.|
0000e530  35 c8 95 20 50 58 25 28  50 58 6e 25 28 62 61 72  |5.. PX%(PXn%(bar|
0000e540  25 29 29 3c 78 70 6f 73  25 20 80 20 62 61 72 25  |%))<xpos% . bar%|
0000e550  3c 3d 4e 42 61 72 73 25  3a 62 61 72 25 2b 3d 31  |<=NBars%:bar%+=1|
0000e560  3a ce 0d 52 d0 14 e7 20  62 61 72 25 3e 30 20 62  |:..R... bar%>0 b|
0000e570  61 72 25 2d 3d 31 0d 52  da 09 3d 62 61 72 25 0d  |ar%-=1.R..=bar%.|
0000e580  52 e4 04 0d 52 ee 11 dd  20 f2 70 6c 61 79 5f 73  |R...R... .play_s|
0000e590  74 61 72 74 0d 52 f8 0a  ea 43 25 2c 6e 25 0d 53  |tart.R...C%,n%.S|
0000e5a0  02 18 c8 99 20 53 6f 75  6e 64 5f 43 6f 6e 66 69  |.... Sound_Confi|
0000e5b0  67 75 72 65 2c 38 0d 53  0c 4c f4 20 73 65 74 20  |gure,8.S.L. set |
0000e5c0  70 6c 61 79 20 73 74 61  72 74 20 62 61 72 20 50  |play start bar P|
0000e5d0  42 41 52 25 20 74 6f 20  73 74 61 72 74 20 6f 66  |BAR% to start of|
0000e5e0  20 63 75 72 72 65 6e 74  6c 79 20 64 69 73 70 6c  | currently displ|
0000e5f0  61 79 65 64 20 77 69 6e  64 6f 77 20 28 73 63 78  |ayed window (scx|
0000e600  25 29 0d 53 16 20 57 69  6e 64 6f 77 25 21 68 61  |%).S. Window%!ha|
0000e610  6e 64 6c 65 25 3d 53 63  6f 72 65 57 69 6e 64 5f  |ndle%=ScoreWind_|
0000e620  68 25 0d 53 20 27 c8 99  20 47 65 74 57 69 6e 64  |h%.S '.. GetWind|
0000e630  6f 77 53 74 61 74 65 25  2c 2c 57 69 6e 64 6f 77  |owState%,,Window|
0000e640  25 2b 68 61 6e 64 6c 65  25 0d 53 2a 20 50 42 41  |%+handle%.S* PBA|
0000e650  52 25 3d a4 46 69 6e 64  42 61 72 28 57 69 6e 64  |R%=.FindBar(Wind|
0000e660  6f 77 25 21 73 63 78 25  29 0d 53 34 13 50 50 25  |ow%!scx%).S4.PP%|
0000e670  3d 47 50 6e 25 28 50 42  41 52 25 29 0d 53 3e 0e  |=GPn%(PBAR%).S>.|
0000e680  e3 20 6e 25 3d 30 20 b8  20 37 0d 53 48 1a 20 50  |. n%=0 . 7.SH. P|
0000e690  25 28 6e 25 29 3d 42 50  6e 25 28 6e 25 2c 50 42  |%(n%)=BPn%(n%,PB|
0000e6a0  41 52 25 29 0d 53 52 06  20 ed 0d 53 5c 0b e3 43  |AR%).SR. ..S\..C|
0000e6b0  25 3d 30 b8 33 0d 53 66  26 50 43 4c 45 46 25 28  |%=0.3.Sf&PCLEF%(|
0000e6c0  43 25 29 3d 43 6c 65 66  25 28 43 4c 45 46 6e 25  |C%)=Clef%(CLEFn%|
0000e6d0  28 43 25 2c 50 42 41 52  25 29 29 0d 53 70 05 ed  |(C%,PBAR%)).Sp..|
0000e6e0  0d 53 7a 21 f2 70 6c 61  79 5f 6b 65 79 5f 73 69  |.Sz!.play_key_si|
0000e6f0  67 28 53 49 47 6e 25 28  31 2c 50 42 41 52 25 29  |g(SIGn%(1,PBAR%)|
0000e700  29 0d 53 84 0e 50 4c 41  59 49 4e 47 25 3d b9 0d  |).S..PLAYING%=..|
0000e710  53 8e 10 53 43 52 4f 4c  4c 49 4e 47 25 3d b9 0d  |S..SCROLLING%=..|
0000e720  53 98 47 42 65 61 74 73  25 3d 28 28 53 49 47 6e  |S.GBeats%=((SIGn|
0000e730  25 28 30 2c 50 42 41 52  25 29 3e 3e 31 80 26 46  |%(0,PBAR%)>>1.&F|
0000e740  29 2b 31 29 2a 4c 65 6e  67 74 68 25 28 53 49 47  |)+1)*Length%(SIG|
0000e750  6e 25 28 30 2c 50 42 41  52 25 29 3e 3e 33 80 25  |n%(0,PBAR%)>>3.%|
0000e760  31 31 31 30 30 29 0d 53  a2 0f 51 25 28 29 3d 42  |11100).S..Q%()=B|
0000e770  65 61 74 73 25 0d 53 ac  0c 54 49 45 25 3d 26 46  |eats%.S..TIE%=&F|
0000e780  46 0d 53 b6 0e 42 32 25  3d 26 31 30 30 30 30 0d  |F.S..B2%=&10000.|
0000e790  53 c0 19 c8 99 20 53 6f  75 6e 64 5f 51 42 65 61  |S.... Sound_QBea|
0000e7a0  74 2c 42 65 61 74 73 25  0d 53 ca 4c c8 99 20 53  |t,Beats%.S.L.. S|
0000e7b0  6f 75 6e 64 5f 51 53 63  68 65 64 75 6c 65 2c 42  |ound_QSchedule,B|
0000e7c0  65 61 74 73 25 2c 53 63  68 25 84 53 6f 75 6e 64  |eats%,Sch%.Sound|
0000e7d0  5f 51 54 65 6d 70 6f 2c  54 65 6d 70 6f 25 28 54  |_QTempo,Tempo%(T|
0000e7e0  65 6d 70 6f 25 29 2a 31  32 38 2a 34 30 39 36 81  |empo%)*128*4096.|
0000e7f0  36 30 30 30 0d 53 d4 29  43 25 3d 42 65 61 74 73  |6000.S.)C%=Beats|
0000e800  25 2f 35 30 2a 26 31 30  30 30 3a e7 43 25 3e 26  |%/50*&1000:.C%>&|
0000e810  37 46 46 46 20 43 25 3d  26 37 46 46 46 0d 53 de  |7FFF C%=&7FFF.S.|
0000e820  16 c8 99 20 53 6f 75 6e  64 5f 51 54 65 6d 70 6f  |... Sound_QTempo|
0000e830  2c 43 25 0d 53 e8 17 4d  49 44 49 5f 4f 46 46 25  |,C%.S..MIDI_OFF%|
0000e840  28 30 2c 30 29 20 3d 20  2d 31 0d 53 f2 17 4d 49  |(0,0) = -1.S..MI|
0000e850  44 49 5f 4f 46 46 25 28  31 2c 30 29 20 3d 20 2d  |DI_OFF%(1,0) = -|
0000e860  31 0d 53 fc 05 e1 0d 54  06 04 0d 54 10 46 f4 20  |1.S....T...T.F. |
0000e870  66 6c 75 73 68 20 73 6f  75 6e 64 20 71 75 65 75  |flush sound queu|
0000e880  65 20 61 6e 64 20 65 6e  73 75 72 65 20 6e 6f 74  |e and ensure not|
0000e890  65 5f 6f 66 66 73 20 61  72 65 20 73 65 6e 74 20  |e_offs are sent |
0000e8a0  74 6f 20 6d 69 64 69 20  63 68 61 6e 6e 65 6c 73  |to midi channels|
0000e8b0  0d 54 1a 0f dd f2 70 6c  61 79 5f 73 74 6f 70 0d  |.T....play_stop.|
0000e8c0  54 24 0f ea 20 6e 6f 74  65 25 2c 20 6e 25 0d 54  |T$.. note%, n%.T|
0000e8d0  2e 0e 50 4c 41 59 49 4e  47 25 3d a3 0d 54 38 12  |..PLAYING%=..T8.|
0000e8e0  c8 99 20 53 6f 75 6e 64  5f 51 49 6e 69 74 0d 54  |.. Sound_QInit.T|
0000e8f0  42 14 e7 20 4d 49 44 49  70 72 65 73 65 6e 74 25  |B.. MIDIpresent%|
0000e900  20 8c 0d 54 4c 0f 20 e3  20 6e 25 3d 30 20 b8 20  | ..TL. . n%=0 . |
0000e910  31 0d 54 56 0d 20 20 6e  6f 74 65 25 3d 30 0d 54  |1.TV.  note%=0.T|
0000e920  60 22 20 20 c8 95 20 28  4d 49 44 49 5f 4f 46 46  |`"  .. (MIDI_OFF|
0000e930  25 28 6e 25 2c 6e 6f 74  65 25 29 20 3e 20 30 29  |%(n%,note%) > 0)|
0000e940  0d 54 6a 2e 20 20 20 c8  99 20 4d 49 44 49 5f 54  |.Tj.   .. MIDI_T|
0000e950  78 43 6f 6d 6d 61 6e 64  25 2c 20 4d 49 44 49 5f  |xCommand%, MIDI_|
0000e960  4f 46 46 25 28 6e 25 2c  6e 6f 74 65 25 29 0d 54  |OFF%(n%,note%).T|
0000e970  74 0f 20 20 20 6e 6f 74  65 25 2b 3d 31 0d 54 7e  |t.   note%+=1.T~|
0000e980  08 20 20 20 ce 0d 54 88  07 20 20 ed 0d 54 92 18  |.   ..T..  ..T..|
0000e990  20 f4 20 72 65 73 65 74  20 65 6e 64 20 6d 61 72  | . reset end mar|
0000e9a0  6b 65 72 73 0d 54 9c 18  20 4d 49 44 49 5f 4f 46  |kers.T.. MIDI_OF|
0000e9b0  46 25 28 30 2c 30 29 20  3d 20 2d 31 0d 54 a6 18  |F%(0,0) = -1.T..|
0000e9c0  20 4d 49 44 49 5f 4f 46  46 25 28 31 2c 30 29 20  | MIDI_OFF%(1,0) |
0000e9d0  3d 20 2d 31 0d 54 b0 06  20 cd 0d 54 ba 05 e1 0d  |= -1.T.. ..T....|
0000e9e0  54 c4 04 0d 54 ce 44 f4  20 54 68 69 73 20 73 68  |T...T.D. This sh|
0000e9f0  6f 75 6c 64 20 67 69 76  65 20 61 20 72 65 61 73  |ould give a reas|
0000ea00  6f 6e 61 62 6c 65 20 61  70 70 72 6f 78 69 6d 61  |onable approxima|
0000ea10  74 69 6f 6e 20 74 6f 20  61 20 73 6d 6f 6f 74 68  |tion to a smooth|
0000ea20  20 73 63 72 6f 6c 6c 0d  54 d8 12 dd 20 f2 43 68  | scroll.T... .Ch|
0000ea30  65 63 6b 53 63 72 6f 6c  6c 0d 54 e2 3b ea 20 50  |eckScroll.T.;. P|
0000ea40  6f 73 58 25 2c 20 57 69  6e 64 6f 77 57 69 64 74  |osX%, WindowWidt|
0000ea50  68 25 2c 20 42 61 72 50  6f 73 25 2c 20 4c 61 73  |h%, BarPos%, Las|
0000ea60  74 53 63 72 6f 6c 6c 25  2c 54 68 69 73 53 63 72  |tScroll%,ThisScr|
0000ea70  6f 6c 6c 25 0d 54 ec 14  e7 20 53 63 6f 72 65 43  |oll%.T... ScoreC|
0000ea80  6c 6f 73 65 64 25 20 8c  0d 54 f6 1e 20 e7 20 ac  |losed% ..T.. . .|
0000ea90  20 50 4c 41 59 49 4e 47  25 20 53 43 52 4f 4c 4c  | PLAYING% SCROLL|
0000eaa0  49 4e 47 25 3d a3 0d 55  00 06 20 e1 0d 55 0a 06  |ING%=..U.. ..U..|
0000eab0  20 cd 0d 55 14 1b e7 20  42 41 44 4d 4f 44 45 25  | ..U... BADMODE%|
0000eac0  20 84 20 50 42 41 52 25  3c 3d 32 20 e1 0d 55 1e  | . PBAR%<=2 ..U.|
0000ead0  16 e7 20 50 4c 41 59 49  4e 47 25 20 f2 43 68 65  |.. PLAYING% .Che|
0000eae0  63 6b 51 0d 55 28 3f e7  20 50 4c 41 59 49 4e 47  |ckQ.U(?. PLAYING|
0000eaf0  25 20 53 42 41 52 25 3d  50 42 41 52 25 2d 32 20  |% SBAR%=PBAR%-2 |
0000eb00  8b 20 42 31 25 3d 42 32  25 3a 42 32 25 3d c6 8f  |. B1%=B2%:B2%=..|
0000eb10  3a e7 42 32 25 3c 42 31  25 3a 53 42 41 52 25 2b  |:.B2%<B1%:SBAR%+|
0000eb20  3d 31 0d 55 32 32 e7 20  53 42 41 52 25 3e 3d 4e  |=1.U22. SBAR%>=N|
0000eb30  42 61 72 73 25 20 84 20  53 42 41 52 25 3e 50 42  |Bars% . SBAR%>PB|
0000eb40  41 52 25 2b 32 20 53 43  52 4f 4c 4c 49 4e 47 25  |AR%+2 SCROLLING%|
0000eb50  3d a3 3a e1 0d 55 3c 2a  c8 99 20 47 65 74 57 69  |=.:..U<*.. GetWi|
0000eb60  6e 64 6f 77 53 74 61 74  65 25 2c 2c 53 63 6f 72  |ndowState%,,Scor|
0000eb70  65 57 42 6c 6b 25 2b 68  61 6e 64 6c 65 25 0d 55  |eWBlk%+handle%.U|
0000eb80  46 2e 57 69 6e 64 6f 77  57 69 64 74 68 25 3d 53  |F.WindowWidth%=S|
0000eb90  63 6f 72 65 57 42 6c 6b  25 21 78 31 25 2d 53 63  |coreWBlk%!x1%-Sc|
0000eba0  6f 72 65 57 42 6c 6b 25  21 78 30 25 0d 55 50 1f  |oreWBlk%!x0%.UP.|
0000ebb0  4c 61 73 74 53 63 72 6f  6c 6c 25 3d 53 63 6f 72  |LastScroll%=Scor|
0000ebc0  65 57 42 6c 6b 25 21 73  63 78 25 0d 55 5a 1a 50  |eWBlk%!scx%.UZ.P|
0000ebd0  6f 73 58 25 3d 50 58 25  28 50 58 6e 25 28 53 42  |osX%=PX%(PXn%(SB|
0000ebe0  41 52 25 29 29 0d 55 64  32 42 61 72 50 6f 73 25  |AR%)).Ud2BarPos%|
0000ebf0  3d 28 50 58 25 28 50 58  6e 25 28 53 42 41 52 25  |=(PX%(PXn%(SBAR%|
0000ec00  2b 31 29 29 2d 50 6f 73  58 25 29 2a c6 8f 20 81  |+1))-PosX%)*.. .|
0000ec10  20 42 65 61 74 73 25 0d  55 6e 5c e7 20 42 61 72  | Beats%.Un\. Bar|
0000ec20  50 6f 73 25 2a 32 3c 50  67 61 70 25 20 e1 20 3a  |Pos%*2<Pgap% . :|
0000ec30  f4 20 69 66 20 73 6d 61  6c 6c 20 61 6d 6f 75 6e  |. if small amoun|
0000ec40  74 20 69 6e 74 6f 20 62  61 72 20 63 61 6e 20 73  |t into bar can s|
0000ec50  63 72 6f 6c 6c 20 74 6f  20 77 72 6f 6e 67 20 62  |croll to wrong b|
0000ec60  61 72 20 28 73 79 6e 63  20 77 69 74 68 20 70 6c  |ar (sync with pl|
0000ec70  61 79 29 0d 55 78 12 50  6f 73 58 25 2b 3d 42 61  |ay).Ux.PosX%+=Ba|
0000ec80  72 50 6f 73 25 0d 55 82  26 54 68 69 73 53 63 72  |rPos%.U.&ThisScr|
0000ec90  6f 6c 6c 25 20 3d 20 50  6f 73 58 25 2d 57 69 6e  |oll% = PosX%-Win|
0000eca0  64 6f 77 57 69 64 74 68  25 81 32 0d 55 8c 16 e7  |dowWidth%.2.U...|
0000ecb0  20 54 68 69 73 53 63 72  6f 6c 6c 25 3c 3d 30 20  | ThisScroll%<=0 |
0000ecc0  e1 0d 55 96 20 e7 20 54  68 69 73 53 63 72 6f 6c  |..U. . ThisScrol|
0000ecd0  6c 25 3c 3e 4c 61 73 74  53 63 72 6f 6c 6c 25 20  |l%<>LastScroll% |
0000ece0  8c 0d 55 a0 12 20 f4 20  61 75 74 6f 2d 73 63 72  |..U.. . auto-scr|
0000ecf0  6f 6c 6c 0d 55 aa 3d 20  f4 20 64 69 76 69 64 65  |oll.U.= . divide|
0000ed00  20 73 63 72 6f 6c 6c 20  69 6e 74 6f 20 73 6d 61  | scroll into sma|
0000ed10  6c 6c 20 62 69 74 73 20  74 6f 20 6d 61 6b 65 20  |ll bits to make |
0000ed20  69 74 20 61 70 70 65 61  72 20 73 6d 6f 6f 74 68  |it appear smooth|
0000ed30  0d 55 b4 30 20 53 63 6f  72 65 57 42 6c 6b 25 21  |.U.0 ScoreWBlk%!|
0000ed40  73 63 78 25 3d 28 4c 61  73 74 53 63 72 6f 6c 6c  |scx%=(LastScroll|
0000ed50  25 2b 54 68 69 73 53 63  72 6f 6c 6c 25 29 2f 32  |%+ThisScroll%)/2|
0000ed60  0d 55 be 27 20 c8 99 20  4f 70 65 6e 57 69 6e 64  |.U.' .. OpenWind|
0000ed70  6f 77 25 2c 2c 53 63 6f  72 65 57 42 6c 6b 25 2b  |ow%,,ScoreWBlk%+|
0000ed80  68 61 6e 64 6c 65 25 0d  55 c8 20 20 53 63 6f 72  |handle%.U.  Scor|
0000ed90  65 57 42 6c 6b 25 21 73  63 78 25 3d 54 68 69 73  |eWBlk%!scx%=This|
0000eda0  53 63 72 6f 6c 6c 25 0d  55 d2 27 20 c8 99 20 4f  |Scroll%.U.' .. O|
0000edb0  70 65 6e 57 69 6e 64 6f  77 25 2c 2c 53 63 6f 72  |penWindow%,,Scor|
0000edc0  65 57 42 6c 6b 25 2b 68  61 6e 64 6c 65 25 0d 55  |eWBlk%+handle%.U|
0000edd0  dc 4f 20 4c 48 42 41 52  25 3d a4 46 69 6e 64 42  |.O LHBAR%=.FindB|
0000ede0  61 72 28 54 68 69 73 53  63 72 6f 6c 6c 25 29 2d  |ar(ThisScroll%)-|
0000edf0  31 20 3a f4 20 74 68 65  20 62 61 72 20 6e 75 6d  |1 :. the bar num|
0000ee00  62 65 72 20 61 74 20 74  68 65 20 6c 65 66 74 20  |ber at the left |
0000ee10  6f 66 20 74 68 65 20 77  69 6e 64 6f 77 0d 55 e6  |of the window.U.|
0000ee20  13 20 e7 20 50 4c 41 59  49 4e 47 25 3d a3 20 8c  |. . PLAYING%=. .|
0000ee30  0d 55 f0 24 f4 20 73 74  6f 70 20 73 63 72 6f 6c  |.U.$. stop scrol|
0000ee40  6c 69 6e 67 20 61 74 20  65 6e 64 20 6f 66 20 6d  |ling at end of m|
0000ee50  75 73 69 63 0d 55 fa 32  20 20 20 e7 20 53 63 6f  |usic.U.2   . Sco|
0000ee60  72 65 57 42 6c 6b 25 21  73 63 78 25 3c 3d 4c 61  |reWBlk%!scx%<=La|
0000ee70  73 74 53 63 72 6f 6c 6c  25 20 53 43 52 4f 4c 4c  |stScroll% SCROLL|
0000ee80  49 4e 47 25 3d a3 0d 56  04 08 20 20 20 cd 0d 56  |ING%=..V..   ..V|
0000ee90  0e 06 20 cd 0d 56 18 05  e1 0d 56 22 04 0d 56 2c  |.. ..V....V"..V,|
0000eea0  0f dd 20 f2 70 6c 61 79  5f 62 61 72 0d 56 36 40  |.. .play_bar.V6@|
0000eeb0  ea 43 25 2c 4c 25 2c 49  25 2c 44 25 2c 53 25 2c  |.C%,L%,I%,D%,S%,|
0000eec0  51 25 2c 54 25 2c 42 25  2c 41 25 3a f4 20 56 61  |Q%,T%,B%,A%:. Va|
0000eed0  72 73 20 66 6f 72 20 70  6c 61 79 5f 62 61 72 20  |rs for play_bar |
0000eee0  26 20 70 6c 61 79 5f 6e  6f 74 65 73 0d 56 40 07  |& play_notes.V@.|
0000eef0  ea 20 66 0d 56 4a 13 4d  49 44 49 5f 4e 6f 74 65  |. f.VJ.MIDI_Note|
0000ef00  6e 75 6d 25 3d 30 0d 56  54 39 51 25 28 29 3d 42  |num%=0.VT9Q%()=B|
0000ef10  65 61 74 73 25 3a f4 20  52 65 73 65 74 20 73 74  |eats%:. Reset st|
0000ef20  61 76 65 20 71 75 65 75  65 20 63 6f 75 6e 74 65  |ave queue counte|
0000ef30  72 73 20 66 6f 72 20 6e  65 78 74 20 62 61 72 0d  |rs for next bar.|
0000ef40  56 5e 0c 42 25 3d 50 42  41 52 25 0d 56 68 39 41  |V^.B%=PBAR%.Vh9A|
0000ef50  63 63 69 64 65 6e 74 61  6c 25 28 29 3d 30 3a f4  |ccidental%()=0:.|
0000ef60  20 4e 6f 20 69 6e 63 69  64 65 6e 74 61 6c 20 61  | No incidental a|
0000ef70  63 63 69 64 65 6e 74 61  6c 73 20 69 6e 69 74 69  |ccidentals initi|
0000ef80  61 6c 6c 79 0d 56 72 0c  46 69 72 73 74 25 3d b9  |ally.Vr.First%=.|
0000ef90  0d 56 7c 18 c8 95 42 25  3d 50 42 41 52 25 80 50  |.V|...B%=PBAR%.P|
0000efa0  50 25 3c 47 41 54 45 25  0d 56 86 41 e7 3f 50 50  |P%<GATE%.V.A.?PP|
0000efb0  25 20 f2 70 6c 61 79 5f  6e 6f 74 65 73 28 3f 50  |% .play_notes(?P|
0000efc0  50 25 29 3a 50 50 25 2b  3d 31 20 8b f2 70 6c 61  |P%):PP%+=1 ..pla|
0000efd0  79 5f 61 74 74 72 69 62  75 74 65 28 50 50 25 3f  |y_attribute(PP%?|
0000efe0  31 29 3a 50 50 25 2b 3d  32 0d 56 90 0c 46 69 72  |1):PP%+=2.V..Fir|
0000eff0  73 74 25 3d a3 0d 56 9a  05 ce 0d 56 a4 23 e7 50  |st%=..V....V.#.P|
0000f000  50 25 3e 3d 47 41 54 45  25 20 50 4c 41 59 49 4e  |P%>=GATE% PLAYIN|
0000f010  47 25 3d a3 3a 53 42 41  52 25 2b 3d 31 0d 56 ae  |G%=.:SBAR%+=1.V.|
0000f020  05 e1 0d 56 b8 04 0d 56  c2 4f f4 20 4e 6f 74 65  |...V...V.O. Note|
0000f030  73 20 66 6f 72 20 65 61  63 68 20 67 61 74 65 20  |s for each gate |
0000f040  73 74 61 72 74 20 70 6c  61 79 69 6e 67 20 61 74  |start playing at|
0000f050  20 51 25 3b 20 74 68 65  20 6c 61 74 65 73 74 20  | Q%; the latest |
0000f060  51 25 28 29 20 6f 66 20  74 68 65 20 73 74 61 76  |Q%() of the stav|
0000f070  65 73 20 6f 6e 0d 56 cc  4e f4 20 77 68 69 63 68  |es on.V.N. which|
0000f080  20 6e 6f 74 65 73 20 61  72 65 20 74 6f 20 70 6c  | notes are to pl|
0000f090  61 79 2e 20 54 68 69 73  20 69 73 20 62 65 63 61  |ay. This is beca|
0000f0a0  75 73 65 20 61 6c 6c 20  6e 6f 74 65 73 20 69 6e  |use all notes in|
0000f0b0  20 61 20 67 61 74 65 20  70 6c 61 79 20 61 74 20  | a gate play at |
0000f0c0  74 68 65 0d 56 d6 50 f4  20 73 61 6d 65 20 74 69  |the.V.P. same ti|
0000f0d0  6d 65 20 61 6e 64 20 63  61 6e 6e 6f 74 20 73 74  |me and cannot st|
0000f0e0  61 72 74 20 62 65 66 6f  72 65 20 74 68 65 20 73  |art before the s|
0000f0f0  68 6f 72 74 65 73 74 20  6f 66 20 74 68 65 20 6e  |hortest of the n|
0000f100  6f 74 65 73 20 70 72 65  63 65 64 69 6e 67 20 74  |otes preceding t|
0000f110  68 65 6d 0d 56 e0 14 f4  20 68 61 76 65 20 66 69  |hem.V... have fi|
0000f120  6e 69 73 68 65 64 2e 0d  56 ea 3e f4 20 51 25 20  |nished..V.>. Q% |
0000f130  69 73 20 74 68 65 20 74  69 6d 65 20 61 74 20 77  |is the time at w|
0000f140  68 69 63 68 20 74 68 65  20 6e 6f 74 65 73 20 69  |hich the notes i|
0000f150  6e 20 74 68 65 20 67 61  74 65 20 61 72 65 20 70  |n the gate are p|
0000f160  6c 61 79 65 64 0d 56 f4  4c f4 20 51 25 28 53 25  |layed.V.L. Q%(S%|
0000f170  29 20 69 73 20 74 68 65  20 74 69 6d 65 20 61 74  |) is the time at|
0000f180  20 74 68 65 20 65 6e 64  20 6f 66 20 74 68 65 20  | the end of the |
0000f190  73 68 6f 72 74 65 73 74  20 6e 6f 74 65 20 70 6c  |shortest note pl|
0000f1a0  61 79 65 64 20 6f 6e 20  73 74 61 76 65 20 53 25  |ayed on stave S%|
0000f1b0  2e 0d 56 fe 45 f4 20 51  49 25 28 53 25 29 20 69  |..V.E. QI%(S%) i|
0000f1c0  73 20 74 68 65 20 63 75  72 72 65 6e 74 20 73 68  |s the current sh|
0000f1d0  6f 72 74 65 73 74 20 6e  6f 74 65 20 62 65 61 74  |ortest note beat|
0000f1e0  73 20 69 6e 74 65 72 76  61 6c 20 6f 6e 20 73 74  |s interval on st|
0000f1f0  61 76 65 20 53 25 0d 57  08 04 0d 57 12 15 dd 20  |ave S%.W...W... |
0000f200  f2 70 6c 61 79 5f 6e 6f  74 65 73 28 47 25 29 0d  |.play_notes(G%).|
0000f210  57 1c 29 ea 20 6e 6f 74  65 25 2c 20 70 61 63 6b  |W.). note%, pack|
0000f220  65 64 25 2c 20 51 6f 66  66 25 2c 78 74 72 61 56  |ed%, Qoff%,xtraV|
0000f230  6f 6c 2c 74 65 6d 70 6f  0d 57 26 2b 74 65 6d 70  |ol,tempo.W&+temp|
0000f240  6f 20 3d 20 35 20 2a 20  31 32 38 20 2a 20 54 65  |o = 5 * 128 * Te|
0000f250  6d 70 6f 25 28 54 65 6d  70 6f 25 29 20 2f 20 36  |mpo%(Tempo%) / 6|
0000f260  30 30 30 0d 57 30 0d 51  25 3d a3 3a 43 25 3d b9  |000.W0.Q%=.:C%=.|
0000f270  0d 57 3a 16 f5 f5 43 25  2d 3d b9 3a fd 47 25 80  |.W:...C%-=.:.G%.|
0000f280  25 31 3c 3c 43 25 0d 57  44 24 e7 51 25 28 53 5f  |%1<<C%.WD$.Q%(S_|
0000f290  43 25 28 43 25 29 29 3e  51 25 20 51 25 3d 51 25  |C%(C%))>Q% Q%=Q%|
0000f2a0  28 53 5f 43 25 28 43 25  29 29 0d 57 4e 0f fd 28  |(S_C%(C%)).WN..(|
0000f2b0  32 3c 3c 43 25 29 3e 47  25 0d 57 58 15 51 49 25  |2<<C%)>G%.WX.QI%|
0000f2c0  28 29 3d 26 31 30 30 30  30 3a 43 25 3d b9 0d 57  |()=&10000:C%=..W|
0000f2d0  62 05 f5 0d 57 6c 64 20  20 e7 20 46 69 72 73 74  |b...Wld  . First|
0000f2e0  25 20 78 74 72 61 56 6f  6c 3d 31 2e 30 31 20 8b  |% xtraVol=1.01 .|
0000f2f0  20 78 74 72 61 56 6f 6c  3d 31 2e 30 20 3a f4 20  | xtraVol=1.0 :. |
0000f300  61 20 6c 69 74 74 6c 65  20 64 79 6e 61 6d 69 63  |a little dynamic|
0000f310  73 2e 20 73 74 72 65 73  73 20 31 73 74 20 62 65  |s. stress 1st be|
0000f320  61 74 20 69 6e 20 62 61  72 20 76 65 72 79 20 73  |at in bar very s|
0000f330  6c 69 67 68 74 6c 79 0d  57 76 17 20 20 f5 43 25  |lightly.Wv.  .C%|
0000f340  2d 3d b9 3a fd 47 25 80  25 31 3c 3c 43 25 0d 57  |-=.:.G%.%1<<C%.W|
0000f350  80 4f 20 20 e7 20 a8 28  78 74 72 61 56 6f 6c 2a  |.O  . .(xtraVol*|
0000f360  56 6f 6c 75 6d 65 25 28  56 6f 6c 75 6d 65 73 25  |Volume%(Volumes%|
0000f370  28 43 25 29 29 29 3e 26  37 46 20 78 74 72 61 56  |(C%)))>&7F xtraV|
0000f380  6f 6c 3d 31 2e 30 20 20  3a f4 20 65 6e 73 75 72  |ol=1.0  :. ensur|
0000f390  65 20 6e 6f 20 6f 76 65  72 66 6c 6f 77 0d 57 8a  |e no overflow.W.|
0000f3a0  3f 20 20 54 25 3d 3f 50  25 28 43 25 29 3a 44 25  |?  T%=?P%(C%):D%|
0000f3b0  3d 50 25 28 43 25 29 3f  31 3a 49 25 3d 44 25 3e  |=P%(C%)?1:I%=D%>|
0000f3c0  3e 33 3a 53 25 3d 53 5f  43 25 28 43 25 29 3a 4c  |>3:S%=S_C%(C%):L|
0000f3d0  25 3d 54 25 3e 3e 33 3a  41 25 3d 30 0d 57 94 16  |%=T%>>3:A%=0.W..|
0000f3e0  20 20 e7 4c 25 80 53 25  3c 3d 53 54 41 56 45 25  |  .L%.S%<=STAVE%|
0000f3f0  20 8c 0d 57 9e 25 20 20  20 20 e7 44 25 80 37 20  | ..W.%    .D%.7 |
0000f400  41 63 63 69 64 65 6e 74  61 6c 25 28 53 25 2c 4c  |Accidental%(S%,L|
0000f410  25 29 3d 44 25 80 37 0d  57 a8 6f 20 20 20 20 41  |%)=D%.7.W.o    A|
0000f420  25 3d 41 63 63 69 64 65  6e 74 61 6c 25 28 53 25  |%=Accidental%(S%|
0000f430  2c 4c 25 29 3a 4c 25 2b  3d 50 43 4c 45 46 25 28  |,L%):L%+=PCLEF%(|
0000f440  53 25 29 3a e7 41 25 20  8b 41 25 3d 4b 65 79 25  |S%):.A% .A%=Key%|
0000f450  28 4c 25 83 37 29 3a f4  20 49 66 20 6e 6f 20 61  |(L%.7):. If no a|
0000f460  63 63 69 64 65 6e 74 61  6c 20 74 68 65 6e 20 72  |ccidental then r|
0000f470  65 76 65 72 74 20 74 6f  20 6b 65 79 20 73 69 67  |evert to key sig|
0000f480  6e 61 74 75 72 65 0d 57  b2 09 20 20 20 20 cd 0d  |nature.W..    ..|
0000f490  57 bc 14 20 20 e7 54 49  45 25 80 25 31 3c 3c 43  |W..  .TIE%.%1<<C|
0000f4a0  25 20 8c 0d 57 c6 90 20  20 20 20 44 25 3d 44 75  |% ..W..    D%=Du|
0000f4b0  72 61 74 69 6f 6e 25 28  54 65 6d 70 6f 25 29 3f  |ration%(Tempo%)?|
0000f4c0  49 25 3a e7 54 25 80 34  20 54 49 45 25 3d 54 49  |I%:.T%.4 TIE%=TI|
0000f4d0  45 25 80 ac 28 25 31 3c  3c 43 25 29 3a 54 25 3d  |E%..(%1<<C%):T%=|
0000f4e0  50 25 28 43 25 29 2b 31  3a f5 54 25 2b 3d 32 3a  |P%(C%)+1:.T%+=2:|
0000f4f0  44 25 2b 3d 44 75 72 61  74 69 6f 6e 25 28 54 65  |D%+=Duration%(Te|
0000f500  6d 70 6f 25 29 3f 28 3f  54 25 3e 3e 33 29 3a fd  |mpo%)?(?T%>>3):.|
0000f510  54 25 3e 46 49 4e 45 25  28 43 25 29 84 34 80 ac  |T%>FINE%(C%).4..|
0000f520  54 25 3f b9 3a e7 44 25  3e 32 35 34 20 44 25 3d  |T%?.:.D%>254 D%=|
0000f530  32 35 34 0d 57 d0 0d 20  20 20 20 e7 4c 25 20 8c  |254.W..    .L% .|
0000f540  0d 57 da 4d 20 20 20 20  20 20 d4 43 25 2b 31 2c  |.W.M      .C%+1,|
0000f550  a8 28 78 74 72 61 56 6f  6c 2a 56 6f 6c 75 6d 65  |.(xtraVol*Volume|
0000f560  25 28 56 6f 6c 75 6d 65  73 25 28 43 25 29 29 29  |%(Volumes%(C%)))|
0000f570  84 26 31 30 30 2c 4c 69  6e 65 28 4c 25 29 2b 41  |.&100,Line(L%)+A|
0000f580  6f 66 66 28 41 25 29 2c  44 25 2c 51 25 0d 57 e4  |off(A%),D%,Q%.W.|
0000f590  1a 20 20 20 20 20 20 e7  20 4d 49 44 49 70 72 65  |.      . MIDIpre|
0000f5a0  73 65 6e 74 25 20 8c 0d  57 ee 3e 20 20 20 20 20  |sent% ..W.>     |
0000f5b0  20 20 20 e7 20 28 4d 49  44 49 43 68 61 6e 6e 65  |   . (MIDIChanne|
0000f5c0  6c 25 28 43 25 29 3e 3d  31 29 20 80 20 28 4d 49  |l%(C%)>=1) . (MI|
0000f5d0  44 49 43 68 61 6e 6e 65  6c 25 28 43 25 29 3c 3d  |DIChannel%(C%)<=|
0000f5e0  31 36 29 20 8c 0d 57 f8  3e 20 20 20 20 20 20 20  |16) ..W.>       |
0000f5f0  20 20 20 6e 6f 74 65 25  20 3d 20 31 32 20 2b 20  |   note% = 12 + |
0000f600  a8 28 28 28 4c 69 6e 65  28 4c 25 29 2b 41 6f 66  |.(((Line(L%)+Aof|
0000f610  66 28 41 25 29 29 2f 26  31 30 30 30 29 20 2a 20  |f(A%))/&1000) * |
0000f620  31 32 29 0d 58 02 62 20  20 20 20 20 20 20 20 20  |12).X.b         |
0000f630  20 70 61 63 6b 65 64 25  20 3d 20 28 4d 49 44 49  | packed% = (MIDI|
0000f640  43 68 61 6e 6e 65 6c 25  28 43 25 29 2d 31 29 20  |Channel%(C%)-1) |
0000f650  84 20 28 6e 6f 74 65 25  3c 3c 38 29 20 84 20 a8  |. (note%<<8) . .|
0000f660  28 78 74 72 61 56 6f 6c  2a 28 56 6f 6c 75 6d 65  |(xtraVol*(Volume|
0000f670  25 28 56 6f 6c 75 6d 65  73 25 28 43 25 29 29 29  |%(Volumes%(C%)))|
0000f680  3c 3c 31 36 29 0d 58 0c  45 20 20 20 20 20 20 20  |<<16).X.E       |
0000f690  20 20 20 4d 49 44 49 5f  4f 46 46 25 28 50 42 41  |   MIDI_OFF%(PBA|
0000f6a0  52 25 83 32 2c 4d 49 44  49 5f 4e 6f 74 65 6e 75  |R%.2,MIDI_Notenu|
0000f6b0  6d 25 29 20 3d 20 4d 5f  4e 6f 74 65 4f 66 66 25  |m%) = M_NoteOff%|
0000f6c0  20 84 20 70 61 63 6b 65  64 25 0d 58 16 20 20 20  | . packed%.X.   |
0000f6d0  20 20 20 20 20 20 20 20  4d 49 44 49 5f 4e 6f 74  |        MIDI_Not|
0000f6e0  65 6e 75 6d 25 20 2b 3d  20 31 0d 58 20 41 20 20  |enum% += 1.X A  |
0000f6f0  20 20 20 20 20 20 20 20  4d 49 44 49 5f 4f 46 46  |        MIDI_OFF|
0000f700  25 28 50 42 41 52 25 83  32 2c 4d 49 44 49 5f 4e  |%(PBAR%.2,MIDI_N|
0000f710  6f 74 65 6e 75 6d 25 29  20 3d 20 2d 31 20 3a f4  |otenum%) = -1 :.|
0000f720  20 65 6e 64 20 6d 61 72  6b 65 72 0d 58 2a 27 20  | end marker.X*' |
0000f730  20 20 20 20 20 20 20 20  20 f4 20 44 25 20 3d 20  |         . D% = |
0000f740  6e 6f 2e 20 6f 66 20 35  20 63 65 6e 74 69 73 65  |no. of 5 centise|
0000f750  63 73 0d 58 34 25 20 20  20 20 20 20 20 20 20 20  |cs.X4%          |
0000f760  51 6f 66 66 25 20 3d 20  51 25 20 2b 20 44 25 20  |Qoff% = Q% + D% |
0000f770  2a 20 74 65 6d 70 6f 0d  58 3e 69 20 20 20 20 20  |* tempo.X>i     |
0000f780  20 20 20 20 20 e7 20 51  6f 66 66 25 20 3e 20 51  |     . Qoff% > Q|
0000f790  25 20 2b 20 31 35 20 51  6f 66 66 25 20 2d 3d 20  |% + 15 Qoff% -= |
0000f7a0  31 30 20 20 3a f4 20 65  6e 73 75 72 65 20 6e 6f  |10  :. ensure no|
0000f7b0  74 65 20 69 73 20 6f 66  66 20 61 66 74 65 72 20  |te is off after |
0000f7c0  73 74 61 72 74 20 61 6e  64 20 62 65 66 6f 72 65  |start and before|
0000f7d0  20 6e 65 78 74 20 6e 6f  74 65 20 73 74 61 72 74  | next note start|
0000f7e0  0d 58 48 54 20 20 20 20  20 20 20 20 20 20 c8 99  |.XHT          ..|
0000f7f0  20 53 6f 75 6e 64 5f 51  53 63 68 65 64 75 6c 65  | Sound_QSchedule|
0000f800  2c 51 25 2c 20 20 20 20  53 63 68 25 20 84 20 4d  |,Q%,    Sch% . M|
0000f810  49 44 49 5f 54 78 43 6f  6d 6d 61 6e 64 25 2c 20  |IDI_TxCommand%, |
0000f820  4d 5f 4e 6f 74 65 4f 6e  25 20 20 84 20 70 61 63  |M_NoteOn%  . pac|
0000f830  6b 65 64 25 0d 58 52 54  20 20 20 20 20 20 20 20  |ked%.XRT        |
0000f840  20 20 c8 99 20 53 6f 75  6e 64 5f 51 53 63 68 65  |  .. Sound_QSche|
0000f850  64 75 6c 65 2c 51 6f 66  66 25 2c 20 53 63 68 25  |dule,Qoff%, Sch%|
0000f860  20 84 20 4d 49 44 49 5f  54 78 43 6f 6d 6d 61 6e  | . MIDI_TxComman|
0000f870  64 25 2c 20 4d 5f 4e 6f  74 65 4f 66 66 25 20 84  |d%, M_NoteOff% .|
0000f880  20 70 61 63 6b 65 64 25  0d 58 5c 0f 20 20 20 20  | packed%.X\.    |
0000f890  20 20 20 20 20 20 cd 0d  58 66 0d 20 20 20 20 20  |      ..Xf.     |
0000f8a0  20 20 20 cd 0d 58 70 0b  20 20 20 20 20 20 cd 0d  |   ..Xp.      ..|
0000f8b0  58 7a 07 20 20 cc 0d 58  84 1f 20 20 20 20 e7 34  |Xz.  ..X..    .4|
0000f8c0  80 ac 54 25 20 54 49 45  25 3d 54 49 45 25 84 25  |..T% TIE%=TIE%.%|
0000f8d0  31 3c 3c 43 25 0d 58 8e  09 20 20 20 20 cd 0d 58  |1<<C%.X..    ..X|
0000f8e0  98 4a 20 20 50 25 28 43  25 29 2b 3d 32 3a e7 4c  |.J  P%(C%)+=2:.L|
0000f8f0  65 6e 67 74 68 25 28 49  25 29 3c 51 49 25 28 53  |ength%(I%)<QI%(S|
0000f900  25 29 20 51 49 25 28 53  25 29 3d 4c 65 6e 67 74  |%) QI%(S%)=Lengt|
0000f910  68 25 28 49 25 29 3a 51  25 28 53 25 29 3d 51 25  |h%(I%):Q%(S%)=Q%|
0000f920  2b 51 49 25 28 53 25 29  0d 58 a2 11 20 20 fd 28  |+QI%(S%).X..  .(|
0000f930  32 3c 3c 43 25 29 3e 47  25 0d 58 ac 05 e1 0d 58  |2<<C%)>G%.X....X|
0000f940  b6 04 0d 58 c0 19 dd 20  f2 70 6c 61 79 5f 61 74  |...X... .play_at|
0000f950  74 72 69 62 75 74 65 28  41 25 29 0d 58 ca 1a 43  |tribute(A%).X..C|
0000f960  25 3d b9 3a f5 43 25 2d  3d b9 3a fd 41 25 80 25  |%=.:.C%-=.:.A%.%|
0000f970  31 3c 3c 43 25 0d 58 d4  70 ee 43 25 2b 31 20 f2  |1<<C%.X.p.C%+1 .|
0000f980  70 6c 61 79 5f 74 69 6d  65 5f 73 69 67 28 41 25  |play_time_sig(A%|
0000f990  29 2c f2 70 6c 61 79 5f  6b 65 79 5f 73 69 67 28  |),.play_key_sig(|
0000f9a0  41 25 29 2c f2 70 6c 61  79 5f 63 6c 65 66 28 41  |A%),.play_clef(A|
0000f9b0  25 29 2c f2 70 6c 61 79  5f 73 6c 75 72 28 41 25  |%),.play_slur(A%|
0000f9c0  29 2c f2 70 6c 61 79 5f  6f 63 74 61 76 65 28 41  |),.play_octave(A|
0000f9d0  25 29 2c f2 70 6c 61 79  5f 62 61 72 5f 6c 69 6e  |%),.play_bar_lin|
0000f9e0  65 28 41 25 29 0d 58 de  05 e1 0d 58 e8 04 0d 58  |e(A%).X....X...X|
0000f9f0  f2 18 dd 20 f2 70 6c 61  79 5f 74 69 6d 65 5f 73  |... .play_time_s|
0000fa00  69 67 28 41 25 29 0d 58  fc 2b 41 25 3d 28 28 41  |ig(A%).X.+A%=((A|
0000fa10  25 3e 3e 31 80 26 46 29  2b 31 29 2a 4c 65 6e 67  |%>>1.&F)+1)*Leng|
0000fa20  74 68 25 28 41 25 3e 3e  33 80 25 31 31 31 30 30  |th%(A%>>3.%11100|
0000fa30  29 0d 59 06 31 c8 99 20  53 6f 75 6e 64 5f 51 53  |).Y.1.. Sound_QS|
0000fa40  63 68 65 64 75 6c 65 2c  42 65 61 74 73 25 2c 53  |chedule,Beats%,S|
0000fa50  63 68 25 84 53 6f 75 6e  64 5f 51 42 65 61 74 2c  |ch%.Sound_QBeat,|
0000fa60  41 25 0d 59 10 0d 42 65  61 74 73 25 3d 41 25 0d  |A%.Y..Beats%=A%.|
0000fa70  59 1a 05 e1 0d 59 24 04  0d 59 2e 17 dd 20 f2 70  |Y....Y$..Y... .p|
0000fa80  6c 61 79 5f 6b 65 79 5f  73 69 67 28 41 25 29 0d  |lay_key_sig(A%).|
0000fa90  59 38 10 ea 4e 25 3a 41  25 3d 41 25 3e 3e 32 0d  |Y8..N%:A%=A%>>2.|
0000faa0  59 42 26 e3 4e 25 3d 30  b8 36 3a 4b 65 79 25 28  |YB&.N%=0.6:Key%(|
0000fab0  4e 25 29 3d 4b 65 79 5f  53 69 67 25 28 41 25 2c  |N%)=Key_Sig%(A%,|
0000fac0  4e 25 29 3a ed 0d 59 4c  05 e1 0d 59 56 04 0d 59  |N%):..YL...YV..Y|
0000fad0  60 14 dd 20 f2 70 6c 61  79 5f 63 6c 65 66 28 41  |`.. .play_clef(A|
0000fae0  25 29 0d 59 6a 20 50 43  4c 45 46 25 28 41 25 3e  |%).Yj PCLEF%(A%>|
0000faf0  3e 36 29 3d 43 6c 65 66  25 28 41 25 3e 3e 33 80  |>6)=Clef%(A%>>3.|
0000fb00  33 29 0d 59 74 05 e1 0d  59 7e 04 0d 59 88 14 dd  |3).Yt...Y~..Y...|
0000fb10  20 f2 70 6c 61 79 5f 73  6c 75 72 28 41 25 29 0d  | .play_slur(A%).|
0000fb20  59 92 05 e1 0d 59 9c 04  0d 59 a6 16 dd 20 f2 70  |Y....Y...Y... .p|
0000fb30  6c 61 79 5f 6f 63 74 61  76 65 28 41 25 29 0d 59  |lay_octave(A%).Y|
0000fb40  b0 05 e1 0d 59 ba 04 0d  59 c4 18 dd 20 f2 70 6c  |....Y...Y... .pl|
0000fb50  61 79 5f 62 61 72 5f 6c  69 6e 65 28 41 25 29 0d  |ay_bar_line(A%).|
0000fb60  59 ce 0c 50 42 41 52 25  2b 3d 31 0d 59 d8 05 e1  |Y..PBAR%+=1.Y...|
0000fb70  0d 59 e2 04 0d 59 ec 11  dd 20 a4 69 6e 69 74 69  |.Y...Y... .initi|
0000fb80  61 6c 69 73 65 0d 59 f6  12 ea 20 53 6f 75 6e 64  |alise.Y... Sound|
0000fb90  45 6e 61 62 6c 65 25 0d  5a 00 12 f2 45 6e 75 6d  |Enable%.Z...Enum|
0000fba0  65 72 61 74 65 53 57 49  73 0d 5a 0a 1a f2 69 6e  |erateSWIs.Z...in|
0000fbb0  69 74 69 61 6c 69 73 65  5f 6d 69 73 63 65 6c 6c  |itialise_miscell|
0000fbc0  61 6e 79 0d 5a 14 16 f2  69 6e 69 74 69 61 6c 69  |any.Z...initiali|
0000fbd0  73 65 5f 73 63 72 65 65  6e 0d 5a 1e 17 f2 69 6e  |se_screen.Z...in|
0000fbe0  69 74 69 61 6c 69 73 65  5f 73 70 72 69 74 65 73  |itialise_sprites|
0000fbf0  0d 5a 28 14 f2 69 6e 69  74 69 61 6c 69 73 65 5f  |.Z(..initialise_|
0000fc00  77 69 6d 70 0d 5a 32 22  53 6f 75 6e 64 45 6e 61  |wimp.Z2"SoundEna|
0000fc10  62 6c 65 25 3d a4 69 6e  69 74 69 61 6c 69 73 65  |ble%=.initialise|
0000fc20  5f 73 6f 75 6e 64 0d 5a  3c 15 f2 69 6e 69 74 69  |_sound.Z<..initi|
0000fc30  61 6c 69 73 65 5f 6d 75  73 69 63 0d 5a 46 14 f2  |alise_music.ZF..|
0000fc40  69 6e 69 74 69 61 6c 69  73 65 5f 6d 65 6e 75 0d  |initialise_menu.|
0000fc50  5a 50 5b e7 20 53 6f 75  6e 64 45 6e 61 62 6c 65  |ZP[. SoundEnable|
0000fc60  25 3d 31 20 e7 20 a4 43  68 65 63 6b 4f 4b 28 22  |%=1 . .CheckOK("|
0000fc70  53 6f 75 6e 64 20 69 73  20 6e 6f 74 20 65 6e 61  |Sound is not ena|
0000fc80  62 6c 65 64 2e 20 44 6f  20 79 6f 75 20 77 69 73  |bled. Do you wis|
0000fc90  68 20 74 6f 20 71 75 69  74 3f 22 2c 20 33 29 20  |h to quit?", 3) |
0000fca0  f2 74 65 72 6d 69 6e 61  74 65 0d 5a 5a 06 3d b9  |.terminate.ZZ.=.|
0000fcb0  0d 5a 64 04 0d 5a 6e 14  dd 20 f2 45 6e 75 6d 65  |.Zd..Zn.. .Enume|
0000fcc0  72 61 74 65 53 57 49 73  0d 5a 78 1a ea 57 25 3a  |rateSWIs.Zx..W%:|
0000fcd0  57 25 20 20 20 20 20 20  20 20 3d 20 26 34 30 30  |W%        = &400|
0000fce0  43 30 0d 5a 82 1c 53 70  72 69 74 65 4f 70 25 20  |C0.Z..SpriteOp% |
0000fcf0  20 20 20 20 20 20 20 20  20 3d 20 26 32 45 0d 5a  |         = &2E.Z|
0000fd00  8c 1d 49 6e 69 74 69 61  6c 69 73 65 25 20 20 20  |..Initialise%   |
0000fd10  20 20 20 20 20 3d 20 57  25 2b 30 0d 5a 96 1d 43  |     = W%+0.Z..C|
0000fd20  72 65 61 74 65 57 69 6e  64 6f 77 25 20 20 20 20  |reateWindow%    |
0000fd30  20 20 3d 20 57 25 2b 31  0d 5a a0 1d 43 72 65 61  |  = W%+1.Z..Crea|
0000fd40  74 65 49 63 6f 6e 25 20  20 20 20 20 20 20 20 3d  |teIcon%        =|
0000fd50  20 57 25 2b 32 0d 5a aa  1d 4f 70 65 6e 57 69 6e  | W%+2.Z..OpenWin|
0000fd60  64 6f 77 25 20 20 20 20  20 20 20 20 3d 20 57 25  |dow%        = W%|
0000fd70  2b 35 0d 5a b4 1d 43 6c  6f 73 65 57 69 6e 64 6f  |+5.Z..CloseWindo|
0000fd80  77 25 20 20 20 20 20 20  20 3d 20 57 25 2b 36 0d  |w%       = W%+6.|
0000fd90  5a be 1d 50 6f 6c 6c 25  20 20 20 20 20 20 20 20  |Z..Poll%        |
0000fda0  20 20 20 20 20 20 3d 20  57 25 2b 37 0d 5a c8 1c  |      = W%+7.Z..|
0000fdb0  52 65 64 72 61 77 57 69  6e 64 6f 77 25 20 20 20  |RedrawWindow%   |
0000fdc0  20 20 3d 20 57 25 2b 38  0d 5a d2 1d 55 70 64 61  |  = W%+8.Z..Upda|
0000fdd0  74 65 57 69 6e 64 6f 77  25 20 20 20 20 20 20 3d  |teWindow%      =|
0000fde0  20 57 25 2b 39 0d 5a dc  1e 47 65 74 52 65 63 74  | W%+9.Z..GetRect|
0000fdf0  61 6e 67 6c 65 25 20 20  20 20 20 20 3d 20 57 25  |angle%      = W%|
0000fe00  2b 31 30 0d 5a e6 1e 47  65 74 57 69 6e 64 6f 77  |+10.Z..GetWindow|
0000fe10  53 74 61 74 65 25 20 20  20 20 3d 20 57 25 2b 31  |State%    = W%+1|
0000fe20  31 0d 5a f0 1e 53 65 74  49 63 6f 6e 53 74 61 74  |1.Z..SetIconStat|
0000fe30  65 25 20 20 20 20 20 20  3d 20 57 25 2b 31 33 0d  |e%      = W%+13.|
0000fe40  5a fa 1e 47 65 74 49 63  6f 6e 49 6e 66 6f 25 20  |Z..GetIconInfo% |
0000fe50  20 20 20 20 20 20 3d 20  57 25 2b 31 34 0d 5b 04  |      = W%+14.[.|
0000fe60  1e 47 65 74 50 6f 69 6e  74 65 72 49 6e 66 6f 25  |.GetPointerInfo%|
0000fe70  20 20 20 20 3d 20 57 25  2b 31 35 0d 5b 0e 1d 44  |    = W%+15.[..D|
0000fe80  72 61 67 42 6f 78 20 20  20 20 20 20 20 20 20 20  |ragBox          |
0000fe90  20 3d 20 57 25 2b 31 36  0d 5b 18 1d 46 6f 72 63  | = W%+16.[..Forc|
0000fea0  65 52 65 64 72 61 77 20  20 20 20 20 20 20 3d 20  |eRedraw       = |
0000feb0  57 25 2b 31 37 0d 5b 22  1d 43 72 65 61 74 65 4d  |W%+17.[".CreateM|
0000fec0  65 6e 75 20 20 20 20 20  20 20 20 3d 20 57 25 2b  |enu        = W%+|
0000fed0  32 30 0d 5b 2c 1d 44 65  63 6f 64 65 4d 65 6e 75  |20.[,.DecodeMenu|
0000fee0  20 20 20 20 20 20 20 20  3d 20 57 25 2b 32 31 0d  |        = W%+21.|
0000fef0  5b 36 1d 53 65 74 45 78  74 65 6e 74 20 20 20 20  |[6.SetExtent    |
0000ff00  20 20 20 20 20 3d 20 57  25 2b 32 33 0d 5b 40 1d  |     = W%+23.[@.|
0000ff10  4f 70 65 6e 54 65 6d 70  6c 61 74 65 20 20 20 20  |OpenTemplate    |
0000ff20  20 20 3d 20 57 25 2b 32  35 0d 5b 4a 1d 43 6c 6f  |  = W%+25.[J.Clo|
0000ff30  73 65 54 65 6d 70 6c 61  74 65 20 20 20 20 20 3d  |seTemplate     =|
0000ff40  20 57 25 2b 32 36 0d 5b  54 1d 4c 6f 61 64 54 65  | W%+26.[T.LoadTe|
0000ff50  6d 70 6c 61 74 65 20 20  20 20 20 20 3d 20 57 25  |mplate      = W%|
0000ff60  2b 32 37 0d 5b 5e 1d 43  6c 6f 73 65 44 6f 77 6e  |+27.[^.CloseDown|
0000ff70  20 20 20 20 20 20 20 20  20 3d 20 57 25 2b 32 39  |         = W%+29|
0000ff80  0d 5b 68 42 c8 99 20 22  4f 53 5f 53 57 49 4e 75  |.[hB.. "OS_SWINu|
0000ff90  6d 62 65 72 46 72 6f 6d  53 74 72 69 6e 67 22 2c  |mberFromString",|
0000ffa0  30 2c 22 57 69 6d 70 5f  53 65 6e 64 4d 65 73 73  |0,"Wimp_SendMess|
0000ffb0  61 67 65 22 20 b8 20 53  65 6e 64 4d 65 73 73 61  |age" . SendMessa|
0000ffc0  67 65 0d 5b 72 4c c8 99  20 22 4f 53 5f 53 57 49  |ge.[rL.. "OS_SWI|
0000ffd0  4e 75 6d 62 65 72 46 72  6f 6d 53 74 72 69 6e 67  |NumberFromString|
0000ffe0  22 2c 30 2c 22 57 69 6d  70 5f 47 65 74 57 69 6e  |",0,"Wimp_GetWin|
0000fff0  64 6f 77 4f 75 74 6c 69  6e 65 22 20 b8 20 47 65  |dowOutline" . Ge|
00010000  74 57 69 6e 64 6f 77 4f  75 74 6c 69 6e 65 0d 5b  |tWindowOutline.[|
00010010  7c 3e c8 99 20 22 4f 53  5f 53 57 49 4e 75 6d 62  ||>.. "OS_SWINumb|
00010020  65 72 46 72 6f 6d 53 74  72 69 6e 67 22 2c 30 2c  |erFromString",0,|
00010030  22 57 69 6d 70 5f 53 65  74 43 6f 6c 6f 75 72 22  |"Wimp_SetColour"|
00010040  20 b8 20 53 65 74 43 6f  6c 6f 75 72 0d 5b 86 04  | . SetColour.[..|
00010050  0d 5b 90 0e ea 20 53 30  2c 53 31 2c 53 32 0d 5b  |.[... S0,S1,S2.[|
00010060  9a 38 c8 99 20 22 4f 53  5f 53 57 49 4e 75 6d 62  |.8.. "OS_SWINumb|
00010070  65 72 46 72 6f 6d 53 74  72 69 6e 67 22 2c 30 2c  |erFromString",0,|
00010080  22 53 6f 75 6e 64 5f 43  6f 6e 66 69 67 75 72 65  |"Sound_Configure|
00010090  22 20 b8 20 53 30 0d 5b  a4 38 c8 99 20 22 4f 53  |" . S0.[.8.. "OS|
000100a0  5f 53 57 49 4e 75 6d 62  65 72 46 72 6f 6d 53 74  |_SWINumberFromSt|
000100b0  72 69 6e 67 22 2c 30 2c  22 53 6f 75 6e 64 5f 56  |ring",0,"Sound_V|
000100c0  6f 6c 75 6d 65 22 20 20  20 20 b8 20 53 31 0d 5b  |olume"    . S1.[|
000100d0  ae 38 c8 99 20 22 4f 53  5f 53 57 49 4e 75 6d 62  |.8.. "OS_SWINumb|
000100e0  65 72 46 72 6f 6d 53 74  72 69 6e 67 22 2c 30 2c  |erFromString",0,|
000100f0  22 53 6f 75 6e 64 5f 51  49 6e 69 74 22 20 20 20  |"Sound_QInit"   |
00010100  20 20 b8 20 53 32 0d 5b  b8 1e 53 6f 75 6e 64 5f  |  . S2.[..Sound_|
00010110  43 6f 6e 66 69 67 75 72  65 20 20 20 20 20 20 20  |Configure       |
00010120  3d 20 53 30 0d 5b c2 20  53 6f 75 6e 64 5f 45 6e  |= S0.[. Sound_En|
00010130  61 62 6c 65 20 20 20 20  20 20 20 20 20 20 3d 20  |able          = |
00010140  53 30 2b 31 0d 5b cc 20  53 6f 75 6e 64 5f 53 74  |S0+1.[. Sound_St|
00010150  65 72 65 6f 20 20 20 20  20 20 20 20 20 20 3d 20  |ereo          = |
00010160  53 30 2b 32 0d 5b d6 1e  53 6f 75 6e 64 5f 56 6f  |S0+2.[..Sound_Vo|
00010170  6c 75 6d 65 20 20 20 20  20 20 20 20 20 20 3d 20  |lume          = |
00010180  53 31 0d 5b e0 20 53 6f  75 6e 64 5f 49 6e 73 74  |S1.[. Sound_Inst|
00010190  61 6c 6c 56 6f 69 63 65  20 20 20 20 3d 20 53 31  |allVoice    = S1|
000101a0  2b 33 0d 5b ea 20 53 6f  75 6e 64 5f 41 74 74 61  |+3.[. Sound_Atta|
000101b0  63 68 56 6f 69 63 65 20  20 20 20 20 3d 20 53 31  |chVoice     = S1|
000101c0  2b 35 0d 5b f4 20 53 6f  75 6e 64 5f 43 6f 6e 74  |+5.[. Sound_Cont|
000101d0  72 6f 6c 20 20 20 20 20  20 20 20 20 3d 20 53 31  |rol         = S1|
000101e0  2b 39 0d 5b fe 1e 53 6f  75 6e 64 5f 51 49 6e 69  |+9.[..Sound_QIni|
000101f0  74 20 20 20 20 20 20 20  20 20 20 20 3d 20 53 32  |t           = S2|
00010200  0d 5c 08 20 53 6f 75 6e  64 5f 51 53 63 68 65 64  |.\. Sound_QSched|
00010210  75 6c 65 20 20 20 20 20  20 20 3d 20 53 32 2b 31  |ule       = S2+1|
00010220  0d 5c 12 20 53 6f 75 6e  64 5f 51 52 65 6d 6f 76  |.\. Sound_QRemov|
00010230  65 20 20 20 20 20 20 20  20 20 3d 20 53 32 2b 32  |e         = S2+2|
00010240  0d 5c 1c 20 53 6f 75 6e  64 5f 51 46 72 65 65 20  |.\. Sound_QFree |
00010250  20 20 20 20 20 20 20 20  20 20 3d 20 53 32 2b 33  |          = S2+3|
00010260  0d 5c 26 20 53 6f 75 6e  64 5f 51 54 65 6d 70 6f  |.\& Sound_QTempo|
00010270  20 20 20 20 20 20 20 20  20 20 3d 20 53 32 2b 35  |          = S2+5|
00010280  0d 5c 30 20 53 6f 75 6e  64 5f 51 42 65 61 74 20  |.\0 Sound_QBeat |
00010290  20 20 20 20 20 20 20 20  20 20 3d 20 53 32 2b 36  |          = S2+6|
000102a0  0d 5c 3a 11 53 63 68 25  3d 26 46 30 30 30 30 30  |.\:.Sch%=&F00000|
000102b0  30 0d 5c 44 08 ea 20 4d  25 0d 5c 4e 07 ea 20 85  |0.\D.. M%.\N.. .|
000102c0  0d 5c 58 1c ee 20 85 20  ea 20 4d 49 44 49 70 72  |.\X.. . . MIDIpr|
000102d0  65 73 65 6e 74 25 3d a3  20 3a 20 e1 0d 5c 62 39  |esent%=. : ..\b9|
000102e0  c8 99 20 22 4f 53 5f 53  57 49 4e 75 6d 62 65 72  |.. "OS_SWINumber|
000102f0  46 72 6f 6d 53 74 72 69  6e 67 22 2c 30 2c 22 4d  |FromString",0,"M|
00010300  49 44 49 5f 53 6f 75 6e  64 45 6e 61 62 6c 65 22  |IDI_SoundEnable"|
00010310  20 b8 20 4d 25 0d 5c 6c  14 4d 5f 4e 6f 74 65 4f  | . M%.\l.M_NoteO|
00010320  66 66 25 20 3d 20 26 38  30 0d 5c 76 14 4d 5f 4e  |ff% = &80.\v.M_N|
00010330  6f 74 65 4f 6e 25 20 20  3d 20 26 39 30 0d 5c 80  |oteOn%  = &90.\.|
00010340  21 4d 49 44 49 5f 53 6f  75 6e 64 45 6e 61 62 6c  |!MIDI_SoundEnabl|
00010350  65 25 20 20 20 20 20 20  20 20 3d 20 4d 25 0d 5c  |e%        = M%.\|
00010360  8a 25 4d 49 44 49 5f 53  65 74 54 78 43 68 61 6e  |.%MIDI_SetTxChan|
00010370  6e 65 6c 25 20 20 20 20  20 20 20 3d 20 4d 25 20  |nel%       = M% |
00010380  2b 20 32 0d 5c 94 25 4d  49 44 49 5f 53 65 74 54  |+ 2.\.%MIDI_SetT|
00010390  78 41 63 74 69 76 65 53  65 6e 73 69 6e 67 25 20  |xActiveSensing% |
000103a0  3d 20 4d 25 20 2b 20 33  0d 5c 9e 26 4d 49 44 49  |= M% + 3.\.&MIDI|
000103b0  5f 54 78 43 6f 6d 6d 61  6e 64 25 20 20 20 20 20  |_TxCommand%     |
000103c0  20 20 20 20 20 3d 20 4d  25 20 2b 20 31 30 0d 5c  |     = M% + 10.\|
000103d0  a8 26 4d 49 44 49 5f 54  78 4c 6f 63 61 6c 43 6f  |.&MIDI_TxLocalCo|
000103e0  6e 74 72 6f 6c 25 20 20  20 20 20 3d 20 4d 25 20  |ntrol%     = M% |
000103f0  2b 20 31 35 0d 5c b2 26  4d 49 44 49 5f 54 78 4f  |+ 15.\.&MIDI_TxO|
00010400  6d 6e 69 4d 6f 64 65 4f  66 66 25 20 20 20 20 20  |mniModeOff%     |
00010410  20 3d 20 4d 25 20 2b 20  31 37 0d 5c bc 26 4d 49  | = M% + 17.\.&MI|
00010420  44 49 5f 54 78 4f 6d 6e  69 4d 6f 64 65 4f 6e 25  |DI_TxOmniModeOn%|
00010430  20 20 20 20 20 20 20 3d  20 4d 25 20 2b 20 31 38  |       = M% + 18|
00010440  0d 5c c6 26 4d 49 44 49  5f 54 78 4d 6f 6e 6f 4d  |.\.&MIDI_TxMonoM|
00010450  6f 64 65 4f 6e 25 20 20  20 20 20 20 20 3d 20 4d  |odeOn%       = M|
00010460  25 20 2b 20 31 39 0d 5c  d0 26 4d 49 44 49 5f 54  |% + 19.\.&MIDI_T|
00010470  78 50 6f 6c 79 4d 6f 64  65 4f 6e 25 20 20 20 20  |xPolyModeOn%    |
00010480  20 20 20 3d 20 4d 25 20  2b 20 32 30 0d 5c da 26  |   = M% + 20.\.&|
00010490  4d 49 44 49 5f 54 78 50  72 6f 67 72 61 6d 43 68  |MIDI_TxProgramCh|
000104a0  61 6e 67 65 25 20 20 20  20 3d 20 4d 25 20 2b 20  |ange%    = M% + |
000104b0  32 31 0d 5c e4 26 4d 49  44 49 5f 54 78 53 79 73  |21.\.&MIDI_TxSys|
000104c0  74 65 6d 52 65 73 65 74  25 20 20 20 20 20 20 3d  |temReset%      =|
000104d0  20 4d 25 20 2b 20 33 30  0d 5c ee 31 4d 49 44 49  | M% + 30.\.1MIDI|
000104e0  70 72 65 73 65 6e 74 25  3d b9 20 3a 20 f4 20 64  |present%=. : . d|
000104f0  69 73 61 62 6c 65 20 75  6e 74 65 73 74 65 64 20  |isable untested |
00010500  4d 49 44 49 20 62 69 74  73 0d 5c f8 05 e1 0d 5d  |MIDI bits.\....]|
00010510  02 04 0d 5d 0c 1c dd 20  f2 69 6e 69 74 69 61 6c  |...]... .initial|
00010520  69 73 65 5f 6d 69 73 63  65 6c 6c 61 6e 79 0d 5d  |ise_miscellany.]|
00010530  16 15 de 20 52 65 73 6f  75 72 63 65 64 69 72 20  |... Resourcedir |
00010540  32 35 35 0d 5d 20 09 ea  20 6c 65 6e 0d 5d 2a 45  |255.] .. len.]*E|
00010550  c8 99 20 22 4f 53 5f 52  65 61 64 56 61 72 56 61  |.. "OS_ReadVarVa|
00010560  6c 22 2c 20 22 4d 61 65  73 74 72 6f 24 64 69 72  |l", "Maestro$dir|
00010570  22 2c 20 52 65 73 6f 75  72 63 65 64 69 72 2c 20  |", Resourcedir, |
00010580  32 35 35 2c 20 30 2c 20  30 20 b8 20 2c 2c 6c 65  |255, 0, 0 . ,,le|
00010590  6e 0d 5d 34 34 52 65 73  6f 75 72 63 65 64 69 72  |n.]44Resourcedir|
000105a0  3f 6c 65 6e 3d 31 33 20  3a 20 f4 20 49 74 20 6e  |?len=13 : . It n|
000105b0  65 65 64 73 20 61 20 63  72 20 74 65 72 6d 69 6e  |eeds a cr termin|
000105c0  61 74 69 6f 6e 0d 5d 3e  1d 52 65 73 6f 75 72 63  |ation.]>.Resourc|
000105d0  65 64 69 72 24 3d 24 52  65 73 6f 75 72 63 65 64  |edir$=$Resourced|
000105e0  69 72 0d 5d 48 07 d1 3d  30 0d 5d 52 12 41 77 61  |ir.]H..=0.]R.Awa|
000105f0  69 74 69 6e 67 41 63 6b  25 3d a3 0d 5d 5c 0f 44  |itingAck%=..]\.D|
00010600  52 41 47 47 49 4e 47 25  3d a3 0d 5d 66 0d 53 41  |RAGGING%=..]f.SA|
00010610  56 49 4e 47 25 3d a3 0d  5d 70 0e 50 4c 41 59 49  |VING%=..]p.PLAYI|
00010620  4e 47 25 3d a3 0d 5d 7a  10 53 43 52 4f 4c 4c 49  |NG%=..]z.SCROLLI|
00010630  4e 47 25 3d a3 0d 5d 84  11 54 52 41 4e 53 43 52  |NG%=..]..TRANSCR|
00010640  49 42 45 25 3d b9 0d 5d  8e 17 de 20 53 74 72 69  |IBE%=..]... Stri|
00010650  6e 67 5f 53 70 61 63 65  25 20 32 35 36 0d 5d 98  |ng_Space% 256.].|
00010660  0e 4f 53 5f 46 69 6c 65  3d 26 38 0d 5d a2 23 53  |.OS_File=&8.].#S|
00010670  70 72 69 74 65 24 3d 52  65 73 6f 75 72 63 65 64  |prite$=Resourced|
00010680  69 72 24 2b 22 2e 53 70  72 69 74 65 73 22 0d 5d  |ir$+".Sprites".]|
00010690  ac 0e 43 48 41 4e 47 45  44 25 3d a3 0d 5d b6 0b  |..CHANGED%=..]..|
000106a0  46 49 4c 45 25 3d a3 0d  5d c0 0c 6c 61 64 64 72  |FILE%=..]..laddr|
000106b0  25 3d 30 0d 5d ca 0c 65  61 64 64 72 25 3d 30 0d  |%=0.]..eaddr%=0.|
000106c0  5d d4 05 e1 0d 5d de 04  0d 5d e8 18 dd 20 f2 69  |]....]...]... .i|
000106d0  6e 69 74 69 61 6c 69 73  65 5f 73 63 72 65 65 6e  |nitialise_screen|
000106e0  0d 5d f2 15 de 20 6d 6f  64 65 62 6c 6f 63 6b 69  |.]... modeblocki|
000106f0  6e 20 20 34 30 0d 5d fc  15 de 20 6d 6f 64 65 62  |n  40.]... modeb|
00010700  6c 6f 63 6b 6f 75 74 20  34 30 0d 5e 06 13 f2 67  |lockout 40.^...g|
00010710  65 74 6d 6f 64 65 69 6e  66 6f 28 b9 29 0d 5e 10  |etmodeinfo(.).^.|
00010720  10 f2 73 65 74 5f 63 6f  6c 6f 75 72 73 0d 5e 1a  |..set_colours.^.|
00010730  05 e1 0d 5e 24 04 0d 5e  2e 12 dd 20 f2 73 65 74  |...^$..^... .set|
00010740  5f 63 6f 6c 6f 75 72 73  0d 5e 38 07 ea 43 25 0d  |_colours.^8..C%.|
00010750  5e 42 31 f4 20 63 6f 6c  6f 75 72 73 20 64 65 66  |^B1. colours def|
00010760  69 6e 65 64 20 69 6e 20  6d 65 6d 6f 20 66 72 6f  |ined in memo fro|
00010770  6d 20 57 53 74 6f 79 65  20 32 31 2f 37 2f 38 38  |m WStoye 21/7/88|
00010780  0d 5e 4c 15 43 5f 4d 65  6e 75 54 69 74 6c 65 66  |.^L.C_MenuTitlef|
00010790  67 20 3d 20 37 0d 5e 56  15 43 5f 4d 65 6e 75 54  |g = 7.^V.C_MenuT|
000107a0  69 74 6c 65 62 67 20 3d  20 32 0d 5e 60 10 43 5f  |itlebg = 2.^`.C_|
000107b0  4d 65 6e 75 66 67 20 3d  20 37 0d 5e 6a 10 43 5f  |Menufg = 7.^j.C_|
000107c0  4d 65 6e 75 62 67 20 3d  20 30 0d 5e 74 14 43 5f  |Menubg = 0.^t.C_|
000107d0  4d 65 6e 75 49 74 65 6d  66 67 20 3d 20 37 0d 5e  |MenuItemfg = 7.^|
000107e0  7e 14 43 5f 4d 65 6e 75  49 74 65 6d 62 67 20 3d  |~.C_MenuItembg =|
000107f0  20 30 0d 5e 88 05 e1 0d  5e 92 04 0d 5e 9c 17 dd  | 0.^....^...^...|
00010800  20 f2 67 65 74 6d 6f 64  65 69 6e 66 6f 28 6e 65  | .getmodeinfo(ne|
00010810  77 29 0d 5e a6 19 ea 20  53 5f 52 6f 77 73 25 2c  |w).^... S_Rows%,|
00010820  20 53 5f 43 6f 6c 75 6d  6e 73 25 0d 5e b0 21 6d  | S_Columns%.^.!m|
00010830  6f 64 65 62 6c 6f 63 6b  69 6e 21 30 3d 30 20 3a  |odeblockin!0=0 :|
00010840  20 f4 20 4d 6f 64 65 46  6c 61 67 73 0d 5e ba 1f  | . ModeFlags.^..|
00010850  6d 6f 64 65 62 6c 6f 63  6b 69 6e 21 34 3d 31 20  |modeblockin!4=1 |
00010860  3a 20 f4 20 53 63 72 52  43 6f 6c 0d 5e c4 1f 6d  |: . ScrRCol.^..m|
00010870  6f 64 65 62 6c 6f 63 6b  69 6e 21 38 3d 32 20 3a  |odeblockin!8=2 :|
00010880  20 f4 20 53 63 72 42 43  6f 6c 0d 5e ce 20 6d 6f  | . ScrBCol.^. mo|
00010890  64 65 62 6c 6f 63 6b 69  6e 21 31 32 3d 33 20 3a  |deblockin!12=3 :|
000108a0  20 f4 20 4e 43 6f 6c 6f  75 72 0d 5e d8 23 6d 6f  | . NColour.^.#mo|
000108b0  64 65 62 6c 6f 63 6b 69  6e 21 31 36 3d 34 20 3a  |deblockin!16=4 :|
000108c0  20 f4 20 58 45 69 67 46  61 63 74 6f 72 0d 5e e2  | . XEigFactor.^.|
000108d0  23 6d 6f 64 65 62 6c 6f  63 6b 69 6e 21 32 30 3d  |#modeblockin!20=|
000108e0  35 20 3a 20 f4 20 59 45  69 67 46 61 63 74 6f 72  |5 : . YEigFactor|
000108f0  0d 5e ec 24 6d 6f 64 65  62 6c 6f 63 6b 69 6e 21  |.^.$modeblockin!|
00010900  32 34 3d 31 31 20 3a 20  f4 20 58 57 69 6e 64 4c  |24=11 : . XWindL|
00010910  69 6d 69 74 0d 5e f6 24  6d 6f 64 65 62 6c 6f 63  |imit.^.$modebloc|
00010920  6b 69 6e 21 32 38 3d 31  32 20 3a 20 f4 20 59 57  |kin!28=12 : . YW|
00010930  69 6e 64 4c 69 6d 69 74  0d 5f 00 28 6d 6f 64 65  |indLimit._.(mode|
00010940  62 6c 6f 63 6b 69 6e 21  33 32 3d 2d 31 20 3a 20  |blockin!32=-1 : |
00010950  f4 20 74 65 72 6d 69 6e  61 74 65 20 6c 69 73 74  |. terminate list|
00010960  0d 5f 0a 36 c8 99 20 22  4f 53 5f 52 65 61 64 56  |._.6.. "OS_ReadV|
00010970  64 75 56 61 72 69 61 62  6c 65 73 22 2c 6d 6f 64  |duVariables",mod|
00010980  65 62 6c 6f 63 6b 69 6e  2c 20 6d 6f 64 65 62 6c  |eblockin, modebl|
00010990  6f 63 6b 6f 75 74 0d 5f  14 51 42 41 44 4d 4f 44  |ockout._.QBADMOD|
000109a0  45 25 20 3d 20 a3 20 3a  20 f4 20 28 28 6d 6f 64  |E% = . : . ((mod|
000109b0  65 62 6c 6f 63 6b 6f 75  74 21 31 32 29 3e 31 35  |eblockout!12)>15|
000109c0  29 20 3a 52 45 4d 20 64  6f 65 73 6e 27 74 20 77  |) :REM doesn't w|
000109d0  6f 72 6b 20 69 6e 20 32  35 36 2d 63 6f 6c 6f 75  |ork in 256-colou|
000109e0  72 20 6d 6f 64 65 73 0d  5f 1e 40 f4 20 6e 6f 20  |r modes._.@. no |
000109f0  70 6f 69 6e 74 20 69 6e  20 72 65 61 64 69 6e 67  |point in reading|
00010a00  20 73 69 7a 65 73 20 73  69 6e 63 65 20 74 68 65  | sizes since the|
00010a10  79 20 61 72 65 20 66 69  78 65 64 20 62 79 20 74  |y are fixed by t|
00010a20  68 65 20 77 69 6d 70 0d  5f 28 1c 48 69 25 3d 31  |he wimp._(.Hi%=1|
00010a30  3c 3c 28 6d 6f 64 65 62  6c 6f 63 6b 6f 75 74 21  |<<(modeblockout!|
00010a40  31 36 29 0d 5f 32 1c 56  69 25 3d 31 3c 3c 28 6d  |16)._2.Vi%=1<<(m|
00010a50  6f 64 65 62 6c 6f 63 6b  6f 75 74 21 32 30 29 0d  |odeblockout!20).|
00010a60  5f 3c 28 53 5f 57 69 64  74 68 25 3d 48 69 25 20  |_<(S_Width%=Hi% |
00010a70  2a 20 28 28 6d 6f 64 65  62 6c 6f 63 6b 6f 75 74  |* ((modeblockout|
00010a80  21 32 34 29 2b 31 29 0d  5f 46 29 53 5f 48 65 69  |!24)+1)._F)S_Hei|
00010a90  67 68 74 25 3d 56 69 25  20 2a 20 28 28 6d 6f 64  |ght%=Vi% * ((mod|
00010aa0  65 62 6c 6f 63 6b 6f 75  74 21 32 38 29 2b 31 29  |eblockout!28)+1)|
00010ab0  0d 5f 50 10 48 69 25 3d  32 3a 20 56 69 25 3d 34  |._P.Hi%=2: Vi%=4|
00010ac0  0d 5f 5a 24 43 5f 57 69  64 74 68 25 3d 38 2a 48  |._Z$C_Width%=8*H|
00010ad0  69 25 20 3a 20 43 5f 48  65 69 67 68 74 25 3d 38  |i% : C_Height%=8|
00010ae0  2a 56 69 25 0d 5f 64 0d  e7 20 ac 20 6e 65 77 20  |*Vi%._d.. . new |
00010af0  8c 0d 5f 6e 51 20 20 e7  20 ac 20 42 41 44 4d 4f  |.._nQ  . . BADMO|
00010b00  44 45 25 20 c8 99 22 57  69 6d 70 5f 52 65 61 64  |DE% .."Wimp_Read|
00010b10  50 69 78 54 72 61 6e 73  22 2c 26 32 30 30 2c 53  |PixTrans",&200,S|
00010b20  70 72 42 6c 6b 25 2c 53  25 28 30 29 2c 2c 2c 2c  |prBlk%,S%(0),,,,|
00010b30  66 61 63 74 6f 72 73 25  2c 70 69 78 74 72 61 6e  |factors%,pixtran|
00010b40  73 25 0d 5f 78 07 20 20  cd 0d 5f 82 05 e1 0d 5f  |s%._x.  .._...._|
00010b50  8c 04 0d 5f 96 19 dd 20  f2 69 6e 69 74 69 61 6c  |..._... .initial|
00010b60  69 73 65 5f 73 70 72 69  74 65 73 0d 5f a0 11 de  |ise_sprites._...|
00010b70  20 66 61 63 74 6f 72 73  25 20 31 36 0d 5f aa 12  | factors% 16._..|
00010b80  de 20 70 69 78 74 72 61  6e 73 25 20 31 36 0d 5f  |. pixtrans% 16._|
00010b90  b4 6a c8 99 20 22 57 69  6d 70 5f 53 70 72 69 74  |.j.. "Wimp_Sprit|
00010ba0  65 4f 70 22 2c 20 31 31  2c 2c 52 65 73 6f 75 72  |eOp", 11,,Resour|
00010bb0  63 65 64 69 72 24 2b 22  2e 21 53 70 72 69 74 65  |cedir$+".!Sprite|
00010bc0  73 22 20 3a f4 20 6d 65  72 67 65 20 6d 75 73 69  |s" :. merge musi|
00010bd0  63 20 66 69 6c 65 20 74  79 70 65 20 73 70 72 69  |c file type spri|
00010be0  74 65 20 69 6e 74 6f 20  77 69 6d 70 20 73 70 72  |te into wimp spr|
00010bf0  69 74 65 20 61 72 65 61  0d 5f be 16 53 70 72 69  |ite area._..Spri|
00010c00  74 65 4c 65 6e 25 20 3d  20 31 30 30 30 30 0d 5f  |teLen% = 10000._|
00010c10  c8 18 de 20 53 70 72 42  6c 6b 25 20 53 70 72 69  |... SprBlk% Spri|
00010c20  74 65 4c 65 6e 25 0d 5f  d2 42 21 53 70 72 42 6c  |teLen%._.B!SprBl|
00010c30  6b 25 20 3d 20 53 70 72  69 74 65 4c 65 6e 25 20  |k% = SpriteLen% |
00010c40  20 20 20 20 20 20 20 3a  f4 20 69 6e 69 74 69 61  |       :. initia|
00010c50  6c 69 73 65 20 70 72 69  76 61 74 65 20 73 70 72  |lise private spr|
00010c60  69 74 65 20 61 72 65 61  0d 5f dc 11 53 70 72 42  |ite area._..SprB|
00010c70  6c 6b 25 21 34 20 3d 20  30 0d 5f e6 12 53 70 72  |lk%!4 = 0._..Spr|
00010c80  42 6c 6b 25 21 38 20 3d  20 31 36 0d 5f f0 13 53  |Blk%!8 = 16._..S|
00010c90  70 72 42 6c 6b 25 21 31  32 20 3d 20 31 36 0d 5f  |prBlk%!12 = 16._|
00010ca0  fa 3f c8 99 20 53 70 72  69 74 65 4f 70 25 2c 20  |.?.. SpriteOp%, |
00010cb0  35 31 32 2b 31 30 2c 20  53 70 72 42 6c 6b 25 2c  |512+10, SprBlk%,|
00010cc0  20 53 70 72 69 74 65 24  20 3a f4 20 2a 53 4c 4f  | Sprite$ :. *SLO|
00010cd0  41 44 20 65 71 75 69 76  61 6c 65 6e 74 0d 60 04  |AD equivalent.`.|
00010ce0  29 53 70 72 50 6c 6f 74  25 20 3d 20 26 32 33 34  |)SprPlot% = &234|
00010cf0  20 20 3a 20 f4 20 73 70  72 69 74 65 20 70 6c 6f  |  : . sprite plo|
00010d00  74 20 63 6f 64 65 0d 60  0e 17 ea 20 49 25 2c 4e  |t code.`... I%,N|
00010d10  25 2c 78 25 2c 79 25 2c  57 25 2c 48 25 0d 60 18  |%,x%,y%,W%,H%.`.|
00010d20  05 f7 0d 60 22 09 4e 25  3d 2d 31 0d 60 2c 07 f3  |...`".N%=-1.`,..|
00010d30  53 24 0d 60 36 0c c8 95  53 24 3c 3e 22 22 0d 60  |S$.`6...S$<>"".`|
00010d40  40 13 f3 78 25 2c 79 25  2c 57 25 2c 48 25 2c 53  |@..x%,y%,W%,H%,S|
00010d50  24 0d 60 4a 09 4e 25 2b  3d 31 0d 60 54 05 ce 0d  |$.`J.N%+=1.`T...|
00010d60  60 5e 2c e7 a4 61 73 73  65 72 74 28 4e 25 3e 3d  |`^,..assert(N%>=|
00010d70  30 2c 22 6c 6f 61 64 69  6e 67 20 73 70 72 69 74  |0,"loading sprit|
00010d80  65 20 64 61 74 61 2e 22  29 20 fa 0d 60 68 4d de  |e data.") ..`hM.|
00010d90  20 53 24 28 4e 25 29 2c  78 25 28 4e 25 29 2c 79  | S$(N%),x%(N%),y|
00010da0  25 28 4e 25 29 2c 58 25  28 4e 25 29 2c 59 25 28  |%(N%),X%(N%),Y%(|
00010db0  4e 25 29 2c 20 53 25 28  4e 25 29 20 3a 20 f4 20  |N%), S%(N%) : . |
00010dc0  53 25 28 29 20 61 72 65  20 73 70 72 69 74 65 20  |S%() are sprite |
00010dd0  70 6f 69 6e 74 65 72 73  0d 60 72 05 f7 0d 60 7c  |pointers.`r...`||
00010de0  0c e3 49 25 3d 30 b8 4e  25 0d 60 86 18 f3 20 53  |..I%=0.N%.`... S|
00010df0  24 28 49 25 29 2c 78 25  2c 79 25 2c 57 25 2c 48  |$(I%),x%,y%,W%,H|
00010e00  25 0d 60 90 4e c8 99 20  53 70 72 69 74 65 4f 70  |%.`.N.. SpriteOp|
00010e10  25 2c 20 32 35 36 2b 32  34 2c 20 53 70 72 42 6c  |%, 256+24, SprBl|
00010e20  6b 25 2c 20 53 24 28 49  25 29 20 b8 20 2c 2c 53  |k%, S$(I%) . ,,S|
00010e30  25 28 49 25 29 20 3a 20  f4 20 67 65 74 20 70 6f  |%(I%) : . get po|
00010e40  69 6e 74 65 72 20 74 6f  20 73 70 72 69 74 65 0d  |inter to sprite.|
00010e50  60 9a 11 78 25 28 49 25  29 3d 78 25 2a 48 69 25  |`..x%(I%)=x%*Hi%|
00010e60  0d 60 a4 11 79 25 28 49  25 29 3d 79 25 2a 56 69  |.`..y%(I%)=y%*Vi|
00010e70  25 0d 60 ae 16 58 25 28  49 25 29 3d 28 57 25 2d  |%.`..X%(I%)=(W%-|
00010e80  78 25 29 2a 48 69 25 0d  60 b8 16 59 25 28 49 25  |x%)*Hi%.`..Y%(I%|
00010e90  29 3d 28 48 25 2d 79 25  29 2a 56 69 25 0d 60 c2  |)=(H%-y%)*Vi%.`.|
00010ea0  05 ed 0d 60 cc 0b 6e 6f  74 65 25 3d 30 0d 60 d6  |...`..note%=0.`.|
00010eb0  0c 72 65 73 74 25 3d 31  36 0d 60 e0 12 61 63 63  |.rest%=16.`..acc|
00010ec0  69 64 65 6e 74 61 6c 25  3d 32 34 0d 60 ea 0c 63  |idental%=24.`..c|
00010ed0  6c 65 66 25 3d 33 32 0d  60 f4 0c 68 69 67 68 25  |lef%=32.`..high%|
00010ee0  3d 33 36 0d 60 fe 0b 64  6f 74 25 3d 34 34 0d 61  |=36.`..dot%=44.a|
00010ef0  08 0e 6c 65 64 67 65 72  25 3d 34 37 0d 61 12 0b  |..ledger%=47.a..|
00010f00  62 61 72 25 3d 34 38 0d  61 1c 0c 74 69 6d 65 25  |bar%=48.a..time%|
00010f10  3d 35 35 0d 61 26 0b 6b  65 79 25 3d 35 36 0d 61  |=55.a&.key%=56.a|
00010f20  30 0b 74 69 65 25 3d 35  37 0d 61 3a 0f 70 6f 69  |0.tie%=57.a:.poi|
00010f30  6e 74 65 72 25 3d 35 38  0d 61 44 4f de 20 53 4c  |nter%=58.aDO. SL|
00010f40  25 28 4e 25 2c 31 29 3a  f4 20 4c 69 73 74 20 26  |%(N%,1):. List &|
00010f50  20 69 74 65 6d 20 69 6e  64 65 78 65 73 20 66 6f  | item indexes fo|
00010f60  72 20 65 61 63 68 20 73  70 72 69 74 65 20 28 73  |r each sprite (s|
00010f70  65 74 20 69 6e 20 6c 69  73 74 20 64 65 66 69 6e  |et in list defin|
00010f80  69 74 69 6f 6e 73 29 0d  61 4e 4a 53 43 4f 52 49  |itions).aNJSCORI|
00010f90  4e 47 25 3d a3 3a f4 20  46 6c 61 67 20 69 6e 64  |NG%=.:. Flag ind|
00010fa0  69 63 61 74 69 6e 67 20  61 20 73 70 72 69 74 65  |icating a sprite|
00010fb0  20 69 73 20 74 6f 20 62  65 20 64 72 61 77 6e 20  | is to be drawn |
00010fc0  75 6e 64 65 72 20 74 68  65 20 70 6f 69 6e 74 65  |under the pointe|
00010fd0  72 0d 61 58 11 77 61 73  53 43 4f 52 49 4e 47 25  |r.aX.wasSCORING%|
00010fe0  3d a3 0d 61 62 12 73 74  6f 70 53 43 4f 52 49 4e  |=..ab.stopSCORIN|
00010ff0  47 25 3d b9 0d 61 6c 0e  53 43 4f 52 49 4e 47 25  |G%=..al.SCORING%|
00011000  3d a3 0d 61 76 33 de 20  53 43 52 49 42 45 25 28  |=..av3. SCRIBE%(|
00011010  31 38 29 3a f4 20 44 65  74 61 69 6c 73 20 6f 66  |18):. Details of|
00011020  20 73 79 6d 62 6f 6c 20  75 6e 64 65 72 20 70 6f  | symbol under po|
00011030  69 6e 74 65 72 0d 61 80  24 f4 20 30 2d 37 20 43  |inter.a.$. 0-7 C|
00011040  68 61 6e 6e 65 6c 20 70  6f 69 6e 74 65 72 73 20  |hannel pointers |
00011050  69 6e 74 6f 20 4e 25 28  29 0d 61 8a 25 73 78 25  |into N%().a.%sx%|
00011060  3d 38 3a f4 20 43 75 72  72 65 6e 74 20 73 70 72  |=8:. Current spr|
00011070  69 74 65 20 58 20 70 6f  73 69 74 69 6f 6e 0d 61  |ite X position.a|
00011080  94 25 73 79 25 3d 39 3a  f4 20 43 75 72 72 65 6e  |.%sy%=9:. Curren|
00011090  74 20 73 70 72 69 74 65  20 59 20 70 6f 73 69 74  |t sprite Y posit|
000110a0  69 6f 6e 0d 61 9e 2f 64  72 61 77 6e 25 3d 31 30  |ion.a./drawn%=10|
000110b0  3a f4 20 46 6c 61 67 20  69 6e 64 69 63 61 74 69  |:. Flag indicati|
000110c0  6e 67 20 73 70 72 69 74  65 20 70 72 65 73 65 6e  |ng sprite presen|
000110d0  63 65 0d 61 a8 1e 73 70  72 69 74 65 25 3d 31 31  |ce.a..sprite%=11|
000110e0  3a f4 20 53 70 72 69 74  65 20 6e 75 6d 62 65 72  |:. Sprite number|
000110f0  0d 61 b2 25 76 61 6c 69  64 25 3d 31 32 3a f4 20  |.a.%valid%=12:. |
00011100  56 61 6c 69 64 20 73 74  61 76 65 20 70 6f 73 69  |Valid stave posi|
00011110  74 69 6f 6e 73 0d 61 bc  2a 73 74 61 76 65 25 3d  |tions.a.*stave%=|
00011120  31 33 3a f4 20 43 75 72  72 65 6e 74 20 73 74 61  |13:. Current sta|
00011130  76 65 20 73 79 6d 62 6f  6c 20 69 73 20 6f 6e 0d  |ve symbol is on.|
00011140  61 c6 43 73 63 6c 65 66  25 3d 31 34 3a f4 20 43  |a.Csclef%=14:. C|
00011150  75 72 72 65 6e 74 20 63  6c 65 66 20 61 70 70 6c  |urrent clef appl|
00011160  79 69 6e 67 20 74 6f 20  73 79 6d 62 6f 6c 20 28  |ying to symbol (|
00011170  75 73 65 64 20 66 6f 72  20 6b 65 79 20 73 69 67  |used for key sig|
00011180  73 29 0d 61 d0 2e 6c 69  6e 65 25 3d 31 35 3a f4  |s).a..line%=15:.|
00011190  20 43 75 72 72 65 6e 74  20 73 74 61 76 65 20 6c  | Current stave l|
000111a0  69 6e 65 20 73 79 6d 62  6f 6c 20 69 73 20 6f 6e  |ine symbol is on|
000111b0  0d 61 da 1f 70 6f 73 78  25 3d 31 36 3a f4 20 58  |.a..posx%=16:. X|
000111c0  20 6d 75 73 69 63 20 70  6f 73 69 74 69 6f 6e 0d  | music position.|
000111d0  61 e4 21 73 67 70 25 3d  31 37 3a f4 20 53 79 6d  |a.!sgp%=17:. Sym|
000111e0  62 6f 6c 20 67 61 74 65  20 70 6f 69 6e 74 65 72  |bol gate pointer|
000111f0  0d 61 ee 3d 73 63 25 3d  31 38 3a f4 20 43 68 61  |.a.=sc%=18:. Cha|
00011200  6e 6e 65 6c 20 6e 75 6d  62 65 72 20 69 66 20 73  |nnel number if s|
00011210  79 6d 62 6f 6c 20 73 70  65 63 69 66 69 65 64 20  |ymbol specified |
00011220  63 6c 6f 73 65 20 74 6f  20 6e 6f 74 65 0d 61 f8  |close to note.a.|
00011230  13 f2 67 65 74 6d 6f 64  65 69 6e 66 6f 28 a3 29  |..getmodeinfo(.)|
00011240  0d 62 02 05 e1 0d 62 0c  16 f4 20 6e 61 6d 65 2c  |.b....b... name,|
00011250  20 78 2c 20 79 2c 20 77  2c 20 68 0d 62 16 70 dc  | x, y, w, h.b.p.|
00011260  20 42 2c 37 2c 33 2c 32  36 2c 37 2c 53 42 2c 30  | B,7,3,26,7,SB,0|
00011270  2c 32 2c 31 32 2c 35 2c  4d 75 2c 30 2c 32 2c 31  |,2,12,5,Mu,0,2,1|
00011280  31 2c 31 35 2c 43 75 2c  30 2c 32 2c 31 31 2c 31  |1,15,Cu,0,2,11,1|
00011290  35 2c 51 75 2c 30 2c 32  2c 31 37 2c 31 37 2c 53  |5,Qu,0,2,17,17,S|
000112a0  51 75 2c 30 2c 32 2c 31  37 2c 31 37 2c 44 53 51  |Qu,0,2,17,17,DSQ|
000112b0  75 2c 30 2c 32 2c 31 37  2c 31 37 2c 53 44 53 51  |u,0,2,17,17,SDSQ|
000112c0  75 2c 30 2c 32 2c 31 37  2c 31 37 0d 62 20 76 dc  |u,0,2,17,17.b v.|
000112d0  20 42 2c 37 2c 33 2c 32  36 2c 37 2c 53 42 2c 30  | B,7,3,26,7,SB,0|
000112e0  2c 32 2c 31 32 2c 35 2c  4d 64 2c 30 2c 31 32 2c  |,2,12,5,Md,0,12,|
000112f0  31 31 2c 31 35 2c 43 64  2c 30 2c 31 32 2c 31 31  |11,15,Cd,0,12,11|
00011300  2c 31 35 2c 51 64 2c 30  2c 31 34 2c 31 31 2c 31  |,15,Qd,0,14,11,1|
00011310  37 2c 53 51 64 2c 30 2c  31 34 2c 31 31 2c 31 37  |7,SQd,0,14,11,17|
00011320  2c 44 53 51 64 2c 30 2c  31 34 2c 31 31 2c 31 37  |,DSQd,0,14,11,17|
00011330  2c 53 44 53 51 64 2c 30  2c 31 34 2c 31 31 2c 31  |,SDSQd,0,14,11,1|
00011340  37 0d 62 2a 84 dc 20 52  65 73 74 2c 2d 31 2c 2d  |7.b*.. Rest,-1,-|
00011350  31 2c 38 2c 34 2c 52 65  73 74 2c 2d 31 2c 2d 32  |1,8,4,Rest,-1,-2|
00011360  2c 38 2c 34 2c 52 65 73  74 2c 2d 31 2c 30 2c 38  |,8,4,Rest,-1,0,8|
00011370  2c 34 2c 52 65 73 74 34  2c 2d 32 2c 35 2c 37 2c  |,4,Rest4,-2,5,7,|
00011380  31 32 2c 52 65 73 74 38  2c 2d 31 2c 34 2c 39 2c  |12,Rest8,-1,4,9,|
00011390  38 2c 52 65 73 74 31 36  2c 30 2c 38 2c 31 31 2c  |8,Rest16,0,8,11,|
000113a0  31 32 2c 52 65 73 74 33  32 2c 31 2c 38 2c 31 33  |12,Rest32,1,8,13|
000113b0  2c 31 36 2c 52 65 73 74  36 34 2c 32 2c 31 32 2c  |,16,Rest64,2,12,|
000113c0  31 35 2c 32 30 0d 62 34  82 dc 20 4d 2c 30 2c 32  |15,20.b4.. M,0,2|
000113d0  2c 31 31 2c 35 2c 4e 61  74 75 72 61 6c 2c 38 2c  |,11,5,Natural,8,|
000113e0  36 2c 37 2c 31 33 2c 53  68 61 72 70 2c 31 30 2c  |6,7,13,Sharp,10,|
000113f0  35 2c 39 2c 31 31 2c 46  6c 61 74 2c 38 2c 33 2c  |5,9,11,Flat,8,3,|
00011400  37 2c 31 32 2c 53 68 61  72 70 32 2c 39 2c 32 2c  |7,12,Sharp2,9,2,|
00011410  38 2c 35 2c 46 6c 61 74  32 2c 31 34 2c 33 2c 31  |8,5,Flat2,14,3,1|
00011420  33 2c 31 32 2c 4e 53 68  61 72 70 2c 31 37 2c 36  |3,12,NSharp,17,6|
00011430  2c 31 36 2c 31 33 2c 4e  46 6c 61 74 2c 31 35 2c  |,16,13,NFlat,15,|
00011440  36 2c 31 34 2c 31 35 0d  62 3e 44 dc 20 54 72 65  |6,14,15.b>D. Tre|
00011450  62 6c 65 2c 30 2c 31 36  2c 31 38 2c 33 31 2c 41  |ble,0,16,18,31,A|
00011460  6c 74 6f 2c 30 2c 38 2c  31 36 2c 31 39 2c 41 6c  |lto,0,8,16,19,Al|
00011470  74 6f 2c 30 2c 34 2c 31  36 2c 31 39 2c 42 61 73  |to,0,4,16,19,Bas|
00011480  73 2c 30 2c 37 2c 32 30  2c 31 37 0d 62 48 36 dc  |s,0,7,20,17.bH6.|
00011490  20 42 68 2c 37 2c 33 2c  32 36 2c 37 2c 53 42 68  | Bh,7,3,26,7,SBh|
000114a0  2c 30 2c 32 2c 31 32 2c  35 2c 4d 68 2c 30 2c 32  |,0,2,12,5,Mh,0,2|
000114b0  2c 31 31 2c 35 2c 43 68  2c 30 2c 32 2c 31 31 2c  |,11,5,Ch,0,2,11,|
000114c0  35 0d 62 52 52 dc 20 6c  64 67 35 2c 32 2c 32 38  |5.bRR. ldg5,2,28|
000114d0  2c 31 35 2c 31 37 2c 6c  64 67 34 2c 32 2c 32 34  |,15,17,ldg4,2,24|
000114e0  2c 31 35 2c 31 33 2c 6c  64 67 33 2c 32 2c 32 30  |,15,13,ldg3,2,20|
000114f0  2c 31 35 2c 39 2c 6c 64  67 32 2c 32 2c 31 36 2c  |,15,9,ldg2,2,16,|
00011500  31 35 2c 35 2c 6c 64 67  31 2c 32 2c 31 32 2c 31  |15,5,ldg1,2,12,1|
00011510  35 2c 31 0d 62 5c 4c dc  20 44 6f 74 31 2c 2d 31  |5,1.b\L. Dot1,-1|
00011520  32 2c 32 2c 33 2c 32 2c  44 6f 74 32 2c 2d 31 32  |2,2,3,2,Dot2,-12|
00011530  2c 32 2c 38 2c 32 2c 44  6f 74 33 2c 2d 31 32 2c  |,2,8,2,Dot3,-12,|
00011540  32 2c 31 33 2c 32 2c 42  61 72 2c 2d 31 2c 38 2c  |2,13,2,Bar,-1,8,|
00011550  32 2c 31 37 2c 43 2c 30  2c 32 2c 31 31 2c 35 0d  |2,17,C,0,2,11,5.|
00011560  62 66 57 dc 20 6c 64 67  31 2c 32 2c 2d 31 32 2c  |bfW. ldg1,2,-12,|
00011570  31 35 2c 31 2c 6c 64 67  32 2c 32 2c 2d 31 32 2c  |15,1,ldg2,2,-12,|
00011580  31 35 2c 35 2c 6c 64 67  33 2c 32 2c 2d 31 32 2c  |15,5,ldg3,2,-12,|
00011590  31 35 2c 39 2c 6c 64 67  34 2c 32 2c 2d 31 32 2c  |15,9,ldg4,2,-12,|
000115a0  31 35 2c 31 33 2c 6c 64  67 35 2c 32 2c 2d 31 32  |15,13,ldg5,2,-12|
000115b0  2c 31 35 2c 31 37 0d 62  70 35 dc 20 54 69 6d 65  |,15,17.bp5. Time|
000115c0  2c 31 2c 39 2c 32 35 2c  31 39 2c 4b 65 79 2c 30  |,1,9,25,19,Key,0|
000115d0  2c 31 33 2c 30 2c 33 30  2c 54 69 65 2c 2d 31 32  |,13,0,30,Tie,-12|
000115e0  2c 2d 33 2c 32 33 2c 33  2c 22 22 0d 62 7a 04 0d  |,-3,23,3,"".bz..|
000115f0  62 84 16 dd 20 f2 69 6e  69 74 69 61 6c 69 73 65  |b... .initialise|
00011600  5f 77 69 6d 70 0d 62 8e  1b f2 65 6e 75 6d 65 72  |_wimp.b...enumer|
00011610  61 74 65 5f 77 69 6d 70  5f 6f 66 66 73 65 74 73  |ate_wimp_offsets|
00011620  0d 62 98 36 74 61 73 6b  25 3d 97 28 22 54 22 29  |.b.6task%=.("T")|
00011630  2b 28 97 28 22 41 22 29  3c 3c 38 29 2b 28 97 28  |+(.("A")<<8)+(.(|
00011640  22 53 22 29 3c 3c 31 36  29 2b 28 97 28 22 4b 22  |"S")<<16)+(.("K"|
00011650  29 3c 3c 32 34 29 0d 62  a2 34 c8 99 20 49 6e 69  |)<<24).b.4.. Ini|
00011660  74 69 61 6c 69 73 65 25  2c 20 32 30 30 2c 20 74  |tialise%, 200, t|
00011670  61 73 6b 25 2c 20 22 4d  61 65 73 74 72 6f 22 20  |ask%, "Maestro" |
00011680  b8 20 2c 54 61 73 6b 5f  68 25 0d 62 ac 1d 4d 6f  |. ,Task_h%.b..Mo|
00011690  75 73 65 5f 58 25 3d 36  34 30 3a 4d 6f 75 73 65  |use_X%=640:Mouse|
000116a0  5f 59 25 3d 35 36 30 0d  62 b6 0c 50 54 49 4d 45  |_Y%=560.b..PTIME|
000116b0  25 3d 30 0d 62 c0 14 de  20 53 70 72 69 74 65 4e  |%=0.b... SpriteN|
000116c0  61 6d 65 25 20 31 34 0d  62 ca 1b 24 53 70 72 69  |ame% 14.b..$Spri|
000116d0  74 65 4e 61 6d 65 25 3d  22 21 4d 61 65 73 74 72  |teName%="!Maestr|
000116e0  6f 22 0d 62 d4 20 21 49  63 6f 6e 25 3d 2d 31 3a  |o".b. !Icon%=-1:|
000116f0  20 f4 20 69 63 6f 6e 62  61 72 20 75 74 69 6c 69  | . iconbar utili|
00011700  74 79 0d 62 de 0d 49 63  6f 6e 25 21 34 3d 30 0d  |ty.b..Icon%!4=0.|
00011710  62 e8 0d 49 63 6f 6e 25  21 38 3d 30 0d 62 f2 0f  |b..Icon%!8=0.b..|
00011720  49 63 6f 6e 25 21 31 32  3d 36 34 0d 62 fc 0f 49  |Icon%!12=64.b..I|
00011730  63 6f 6e 25 21 31 36 3d  36 38 0d 63 06 36 49 63  |con%!16=68.c.6Ic|
00011740  6f 6e 25 21 32 30 3d 28  26 33 31 31 41 20 84 20  |on%!20=(&311A . |
00011750  28 30 3c 3c 32 34 29 20  84 20 28 37 3c 3c 32 38  |(0<<24) . (7<<28|
00011760  29 29 20 3a f4 20 69 6e  64 69 72 65 63 74 65 64  |)) :. indirected|
00011770  0d 63 10 2b 49 63 6f 6e  25 21 32 34 3d 53 70 72  |.c.+Icon%!24=Spr|
00011780  69 74 65 4e 61 6d 65 25  20 3a f4 20 69 6e 64 69  |iteName% :. indi|
00011790  72 65 63 74 65 64 20 6e  61 6d 65 0d 63 1a 28 49  |rected name.c.(I|
000117a0  63 6f 6e 25 21 32 38 3d  31 20 3a f4 20 75 73 65  |con%!28=1 :. use|
000117b0  20 63 6f 6d 6d 6f 6e 20  73 70 72 69 74 65 20 61  | common sprite a|
000117c0  72 65 61 0d 63 24 1e 49  63 6f 6e 25 21 33 32 3d  |rea.c$.Icon%!32=|
000117d0  31 32 20 3a f4 20 6e 61  6d 65 20 6c 65 6e 67 74  |12 :. name lengt|
000117e0  68 0d 63 2e 27 c8 99 20  43 72 65 61 74 65 49 63  |h.c.'.. CreateIc|
000117f0  6f 6e 25 2c 20 2c 49 63  6f 6e 25 20 b8 20 4d 61  |on%, ,Icon% . Ma|
00011800  65 73 74 72 6f 5f 68 25  0d 63 38 13 f2 6c 6f 61  |estro_h%.c8..loa|
00011810  64 5f 74 65 6d 70 6c 61  74 65 73 0d 63 42 05 e1  |d_templates.cB..|
00011820  0d 63 4c 04 0d 63 56 1d  dd 20 f2 65 6e 75 6d 65  |.cL..cV.. .enume|
00011830  72 61 74 65 5f 77 69 6d  70 5f 6f 66 66 73 65 74  |rate_wimp_offset|
00011840  73 0d 63 60 17 de 20 57  69 6d 70 5f 53 70 61 63  |s.c`.. Wimp_Spac|
00011850  65 25 20 26 34 30 30 30  0d 63 6a 19 57 69 6e 64  |e% &4000.cj.Wind|
00011860  6f 77 25 3d 57 69 6d 70  5f 53 70 61 63 65 25 2b  |ow%=Wimp_Space%+|
00011870  34 0d 63 74 0e 68 61 6e  64 6c 65 25 3d 2d 34 0d  |4.ct.handle%=-4.|
00011880  63 7e 1c 78 30 25 3d 30  3a 79 30 25 3d 34 3a 78  |c~.x0%=0:y0%=4:x|
00011890  31 25 3d 38 3a 79 31 25  3d 31 32 0d 63 88 13 73  |1%=8:y1%=12.c..s|
000118a0  63 78 25 3d 31 36 3a 73  63 79 25 3d 32 30 0d 63  |cx%=16:scy%=20.c|
000118b0  92 0d 75 6e 64 65 72 25  3d 32 34 0d 63 9c 16 66  |..under%=24.c..f|
000118c0  6c 61 67 73 3d 32 38 3a  73 74 61 74 75 73 3d 33  |lags=28:status=3|
000118d0  30 0d 63 a6 25 74 46 72  67 64 3d 33 32 3a 74 42  |0.c.%tFrgd=32:tB|
000118e0  6b 67 64 3d 33 33 3a 46  72 67 64 3d 33 34 3a 42  |kgd=33:Frgd=34:B|
000118f0  6b 67 64 3d 33 35 0d 63  b0 11 73 62 6f 3d 33 36  |kgd=35.c..sbo=36|
00011900  3a 73 62 69 3d 33 37 0d  63 ba 0c 74 48 69 67 68  |:sbi=37.c..tHigh|
00011910  3d 33 38 0d 63 c4 12 74  69 74 6c 65 5f 66 6c 61  |=38.c..title_fla|
00011920  67 73 3d 35 36 0d 63 ce  16 77 6f 72 6b 5f 61 72  |gs=56.c..work_ar|
00011930  65 61 5f 66 6c 61 67 73  3d 36 30 0d 63 d8 12 73  |ea_flags=60.c..s|
00011940  70 72 69 74 65 5f 61 72  65 61 3d 36 34 0d 63 e2  |prite_area=64.c.|
00011950  0c 74 69 74 6c 65 3d 37  32 0d 63 ec 0c 69 63 6f  |.title=72.c..ico|
00011960  6e 73 3d 38 34 0d 63 f6  10 69 63 6f 6e 5f 64 65  |ns=84.c..icon_de|
00011970  66 73 3d 38 38 0d 64 00  17 49 63 6f 6e 25 3d 57  |fs=88.d..Icon%=W|
00011980  69 6d 70 5f 53 70 61 63  65 25 2b 34 0d 64 0a 0d  |imp_Space%+4.d..|
00011990  69 66 6c 61 67 73 3d 31  36 0d 64 14 0d 43 6f 6c  |iflags=16.d..Col|
000119a0  6f 75 72 3d 31 39 0d 64  1e 0c 69 64 61 74 61 3d  |our=19.d..idata=|
000119b0  32 30 0d 64 28 16 4d 6f  75 73 65 25 3d 57 69 6d  |20.d(.Mouse%=Wim|
000119c0  70 5f 53 70 61 63 65 25  0d 64 32 0d 62 75 74 74  |p_Space%.d2.butt|
000119d0  6f 6e 73 3d 38 0d 64 3c  0d 77 69 6e 64 6f 77 3d  |ons=8.d<.window=|
000119e0  31 32 0d 64 46 0b 69 63  6f 6e 3d 31 36 0d 64 50  |12.dF.icon=16.dP|
000119f0  12 6f 6c 64 5f 62 75 74  74 6f 6e 73 3d 32 30 0d  |.old_buttons=20.|
00011a00  64 5a 0d 63 6f 6c 6f 75  72 3d 32 33 0d 64 64 0b  |dZ.colour=23.dd.|
00011a10  73 74 61 74 65 3d 34 0d  64 6e 0a 6d 61 73 6b 3d  |state=4.dn.mask=|
00011a20  38 0d 64 78 14 43 6c 69  70 25 3d 57 69 6e 64 6f  |8.dx.Clip%=Windo|
00011a30  77 25 2b 32 34 0d 64 82  0a 6b 65 79 3d 32 30 0d  |w%+24.d..key=20.|
00011a40  64 8c 05 e1 0d 64 96 04  0d 64 a0 15 dd 20 f2 6c  |d....d...d... .l|
00011a50  6f 61 64 5f 74 65 6d 70  6c 61 74 65 73 0d 64 aa  |oad_templates.d.|
00011a60  0f ea 20 73 69 7a 65 2c  20 65 6e 64 0d 64 b4 13  |.. size, end.d..|
00011a70  de 20 77 69 6e 64 6f 77  6e 61 6d 65 20 31 32 0d  |. windowname 12.|
00011a80  64 be 13 de 20 53 63 6f  72 65 57 42 6c 6b 25 20  |d... ScoreWBlk% |
00011a90  33 32 0d 64 c8 12 de 20  4e 6f 74 65 50 42 6c 6b  |32.d... NotePBlk|
00011aa0  25 20 33 32 0d 64 d2 13  de 20 53 68 61 72 70 50  |% 32.d... SharpP|
00011ab0  42 6c 6b 25 20 33 32 0d  64 dc 12 de 20 52 65 73  |Blk% 32.d... Res|
00011ac0  74 50 42 6c 6b 25 20 33  32 0d 64 e6 15 de 20 53  |tPBlk% 32.d... S|
00011ad0  63 6f 72 65 54 69 74 6c  65 25 20 32 35 36 0d 64  |coreTitle% 256.d|
00011ae0  f0 0f 73 69 7a 65 20 3d  20 31 30 30 30 0d 64 fa  |..size = 1000.d.|
00011af0  15 64 69 61 6c 6f 67 73  69 7a 65 20 3d 20 33 30  |.dialogsize = 30|
00011b00  30 30 0d 65 04 4b de 20  49 6e 73 74 72 49 6e 64  |00.e.K. InstrInd|
00011b10  69 72 65 63 74 20 73 69  7a 65 20 3a 20 f4 20 62  |irect size : . b|
00011b20  75 66 66 65 72 20 66 6f  72 20 69 6e 64 69 72 65  |uffer for indire|
00011b30  63 74 65 64 20 74 65 78  74 20 6f 66 20 69 6e 73  |cted text of ins|
00011b40  74 72 75 6d 65 6e 74 73  20 6c 69 73 74 0d 65 0e  |truments list.e.|
00011b50  17 53 63 6f 72 65 57 42  6c 6b 25 2d 3d 68 61 6e  |.ScoreWBlk%-=han|
00011b60  64 6c 65 25 0d 65 18 4c  de 20 44 69 61 6c 6f 67  |dle%.e.L. Dialog|
00011b70  49 6e 64 69 72 65 63 74  20 64 69 61 6c 6f 67 73  |Indirect dialogs|
00011b80  69 7a 65 20 3a 20 f4 20  62 75 66 66 20 66 6f 72  |ize : . buff for|
00011b90  20 69 6e 64 69 72 65 63  74 65 64 20 74 65 78 74  | indirected text|
00011ba0  20 6f 66 20 64 69 61 6c  6f 67 20 62 6f 78 65 73  | of dialog boxes|
00011bb0  0d 65 22 16 4e 6f 74 65  50 42 6c 6b 25 2d 3d 68  |.e".NotePBlk%-=h|
00011bc0  61 6e 64 6c 65 25 0d 65  2c 17 53 68 61 72 70 50  |andle%.e,.SharpP|
00011bd0  42 6c 6b 25 2d 3d 68 61  6e 64 6c 65 25 0d 65 36  |Blk%-=handle%.e6|
00011be0  16 52 65 73 74 50 42 6c  6b 25 2d 3d 68 61 6e 64  |.RestPBlk%-=hand|
00011bf0  6c 65 25 0d 65 40 2f c8  99 20 4f 70 65 6e 54 65  |le%.e@/.. OpenTe|
00011c00  6d 70 6c 61 74 65 2c 20  2c 52 65 73 6f 75 72 63  |mplate, ,Resourc|
00011c10  65 64 69 72 24 2b 22 2e  54 65 6d 70 6c 61 74 65  |edir$+".Template|
00011c20  73 22 0d 65 4a 1b 24 77  69 6e 64 6f 77 6e 61 6d  |s".eJ.$windownam|
00011c30  65 3d 22 53 63 6f 72 65  57 69 6e 64 22 0d 65 54  |e="ScoreWind".eT|
00011c40  4f c8 99 20 4c 6f 61 64  54 65 6d 70 6c 61 74 65  |O.. LoadTemplate|
00011c50  2c 20 2c 57 69 6e 64 6f  77 25 2c 20 53 63 6f 72  |, ,Window%, Scor|
00011c60  65 54 69 74 6c 65 25 2c  20 53 63 6f 72 65 54 69  |eTitle%, ScoreTi|
00011c70  74 6c 65 25 2b 32 35 35  2c 20 2d 31 2c 20 24 77  |tle%+255, -1, $w|
00011c80  69 6e 64 6f 77 6e 61 6d  65 2c 20 30 0d 65 5e 55  |indowname, 0.e^U|
00011c90  57 69 6e 64 6f 77 25 21  36 38 3d 26 31 30 30 30  |Window%!68=&1000|
00011ca0  31 20 3a f4 20 72 65 73  65 72 76 65 64 20 77 6f  |1 :. reserved wo|
00011cb0  72 64 20 73 65 74 73 20  6d 69 6e 20 77 69 6e 64  |rd sets min wind|
00011cc0  6f 77 20 73 69 7a 65 2e  20 74 6f 20 6f 74 68 65  |ow size. to othe|
00011cd0  72 20 74 68 61 6e 20 74  69 74 6c 65 20 73 69 7a  |r than title siz|
00011ce0  65 0d 65 68 2d c8 99 20  43 72 65 61 74 65 57 69  |e.eh-.. CreateWi|
00011cf0  6e 64 6f 77 25 2c 20 2c  57 69 6e 64 6f 77 25 20  |ndow%, ,Window% |
00011d00  b8 20 53 63 6f 72 65 57  69 6e 64 5f 68 25 0d 65  |. ScoreWind_h%.e|
00011d10  72 23 53 63 6f 72 65 57  42 6c 6b 25 21 68 61 6e  |r#ScoreWBlk%!han|
00011d20  64 6c 65 25 3d 53 63 6f  72 65 57 69 6e 64 5f 68  |dle%=ScoreWind_h|
00011d30  25 0d 65 7c 38 c8 99 20  47 65 74 57 69 6e 64 6f  |%.e|8.. GetWindo|
00011d40  77 53 74 61 74 65 25 2c  20 53 63 6f 72 65 57 69  |wState%, ScoreWi|
00011d50  6e 64 5f 68 25 2c 20 53  63 6f 72 65 57 42 6c 6b  |nd_h%, ScoreWBlk|
00011d60  25 2b 68 61 6e 64 6c 65  25 0d 65 86 1c 24 77 69  |%+handle%.e..$wi|
00011d70  6e 64 6f 77 6e 61 6d 65  3d 22 53 68 61 72 70 73  |ndowname="Sharps|
00011d80  50 61 6e 65 22 0d 65 90  4d c8 99 20 4c 6f 61 64  |Pane".e.M.. Load|
00011d90  54 65 6d 70 6c 61 74 65  2c 20 2c 57 69 6e 64 6f  |Template, ,Windo|
00011da0  77 25 2c 20 57 69 6e 64  6f 77 25 2b 69 63 6f 6e  |w%, Window%+icon|
00011db0  73 2c 20 57 69 6e 64 6f  77 25 2b 32 30 30 2c 20  |s, Window%+200, |
00011dc0  2d 31 2c 20 24 77 69 6e  64 6f 77 6e 61 6d 65 2c  |-1, $windowname,|
00011dd0  20 30 0d 65 9a 31 57 69  6e 64 6f 77 25 21 36 34  | 0.e.1Window%!64|
00011de0  3d 53 70 72 42 6c 6b 25  20 3a f4 20 75 73 65 20  |=SprBlk% :. use |
00011df0  70 72 69 76 61 74 65 20  73 70 72 69 74 65 20 61  |private sprite a|
00011e00  72 65 61 0d 65 a4 2e c8  99 20 43 72 65 61 74 65  |rea.e.... Create|
00011e10  57 69 6e 64 6f 77 25 2c  2c 20 57 69 6e 64 6f 77  |Window%,, Window|
00011e20  25 20 b8 20 53 68 61 72  70 73 50 61 6e 65 5f 68  |% . SharpsPane_h|
00011e30  25 0d 65 ae 24 53 68 61  72 70 50 42 6c 6b 25 21  |%.e.$SharpPBlk%!|
00011e40  68 61 6e 64 6c 65 25 3d  53 68 61 72 70 73 50 61  |handle%=SharpsPa|
00011e50  6e 65 5f 68 25 0d 65 b8  2b c8 99 20 47 65 74 57  |ne_h%.e.+.. GetW|
00011e60  69 6e 64 6f 77 53 74 61  74 65 25 2c 2c 20 53 68  |indowState%,, Sh|
00011e70  61 72 70 50 42 6c 6b 25  2b 68 61 6e 64 6c 65 25  |arpPBlk%+handle%|
00011e80  0d 65 c2 18 53 68 61 72  70 50 42 6c 6b 25 21 75  |.e..SharpPBlk%!u|
00011e90  6e 64 65 72 25 3d 2d 31  0d 65 cc 1b 24 77 69 6e  |nder%=-1.e..$win|
00011ea0  64 6f 77 6e 61 6d 65 3d  22 52 65 73 74 73 50 61  |downame="RestsPa|
00011eb0  6e 65 22 0d 65 d6 4d c8  99 20 4c 6f 61 64 54 65  |ne".e.M.. LoadTe|
00011ec0  6d 70 6c 61 74 65 2c 20  2c 57 69 6e 64 6f 77 25  |mplate, ,Window%|
00011ed0  2c 20 57 69 6e 64 6f 77  25 2b 69 63 6f 6e 73 2c  |, Window%+icons,|
00011ee0  20 57 69 6e 64 6f 77 25  2b 32 30 30 2c 20 2d 31  | Window%+200, -1|
00011ef0  2c 20 24 77 69 6e 64 6f  77 6e 61 6d 65 2c 20 30  |, $windowname, 0|
00011f00  0d 65 e0 31 57 69 6e 64  6f 77 25 21 36 34 3d 53  |.e.1Window%!64=S|
00011f10  70 72 42 6c 6b 25 20 3a  f4 20 75 73 65 20 70 72  |prBlk% :. use pr|
00011f20  69 76 61 74 65 20 73 70  72 69 74 65 20 61 72 65  |ivate sprite are|
00011f30  61 0d 65 ea 2d c8 99 20  43 72 65 61 74 65 57 69  |a.e.-.. CreateWi|
00011f40  6e 64 6f 77 25 2c 20 2c  57 69 6e 64 6f 77 25 20  |ndow%, ,Window% |
00011f50  b8 20 52 65 73 74 73 50  61 6e 65 5f 68 25 0d 65  |. RestsPane_h%.e|
00011f60  f4 22 52 65 73 74 50 42  6c 6b 25 21 68 61 6e 64  |."RestPBlk%!hand|
00011f70  6c 65 25 3d 52 65 73 74  73 50 61 6e 65 5f 68 25  |le%=RestsPane_h%|
00011f80  0d 65 fe 2a c8 99 20 47  65 74 57 69 6e 64 6f 77  |.e.*.. GetWindow|
00011f90  53 74 61 74 65 25 2c 2c  20 52 65 73 74 50 42 6c  |State%,, RestPBl|
00011fa0  6b 25 2b 68 61 6e 64 6c  65 25 0d 66 08 22 52 65  |k%+handle%.f."Re|
00011fb0  73 74 50 42 6c 6b 25 21  75 6e 64 65 72 25 3d 53  |stPBlk%!under%=S|
00011fc0  68 61 72 70 73 50 61 6e  65 5f 68 25 0d 66 12 1b  |harpsPane_h%.f..|
00011fd0  24 77 69 6e 64 6f 77 6e  61 6d 65 3d 22 4e 6f 74  |$windowname="Not|
00011fe0  65 73 50 61 6e 65 22 0d  66 1c 4d c8 99 20 4c 6f  |esPane".f.M.. Lo|
00011ff0  61 64 54 65 6d 70 6c 61  74 65 2c 20 2c 57 69 6e  |adTemplate, ,Win|
00012000  64 6f 77 25 2c 20 57 69  6e 64 6f 77 25 2b 69 63  |dow%, Window%+ic|
00012010  6f 6e 73 2c 20 57 69 6e  64 6f 77 25 2b 32 30 30  |ons, Window%+200|
00012020  2c 20 2d 31 2c 20 24 77  69 6e 64 6f 77 6e 61 6d  |, -1, $windownam|
00012030  65 2c 20 30 0d 66 26 31  57 69 6e 64 6f 77 25 21  |e, 0.f&1Window%!|
00012040  36 34 3d 53 70 72 42 6c  6b 25 20 3a f4 20 75 73  |64=SprBlk% :. us|
00012050  65 20 70 72 69 76 61 74  65 20 73 70 72 69 74 65  |e private sprite|
00012060  20 61 72 65 61 0d 66 30  2d c8 99 20 43 72 65 61  | area.f0-.. Crea|
00012070  74 65 57 69 6e 64 6f 77  25 2c 20 2c 57 69 6e 64  |teWindow%, ,Wind|
00012080  6f 77 25 20 b8 20 4e 6f  74 65 73 50 61 6e 65 5f  |ow% . NotesPane_|
00012090  68 25 0d 66 3a 22 4e 6f  74 65 50 42 6c 6b 25 21  |h%.f:"NotePBlk%!|
000120a0  68 61 6e 64 6c 65 25 3d  4e 6f 74 65 73 50 61 6e  |handle%=NotesPan|
000120b0  65 5f 68 25 0d 66 44 2a  c8 99 20 47 65 74 57 69  |e_h%.fD*.. GetWi|
000120c0  6e 64 6f 77 53 74 61 74  65 25 2c 2c 20 4e 6f 74  |ndowState%,, Not|
000120d0  65 50 42 6c 6b 25 2b 68  61 6e 64 6c 65 25 0d 66  |ePBlk%+handle%.f|
000120e0  4e 21 4e 6f 74 65 50 42  6c 6b 25 21 75 6e 64 65  |N!NotePBlk%!unde|
000120f0  72 25 3d 52 65 73 74 73  50 61 6e 65 5f 68 25 0d  |r%=RestsPane_h%.|
00012100  66 58 27 50 61 6e 65 48  65 69 67 68 74 25 3d 57  |fX'PaneHeight%=W|
00012110  69 6e 64 6f 77 25 21 79  31 25 2d 57 69 6e 64 6f  |indow%!y1%-Windo|
00012120  77 25 21 79 30 25 0d 66  62 1e 53 65 6c 57 25 3d  |w%!y0%.fb.SelW%=|
00012130  4e 6f 74 65 73 50 61 6e  65 5f 68 25 3a 53 65 6c  |NotesPane_h%:Sel|
00012140  49 25 3d 30 0d 66 6c 1b  24 77 69 6e 64 6f 77 6e  |I%=0.fl.$windown|
00012150  61 6d 65 3d 22 49 6e 73  74 72 57 69 6e 64 22 0d  |ame="InstrWind".|
00012160  66 76 55 20 c8 99 20 4c  6f 61 64 54 65 6d 70 6c  |fvU .. LoadTempl|
00012170  61 74 65 2c 20 2c 57 69  6e 64 6f 77 25 2c 20 49  |ate, ,Window%, I|
00012180  6e 73 74 72 49 6e 64 69  72 65 63 74 2c 20 49 6e  |nstrIndirect, In|
00012190  73 74 72 49 6e 64 69 72  65 63 74 2b 73 69 7a 65  |strIndirect+size|
000121a0  2c 20 2d 31 2c 20 24 77  69 6e 64 6f 77 6e 61 6d  |, -1, $windownam|
000121b0  65 2c 20 30 0d 66 80 50  e7 20 ac 20 4d 49 44 49  |e, 0.f.P. . MIDI|
000121c0  70 72 65 73 65 6e 74 25  20 57 69 6e 64 6f 77 25  |present% Window%|
000121d0  21 38 2d 3d 31 30 30 3a  57 69 6e 64 6f 77 25 21  |!8-=100:Window%!|
000121e0  34 38 2d 3d 31 30 30 3a  f4 20 68 69 64 65 20 4d  |48-=100:. hide M|
000121f0  49 44 49 20 63 6f 6c 75  6d 6e 20 69 6e 20 77 69  |IDI column in wi|
00012200  6e 64 6f 77 0d 66 8a 2e  c8 99 20 43 72 65 61 74  |ndow.f.... Creat|
00012210  65 57 69 6e 64 6f 77 25  2c 20 2c 57 69 6e 64 6f  |eWindow%, ,Windo|
00012220  77 25 20 20 b8 20 49 6e  73 74 72 57 69 6e 64 5f  |w%  . InstrWind_|
00012230  68 25 0d 66 94 08 ea 20  6e 25 0d 66 9e 69 de 20  |h%.f... n%.f.i. |
00012240  53 74 61 76 65 53 74 72  25 28 37 29 2c 20 56 6f  |StaveStr%(7), Vo|
00012250  69 63 65 53 74 72 25 28  37 29 2c 20 56 6f 6c 75  |iceStr%(7), Volu|
00012260  6d 65 53 74 72 25 28 37  29 2c 20 53 74 65 72 65  |meStr%(7), Stere|
00012270  6f 53 74 72 25 28 37 29  2c 20 4d 49 44 49 43 68  |oStr%(7), MIDICh|
00012280  53 74 72 25 28 37 29 20  3a f4 20 70 6f 69 6e 74  |Str%(7) :. point|
00012290  65 72 73 20 74 6f 20 69  63 6f 6e 20 73 74 72 69  |ers to icon stri|
000122a0  6e 67 73 0d 66 a8 3d 56  6f 69 63 65 53 69 7a 65  |ngs.f.=VoiceSize|
000122b0  25 3d 32 30 20 3a 20 56  6f 6c 53 69 7a 65 25 3d  |%=20 : VolSize%=|
000122c0  34 20 3a 20 53 74 65 72  53 69 7a 65 25 3d 31 34  |4 : SterSize%=14|
000122d0  20 3a 20 4d 49 44 49 43  68 53 69 7a 65 25 3d 33  | : MIDIChSize%=3|
000122e0  0d 66 b2 0e e3 20 6e 25  3d 30 20 b8 20 37 0d 66  |.f... n%=0 . 7.f|
000122f0  bc 2c 20 20 53 74 61 76  65 53 74 72 25 28 6e 25  |.,  StaveStr%(n%|
00012300  29 20 20 3d 20 49 6e 73  74 72 49 6e 64 69 72 65  |)  = InstrIndire|
00012310  63 74 20 2b 20 6e 25 2a  31 34 0d 66 c6 07 20 20  |ct + n%*14.f..  |
00012320  ed 0d 66 d0 17 49 6e 73  74 72 49 6e 64 69 72 65  |..f..InstrIndire|
00012330  63 74 2b 3d 38 2a 31 34  0d 66 da 0e e3 20 6e 25  |ct+=8*14.f... n%|
00012340  3d 30 20 b8 20 37 0d 66  e4 34 20 20 56 6f 69 63  |=0 . 7.f.4  Voic|
00012350  65 53 74 72 25 28 6e 25  29 20 20 3d 20 49 6e 73  |eStr%(n%)  = Ins|
00012360  74 72 49 6e 64 69 72 65  63 74 20 2b 20 6e 25 2a  |trIndirect + n%*|
00012370  56 6f 69 63 65 53 69 7a  65 25 0d 66 ee 41 20 20  |VoiceSize%.f.A  |
00012380  56 6f 6c 75 6d 65 53 74  72 25 28 6e 25 29 20 3d  |VolumeStr%(n%) =|
00012390  20 49 6e 73 74 72 49 6e  64 69 72 65 63 74 20 2b  | InstrIndirect +|
000123a0  20 38 2a 56 6f 69 63 65  53 69 7a 65 25 20 2b 20  | 8*VoiceSize% + |
000123b0  6e 25 2a 56 6f 6c 53 69  7a 65 25 0d 66 f8 4f 20  |n%*VolSize%.f.O |
000123c0  20 53 74 65 72 65 6f 53  74 72 25 28 6e 25 29 20  | StereoStr%(n%) |
000123d0  3d 20 49 6e 73 74 72 49  6e 64 69 72 65 63 74 20  |= InstrIndirect |
000123e0  2b 20 38 2a 56 6f 69 63  65 53 69 7a 65 25 20 2b  |+ 8*VoiceSize% +|
000123f0  20 38 2a 56 6f 6c 53 69  7a 65 25 20 2b 20 6e 25  | 8*VolSize% + n%|
00012400  2a 53 74 65 72 53 69 7a  65 25 0d 67 02 5f 20 20  |*SterSize%.g._  |
00012410  4d 49 44 49 43 68 53 74  72 25 28 6e 25 29 20 3d  |MIDIChStr%(n%) =|
00012420  20 49 6e 73 74 72 49 6e  64 69 72 65 63 74 20 2b  | InstrIndirect +|
00012430  20 38 2a 56 6f 69 63 65  53 69 7a 65 25 20 2b 20  | 8*VoiceSize% + |
00012440  38 2a 56 6f 6c 53 69 7a  65 25 20 2b 20 20 38 2a  |8*VolSize% +  8*|
00012450  53 74 65 72 53 69 7a 65  25 20 2b 6e 25 2a 4d 49  |SterSize% +n%*MI|
00012460  44 49 43 68 53 69 7a 65  25 0d 67 0c 5c 20 20 e7  |DIChSize%.g.\  .|
00012470  20 ac 20 4d 49 44 49 70  72 65 73 65 6e 74 25 20  | . MIDIpresent% |
00012480  f2 55 70 64 61 74 65 49  63 6f 6e 28 49 6e 73 74  |.UpdateIcon(Inst|
00012490  72 57 69 6e 64 5f 68 25  2c 20 33 32 2b 6e 25 2c  |rWind_h%, 32+n%,|
000124a0  20 31 3c 3c 32 32 2c 20  30 29 20 3a f4 20 6d 61  | 1<<22, 0) :. ma|
000124b0  6b 65 20 69 63 6f 6e 73  20 75 6e 73 65 6c 65 63  |ke icons unselec|
000124c0  74 61 62 6c 65 0d 67 16  07 20 20 ed 0d 67 20 21  |table.g..  ..g !|
000124d0  65 6e 64 3d 44 69 61 6c  6f 67 49 6e 64 69 72 65  |end=DialogIndire|
000124e0  63 74 2b 64 69 61 6c 6f  67 73 69 7a 65 0d 67 2a  |ct+dialogsize.g*|
000124f0  1a 24 77 69 6e 64 6f 77  6e 61 6d 65 3d 22 70 72  |.$windowname="pr|
00012500  6f 67 49 6e 66 6f 22 0d  67 34 46 c8 99 20 4c 6f  |ogInfo".g4F.. Lo|
00012510  61 64 54 65 6d 70 6c 61  74 65 2c 20 2c 57 69 6e  |adTemplate, ,Win|
00012520  64 6f 77 25 2c 20 44 69  61 6c 6f 67 49 6e 64 69  |dow%, DialogIndi|
00012530  72 65 63 74 2c 20 65 6e  64 2c 20 2d 31 2c 20 24  |rect, end, -1, $|
00012540  77 69 6e 64 6f 77 6e 61  6d 65 2c 20 30 0d 67 3e  |windowname, 0.g>|
00012550  2d c8 99 20 43 72 65 61  74 65 57 69 6e 64 6f 77  |-.. CreateWindow|
00012560  25 2c 20 2c 57 69 6e 64  6f 77 25 20 20 b8 20 50  |%, ,Window%  . P|
00012570  72 6f 67 49 6e 66 6f 5f  68 25 0d 67 48 37 44 69  |rogInfo_h%.gH7Di|
00012580  61 6c 6f 67 49 6e 64 69  72 65 63 74 2b 3d 31 33  |alogIndirect+=13|
00012590  20 3a 20 f4 20 73 6b 69  70 20 69 6e 64 69 72 65  | : . skip indire|
000125a0  63 74 65 64 20 77 69 6e  64 6f 77 20 74 69 74 6c  |cted window titl|
000125b0  65 0d 67 52 3c 24 44 69  61 6c 6f 67 49 6e 64 69  |e.gR<$DialogIndi|
000125c0  72 65 63 74 20 3d 20 22  4d 61 65 73 74 72 6f 22  |rect = "Maestro"|
000125d0  20 20 20 20 20 20 20 20  20 3a 20 44 69 61 6c 6f  |         : Dialo|
000125e0  67 49 6e 64 69 72 65 63  74 2b 3d 34 30 0d 67 5c  |gIndirect+=40.g\|
000125f0  3c 24 44 69 61 6c 6f 67  49 6e 64 69 72 65 63 74  |<$DialogIndirect|
00012600  20 3d 20 22 4d 75 73 69  63 20 70 6c 61 79 65 72  | = "Music player|
00012610  22 20 20 20 20 3a 20 44  69 61 6c 6f 67 49 6e 64  |"    : DialogInd|
00012620  69 72 65 63 74 2b 3d 34  30 0d 67 66 3c 24 44 69  |irect+=40.gf<$Di|
00012630  61 6c 6f 67 49 6e 64 69  72 65 63 74 20 3d 20 22  |alogIndirect = "|
00012640  41 63 6f 72 6e 20 43 6f  6d 70 75 74 65 72 73 22  |Acorn Computers"|
00012650  20 3a 20 44 69 61 6c 6f  67 49 6e 64 69 72 65 63  | : DialogIndirec|
00012660  74 2b 3d 34 30 0d 67 70  3c 24 44 69 61 6c 6f 67  |t+=40.gp<$Dialog|
00012670  49 6e 64 69 72 65 63 74  20 3d 20 56 65 72 73 69  |Indirect = Versi|
00012680  6f 6e 53 74 72 24 20 20  20 20 20 20 20 3a 20 44  |onStr$       : D|
00012690  69 61 6c 6f 67 49 6e 64  69 72 65 63 74 2b 3d 33  |ialogIndirect+=3|
000126a0  30 0d 67 7a 17 24 77 69  6e 64 6f 77 6e 61 6d 65  |0.gz.$windowname|
000126b0  3d 22 71 75 65 72 79 22  0d 67 84 46 c8 99 20 4c  |="query".g.F.. L|
000126c0  6f 61 64 54 65 6d 70 6c  61 74 65 2c 20 2c 57 69  |oadTemplate, ,Wi|
000126d0  6e 64 6f 77 25 2c 20 44  69 61 6c 6f 67 49 6e 64  |ndow%, DialogInd|
000126e0  69 72 65 63 74 2c 20 65  6e 64 2c 20 2d 31 2c 20  |irect, end, -1, |
000126f0  24 77 69 6e 64 6f 77 6e  61 6d 65 2c 20 30 0d 67  |$windowname, 0.g|
00012700  8e 2f c8 99 20 43 72 65  61 74 65 57 69 6e 64 6f  |./.. CreateWindo|
00012710  77 25 2c 20 2c 57 69 6e  64 6f 77 25 20 20 b8 20  |w%, ,Window%  . |
00012720  41 62 6f 72 74 51 75 65  72 79 5f 68 25 0d 67 98  |AbortQuery_h%.g.|
00012730  31 44 69 61 6c 6f 67 49  6e 64 69 72 65 63 74 2b  |1DialogIndirect+|
00012740  3d 31 30 30 20 3a f4 20  22 6d 75 73 69 63 20 6e  |=100 :. "music n|
00012750  6f 74 20 73 61 76 65 64  20 65 74 63 2e 22 0d 67  |ot saved etc.".g|
00012760  a2 17 44 69 61 6c 6f 67  49 6e 64 69 72 65 63 74  |..DialogIndirect|
00012770  2b 3d 31 30 30 0d 67 ac  18 de 20 46 69 6c 65 53  |+=100.g... FileS|
00012780  70 72 69 74 65 4e 61 6d  65 25 20 31 36 0d 67 b6  |priteName% 16.g.|
00012790  2d 24 46 69 6c 65 53 70  72 69 74 65 4e 61 6d 65  |-$FileSpriteName|
000127a0  25 3d 22 66 69 6c 65 5f  22 2b c3 7e 4d 75 73 69  |%="file_"+.~Musi|
000127b0  63 46 69 6c 65 54 79 70  65 25 0d 67 c0 1b 24 77  |cFileType%.g..$w|
000127c0  69 6e 64 6f 77 6e 61 6d  65 3d 22 78 66 65 72 5f  |indowname="xfer_|
000127d0  73 65 6e 64 22 0d 67 ca  46 c8 99 20 4c 6f 61 64  |send".g.F.. Load|
000127e0  54 65 6d 70 6c 61 74 65  2c 20 2c 57 69 6e 64 6f  |Template, ,Windo|
000127f0  77 25 2c 20 44 69 61 6c  6f 67 49 6e 64 69 72 65  |w%, DialogIndire|
00012800  63 74 2c 20 65 6e 64 2c  20 2d 31 2c 20 24 77 69  |ct, end, -1, $wi|
00012810  6e 64 6f 77 6e 61 6d 65  2c 20 30 0d 67 d4 2a 57  |ndowname, 0.g.*W|
00012820  69 6e 64 6f 77 25 21 36  34 3d 31 20 3a f4 20 75  |indow%!64=1 :. u|
00012830  73 65 20 63 6f 6d 6d 6f  6e 20 73 70 72 69 74 65  |se common sprite|
00012840  20 61 72 65 61 0d 67 de  4b 53 70 72 69 74 65 49  | area.g.KSpriteI|
00012850  63 6f 6e 25 3d 57 69 6e  64 6f 77 25 2b 38 38 2b  |con%=Window%+88+|
00012860  33 32 2a 32 20 20 3a f4  20 70 6f 69 6e 74 65 72  |32*2  :. pointer|
00012870  20 74 6f 20 69 63 6f 6e  20 6e 75 6d 62 65 72 20  | to icon number |
00012880  32 20 69 6e 20 73 61 76  65 20 77 69 6e 64 6f 77  |2 in save window|
00012890  0d 67 e8 44 53 70 72 69  74 65 49 63 6f 6e 25 21  |.g.DSpriteIcon%!|
000128a0  31 36 3d 53 70 72 69 74  65 49 63 6f 6e 25 21 31  |16=SpriteIcon%!1|
000128b0  36 20 84 20 31 3c 3c 31  20 84 20 31 3c 3c 38 20  |6 . 1<<1 . 1<<8 |
000128c0  3a f4 20 69 6e 64 69 72  65 63 74 65 64 20 73 70  |:. indirected sp|
000128d0  72 69 74 65 0d 67 f2 33  53 70 72 69 74 65 49 63  |rite.g.3SpriteIc|
000128e0  6f 6e 25 21 31 36 3d 53  70 72 69 74 65 49 63 6f  |on%!16=SpriteIco|
000128f0  6e 25 21 31 36 20 80 20  ac 20 31 20 3a f4 20 6e  |n%!16 . . 1 :. n|
00012900  6f 74 20 74 65 78 74 0d  67 fc 29 53 70 72 69 74  |ot text.g.)Sprit|
00012910  65 49 63 6f 6e 25 21 32  34 3d 31 20 3a f4 20 77  |eIcon%!24=1 :. w|
00012920  69 6d 70 20 61 72 65 61  20 70 6f 69 6e 74 65 72  |imp area pointer|
00012930  0d 68 06 15 53 70 72 69  74 65 49 63 6f 6e 25 21  |.h..SpriteIcon%!|
00012940  32 38 3d 31 32 0d 68 10  29 c8 99 20 43 72 65 61  |28=12.h.).. Crea|
00012950  74 65 57 69 6e 64 6f 77  25 2c 20 2c 57 69 6e 64  |teWindow%, ,Wind|
00012960  6f 77 25 20 20 b8 20 53  61 76 65 5f 68 25 0d 68  |ow%  . Save_h%.h|
00012970  1a 1b 53 61 76 65 54 65  78 74 3d 44 69 61 6c 6f  |..SaveText=Dialo|
00012980  67 49 6e 64 69 72 65 63  74 0d 68 24 34 24 53 61  |gIndirect.h$4$Sa|
00012990  76 65 54 65 78 74 3d 22  4d 75 73 69 63 46 69 6c  |veText="MusicFil|
000129a0  65 22 2b bd 28 30 29 20  3a 20 44 69 61 6c 6f 67  |e"+.(0) : Dialog|
000129b0  49 6e 64 69 72 65 63 74  2b 3d 32 35 35 0d 68 2e  |Indirect+=255.h.|
000129c0  4c 53 61 76 65 53 70 72  69 74 65 25 3d 44 69 61  |LSaveSprite%=Dia|
000129d0  6c 6f 67 49 6e 64 69 72  65 63 74 20 3a f4 20 61  |logIndirect :. a|
000129e0  64 64 72 65 73 73 20 6f  66 20 66 69 6c 65 20 74  |ddress of file t|
000129f0  79 70 65 20 73 70 72 69  74 65 20 69 6e 20 73 61  |ype sprite in sa|
00012a00  76 65 20 77 69 6e 64 6f  77 0d 68 38 16 44 69 61  |ve window.h8.Dia|
00012a10  6c 6f 67 49 6e 64 69 72  65 63 74 2b 3d 31 36 0d  |logIndirect+=16.|
00012a20  68 42 21 24 53 61 76 65  53 70 72 69 74 65 25 3d  |hB!$SaveSprite%=|
00012a30  24 46 69 6c 65 53 70 72  69 74 65 4e 61 6d 65 25  |$FileSpriteName%|
00012a40  0d 68 4c 1d 24 77 69 6e  64 6f 77 6e 61 6d 65 3d  |.hL.$windowname=|
00012a50  22 64 62 6f 78 66 69 6c  65 5f 64 62 22 0d 68 56  |"dboxfile_db".hV|
00012a60  46 c8 99 20 4c 6f 61 64  54 65 6d 70 6c 61 74 65  |F.. LoadTemplate|
00012a70  2c 20 2c 57 69 6e 64 6f  77 25 2c 20 44 69 61 6c  |, ,Window%, Dial|
00012a80  6f 67 49 6e 64 69 72 65  63 74 2c 20 65 6e 64 2c  |ogIndirect, end,|
00012a90  20 2d 31 2c 20 24 77 69  6e 64 6f 77 6e 61 6d 65  | -1, $windowname|
00012aa0  2c 20 30 0d 68 60 29 c8  99 20 43 72 65 61 74 65  |, 0.h`).. Create|
00012ab0  57 69 6e 64 6f 77 25 2c  20 2c 57 69 6e 64 6f 77  |Window%, ,Window|
00012ac0  25 20 20 b8 20 4c 6f 61  64 5f 68 25 0d 68 6a 30  |%  . Load_h%.hj0|
00012ad0  44 69 61 6c 6f 67 49 6e  64 69 72 65 63 74 2b 3d  |DialogIndirect+=|
00012ae0  33 30 20 3a 20 4c 6f 61  64 54 65 78 74 3d 44 69  |30 : LoadText=Di|
00012af0  61 6c 6f 67 49 6e 64 69  72 65 63 74 0d 68 74 2d  |alogIndirect.ht-|
00012b00  24 4c 6f 61 64 54 65 78  74 3d 24 53 61 76 65 54  |$LoadText=$SaveT|
00012b10  65 78 74 20 3a 20 44 69  61 6c 6f 67 49 6e 64 69  |ext : DialogIndi|
00012b20  72 65 63 74 2b 3d 32 35  35 0d 68 7e 1a 24 77 69  |rect+=255.h~.$wi|
00012b30  6e 64 6f 77 6e 61 6d 65  3d 22 54 69 6d 65 53 69  |ndowname="TimeSi|
00012b40  67 57 22 0d 68 88 46 c8  99 20 4c 6f 61 64 54 65  |gW".h.F.. LoadTe|
00012b50  6d 70 6c 61 74 65 2c 20  2c 57 69 6e 64 6f 77 25  |mplate, ,Window%|
00012b60  2c 20 44 69 61 6c 6f 67  49 6e 64 69 72 65 63 74  |, DialogIndirect|
00012b70  2c 20 65 6e 64 2c 20 2d  31 2c 20 24 77 69 6e 64  |, end, -1, $wind|
00012b80  6f 77 6e 61 6d 65 2c 20  30 0d 68 92 2c c8 99 20  |owname, 0.h.,.. |
00012b90  43 72 65 61 74 65 57 69  6e 64 6f 77 25 2c 20 2c  |CreateWindow%, ,|
00012ba0  57 69 6e 64 6f 77 25 20  20 b8 20 54 69 6d 65 53  |Window%  . TimeS|
00012bb0  69 67 5f 68 25 0d 68 9c  31 42 61 72 4c 65 6e 67  |ig_h%.h.1BarLeng|
00012bc0  74 68 25 3d 44 69 61 6c  6f 67 49 6e 64 69 72 65  |th%=DialogIndire|
00012bd0  63 74 20 3a 20 44 69 61  6c 6f 67 49 6e 64 69 72  |ct : DialogIndir|
00012be0  65 63 74 2b 3d 33 0d 68  a6 31 4e 6f 74 65 56 61  |ect+=3.h.1NoteVa|
00012bf0  6c 75 65 25 3d 44 69 61  6c 6f 67 49 6e 64 69 72  |lue%=DialogIndir|
00012c00  65 63 74 20 3a 20 44 69  61 6c 6f 67 49 6e 64 69  |ect : DialogIndi|
00012c10  72 65 63 74 2b 3d 33 0d  68 b0 16 24 77 69 6e 64  |rect+=3.h..$wind|
00012c20  6f 77 6e 61 6d 65 3d 22  42 61 72 57 22 0d 68 ba  |owname="BarW".h.|
00012c30  46 c8 99 20 4c 6f 61 64  54 65 6d 70 6c 61 74 65  |F.. LoadTemplate|
00012c40  2c 20 2c 57 69 6e 64 6f  77 25 2c 20 44 69 61 6c  |, ,Window%, Dial|
00012c50  6f 67 49 6e 64 69 72 65  63 74 2c 20 65 6e 64 2c  |ogIndirect, end,|
00012c60  20 2d 31 2c 20 24 77 69  6e 64 6f 77 6e 61 6d 65  | -1, $windowname|
00012c70  2c 20 30 0d 68 c4 28 c8  99 20 43 72 65 61 74 65  |, 0.h.(.. Create|
00012c80  57 69 6e 64 6f 77 25 2c  20 2c 57 69 6e 64 6f 77  |Window%, ,Window|
00012c90  25 20 20 b8 20 42 61 72  5f 68 25 0d 68 ce 4b 42  |%  . Bar_h%.h.KB|
00012ca0  61 72 4e 75 6d 25 3d 44  69 61 6c 6f 67 49 6e 64  |arNum%=DialogInd|
00012cb0  69 72 65 63 74 20 3a 20  44 69 61 6c 6f 67 49 6e  |irect : DialogIn|
00012cc0  64 69 72 65 63 74 2b 3d  31 35 20 3a f4 20 61 6c  |direct+=15 :. al|
00012cd0  6c 6f 77 20 66 6f 72 20  76 61 6c 69 64 61 74 69  |low for validati|
00012ce0  6f 6e 20 73 74 72 0d 68  d8 1a 24 77 69 6e 64 6f  |on str.h..$windo|
00012cf0  77 6e 61 6d 65 3d 22 46  69 6c 65 49 6e 66 6f 22  |wname="FileInfo"|
00012d00  0d 68 e2 46 c8 99 20 4c  6f 61 64 54 65 6d 70 6c  |.h.F.. LoadTempl|
00012d10  61 74 65 2c 20 2c 57 69  6e 64 6f 77 25 2c 20 44  |ate, ,Window%, D|
00012d20  69 61 6c 6f 67 49 6e 64  69 72 65 63 74 2c 20 65  |ialogIndirect, e|
00012d30  6e 64 2c 20 2d 31 2c 20  24 77 69 6e 64 6f 77 6e  |nd, -1, $windown|
00012d40  61 6d 65 2c 20 30 0d 68  ec 2a 57 69 6e 64 6f 77  |ame, 0.h.*Window|
00012d50  25 21 36 34 3d 31 20 3a  f4 20 75 73 65 20 63 6f  |%!64=1 :. use co|
00012d60  6d 6d 6f 6e 20 73 70 72  69 74 65 20 61 72 65 61  |mmon sprite area|
00012d70  0d 68 f6 4b 53 70 72 69  74 65 49 63 6f 6e 25 3d  |.h.KSpriteIcon%=|
00012d80  57 69 6e 64 6f 77 25 2b  38 38 2b 33 32 2a 36 20  |Window%+88+32*6 |
00012d90  20 3a f4 20 70 6f 69 6e  74 65 72 20 74 6f 20 69  | :. pointer to i|
00012da0  63 6f 6e 20 6e 75 6d 62  65 72 20 36 20 69 6e 20  |con number 6 in |
00012db0  73 61 76 65 20 77 69 6e  64 6f 77 0d 69 00 44 53  |save window.i.DS|
00012dc0  70 72 69 74 65 49 63 6f  6e 25 21 31 36 3d 53 70  |priteIcon%!16=Sp|
00012dd0  72 69 74 65 49 63 6f 6e  25 21 31 36 20 84 20 31  |riteIcon%!16 . 1|
00012de0  3c 3c 31 20 84 20 31 3c  3c 38 20 3a f4 20 69 6e  |<<1 . 1<<8 :. in|
00012df0  64 69 72 65 63 74 65 64  20 73 70 72 69 74 65 0d  |directed sprite.|
00012e00  69 0a 33 53 70 72 69 74  65 49 63 6f 6e 25 21 31  |i.3SpriteIcon%!1|
00012e10  36 3d 53 70 72 69 74 65  49 63 6f 6e 25 21 31 36  |6=SpriteIcon%!16|
00012e20  20 80 20 ac 20 31 20 3a  f4 20 6e 6f 74 20 74 65  | . . 1 :. not te|
00012e30  78 74 0d 69 14 29 53 70  72 69 74 65 49 63 6f 6e  |xt.i.)SpriteIcon|
00012e40  25 21 32 34 3d 31 20 3a  f4 20 77 69 6d 70 20 61  |%!24=1 :. wimp a|
00012e50  72 65 61 20 70 6f 69 6e  74 65 72 0d 69 1e 15 53  |rea pointer.i..S|
00012e60  70 72 69 74 65 49 63 6f  6e 25 21 32 38 3d 31 32  |priteIcon%!28=12|
00012e70  0d 69 28 2d c8 99 20 43  72 65 61 74 65 57 69 6e  |.i(-.. CreateWin|
00012e80  64 6f 77 25 2c 20 2c 57  69 6e 64 6f 77 25 20 20  |dow%, ,Window%  |
00012e90  b8 20 46 69 6c 65 49 6e  66 6f 5f 68 25 0d 69 32  |. FileInfo_h%.i2|
00012ea0  32 54 68 69 73 46 69 6c  65 25 3d 44 69 61 6c 6f  |2ThisFile%=Dialo|
00012eb0  67 49 6e 64 69 72 65 63  74 20 3a 20 44 69 61 6c  |gIndirect : Dial|
00012ec0  6f 67 49 6e 64 69 72 65  63 74 2b 3d 32 35 35 0d  |ogIndirect+=255.|
00012ed0  69 3c 30 55 70 64 61 74  65 64 25 3d 44 69 61 6c  |i<0Updated%=Dial|
00012ee0  6f 67 49 6e 64 69 72 65  63 74 20 3a 20 44 69 61  |ogIndirect : Dia|
00012ef0  6c 6f 67 49 6e 64 69 72  65 63 74 2b 3d 31 32 0d  |logIndirect+=12.|
00012f00  69 46 31 46 69 6c 65 54  79 70 65 25 3d 44 69 61  |iF1FileType%=Dia|
00012f10  6c 6f 67 49 6e 64 69 72  65 63 74 20 3a 20 44 69  |logIndirect : Di|
00012f20  61 6c 6f 67 49 6e 64 69  72 65 63 74 2b 3d 32 30  |alogIndirect+=20|
00012f30  0d 69 50 31 46 69 6c 65  53 69 7a 65 25 3d 44 69  |.iP1FileSize%=Di|
00012f40  61 6c 6f 67 49 6e 64 69  72 65 63 74 20 3a 20 44  |alogIndirect : D|
00012f50  69 61 6c 6f 67 49 6e 64  69 72 65 63 74 2b 3d 32  |ialogIndirect+=2|
00012f60  30 0d 69 5a 32 46 69 6c  65 44 61 74 65 25 3d 44  |0.iZ2FileDate%=D|
00012f70  69 61 6c 6f 67 49 6e 64  69 72 65 63 74 20 3a 20  |ialogIndirect : |
00012f80  44 69 61 6c 6f 67 49 6e  64 69 72 65 63 74 2b 3d  |DialogIndirect+=|
00012f90  31 30 30 0d 69 64 4b 46  69 6c 65 54 79 70 65 53  |100.idKFileTypeS|
00012fa0  70 72 69 74 65 25 3d 44  69 61 6c 6f 67 49 6e 64  |prite%=DialogInd|
00012fb0  69 72 65 63 74 20 3a f4  20 61 64 64 72 65 73 73  |irect :. address|
00012fc0  20 6f 66 20 66 69 6c 65  20 74 79 70 65 20 73 70  | of file type sp|
00012fd0  72 69 74 65 20 69 6e 20  77 69 6e 64 6f 77 0d 69  |rite in window.i|
00012fe0  6e 3a 24 46 69 6c 65 54  79 70 65 53 70 72 69 74  |n:$FileTypeSprit|
00012ff0  65 25 3d 24 46 69 6c 65  53 70 72 69 74 65 4e 61  |e%=$FileSpriteNa|
00013000  6d 65 25 20 3a 20 44 69  61 6c 6f 67 49 6e 64 69  |me% : DialogIndi|
00013010  72 65 63 74 2b 3d 31 36  0d 69 78 1b 24 54 68 69  |rect+=16.ix.$Thi|
00013020  73 46 69 6c 65 25 3d 22  3c 75 6e 74 69 74 6c 65  |sFile%="<untitle|
00013030  64 3e 22 0d 69 82 12 24  55 70 64 61 74 65 64 25  |d>".i..$Updated%|
00013040  3d 22 4e 4f 22 0d 69 8c  13 46 24 3d 22 3c 75 6e  |="NO".i..F$="<un|
00013050  74 69 74 6c 65 64 3e 22  0d 69 96 16 24 54 68 69  |titled>".i..$Thi|
00013060  73 46 69 6c 65 25 3d 46  24 2b bd 28 30 29 0d 69  |sFile%=F$+.(0).i|
00013070  a0 18 24 53 63 6f 72 65  54 69 74 6c 65 25 3d 46  |..$ScoreTitle%=F|
00013080  24 2b bd 28 30 29 0d 69  aa 14 c8 99 20 43 6c 6f  |$+.(0).i.... Clo|
00013090  73 65 54 65 6d 70 6c 61  74 65 0d 69 b4 57 e7 20  |seTemplate.i.W. |
000130a0  a4 61 73 73 65 72 74 28  44 69 61 6c 6f 67 49 6e  |.assert(DialogIn|
000130b0  64 69 72 65 63 74 3c 65  6e 64 2d 31 30 2c 20 22  |direct<end-10, "|
000130c0  4e 6f 74 20 65 6e 6f 75  67 68 20 6d 65 6d 6f 72  |Not enough memor|
000130d0  79 20 74 6f 20 6c 6f 61  64 20 77 69 6e 64 6f 77  |y to load window|
000130e0  20 74 65 6d 70 6c 61 74  65 73 2e 22 29 20 3a 20  | templates.") : |
000130f0  fa 0d 69 be 12 53 63 6f  72 65 43 6c 6f 73 65 64  |..i..ScoreClosed|
00013100  25 3d a3 0d 69 c8 05 e1  0d 69 d2 04 0d 69 dc 16  |%=..i....i...i..|
00013110  dd 20 f2 69 6e 69 74 69  61 6c 69 73 65 5f 6d 65  |. .initialise_me|
00013120  6e 75 0d 69 e6 42 ea 20  69 74 65 6d 24 2c 20 73  |nu.i.B. item$, s|
00013130  75 62 25 2c 20 4d 65 6e  75 42 6c 6f 63 6b 2c 20  |ub%, MenuBlock, |
00013140  53 75 62 4d 65 6e 75 42  6c 6f 63 6b 2c 20 4d 65  |SubMenuBlock, Me|
00013150  6e 75 45 6e 64 2c 20 4d  65 6e 75 49 74 65 6d 73  |nuEnd, MenuItems|
00013160  4c 69 73 74 0d 69 f0 22  ea 20 6e 65 78 74 73 75  |List.i.". nextsu|
00013170  62 25 2c 20 66 6c 61 67  73 25 2c 20 6d 25 2c 20  |b%, flags%, m%, |
00013180  77 69 64 74 68 25 0d 69  fa 1a 4d 65 6e 75 53 69  |width%.i..MenuSi|
00013190  7a 65 25 20 3d 20 32 38  2b 28 32 30 2a 32 34 29  |ze% = 28+(20*24)|
000131a0  0d 6a 04 33 de 20 4d 65  6e 75 53 74 61 72 74 20  |.j.3. MenuStart |
000131b0  31 35 2a 4d 65 6e 75 53  69 7a 65 25 20 20 3a f4  |15*MenuSize%  :.|
000131c0  20 61 6c 6c 6f 77 20 31  35 20 6d 65 6e 75 73 20  | allow 15 menus |
000131d0  6d 61 78 0d 6a 0e 22 4d  65 6e 75 45 6e 64 3d 4d  |max.j."MenuEnd=M|
000131e0  65 6e 75 53 74 61 72 74  2b 31 35 2a 4d 65 6e 75  |enuStart+15*Menu|
000131f0  53 69 7a 65 25 0d 6a 18  15 de 20 4d 65 6e 75 53  |Size%.j... MenuS|
00013200  74 72 69 6e 67 20 31 34  2a 34 0d 6a 22 31 de 20  |tring 14*4.j"1. |
00013210  53 74 61 76 65 4e 75 6d  25 20 31 20 3a 20 f4 20  |StaveNum% 1 : . |
00013220  62 75 66 66 65 72 73 20  66 6f 72 20 77 72 69 74  |buffers for writ|
00013230  65 61 62 6c 65 20 69 63  6f 6e 73 0d 6a 2c 10 de  |eable icons.j,..|
00013240  20 56 61 6c 73 74 72 53  20 31 30 0d 6a 36 08 f7  | ValstrS 10.j6..|
00013250  20 2b 30 0d 6a 40 17 4d  65 6e 75 42 6c 6f 63 6b  | +0.j@.MenuBlock|
00013260  3d 4d 65 6e 75 53 74 61  72 74 0d 6a 4a 0b f3 20  |=MenuStart.jJ.. |
00013270  69 74 65 6d 24 0d 6a 54  0f c8 95 20 69 74 65 6d  |item$.jT... item|
00013280  24 3e 22 22 0d 6a 5e 13  20 c8 8e 20 c0 69 74 65  |$>"".j^. .. .ite|
00013290  6d 24 2c 33 29 20 ca 0d  6a 68 23 20 20 c9 20 22  |m$,3) ..jh#  . "|
000132a0  4d 61 65 22 20 3a 20 49  63 6f 6e 4d 65 6e 75 25  |Mae" : IconMenu%|
000132b0  3d 4d 65 6e 75 42 6c 6f  63 6b 0d 6a 72 3c f4 20  |=MenuBlock.jr<. |
000132c0  6e 6f 74 65 20 74 68 65  72 65 20 61 72 65 20 32  |note there are 2|
000132d0  20 22 4d 61 65 73 74 72  6f 22 20 6d 65 6e 75 73  | "Maestro" menus|
000132e0  2e 20 49 63 6f 6e 4d 65  6e 75 25 20 69 73 20 74  |. IconMenu% is t|
000132f0  68 65 20 32 6e 64 0d 6a  7c 24 20 20 c9 20 22 53  |he 2nd.j|$  . "S|
00013300  74 61 22 20 3a 20 53 74  61 76 65 4d 65 6e 75 25  |ta" : StaveMenu%|
00013310  3d 4d 65 6e 75 42 6c 6f  63 6b 0d 6a 86 25 20 20  |=MenuBlock.j.%  |
00013320  c9 20 22 56 6f 6c 22 20  3a 20 56 6f 6c 75 6d 65  |. "Vol" : Volume|
00013330  4d 65 6e 75 25 3d 4d 65  6e 75 42 6c 6f 63 6b 0d  |Menu%=MenuBlock.|
00013340  6a 90 24 20 20 c9 20 22  54 65 6d 22 20 3a 20 54  |j.$  . "Tem" : T|
00013350  65 6d 70 6f 4d 65 6e 75  25 3d 4d 65 6e 75 42 6c  |empoMenu%=MenuBl|
00013360  6f 63 6b 0d 6a 9a 24 20  20 c9 20 22 4d 61 6a 22  |ock.j.$  . "Maj"|
00013370  20 3a 20 4d 61 6a 6f 72  4d 65 6e 75 25 3d 4d 65  | : MajorMenu%=Me|
00013380  6e 75 42 6c 6f 63 6b 0d  6a a4 24 20 20 c9 20 22  |nuBlock.j.$  . "|
00013390  4d 69 6e 22 20 3a 20 4d  69 6e 6f 72 4d 65 6e 75  |Min" : MinorMenu|
000133a0  25 3d 4d 65 6e 75 42 6c  6f 63 6b 0d 6a ae 07 20  |%=MenuBlock.j.. |
000133b0  20 cb 0d 6a b8 17 20 24  4d 65 6e 75 42 6c 6f 63  | ..j.. $MenuBloc|
000133c0  6b 20 3d 20 69 74 65 6d  24 0d 6a c2 21 20 4d 65  |k = item$.j.! Me|
000133d0  6e 75 42 6c 6f 63 6b 3f  31 32 20 3d 20 43 5f 4d  |nuBlock?12 = C_M|
000133e0  65 6e 75 54 69 74 6c 65  66 67 0d 6a cc 21 20 4d  |enuTitlefg.j.! M|
000133f0  65 6e 75 42 6c 6f 63 6b  3f 31 33 20 3d 20 43 5f  |enuBlock?13 = C_|
00013400  4d 65 6e 75 54 69 74 6c  65 62 67 0d 6a d6 1c 20  |MenuTitlebg.j.. |
00013410  4d 65 6e 75 42 6c 6f 63  6b 3f 31 34 20 3d 20 43  |MenuBlock?14 = C|
00013420  5f 4d 65 6e 75 66 67 0d  6a e0 1c 20 4d 65 6e 75  |_Menufg.j.. Menu|
00013430  42 6c 6f 63 6b 3f 31 35  20 3d 20 43 5f 4d 65 6e  |Block?15 = C_Men|
00013440  75 62 67 0d 6a ea 0d 20  f3 20 77 69 64 74 68 25  |ubg.j.. . width%|
00013450  0d 6a f4 17 f4 20 61 64  6a 75 73 74 20 6d 65 6e  |.j... adjust men|
00013460  75 20 77 69 64 74 68 0d  6a fe 25 20 4d 65 6e 75  |u width.j.% Menu|
00013470  42 6c 6f 63 6b 21 31 36  20 3d 20 77 69 64 74 68  |Block!16 = width|
00013480  25 20 2a 20 43 5f 57 69  64 74 68 25 0d 6b 08 16  |% * C_Width%.k..|
00013490  20 4d 65 6e 75 42 6c 6f  63 6b 21 32 30 20 3d 20  | MenuBlock!20 = |
000134a0  34 34 0d 6b 12 15 20 4d  65 6e 75 42 6c 6f 63 6b  |44.k.. MenuBlock|
000134b0  21 32 34 20 3d 20 30 0d  6b 1c 1f 20 4d 65 6e 75  |!24 = 0.k.. Menu|
000134c0  49 74 65 6d 73 4c 69 73  74 3d 4d 65 6e 75 42 6c  |ItemsList=MenuBl|
000134d0  6f 63 6b 2b 32 38 0d 6b  26 25 20 53 75 62 4d 65  |ock+28.k&% SubMe|
000134e0  6e 75 42 6c 6f 63 6b 3d  4d 65 6e 75 42 6c 6f 63  |nuBlock=MenuBloc|
000134f0  6b 2b 4d 65 6e 75 53 69  7a 65 25 0d 6b 30 1a 20  |k+MenuSize%.k0. |
00013500  6e 65 78 74 73 75 62 25  3d 53 75 62 4d 65 6e 75  |nextsub%=SubMenu|
00013510  42 6c 6f 63 6b 0d 6b 3a  0c 20 f3 20 69 74 65 6d  |Block.k:. . item|
00013520  24 0d 6b 44 10 20 c8 95  20 69 74 65 6d 24 3e 22  |$.kD. .. item$>"|
00013530  22 0d 6b 4e 0d 20 20 20  f3 20 73 75 62 25 0d 6b  |".kN.   . sub%.k|
00013540  58 3d 20 20 20 e7 20 73  75 62 25 3d 30 20 73 75  |X=   . sub%=0 su|
00013550  62 25 3d 2d 31 20 8b 20  73 75 62 25 3d 6e 65 78  |b%=-1 . sub%=nex|
00013560  74 73 75 62 25 20 3a 20  6e 65 78 74 73 75 62 25  |tsub% : nextsub%|
00013570  2b 3d 4d 65 6e 75 53 69  7a 65 25 0d 6b 62 31 20  |+=MenuSize%.kb1 |
00013580  20 20 e7 20 a4 61 73 73  65 72 74 28 73 75 62 25  |  . .assert(sub%|
00013590  3c 4d 65 6e 75 45 6e 64  2c 20 22 4d 65 6e 75 20  |<MenuEnd, "Menu |
000135a0  74 6f 6f 20 62 69 67 2e  22 29 20 fa 0d 6b 6c 19  |too big.") ..kl.|
000135b0  f4 20 70 6f 69 6e 74 65  72 73 20 74 6f 20 77 69  |. pointers to wi|
000135c0  6e 64 6f 77 73 0d 6b 76  15 20 20 20 c8 8e 20 c0  |ndows.kv.   .. .|
000135d0  69 74 65 6d 24 2c 34 29  20 ca 0d 6b 80 24 20 20  |item$,4) ..k.$  |
000135e0  20 20 c9 20 22 49 6e 73  74 22 20 3a 20 73 75 62  |  . "Inst" : sub|
000135f0  25 3d 49 6e 73 74 72 57  69 6e 64 5f 68 25 0d 6b  |%=InstrWind_h%.k|
00013600  8a 23 20 20 20 20 c9 20  22 49 6e 66 6f 22 20 3a  |.#    . "Info" :|
00013610  20 73 75 62 25 3d 50 72  6f 67 49 6e 66 6f 5f 68  | sub%=ProgInfo_h|
00013620  25 0d 6b 94 1f 20 20 20  20 c9 20 22 53 61 76 65  |%.k..    . "Save|
00013630  22 20 3a 20 73 75 62 25  3d 53 61 76 65 5f 68 25  |" : sub%=Save_h%|
00013640  0d 6b 9e 23 20 20 20 20  c9 20 22 46 69 6c 65 22  |.k.#    . "File"|
00013650  20 3a 20 73 75 62 25 3d  46 69 6c 65 49 6e 66 6f  | : sub%=FileInfo|
00013660  5f 68 25 0d 6b a8 22 20  20 20 20 c9 20 22 54 69  |_h%.k."    . "Ti|
00013670  6d 65 22 20 3a 20 73 75  62 25 3d 54 69 6d 65 53  |me" : sub%=TimeS|
00013680  69 67 5f 68 25 0d 6b b2  1e 20 20 20 20 c9 20 22  |ig_h%.k..    . "|
00013690  47 6f 74 6f 22 20 3a 20  73 75 62 25 3d 42 61 72  |Goto" : sub%=Bar|
000136a0  5f 68 25 0d 6b bc 09 20  20 20 20 cb 0d 6b c6 27  |_h%.k..    ..k.'|
000136b0  20 20 20 24 28 4d 65 6e  75 49 74 65 6d 73 4c 69  |   $(MenuItemsLi|
000136c0  73 74 2b 31 32 29 20 3d  20 69 74 65 6d 24 2b bd  |st+12) = item$+.|
000136d0  28 30 29 0d 6b d0 1d 20  20 20 4d 65 6e 75 49 74  |(0).k..   MenuIt|
000136e0  65 6d 73 4c 69 73 74 21  34 20 3d 20 73 75 62 25  |emsList!4 = sub%|
000136f0  0d 6b da 46 20 20 20 4d  65 6e 75 49 74 65 6d 73  |.k.F   MenuItems|
00013700  4c 69 73 74 21 38 20 3d  20 26 32 31 20 84 20 28  |List!8 = &21 . (|
00013710  43 5f 4d 65 6e 75 49 74  65 6d 66 67 3c 3c 32 34  |C_MenuItemfg<<24|
00013720  29 20 84 20 28 43 5f 4d  65 6e 75 49 74 65 6d 62  |) . (C_MenuItemb|
00013730  67 3c 3c 32 38 29 0d 6b  e4 0f 20 20 20 f3 20 66  |g<<28).k..   . f|
00013740  6c 61 67 73 25 0d 6b ee  23 20 20 20 21 4d 65 6e  |lags%.k.#   !Men|
00013750  75 49 74 65 6d 73 4c 69  73 74 3d 66 6c 61 67 73  |uItemsList=flags|
00013760  25 20 80 20 25 31 31 31  0d 6b f8 21 20 20 20 f4  |% . %111.k.!   .|
00013770  20 69 6e 64 69 72 65 63  74 20 77 72 69 74 65 61  | indirect writea|
00013780  62 6c 65 20 69 63 6f 6e  73 0d 6c 02 13 20 20 20  |ble icons.l..   |
00013790  e7 20 66 6c 61 67 73 25  80 34 20 8c 0d 6c 0c 46  |. flags%.4 ..l.F|
000137a0  20 20 20 20 4d 65 6e 75  49 74 65 6d 73 4c 69 73  |    MenuItemsLis|
000137b0  74 21 38 20 3d 20 28 4d  65 6e 75 49 74 65 6d 73  |t!8 = (MenuItems|
000137c0  4c 69 73 74 21 38 29 20  84 20 31 3c 3c 38 20 3a  |List!8) . 1<<8 :|
000137d0  f4 20 73 65 74 20 69 6e  64 69 72 65 63 74 20 62  |. set indirect b|
000137e0  69 74 0d 6c 16 16 20 20  20 20 c8 8e 20 c0 69 74  |it.l..    .. .it|
000137f0  65 6d 24 2c 34 29 20 ca  0d 6c 20 11 20 20 20 20  |em$,4) ..l .    |
00013800  20 c9 20 22 53 74 61 76  22 0d 6c 2a 38 20 20 20  | . "Stav".l*8   |
00013810  20 20 20 4d 65 6e 75 49  74 65 6d 73 4c 69 73 74  |   MenuItemsList|
00013820  21 31 32 3d 53 74 61 76  65 4e 75 6d 25 20 20 20  |!12=StaveNum%   |
00013830  3a f4 20 62 75 66 66 65  72 20 70 6f 69 6e 74 65  |:. buffer pointe|
00013840  72 0d 6c 34 19 20 20 20  20 20 20 24 56 61 6c 73  |r.l4.      $Vals|
00013850  74 72 53 3d 22 61 31 2d  34 22 0d 6c 3e 39 20 20  |trS="a1-4".l>9  |
00013860  20 20 20 20 4d 65 6e 75  49 74 65 6d 73 4c 69 73  |    MenuItemsLis|
00013870  74 21 31 36 20 3d 20 56  61 6c 73 74 72 53 20 3a  |t!16 = ValstrS :|
00013880  f4 20 76 61 6c 69 64 61  74 69 6f 6e 20 73 74 72  |. validation str|
00013890  69 6e 67 0d 6c 48 2f 20  20 20 20 20 20 4d 65 6e  |ing.lH/      Men|
000138a0  75 49 74 65 6d 73 4c 69  73 74 21 32 30 20 3d 20  |uItemsList!20 = |
000138b0  32 20 3a f4 20 62 75 66  66 65 72 20 6c 65 6e 67  |2 :. buffer leng|
000138c0  74 68 0d 6c 52 0a 20 20  20 20 20 cb 0d 6c 5c 09  |th.lR.     ..l\.|
000138d0  20 20 20 20 cd 0d 6c 66  18 20 20 20 4d 65 6e 75  |    ..lf.   Menu|
000138e0  49 74 65 6d 73 4c 69 73  74 2b 3d 32 34 0d 6c 70  |ItemsList+=24.lp|
000138f0  0e 20 20 20 f3 20 69 74  65 6d 24 0d 6c 7a 08 20  |.   . item$.lz. |
00013900  20 20 ce 0d 6c 84 10 20  f4 20 6c 61 73 74 20 69  |  ..l.. . last i|
00013910  74 65 6d 0d 6c 8e 16 20  4d 65 6e 75 49 74 65 6d  |tem.l.. MenuItem|
00013920  73 4c 69 73 74 2d 3d 32  34 0d 6c 98 38 20 21 4d  |sList-=24.l.8 !M|
00013930  65 6e 75 49 74 65 6d 73  4c 69 73 74 20 3d 20 21  |enuItemsList = !|
00013940  4d 65 6e 75 49 74 65 6d  73 4c 69 73 74 20 84 20  |MenuItemsList . |
00013950  26 38 30 20 3a 20 f4 20  6c 61 73 74 20 69 74 65  |&80 : . last ite|
00013960  6d 0d 6c a2 0c 20 f3 20  69 74 65 6d 24 0d 6c ac  |m.l.. . item$.l.|
00013970  1b 20 4d 65 6e 75 42 6c  6f 63 6b 3d 53 75 62 4d  |. MenuBlock=SubM|
00013980  65 6e 75 42 6c 6f 63 6b  0d 6c b6 05 ce 0d 6c c0  |enuBlock.l....l.|
00013990  13 24 42 61 72 4c 65 6e  67 74 68 25 3d 22 34 22  |.$BarLength%="4"|
000139a0  0d 6c ca 18 f2 53 65 74  56 6f 6c 75 6d 65 28 36  |.l...SetVolume(6|
000139b0  29 20 3a 20 f4 20 66 66  0d 6c d4 1e f2 53 65 74  |) : . ff.l...Set|
000139c0  54 65 6d 70 6f 28 38 29  20 20 3a 20 f4 20 6d 6f  |Tempo(8)  : . mo|
000139d0  64 65 72 61 74 6f 0d 6c  de 1e 24 53 74 61 76 65  |derato.l..$Stave|
000139e0  4e 75 6d 25 3d c0 c3 28  53 54 41 56 45 25 2b 31  |Num%=..(STAVE%+1|
000139f0  29 2c 31 29 0d 6c e8 34  69 74 65 6d 25 20 3d 20  |),1).l.4item% = |
00013a00  a4 46 69 6e 64 4d 65 6e  75 49 74 65 6d 28 22 2b  |.FindMenuItem("+|
00013a10  70 65 72 63 75 73 73 69  6f 6e 22 2c 20 53 74 61  |percussion", Sta|
00013a20  76 65 4d 65 6e 75 25 29  0d 6c f2 49 e7 20 28 69  |veMenu%).l.I. (i|
00013a30  74 65 6d 25 3e 3d 30 29  20 21 69 74 65 6d 25 20  |tem%>=0) !item% |
00013a40  3d 20 a4 53 65 74 42 69  74 28 50 45 52 43 25 3d  |= .SetBit(PERC%=|
00013a50  31 2c 20 21 69 74 65 6d  25 2c 20 30 29 3a f4 20  |1, !item%, 0):. |
00013a60  73 65 74 20 6f 72 20 63  6c 65 61 72 20 74 69 63  |set or clear tic|
00013a70  6b 0d 6c fc 21 f4 20 61  62 73 74 72 61 63 74 65  |k.l.!. abstracte|
00013a80  64 20 66 72 6f 6d 20 73  65 74 20 6b 65 79 20 73  |d from set key s|
00013a90  69 67 0d 6d 06 07 ea 20  6e 0d 6d 10 81 e7 20 4b  |ig.m... n.m... K|
00013aa0  45 59 5f 53 49 47 25 28  31 29 20 6e 3d 61 63 63  |EY_SIG%(1) n=acc|
00013ab0  69 64 65 6e 74 61 6c 25  2b 32 2b 4b 45 59 5f 53  |idental%+2+KEY_S|
00013ac0  49 47 25 28 30 29 20 3a  20 58 25 28 6b 65 79 25  |IG%(0) : X%(key%|
00013ad0  29 3d 28 78 25 28 6e 29  2b 58 25 28 6e 29 29 2a  |)=(x%(n)+X%(n))*|
00013ae0  4b 45 59 5f 53 49 47 25  28 31 29 20 8b 20 58 25  |KEY_SIG%(1) . X%|
00013af0  28 6b 65 79 25 29 3d 78  25 28 61 63 63 69 64 65  |(key%)=x%(accide|
00013b00  6e 74 61 6c 25 2b 32 29  2b 58 25 28 61 63 63 69  |ntal%+2)+X%(acci|
00013b10  64 65 6e 74 61 6c 25 2b  32 29 0d 6d 1a 0e 43 4f  |dental%+2).m..CO|
00013b20  4e 46 49 52 4d 25 3d a3  0d 6d 24 05 e1 0d 6d 2e  |NFIRM%=..m$...m.|
00013b30  3b f4 20 5b 74 69 74 6c  65 2c 20 77 69 64 74 68  |;. [title, width|
00013b40  2c 20 5b 69 74 65 6d 2c  20 31 20 69 66 20 73 75  |, [item, 1 if su|
00013b50  62 5f 6d 65 6e 75 20 70  6f 69 6e 74 65 72 2c 20  |b_menu pointer, |
00013b60  66 6c 61 67 73 5d 20 5d  0d 6d 38 13 dc 20 22 4d  |flags] ].m8.. "M|
00013b70  61 65 73 74 72 6f 22 2c  20 31 32 0d 6d 42 29 dc  |aestro", 12.mB).|
00013b80  20 22 53 61 76 65 22 2c  30 2c 30 2c 20 22 46 69  | "Save",0,0, "Fi|
00013b90  6c 65 22 2c 30 2c 30 2c  20 22 43 6c 65 61 72 22  |le",0,0, "Clear"|
00013ba0  2c 30 2c 32 0d 6d 4c 40  dc 20 22 53 74 61 76 65  |,0,2.mL@. "Stave|
00013bb0  73 22 2c 31 2c 30 2c 20  22 49 6e 73 74 72 75 6d  |s",1,0, "Instrum|
00013bc0  65 6e 74 73 22 2c 30 2c  30 2c 20 22 56 6f 6c 75  |ents",0,0, "Volu|
00013bd0  6d 65 22 2c 31 2c 30 2c  20 22 54 65 6d 70 6f 22  |me",1,0, "Tempo"|
00013be0  2c 31 2c 32 0d 6d 56 25  dc 20 22 54 69 6d 65 20  |,1,2.mV%. "Time |
00013bf0  73 69 67 2e 22 2c 30 2c  30 2c 20 22 4b 65 79 20  |sig.",0,0, "Key |
00013c00  73 69 67 2e 22 2c 31 2c  32 0d 6d 60 1f dc 20 22  |sig.",1,2.m`.. "|
00013c10  47 6f 74 6f 22 2c 30 2c  30 2c 20 22 50 6c 61 79  |Goto",0,0, "Play|
00013c20  22 2c 30 2c 30 2c 22 22  0d 6d 6a 11 dc 20 22 53  |",0,0,"".mj.. "S|
00013c30  74 61 76 65 73 22 2c 31  32 0d 6d 74 2a dc 20 22  |taves",12.mt*. "|
00013c40  53 74 61 76 65 4e 75 6d  22 2c 30 2c 34 2c 20 22  |StaveNum",0,4, "|
00013c50  2b 70 65 72 63 75 73 73  69 6f 6e 22 2c 30 2c 30  |+percussion",0,0|
00013c60  2c 22 22 0d 6d 7e 1b f4  20 34 20 69 6e 64 69 63  |,"".m~.. 4 indic|
00013c70  61 74 65 73 20 77 72 69  74 65 61 62 6c 65 0d 6d  |ates writeable.m|
00013c80  88 10 dc 20 22 56 6f 6c  75 6d 65 22 2c 34 0d 6d  |... "Volume",4.m|
00013c90  92 37 dc 20 22 70 70 70  22 2c 30 2c 30 2c 20 22  |.7. "ppp",0,0, "|
00013ca0  70 70 22 2c 30 2c 30 2c  20 22 70 22 2c 30 2c 30  |pp",0,0, "p",0,0|
00013cb0  2c 20 22 6d 70 22 2c 30  2c 30 2c 20 22 6d 66 22  |, "mp",0,0, "mf"|
00013cc0  2c 20 30 2c 30 0d 6d 9c  25 dc 20 22 66 22 2c 30  |, 0,0.m.%. "f",0|
00013cd0  2c 30 2c 20 22 66 66 22  2c 30 2c 31 2c 20 22 66  |,0, "ff",0,1, "f|
00013ce0  66 66 22 2c 30 2c 30 2c  22 22 0d 6d a6 10 dc 20  |ff",0,0,"".m... |
00013cf0  22 54 65 6d 70 6f 22 2c  31 32 0d 6d b0 41 dc 20  |"Tempo",12.m.A. |
00013d00  22 4c 61 72 67 69 73 73  69 6d 6f 22 2c 30 2c 30  |"Largissimo",0,0|
00013d10  2c 20 22 4c 61 72 67 6f  22 2c 30 2c 30 2c 20 22  |, "Largo",0,0, "|
00013d20  4c 61 72 67 68 65 74 74  6f 22 2c 30 2c 30 2c 20  |Larghetto",0,0, |
00013d30  22 47 72 61 76 65 22 2c  30 2c 30 0d 6d ba 43 dc  |"Grave",0,0.m.C.|
00013d40  20 22 41 64 61 67 69 6f  22 2c 30 2c 30 2c 20 22  | "Adagio",0,0, "|
00013d50  41 64 61 67 69 65 74 74  6f 22 2c 30 2c 30 2c 20  |Adagietto",0,0, |
00013d60  22 41 6e 64 61 6e 74 65  22 2c 30 2c 30 2c 20 22  |"Andante",0,0, "|
00013d70  41 6e 64 61 6e 74 69 6e  6f 22 2c 30 2c 30 0d 6d  |Andantino",0,0.m|
00013d80  c4 43 dc 20 22 4d 6f 64  65 72 61 74 6f 22 2c 30  |.C. "Moderato",0|
00013d90  2c 31 2c 20 22 41 6c 6c  65 67 72 65 74 74 6f 22  |,1, "Allegretto"|
00013da0  2c 30 2c 30 2c 20 22 41  6c 6c 65 67 72 6f 22 2c  |,0,0, "Allegro",|
00013db0  30 2c 30 2c 20 22 56 69  76 61 63 65 22 2c 30 2c  |0,0, "Vivace",0,|
00013dc0  30 0d 6d ce 36 dc 20 22  56 65 6c 6f 63 65 22 2c  |0.m.6. "Veloce",|
00013dd0  30 2c 30 2c 20 22 50 72  65 73 74 6f 22 2c 30 2c  |0,0, "Presto",0,|
00013de0  30 2c 20 22 50 72 65 73  74 69 73 73 69 6d 6f 22  |0, "Prestissimo"|
00013df0  2c 30 2c 30 2c 22 22 0d  6d d8 12 dc 20 22 4b 65  |,0,0,"".m... "Ke|
00013e00  79 20 73 69 67 2e 22 2c  36 0d 6d e2 21 dc 20 22  |y sig.",6.m.!. "|
00013e10  4d 61 6a 6f 72 22 2c 31  2c 30 2c 20 22 4d 69 6e  |Major",1,0, "Min|
00013e20  6f 72 22 2c 31 2c 30 2c  22 22 0d 6d ec 0f dc 20  |or",1,0,"".m... |
00013e30  22 4d 61 6a 6f 72 22 2c  33 0d 6d f6 49 dc 20 22  |"Major",3.m.I. "|
00013e40  43 62 22 2c 30 2c 30 2c  20 22 47 62 22 2c 30 2c  |Cb",0,0, "Gb",0,|
00013e50  30 2c 20 22 44 62 22 2c  30 2c 30 2c 20 22 41 62  |0, "Db",0,0, "Ab|
00013e60  22 2c 30 2c 30 2c 20 22  45 62 22 2c 30 2c 30 2c  |",0,0, "Eb",0,0,|
00013e70  20 22 42 62 22 2c 30 2c  30 2c 20 22 46 22 2c 30  | "Bb",0,0, "F",0|
00013e80  2c 32 0d 6e 00 29 dc 20  22 43 22 2c 20 30 2c 33  |,2.n.). "C", 0,3|
00013e90  20 3a 20 52 45 4d 20 64  6f 74 74 65 64 20 6c 69  | : REM dotted li|
00013ea0  6e 65 20 61 6e 64 20 74  69 63 6b 0d 6e 0a 4d dc  |ne and tick.n.M.|
00013eb0  20 22 47 22 2c 20 30 2c  30 2c 20 22 44 22 2c 20  | "G", 0,0, "D", |
00013ec0  30 2c 30 2c 20 22 41 22  2c 20 30 2c 30 2c 20 22  |0,0, "A", 0,0, "|
00013ed0  45 22 2c 20 30 2c 30 2c  20 22 42 22 2c 20 30 2c  |E", 0,0, "B", 0,|
00013ee0  30 2c 20 22 46 23 22 2c  30 2c 30 2c 20 22 43 23  |0, "F#",0,0, "C#|
00013ef0  22 2c 30 2c 30 2c 22 22  0d 6e 14 0f dc 20 22 4d  |",0,0,"".n... "M|
00013f00  69 6e 6f 72 22 2c 33 0d  6e 1e 49 dc 20 22 41 62  |inor",3.n.I. "Ab|
00013f10  22 2c 30 2c 30 2c 20 22  45 62 22 2c 30 2c 30 2c  |",0,0, "Eb",0,0,|
00013f20  20 22 42 62 22 2c 30 2c  30 2c 20 22 46 22 2c 20  | "Bb",0,0, "F", |
00013f30  30 2c 30 2c 20 22 43 22  2c 20 30 2c 30 2c 20 22  |0,0, "C", 0,0, "|
00013f40  47 22 2c 20 30 2c 30 2c  20 22 44 22 2c 30 2c 32  |G", 0,0, "D",0,2|
00013f50  0d 6e 28 29 dc 20 22 41  22 2c 20 30 2c 33 20 3a  |.n(). "A", 0,3 :|
00013f60  20 52 45 4d 20 64 6f 74  74 65 64 20 6c 69 6e 65  | REM dotted line|
00013f70  20 61 6e 64 20 74 69 63  6b 0d 6e 32 4d dc 20 22  | and tick.n2M. "|
00013f80  45 22 2c 20 30 2c 30 2c  20 22 42 22 2c 20 30 2c  |E", 0,0, "B", 0,|
00013f90  30 2c 20 22 46 23 22 2c  30 2c 30 2c 20 22 43 23  |0, "F#",0,0, "C#|
00013fa0  22 2c 30 2c 30 2c 20 22  47 23 22 2c 30 2c 30 2c  |",0,0, "G#",0,0,|
00013fb0  20 22 44 23 22 2c 30 2c  30 2c 20 22 41 23 22 2c  | "D#",0,0, "A#",|
00013fc0  30 2c 30 2c 22 22 0d 6e  3c 11 dc 20 22 4d 61 65  |0,0,"".n<.. "Mae|
00013fd0  73 74 72 6f 22 2c 35 0d  6e 46 1f dc 20 22 49 6e  |stro",5.nF.. "In|
00013fe0  66 6f 22 2c 30 2c 30 2c  20 22 51 75 69 74 22 2c  |fo",0,0, "Quit",|
00013ff0  30 2c 30 2c 22 22 0d 6e  50 08 dc 20 22 22 0d 6e  |0,0,"".nP.. "".n|
00014000  5a 04 0d 6e 64 41 dd 20  a4 46 69 6e 64 4d 65 6e  |Z..ndA. .FindMen|
00014010  75 49 74 65 6d 28 69 74  65 6d 24 2c 20 6d 65 6e  |uItem(item$, men|
00014020  75 25 29 20 3a 20 f4 20  72 65 74 75 72 6e 20 70  |u%) : . return p|
00014030  6f 69 6e 74 65 72 20 74  6f 20 6d 65 6e 75 20 69  |ointer to menu i|
00014040  74 65 6d 0d 6e 6e 11 ea  20 69 74 65 6d 25 2c 74  |tem.nn.. item%,t|
00014050  68 69 73 24 0d 6e 78 13  69 74 65 6d 24 3d c0 69  |his$.nx.item$=.i|
00014060  74 65 6d 24 2c 33 29 0d  6e 82 12 69 74 65 6d 25  |tem$,3).n..item%|
00014070  3d 6d 65 6e 75 25 2b 32  38 0d 6e 8c 19 74 68 69  |=menu%+28.n..thi|
00014080  73 24 3d c0 24 28 69 74  65 6d 25 2b 31 32 29 2c  |s$=.$(item%+12),|
00014090  33 29 0d 6e 96 18 e7 20  28 74 68 69 73 24 20 3c  |3).n... (this$ <|
000140a0  3e 20 69 74 65 6d 24 29  20 8c 0d 6e a0 07 20 20  |> item$) ..n..  |
000140b0  f5 0d 6e aa 11 20 20 20  20 69 74 65 6d 25 2b 3d  |..n..    item%+=|
000140c0  32 34 0d 6e b4 1d 20 20  20 20 74 68 69 73 24 3d  |24.n..    this$=|
000140d0  c0 24 28 69 74 65 6d 25  2b 31 32 29 2c 33 29 0d  |.$(item%+12),3).|
000140e0  6e be 30 20 20 20 20 fd  20 28 20 28 74 68 69 73  |n.0    . ( (this|
000140f0  24 20 3d 20 69 74 65 6d  24 29 20 84 20 28 21 69  |$ = item$) . (!i|
00014100  74 65 6d 25 20 80 20 26  38 30 29 3e 30 20 29 0d  |tem% . &80)>0 ).|
00014110  6e c8 07 20 20 cd 0d 6e  d2 2a e7 20 28 74 68 69  |n..  ..n.*. (thi|
00014120  73 24 20 3c 3e 20 69 74  65 6d 24 29 20 8c 20 3d  |s$ <> item$) . =|
00014130  2d 31 20 3a 20 f4 20 6e  6f 74 20 66 6f 75 6e 64  |-1 : . not found|
00014140  0d 6e dc 0a 3d 69 74 65  6d 25 0d 6e e6 04 0d 6e  |.n..=item%.n...n|
00014150  f0 17 dd 20 a4 69 6e 69  74 69 61 6c 69 73 65 5f  |... .initialise_|
00014160  73 6f 75 6e 64 0d 6e fa  12 ea 20 53 6f 75 6e 64  |sound.n... Sound|
00014170  45 6e 61 62 6c 65 25 0d  6f 04 28 c8 99 20 53 6f  |Enable%.o.(.. So|
00014180  75 6e 64 5f 43 6f 6e 66  69 67 75 72 65 2c 38 20  |und_Configure,8 |
00014190  b8 20 50 72 65 76 43 6f  6e 66 69 67 75 72 65 0d  |. PrevConfigure.|
000141a0  6f 0e 24 c8 99 20 53 6f  75 6e 64 5f 45 6e 61 62  |o.$.. Sound_Enab|
000141b0  6c 65 2c 30 20 b8 20 53  6f 75 6e 64 45 6e 61 62  |le,0 . SoundEnab|
000141c0  6c 65 25 0d 6f 18 21 f4  20 64 69 73 63 6f 6e 6e  |le%.o.!. disconn|
000141d0  65 63 74 20 6d 69 64 69  20 69 6e 74 65 72 70 72  |ect midi interpr|
000141e0  65 74 65 72 0d 6f 22 29  e7 20 4d 49 44 49 70 72  |eter.o"). MIDIpr|
000141f0  65 73 65 6e 74 25 20 c8  99 20 4d 49 44 49 5f 53  |esent% .. MIDI_S|
00014200  6f 75 6e 64 45 6e 61 62  6c 65 25 2c 30 0d 6f 2c  |oundEnable%,0.o,|
00014210  11 3d 53 6f 75 6e 64 45  6e 61 62 6c 65 25 0d 6f  |.=SoundEnable%.o|
00014220  36 04 0d 6f 40 14 dd 20  f2 43 6c 65 61 72 41 6c  |6..o@.. .ClearAl|
00014230  6c 4d 75 73 69 63 0d 6f  4a 14 46 49 4e 45 25 28  |lMusic.oJ.FINE%(|
00014240  29 3d 4d 55 53 49 43 25  28 29 0d 6f 54 1c 50 50  |)=MUSIC%().oT.PP|
00014250  25 3d 4d 55 53 49 43 25  3a 50 25 28 29 3d 4d 55  |%=MUSIC%:P%()=MU|
00014260  53 49 43 25 28 29 0d 6f  5e 1e 4e 42 61 72 73 25  |SIC%().o^.NBars%|
00014270  3d 30 20 3a f4 20 6e 75  6d 62 65 72 20 6f 66 20  |=0 :. number of |
00014280  62 61 72 73 0d 6f 68 1f  42 41 52 25 3d 30 3a f4  |bars.oh.BAR%=0:.|
00014290  20 43 75 72 72 65 6e 74  20 62 61 72 20 6e 75 6d  | Current bar num|
000142a0  62 65 72 0d 6f 72 21 50  42 41 52 25 3d 30 3a f4  |ber.or!PBAR%=0:.|
000142b0  20 50 6c 61 79 69 6e 67  20 62 61 72 20 63 6f 75  | Playing bar cou|
000142c0  6e 74 65 72 0d 6f 7c 22  53 42 41 52 25 3d 30 3a  |nter.o|"SBAR%=0:|
000142d0  f4 20 73 63 72 6f 6c 6c  69 6e 67 20 62 61 72 20  |. scrolling bar |
000142e0  6e 75 6d 62 65 72 0d 6f  86 37 f2 73 74 61 72 74  |number.o.7.start|
000142f0  5f 6d 75 73 69 63 3a f4  20 53 65 74 20 70 6f 69  |_music:. Set poi|
00014300  6e 74 65 72 73 20 74 6f  20 73 74 61 72 74 20 6f  |nters to start o|
00014310  66 20 6d 75 73 69 63 20  73 74 6f 72 65 0d 6f 90  |f music store.o.|
00014320  0b 45 50 25 3d 47 50 25  0d 6f 9a 2d f2 62 61 72  |.EP%=GP%.o.-.bar|
00014330  3a f4 20 4d 75 73 69 63  20 61 6c 77 61 79 73 20  |:. Music always |
00014340  73 74 61 72 74 73 20 6f  66 66 20 77 69 74 68 20  |starts off with |
00014350  61 20 62 61 72 0d 6f a4  29 47 41 54 45 25 3d 4d  |a bar.o.)GATE%=M|
00014360  55 53 49 43 25 2b 32 3a  f4 20 45 6e 64 20 6f 66  |USIC%+2:. End of|
00014370  20 6d 69 6e 69 6d 75 6d  20 73 63 6f 72 65 0d 6f  | minimum score.o|
00014380  ae 2f 50 58 25 28 30 29  3d 30 3a f4 20 53 63 6f  |./PX%(0)=0:. Sco|
00014390  72 65 20 73 74 61 72 74  73 20 61 74 20 6c 65 66  |re starts at lef|
000143a0  74 20 77 69 6e 64 6f 77  20 65 64 67 65 0d 6f b8  |t window edge.o.|
000143b0  10 50 58 6e 25 28 42 41  52 25 29 3d 30 0d 6f c2  |.PXn%(BAR%)=0.o.|
000143c0  1c 50 57 25 28 30 29 3d  34 2a 48 69 25 3a f4 20  |.PW%(0)=4*Hi%:. |
000143d0  42 61 72 20 77 69 64 74  68 0d 6f cc 2c 50 54 59  |Bar width.o.,PTY|
000143e0  50 45 25 28 30 29 3d 42  61 72 25 3a f4 20 53 63  |PE%(0)=Bar%:. Sc|
000143f0  6f 72 65 20 73 74 61 72  74 73 20 77 69 74 68 20  |ore starts with |
00014400  61 20 62 61 72 0d 6f d6  31 47 50 25 3d 4d 55 53  |a bar.o.1GP%=MUS|
00014410  49 43 25 3a f4 20 52 65  73 65 74 20 67 61 74 65  |IC%:. Reset gate|
00014420  20 70 6f 69 6e 74 65 72  20 66 6f 72 20 73 65 74  | pointer for set|
00014430  20 73 63 6f 72 65 0d 6f  e0 12 47 50 6e 25 28 42  | score.o..GPn%(B|
00014440  41 52 25 29 3d 47 50 25  0d 6f ea 0f f2 72 65 73  |AR%)=GP%.o...res|
00014450  63 6f 72 65 28 30 29 0d  6f f4 18 f2 53 65 74 45  |core(0).o...SetE|
00014460  78 74 65 6e 74 28 53 5f  57 69 64 74 68 25 29 0d  |xtent(S_Width%).|
00014470  6f fe 0c f2 72 65 6c 65  61 73 65 0d 70 08 11 77  |o...release.p..w|
00014480  61 73 53 43 4f 52 49 4e  47 25 3d a3 0d 70 12 12  |asSCORING%=..p..|
00014490  73 74 6f 70 53 43 4f 52  49 4e 47 25 3d b9 0d 70  |stopSCORING%=..p|
000144a0  1c 0e 53 43 4f 52 49 4e  47 25 3d a3 0d 70 26 0e  |..SCORING%=..p&.|
000144b0  43 48 41 4e 47 45 44 25  3d a3 0d 70 30 12 24 55  |CHANGED%=..p0.$U|
000144c0  70 64 61 74 65 64 25 3d  22 4e 4f 22 0d 70 3a 1e  |pdated%="NO".p:.|
000144d0  f2 55 70 64 61 74 65 54  69 74 6c 65 28 22 3c 75  |.UpdateTitle("<u|
000144e0  6e 74 69 74 6c 65 64 3e  22 29 0d 70 44 1e 24 53  |ntitled>").pD.$S|
000144f0  61 76 65 54 65 78 74 3d  22 4d 75 73 69 63 46 69  |aveText="MusicFi|
00014500  6c 65 22 2b bd 28 30 29  0d 70 4e 1e 24 4c 6f 61  |le"+.(0).pN.$Loa|
00014510  64 54 65 78 74 3d 22 4d  75 73 69 63 46 69 6c 65  |dText="MusicFile|
00014520  22 2b bd 28 30 29 0d 70  58 2f 6e 3d a4 47 65 74  |"+.(0).pX/n=.Get|
00014530  46 69 6c 65 49 6e 66 6f  28 22 22 29 20 3a f4 20  |FileInfo("") :. |
00014540  63 6c 65 61 72 20 66 69  6c 65 20 69 6e 66 6f 20  |clear file info |
00014550  73 74 75 66 66 0d 70 62  11 24 46 69 6c 65 44 61  |stuff.pb.$FileDa|
00014560  74 65 25 3d 22 22 0d 70  6c 05 e1 0d 70 76 04 0d  |te%="".pl...pv..|
00014570  70 80 23 f4 20 20 20 50  52 4f 43 45 44 55 52 45  |p.#.   PROCEDURE|
00014580  3a 20 69 6e 69 74 69 61  6c 69 73 65 5f 6d 75 73  |: initialise_mus|
00014590  69 63 0d 70 8a 05 f4 0d  70 94 21 f4 20 20 53 54  |ic.p....p.!.  ST|
000145a0  52 55 43 54 55 52 45 53  3a 20 51 75 65 75 65 20  |RUCTURES: Queue |
000145b0  6f 66 20 47 61 74 65 3b  0d 70 9e 22 f4 20 20 20  |of Gate;.p.".   |
000145c0  20 20 20 20 20 20 20 20  20 20 20 51 75 65 75 65  |           Queue|
000145d0  20 6f 66 20 4d 75 73 69  63 3b 0d 70 a8 05 f4 0d  | of Music;.p....|
000145e0  70 b2 2e f4 20 20 20 20  20 20 20 54 59 50 45 53  |p...       TYPES|
000145f0  3a 20 20 47 61 74 65 3d  20 62 79 74 65 30 3e 30  |:  Gate= byte0>0|
00014600  20 2d 3e 20 47 61 74 65  5f 4d 61 73 6b 0d 70 bc  | -> Gate_Mask.p.|
00014610  34 f4 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4.              |
00014620  20 20 20 20 20 20 20 62  79 74 65 30 3d 30 20 2d  |       byte0=0 -|
00014630  3e 20 4d 75 73 69 63 5f  41 74 74 72 69 62 75 74  |> Music_Attribut|
00014640  65 0d 70 c6 05 f4 0d 70  d0 55 f4 20 20 20 20 20  |e.p....p.U.     |
00014650  20 20 20 20 20 47 61 74  65 5f 4d 61 73 6b 3d 20  |     Gate_Mask= |
00014660  62 79 74 65 3b 20 62 69  74 6e 3d 31 20 2d 3e 20  |byte; bitn=1 -> |
00014670  67 61 74 65 20 31 20 6e  6f 74 65 2f 72 65 73 74  |gate 1 note/rest|
00014680  20 66 72 6f 6d 20 6d 75  73 69 63 20 71 75 65 75  | from music queu|
00014690  65 20 6e 20 28 6e 3d 30  2d 37 29 0d 70 da 05 f4  |e n (n=0-7).p...|
000146a0  0d 70 e4 28 f4 20 20 20  20 4d 75 73 69 63 5f 41  |.p.(.    Music_A|
000146b0  74 74 72 69 62 75 74 65  3d 20 77 6f 72 64 3b 20  |ttribute= word; |
000146c0  62 69 74 30 5f 37 3d 30  0d 70 ee 4e f4 20 20 20  |bit0_7=0.p.N.   |
000146d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000146e0  20 20 20 20 20 20 20 20  20 20 62 69 74 38 3d 31  |          bit8=1|
000146f0  20 2d 3e 20 54 69 6d 65  20 73 69 67 6e 61 74 75  | -> Time signatu|
00014700  72 65 20 62 69 74 31 32  5f 39 20 4e 6f 2e 20 62  |re bit12_9 No. b|
00014710  65 61 74 73 2d 31 0d 70  f8 4d f4 20 20 20 20 20  |eats-1.p.M.     |
00014720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00014750  20 62 69 74 31 35 5f 31  33 20 42 65 61 74 20 74  | bit15_13 Beat t|
00014760  79 70 65 0d 71 02 48 f4  20 20 20 20 20 20 20 20  |ype.q.H.        |
00014770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014780  20 20 20 20 20 62 69 74  39 3d 31 20 2d 3e 20 4b  |     bit9=1 -> K|
00014790  65 79 20 73 69 67 6e 61  74 75 72 65 20 62 69 74  |ey signature bit|
000147a0  31 30 20 30 2d 23 2c 20  31 2d 62 0d 71 0c 46 f4  |10 0-#, 1-b.q.F.|
000147b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000147e0  20 20 20 20 20 62 69 74  31 33 5f 31 31 20 30 2d  |     bit13_11 0-|
000147f0  37 0d 71 16 50 f4 20 20  20 20 20 20 20 20 20 20  |7.q.P.          |
00014800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014810  20 20 62 69 74 31 30 3d  31 20 2d 3e 20 43 6c 65  |  bit10=1 -> Cle|
00014820  66 20 62 69 74 31 32 5f  31 31 20 54 72 65 62 6c  |f bit12_11 Trebl|
00014830  65 2c 41 6c 74 6f 2c 54  65 6e 6f 72 2c 42 61 73  |e,Alto,Tenor,Bas|
00014840  73 0d 71 20 43 f4 20 20  20 20 20 20 20 20 20 20  |s.q C.          |
00014850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00014870  20 20 62 69 74 31 35 5f  31 34 20 53 74 61 76 65  |  bit15_14 Stave|
00014880  20 31 2d 34 0d 71 2a 44  f4 20 20 20 20 20 20 20  | 1-4.q*D.       |
00014890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000148a0  20 20 20 20 20 62 69 74  31 31 3d 31 20 2d 3e 20  |     bit11=1 -> |
000148b0  53 6c 75 72 20 73 77 69  74 63 68 20 62 69 74 31  |Slur switch bit1|
000148c0  32 20 6f 6e 2f 6f 66 66  0d 71 34 4a f4 20 20 20  |2 on/off.q4J.   |
000148d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00014900  62 69 74 31 35 5f 31 34  20 53 74 61 76 65 20 31  |bit15_14 Stave 1|
00014910  2d 34 0d 71 3e 4a f4 20  20 20 20 20 20 20 20 20  |-4.q>J.         |
00014920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014930  20 20 20 62 69 74 31 32  3d 31 20 2d 3e 20 4f 63  |   bit12=1 -> Oc|
00014940  74 61 76 65 20 73 68 69  66 74 20 62 69 74 31 33  |tave shift bit13|
00014950  20 30 2d 75 70 2c 31 2d  64 6f 77 6e 0d 71 48 4b  | 0-up,1-down.qHK|
00014960  f4 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00014970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00014990  20 20 20 20 20 62 69 74  31 35 5f 31 34 20 53 74  |     bit15_14 St|
000149a0  61 76 65 20 31 2d 34 0d  71 52 2f f4 20 20 20 20  |ave 1-4.qR/.    |
000149b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000149c0  20 20 20 20 20 20 20 20  62 69 74 31 33 3d 31 20  |        bit13=1 |
000149d0  2d 3e 20 62 61 72 0d 71  5c 35 f4 20 20 20 20 20  |-> bar.q\5.     |
000149e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000149f0  20 20 20 20 28 62 69 74  31 33 5f 30 3d 30 20 2d  |    (bit13_0=0 -|
00014a00  3e 20 52 65 73 65 72 76  65 64 29 0d 71 66 05 f4  |> Reserved).qf..|
00014a10  0d 71 70 30 f4 20 20 20  20 20 20 20 20 20 20 20  |.qp0.           |
00014a20  20 20 20 4d 75 73 69 63  3d 20 77 6f 72 64 3b 20  |   Music= word; |
00014a30  62 69 74 37 5f 33 3e 30  20 2d 3e 20 4e 6f 74 65  |bit7_3>0 -> Note|
00014a40  0d 71 7a 30 f4 20 20 20  20 20 20 20 20 20 20 20  |.qz0.           |
00014a50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014a60  62 69 74 37 5f 33 3d 30  20 2d 3e 20 52 65 73 74  |bit7_3=0 -> Rest|
00014a70  0d 71 84 05 f4 0d 71 8e  47 f4 20 20 20 20 20 20  |.q....q.G.      |
00014a80  20 20 20 20 20 20 20 20  20 4e 6f 74 65 3d 20 77  |         Note= w|
00014a90  6f 72 64 3b 20 62 69 74  30 3d 20 20 20 20 20 53  |ord; bit0=     S|
00014aa0  74 65 6d 20 6f 72 69 65  6e 74 61 74 69 6f 6e 3a  |tem orientation:|
00014ab0  20 30 2d 75 70 2c 31 2d  64 6f 77 6e 0d 71 98 41  | 0-up,1-down.q.A|
00014ac0  f4 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00014ad0  20 20 20 20 20 20 20 20  20 20 20 20 62 69 74 31  |            bit1|
00014ae0  3d 31 20 2d 3e 20 4a 6f  69 6e 20 62 61 72 62 73  |=1 -> Join barbs|
00014af0  20 74 6f 20 6e 65 78 74  20 6e 6f 74 65 0d 71 a2  | to next note.q.|
00014b00  3c f4 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |<.              |
00014b10  20 20 20 20 20 20 20 20  20 20 20 20 20 62 69 74  |             bit|
00014b20  32 3d 31 20 2d 3e 20 54  69 65 20 77 69 74 68 20  |2=1 -> Tie with |
00014b30  6e 65 78 74 20 6e 6f 74  65 0d 71 ac 5b f4 20 20  |next note.q.[.  |
00014b40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014b50  20 20 20 20 20 20 20 62  69 74 37 5f 33 3e 30 20  |       bit7_3>0 |
00014b60  20 20 20 4e 6f 74 65 20  73 74 61 76 65 20 6c 69  |   Note stave li|
00014b70  6e 65 20 70 6f 73 69 74  69 6f 6e 20 31 20 74 6f  |ne position 1 to|
00014b80  20 33 31 20 28 31 36 3d  63 65 6e 74 72 65 20 6c  | 31 (16=centre l|
00014b90  69 6e 65 29 0d 71 b6 45  f4 20 20 20 20 20 20 20  |ine).q.E.       |
00014ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014bb0  20 62 69 74 31 30 5f 38  3e 30 20 2d 3e 20 41 63  | bit10_8>0 -> Ac|
00014bc0  63 69 64 65 6e 74 61 6c  20 4e 2c 23 2c 62 2c 58  |cidental N,#,b,X|
00014bd0  2c 62 62 2c 4e 23 2c 4e  62 0d 71 c0 3f f4 20 20  |,bb,N#,Nb.q.?.  |
00014be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014bf0  20 20 20 20 20 62 69 74  31 32 5f 31 31 3d 20 20  |     bit12_11=  |
00014c00  20 20 20 4e 75 6d 62 65  72 20 6f 66 20 64 6f 74  |   Number of dot|
00014c10  73 20 30 20 74 6f 20 33  0d 71 ca 4d f4 20 20 20  |s 0 to 3.q.M.   |
00014c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014c30  20 20 20 20 62 69 74 31  35 5f 31 33 3d 20 20 20  |    bit15_13=   |
00014c40  20 20 54 79 70 65 3a 20  42 72 65 76 65 20 74 6f  |  Type: Breve to|
00014c50  20 53 65 6d 69 2d 64 65  6d 69 2d 73 65 6d 69 71  | Semi-demi-semiq|
00014c60  75 61 76 65 72 0d 71 d4  05 f4 0d 71 de 51 f4 20  |uaver.q....q.Q. |
00014c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 52 65  |              Re|
00014c80  73 74 3d 20 77 6f 72 64  3b 20 62 69 74 30 3d 30  |st= word; bit0=0|
00014c90  20 20 20 20 4e 42 20 49  66 20 61 20 72 65 73 74  |    NB If a rest|
00014ca0  20 63 6f 69 6e 63 69 64  65 73 20 77 69 74 68 20  | coincides with |
00014cb0  61 20 6e 6f 74 65 2c 20  69 74 73 0d 71 e8 4a f4  |a note, its.q.J.|
00014cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014cd0  20 20 20 20 20 20 20 20  20 20 20 62 69 74 31 3d  |           bit1=|
00014ce0  30 20 20 20 20 20 20 20  70 6f 73 69 74 69 6f 6e  |0       position|
00014cf0  20 69 73 20 64 65 74 65  72 6d 69 6e 65 64 20 62  | is determined b|
00014d00  79 20 74 68 65 0d 71 f2  50 f4 20 20 20 20 20 20  |y the.q.P.      |
00014d10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014d20  20 20 20 20 20 62 69 74  32 3d 30 20 20 20 20 20  |     bit2=0     |
00014d30  20 20 66 6f 6c 6c 6f 77  69 6e 67 20 6e 6f 74 65  |  following note|
00014d40  20 6f 6e 20 74 68 65 20  73 61 6d 65 20 63 68 61  | on the same cha|
00014d50  6e 6e 65 6c 2e 0d 71 fc  26 f4 20 20 20 20 20 20  |nnel..q.&.      |
00014d60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014d70  20 20 20 62 69 74 37 5f  33 3d 30 0d 72 06 26 f4  |   bit7_3=0.r.&.|
00014d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014d90  20 20 20 20 20 20 20 20  62 69 74 31 30 5f 38 3d  |        bit10_8=|
00014da0  30 0d 72 10 3f f4 20 20  20 20 20 20 20 20 20 20  |0.r.?.          |
00014db0  20 20 20 20 20 20 20 20  20 20 20 20 20 62 69 74  |             bit|
00014dc0  31 32 5f 31 31 3d 20 20  20 20 20 4e 75 6d 62 65  |12_11=     Numbe|
00014dd0  72 20 6f 66 20 64 6f 74  73 20 30 20 74 6f 20 33  |r of dots 0 to 3|
00014de0  0d 72 1a 57 f4 20 20 20  20 20 20 20 20 20 20 20  |.r.W.           |
00014df0  20 20 20 20 20 20 20 20  20 20 20 20 62 69 74 31  |            bit1|
00014e00  35 5f 31 33 3d 20 20 20  20 20 54 79 70 65 3a 20  |5_13=     Type: |
00014e10  42 72 65 76 65 20 72 65  73 74 20 74 6f 20 53 65  |Breve rest to Se|
00014e20  6d 69 2d 64 65 6d 69 2d  73 65 6d 69 71 75 61 76  |mi-demi-semiquav|
00014e30  65 72 20 72 65 73 74 0d  72 24 05 f4 0d 72 2e 23  |er rest.r$...r.#|
00014e40  f4 20 20 20 20 20 20 50  6f 73 69 74 69 6f 6e 5f  |.      Position_|
00014e50  74 79 70 65 3d 20 30 20  2d 3e 20 4e 6f 74 65 0d  |type= 0 -> Note.|
00014e60  72 38 2d f4 20 20 20 20  20 20 20 20 20 20 20 20  |r8-.            |
00014e70  20 20 20 20 20 20 20 20  20 31 20 2d 3e 20 54 69  |         1 -> Ti|
00014e80  6d 65 20 53 69 67 6e 61  74 75 72 65 0d 72 42 2c  |me Signature.rB,|
00014e90  f4 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00014ea0  20 20 20 20 20 20 32 20  2d 3e 20 4b 65 79 20 53  |      2 -> Key S|
00014eb0  69 67 6e 61 74 75 72 65  0d 72 4c 23 f4 20 20 20  |ignature.rL#.   |
00014ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014ed0  20 20 33 20 2d 3e 20 43  6c 65 66 0d 72 56 23 f4  |  3 -> Clef.rV#.|
00014ee0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014ef0  20 20 20 20 20 34 20 2d  3e 20 53 6c 75 72 0d 72  |     4 -> Slur.r|
00014f00  60 2b f4 20 20 20 20 20  20 20 20 20 20 20 20 20  |`+.             |
00014f10  20 20 20 20 20 20 20 20  35 20 2d 3e 20 4f 63 74  |        5 -> Oct|
00014f20  61 76 65 20 73 68 69 66  74 0d 72 6a 22 f4 20 20  |ave shift.rj".  |
00014f30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00014f40  20 20 20 36 20 2d 3e 20  42 61 72 0d 72 74 05 3a  |   6 -> Bar.rt.:|
00014f50  0d 72 7e 17 dd 20 f2 69  6e 69 74 69 61 6c 69 73  |.r~.. .initialis|
00014f60  65 5f 6d 75 73 69 63 0d  72 88 19 ea 4e 25 2c 43  |e_music.r...N%,C|
00014f70  25 3a f4 20 4e 6f 74 65  2c 63 68 61 6e 6e 65 6c  |%:. Note,channel|
00014f80  0d 72 92 17 f2 69 6e 69  74 69 61 6c 69 73 65 5f  |.r...initialise_|
00014f90  6f 70 74 69 6f 6e 73 0d  72 9c 5b 4e 6f 74 65 25  |options.r.[Note%|
00014fa0  3d 30 3a 54 69 6d 65 25  3d 31 3a 4b 65 79 25 3d  |=0:Time%=1:Key%=|
00014fb0  32 3a 43 6c 65 66 25 3d  34 3a 53 6c 75 72 25 3d  |2:Clef%=4:Slur%=|
00014fc0  38 3a 4f 63 74 61 76 65  25 3d 31 36 3a 42 61 72  |8:Octave%=16:Bar|
00014fd0  25 3d 33 32 3a f4 20 53  74 61 76 65 20 61 74 74  |%=32:. Stave att|
00014fe0  72 69 62 75 74 65 20 65  6e 75 6d 65 72 61 74 6f  |ribute enumerato|
00014ff0  72 73 0d 72 a6 71 de 20  4e 69 6e 63 25 28 36 29  |rs.r.q. Ninc%(6)|
00015000  2c 4c 69 6e 65 28 34 32  29 2c 41 6f 66 66 28 37  |,Line(42),Aoff(7|
00015010  29 2c 43 6c 65 66 25 28  33 29 2c 4b 65 79 25 28  |),Clef%(3),Key%(|
00015020  36 29 2c 4b 65 79 5f 53  69 67 25 28 31 35 2c 36  |6),Key_Sig%(15,6|
00015030  29 2c 4c 65 6e 67 74 68  25 28 33 31 29 2c 44 75  |),Length%(31),Du|
00015040  72 61 74 69 6f 6e 25 28  4e 54 65 6d 70 6f 73 25  |ration%(NTempos%|
00015050  29 2c 41 63 63 69 64 65  6e 74 61 6c 25 28 33 2c  |),Accidental%(3,|
00015060  33 31 29 0d 72 b0 3d e3  4e 25 3d 30 b8 36 3a 4e  |31).r.=.N%=0.6:N|
00015070  69 6e 63 25 28 4e 25 29  3d 97 c1 22 30 32 34 35  |inc%(N%)=.."0245|
00015080  37 39 3b 22 2c 4e 25 2b  31 29 80 31 35 3a ed 3a  |79;",N%+1).15:.:|
00015090  f4 20 4e 6f 74 65 20 69  6e 63 72 65 6d 65 6e 74  |. Note increment|
000150a0  0d 72 ba 28 ea 53 54 3a  53 54 3d 26 31 30 30 30  |.r.(.ST:ST=&1000|
000150b0  2f 31 32 3a f4 20 53 65  6d 69 74 6f 6e 65 20 69  |/12:. Semitone i|
000150c0  6e 63 72 65 6d 65 6e 74  0d 72 c4 0c e3 4e 25 3d  |ncrement.r...N%=|
000150d0  30 b8 34 32 0d 72 ce 2c  4c 69 6e 65 28 4e 25 29  |0.42.r.,Line(N%)|
000150e0  3d 28 31 2b 4e 25 81 37  3c 3c 31 32 29 2b 4e 69  |=(1+N%.7<<12)+Ni|
000150f0  6e 63 25 28 4e 25 83 37  29 2a 53 54 2b 2e 34 39  |nc%(N%.7)*ST+.49|
00015100  0d 72 d8 45 ed 3a f4 20  4e 6f 74 65 73 20 63 6f  |.r.E.:. Notes co|
00015110  72 72 65 73 70 6f 6e 64  69 6e 67 20 74 6f 20 73  |rresponding to s|
00015120  74 61 76 65 20 6c 69 6e  65 73 20 28 43 20 6f 63  |tave lines (C oc|
00015130  74 61 76 65 20 31 20 54  4f 20 43 20 6f 63 74 61  |tave 1 TO C octa|
00015140  76 65 20 37 29 0d 72 e2  61 41 6f 66 66 28 32 29  |ve 7).r.aAoff(2)|
00015150  3d 53 54 3a 41 6f 66 66  28 33 29 3d 2d 53 54 3a  |=ST:Aoff(3)=-ST:|
00015160  41 6f 66 66 28 34 29 3d  53 54 2a 32 3a 41 6f 66  |Aoff(4)=ST*2:Aof|
00015170  66 28 35 29 3d 2d 53 54  2a 32 3a 41 6f 66 66 28  |f(5)=-ST*2:Aoff(|
00015180  36 29 3d 53 54 3a 41 6f  66 66 28 37 29 3d 2d 53  |6)=ST:Aoff(7)=-S|
00015190  54 3a f4 20 41 63 63 69  64 65 6e 74 61 6c 20 6f  |T:. Accidental o|
000151a0  66 66 73 65 74 73 0d 72  ec 4e 43 6c 65 66 25 28  |ffsets.r.NClef%(|
000151b0  30 29 3d 31 31 3a 43 6c  65 66 25 28 31 29 3d 35  |0)=11:Clef%(1)=5|
000151c0  3a 43 6c 65 66 25 28 32  29 3d 33 3a 43 6c 65 66  |:Clef%(2)=3:Clef|
000151d0  25 28 33 29 3d 2d 31 3a  f4 20 4c 69 6e 65 20 6f  |%(3)=-1:. Line o|
000151e0  66 66 73 65 74 73 20 66  6f 72 20 65 61 63 68 20  |ffsets for each |
000151f0  63 6c 65 66 0d 72 f6 0c  e3 43 25 3d 32 b8 31 35  |clef.r...C%=2.15|
00015200  0d 73 00 13 e3 4e 25 3d  30 b8 28 43 25 3e 3e 31  |.s...N%=0.(C%>>1|
00015210  29 2d 31 0d 73 0a 30 4b  65 79 5f 53 69 67 25 28  |)-1.s.0Key_Sig%(|
00015220  43 25 2c 28 37 2b 4b 65  79 5f 59 25 28 31 2c 43  |C%,(7+Key_Y%(1,C|
00015230  25 80 25 31 2c 4e 25 29  29 83 37 29 3d 43 25 83  |%.%1,N%)).7)=C%.|
00015240  32 2b 32 0d 73 14 05 ed  0d 73 1e 32 ed 3a f4 20  |2+2.s....s.2.:. |
00015250  53 65 74 20 75 70 20 6e  6f 74 65 20 6f 66 66 73  |Set up note offs|
00015260  65 74 73 20 66 6f 72 20  65 61 63 68 20 6b 65 79  |ets for each key|
00015270  20 73 69 67 6e 61 74 75  72 65 0d 73 28 0c e3 43  | signature.s(..C|
00015280  25 3d 30 b8 33 31 0d 73  32 74 4c 65 6e 67 74 68  |%=0.31.s2tLength|
00015290  25 28 43 25 29 3d 28 25  31 3c 3c 37 2d 28 43 25  |%(C%)=(%1<<7-(C%|
000152a0  3e 3e 32 29 29 2a 28 25  31 31 31 31 30 30 30 3e  |>>2))*(%1111000>|
000152b0  3e 28 43 25 80 33 29 80  25 31 31 31 31 29 3a f4  |>(C%.3).%1111):.|
000152c0  20 4c 65 6e 67 74 68 20  6f 66 20 65 61 63 68 20  | Length of each |
000152d0  70 6f 73 73 69 62 6c 65  20 6e 6f 74 65 2f 72 65  |possible note/re|
000152e0  73 74 20 28 64 6f 74 74  65 64 29 20 69 6e 20 74  |st (dotted) in t|
000152f0  65 6d 70 6f 20 62 65 61  74 73 0d 73 3c 05 ed 0d  |empo beats.s<...|
00015300  73 46 12 ea 44 25 3a f4  20 44 75 72 61 74 69 6f  |sF..D%:. Duratio|
00015310  6e 0d 73 50 12 e3 4e 25  3d 30 b8 4e 54 65 6d 70  |n.sP..N%=0.NTemp|
00015320  6f 73 25 0d 73 5a 3b de  20 43 25 20 33 32 3a 44  |os%.sZ;. C% 32:D|
00015330  75 72 61 74 69 6f 6e 25  28 4e 25 29 3d 43 25 3a  |uration%(N%)=C%:|
00015340  f4 20 52 65 73 65 72 76  65 20 73 70 61 63 65 20  |. Reserve space |
00015350  66 6f 72 20 65 61 63 68  20 74 65 6d 70 6f 0d 73  |for each tempo.s|
00015360  64 0c e3 43 25 3d 30 b8  33 31 0d 73 6e 81 44 25  |d..C%=0.31.sn.D%|
00015370  3d 37 35 2f 54 65 6d 70  6f 25 28 4e 25 29 2a 4c  |=75/Tempo%(N%)*L|
00015380  65 6e 67 74 68 25 28 43  25 29 2f 38 2b 2e 35 3a  |ength%(C%)/8+.5:|
00015390  f4 20 44 75 72 61 74 69  6f 6e 73 20 6f 66 20 6e  |. Durations of n|
000153a0  6f 74 65 2b 64 6f 74 20  63 6f 6d 62 69 6e 61 74  |ote+dot combinat|
000153b0  69 6f 6e 73 20 69 6e 20  32 30 74 68 73 20 6f 66  |ions in 20ths of|
000153c0  20 61 20 73 65 63 6f 6e  64 20 66 6f 72 20 65 61  | a second for ea|
000153d0  63 68 20 74 65 6d 70 6f  20 28 4d 61 78 20 32 32  |ch tempo (Max 22|
000153e0  2e 35 20 53 65 63 6f 6e  64 73 29 0d 73 78 46 e7  |.5 Seconds).sxF.|
000153f0  44 25 3e 32 35 34 20 44  25 3d 32 35 34 3a f4 20  |D%>254 D%=254:. |
00015400  4c 69 6d 69 74 20 74 6f  20 6d 61 78 69 6d 75 6d  |Limit to maximum|
00015410  20 70 6f 73 73 69 62 6c  65 20 64 75 72 61 74 69  | possible durati|
00015420  6f 6e 20 28 31 32 2e 37  20 53 65 63 6f 6e 64 73  |on (12.7 Seconds|
00015430  29 0d 73 82 17 44 75 72  61 74 69 6f 6e 25 28 4e  |).s..Duration%(N|
00015440  25 29 3f 43 25 3d 44 25  0d 73 8c 05 ed 0d 73 96  |%)?C%=D%.s....s.|
00015450  05 ed 0d 73 a0 53 54 49  45 25 3d 26 46 46 3a f4  |...s.STIE%=&FF:.|
00015460  20 54 69 65 20 73 74 61  74 65 20 6f 66 20 63 68  | Tie state of ch|
00015470  61 6e 6e 65 6c 73 20 2d  20 45 61 63 68 20 62 69  |annels - Each bi|
00015480  74 20 63 6f 72 72 65 73  70 6f 6e 64 73 20 74 6f  |t corresponds to|
00015490  20 61 20 63 68 61 6e 6e  65 6c 2c 20 30 20 69 66  | a channel, 0 if|
000154a0  20 74 69 65 64 0d 73 aa  3b 53 50 41 43 45 25 3d  | tied.s.;SPACE%=|
000154b0  93 2d e0 20 3a f4 20 66  69 6e 64 20 61 76 61 69  |.-. :. find avai|
000154c0  6c 61 62 6c 65 20 73 70  61 63 65 20 74 6f 20 74  |lable space to t|
000154d0  61 69 6c 6f 72 20 61 6c  6c 6f 63 61 74 69 6f 6e  |ailor allocation|
000154e0  0d 73 b4 4c e7 a4 61 73  73 65 72 74 28 53 50 41  |.s.L..assert(SPA|
000154f0  43 45 25 3e 31 30 32 34  2c 22 4e 6f 74 20 65 6e  |CE%>1024,"Not en|
00015500  6f 75 67 68 20 6d 65 6d  6f 72 79 20 61 76 61 69  |ough memory avai|
00015510  6c 61 62 6c 65 20 66 6f  72 20 6d 75 73 69 63 20  |lable for music |
00015520  73 74 6f 72 61 67 65 2e  22 29 20 fa 0d 73 be 3d  |storage.") ..s.=|
00015530  4d 61 78 5f 47 61 74 65  25 3d 53 50 41 43 45 25  |Max_Gate%=SPACE%|
00015540  2f 31 30 30 20 3a f4 20  6d 61 78 20 6e 6f 2e 20  |/100 :. max no. |
00015550  6f 66 20 67 61 74 65 73  20 28 65 76 65 6e 74 73  |of gates (events|
00015560  2c 20 63 68 6f 72 64 73  29 0d 73 c8 32 4d 61 78  |, chords).s.2Max|
00015570  5f 42 61 72 25 3d 4d 61  78 5f 47 61 74 65 25 2f  |_Bar%=Max_Gate%/|
00015580  34 20 3a f4 20 6d 61 78  69 6d 75 6d 20 6e 75 6d  |4 :. maximum num|
00015590  62 65 72 20 6f 66 20 62  61 72 73 0d 73 d2 30 50  |ber of bars.s.0P|
000155a0  4c 41 59 49 4e 47 25 3d  a3 3a f4 20 46 6c 61 67  |LAYING%=.:. Flag|
000155b0  20 69 6e 64 69 63 61 74  69 6e 67 20 70 6c 61 79  | indicating play|
000155c0  20 69 6e 20 70 72 6f 63  65 73 73 0d 73 dc 3f 53  | in process.s.?S|
000155d0  43 52 4f 4c 4c 49 4e 47  25 3d a3 3a f4 20 46 6c  |CROLLING%=.:. Fl|
000155e0  61 67 20 69 6e 64 69 63  61 74 69 6e 67 20 61 75  |ag indicating au|
000155f0  74 6f 2d 73 63 72 6f 6c  6c 69 6e 67 20 77 68 69  |to-scrolling whi|
00015600  6c 65 20 70 6c 61 79 69  6e 67 0d 73 e6 43 de 20  |le playing.s.C. |
00015610  51 25 28 4d 61 78 5f 53  74 61 76 65 25 2b 32 29  |Q%(Max_Stave%+2)|
00015620  3a f4 20 54 69 6d 65 20  70 6f 73 69 74 69 6f 6e  |:. Time position|
00015630  73 20 6f 66 20 6e 65 78  74 20 6e 6f 74 65 73 20  |s of next notes |
00015640  6f 6e 20 65 61 63 68 20  73 74 61 76 65 0d 73 f0  |on each stave.s.|
00015650  40 de 20 51 49 25 28 4d  61 78 5f 53 74 61 76 65  |@. QI%(Max_Stave|
00015660  25 2b 32 29 3a f4 20 54  69 6d 65 20 69 6e 63 72  |%+2):. Time incr|
00015670  65 6d 65 6e 74 73 20 6f  66 20 51 25 28 29 20 66  |ements of Q%() f|
00015680  6f 72 20 65 61 63 68 20  73 74 61 76 65 0d 73 fa  |or each stave.s.|
00015690  42 42 31 25 3d 30 3a 42  32 25 3d 30 3a f4 20 41  |BB1%=0:B2%=0:. A|
000156a0  6c 74 65 72 6e 61 74 65  20 62 65 61 74 20 63 6f  |lternate beat co|
000156b0  75 6e 74 65 72 73 20 75  73 65 64 20 74 6f 20 64  |unters used to d|
000156c0  65 74 65 63 74 20 7a 65  72 6f 20 77 72 61 70 0d  |etect zero wrap.|
000156d0  74 04 06 3a 3a 0d 74 0e  34 de 20 47 50 6e 25 28  |t..::.t.4. GPn%(|
000156e0  4d 61 78 5f 42 61 72 25  29 20 3a f4 20 47 50 25  |Max_Bar%) :. GP%|
000156f0  20 61 74 20 74 68 65 20  73 74 61 72 74 20 6f 66  | at the start of|
00015700  20 65 61 63 68 20 62 61  72 0d 74 18 61 de 20 50  | each bar.t.a. P|
00015710  58 25 28 4d 61 78 5f 47  61 74 65 25 29 2c 50 57  |X%(Max_Gate%),PW|
00015720  25 28 4d 61 78 5f 47 61  74 65 25 29 2c 50 54 59  |%(Max_Gate%),PTY|
00015730  50 45 25 28 4d 61 78 5f  47 61 74 65 25 29 3a f4  |PE%(Max_Gate%):.|
00015740  20 4e 6f 74 61 74 69 6f  6e 20 73 63 72 65 65 6e  | Notation screen|
00015750  20 70 6f 73 69 74 69 6f  6e 73 2c 20 77 69 64 74  | positions, widt|
00015760  68 73 20 26 20 74 79 70  65 73 0d 74 22 66 f4 20  |hs & types.t"f. |
00015770  50 58 25 20 69 73 20 50  58 25 28 29 20 69 6e 64  |PX% is PX%() ind|
00015780  65 78 20 74 6f 20 73 63  72 65 65 6e 20 70 6f 73  |ex to screen pos|
00015790  69 74 69 6f 6e 73 20 26  20 74 79 70 65 73 20 2d  |itions & types -|
000157a0  20 41 6c 77 61 79 73 20  72 65 66 65 72 73 20 74  | Always refers t|
000157b0  6f 20 74 68 65 20 6e 6f  74 65 2f 61 74 74 72 69  |o the note/attri|
000157c0  62 75 74 65 20 6a 75 73  74 20 70 61 73 73 65 64  |bute just passed|
000157d0  0d 74 2c 30 de 20 50 58  6e 25 28 4d 61 78 5f 42  |.t,0. PXn%(Max_B|
000157e0  61 72 25 29 20 3a f4 20  50 58 25 20 61 74 20 73  |ar%) :. PX% at s|
000157f0  74 61 72 74 20 6f 66 20  65 61 63 68 20 62 61 72  |tart of each bar|
00015800  0d 74 36 4c de 20 42 50  6e 25 28 37 2c 4d 61 78  |.t6L. BPn%(7,Max|
00015810  5f 42 61 72 25 29 3a f4  20 49 6e 64 69 63 65 73  |_Bar%):. Indices|
00015820  20 74 6f 20 28 38 29 20  6e 6f 74 65 20 71 75 65  | to (8) note que|
00015830  75 65 73 20 61 74 20 74  68 65 20 73 74 61 72 74  |ues at the start|
00015840  20 6f 66 20 65 61 63 68  20 62 61 72 0d 74 40 3c  | of each bar.t@<|
00015850  de 20 4d 55 53 49 43 25  28 37 29 2c 46 49 4e 45  |. MUSIC%(7),FINE|
00015860  25 28 37 29 3a f4 20 50  6f 69 6e 74 65 72 73 20  |%(7):. Pointers |
00015870  64 65 6c 69 6d 69 74 69  6e 67 20 6d 75 73 69 63  |delimiting music|
00015880  20 73 74 6f 72 61 67 65  0d 74 4a 4b de 20 4e 25  | storage.tJK. N%|
00015890  28 37 29 2c 6e 25 28 37  29 3a f4 20 50 6f 69 6e  |(7),n%(7):. Poin|
000158a0  74 65 72 73 20 74 6f 20  63 75 72 72 65 6e 74 20  |ters to current |
000158b0  6e 6f 74 65 73 20 28 6e  25 28 29 3d 63 6f 70 79  |notes (n%()=copy|
000158c0  2c 20 63 66 20 50 52 4f  43 70 72 6f 78 69 6d 61  |, cf PROCproxima|
000158d0  74 65 29 0d 74 54 3c de  20 43 25 28 37 29 2c 63  |te).tT<. C%(7),c|
000158e0  25 28 37 29 3a f4 20 49  6e 64 65 78 65 73 20 6f  |%(7):. Indexes o|
000158f0  66 20 67 61 74 65 20 63  68 61 6e 6e 65 6c 73 20  |f gate channels |
00015900  75 73 65 64 20 69 6e 20  73 6f 72 74 69 6e 67 0d  |used in sorting.|
00015910  74 5e 54 de 20 43 4c 45  46 25 28 4d 61 78 5f 53  |t^T. CLEF%(Max_S|
00015920  74 61 76 65 25 29 2c 63  6c 65 66 25 28 4d 61 78  |tave%),clef%(Max|
00015930  5f 53 74 61 76 65 25 29  3a f4 20 43 75 72 72 65  |_Stave%):. Curre|
00015940  6e 74 20 63 6c 65 66 20  6f 6e 20 65 61 63 68 20  |nt clef on each |
00015950  73 74 61 76 65 20 28 26  20 63 6c 65 66 20 63 6f  |stave (& clef co|
00015960  70 79 29 0d 74 68 3f de  20 43 4c 45 46 6e 25 28  |py).th?. CLEFn%(|
00015970  4d 61 78 5f 53 74 61 76  65 25 2c 4d 61 78 5f 42  |Max_Stave%,Max_B|
00015980  61 72 25 29 20 3a f4 20  43 4c 45 46 25 20 61 74  |ar%) :. CLEF% at|
00015990  20 73 74 61 72 74 20 6f  66 20 65 61 63 68 20 62  | start of each b|
000159a0  61 72 0d 74 72 42 de 20  53 49 47 25 28 31 29 2c  |ar.trB. SIG%(1),|
000159b0  73 69 67 25 28 31 29 3a  f4 20 42 61 73 65 20 62  |sig%(1):. Base b|
000159c0  61 72 20 6b 65 79 20 26  20 74 69 6d 65 20 73 69  |ar key & time si|
000159d0  67 73 2c 20 63 75 72 72  65 6e 74 20 61 6e 64 20  |gs, current and |
000159e0  63 6f 70 79 0d 74 7c 38  de 20 53 49 47 6e 25 28  |copy.t|8. SIGn%(|
000159f0  31 2c 4d 61 78 5f 42 61  72 25 29 20 3a f4 20 53  |1,Max_Bar%) :. S|
00015a00  49 47 25 20 61 74 20 74  68 65 20 73 74 61 72 74  |IG% at the start|
00015a10  20 6f 66 20 65 61 63 68  20 62 61 72 0d 74 86 33  | of each bar.t.3|
00015a20  de 20 50 25 28 37 29 2c  50 43 4c 45 46 25 28 33  |. P%(7),PCLEF%(3|
00015a30  29 3a f4 20 50 6c 61 79  69 6e 67 20 6e 6f 74 65  |):. Playing note|
00015a40  20 70 6f 69 6e 74 65 72  73 2c 20 63 6c 65 66 0d  | pointers, clef.|
00015a50  74 90 16 4d 61 78 4e 6f  74 65 73 49 6e 42 61 72  |t..MaxNotesInBar|
00015a60  25 3d 31 32 38 0d 74 9a  5b f4 20 77 68 69 6c 65  |%=128.t.[. while|
00015a70  20 6f 6e 65 20 68 61 6c  66 20 6f 66 20 64 72 61  | one half of dra|
00015a80  77 20 71 20 69 73 20 62  65 69 6e 67 20 66 69 6c  |w q is being fil|
00015a90  6c 65 64 2c 20 74 68 65  20 6f 74 68 65 72 20 68  |led, the other h|
00015aa0  61 6c 66 20 69 73 20 62  65 69 6e 67 20 75 73 65  |alf is being use|
00015ab0  64 20 66 6f 72 20 73 63  72 6f 6c 6c 69 6e 67 2e  |d for scrolling.|
00015ac0  0d 74 a4 08 ea 20 6e 25  0d 74 ae 17 6e 25 3d 4d  |.t... n%.t..n%=M|
00015ad0  61 78 4e 6f 74 65 73 49  6e 42 61 72 25 2a 34 0d  |axNotesInBar%*4.|
00015ae0  74 b8 5f de 20 4d 49 44  49 5f 4f 46 46 25 28 31  |t._. MIDI_OFF%(1|
00015af0  2c 6e 25 29 20 3a f4 20  61 6e 20 61 72 72 61 79  |,n%) :. an array|
00015b00  20 6f 66 20 4d 49 44 49  20 6e 6f 74 65 6f 66 66  | of MIDI noteoff|
00015b10  73 20 69 66 20 70 6c 61  79 69 6e 67 20 69 73 20  |s if playing is |
00015b20  73 74 6f 70 70 65 64 20  69 6e 20 74 68 65 20 6d  |stopped in the m|
00015b30  69 64 64 6c 65 20 6f 66  20 61 20 62 61 72 0d 74  |iddle of a bar.t|
00015b40  c2 15 4d 49 44 49 5f 4f  46 46 25 28 30 2c 30 29  |..MIDI_OFF%(0,0)|
00015b50  3d 2d 31 0d 74 cc 15 4d  49 44 49 5f 4f 46 46 25  |=-1.t..MIDI_OFF%|
00015b60  28 31 2c 30 29 3d 2d 31  0d 74 d6 13 4d 49 44 49  |(1,0)=-1.t..MIDI|
00015b70  5f 4e 6f 74 65 6e 75 6d  25 3d 30 0d 74 e0 0e 53  |_Notenum%=0.t..S|
00015b80  50 41 43 45 25 3d 93 2d  e0 0d 74 ea 41 53 50 41  |PACE%=.-..t.ASPA|
00015b90  43 45 25 2d 3d 26 34 30  30 30 3a f4 20 4c 65 61  |CE%-=&4000:. Lea|
00015ba0  76 65 20 61 20 66 65 77  20 4b 20 66 6f 72 20 74  |ve a few K for t|
00015bb0  68 65 20 70 72 6f 67 72  61 6d 20 61 6e 64 20 42  |he program and B|
00015bc0  61 73 69 63 20 73 74 61  63 6b 0d 74 f4 4c e7 a4  |asic stack.t.L..|
00015bd0  61 73 73 65 72 74 28 53  50 41 43 45 25 3e 31 30  |assert(SPACE%>10|
00015be0  32 34 2c 22 4e 6f 74 20  65 6e 6f 75 67 68 20 6d  |24,"Not enough m|
00015bf0  65 6d 6f 72 79 20 61 76  61 69 6c 61 62 6c 65 20  |emory available |
00015c00  66 6f 72 20 6d 75 73 69  63 20 73 74 6f 72 61 67  |for music storag|
00015c10  65 2e 22 29 20 fa 0d 74  fe 56 de 20 4d 55 53 49  |e.") ..t.V. MUSI|
00015c20  43 25 20 53 50 41 43 45  25 2b 38 3a f4 20 41 6c  |C% SPACE%+8:. Al|
00015c30  6c 6f 63 61 74 65 20 6d  61 69 6e 20 6d 75 73 69  |locate main musi|
00015c40  63 20 73 70 61 63 65 20  28 2b 38 3a 20 45 78 74  |c space (+8: Ext|
00015c50  72 61 20 62 79 74 65 73  20 69 6e 20 63 61 73 65  |ra bytes in case|
00015c60  20 6f 66 20 6f 76 65 72  72 75 6e 29 0d 75 08 2d  | of overrun).u.-|
00015c70  46 49 4e 45 25 3d 4d 55  53 49 43 25 2b 53 50 41  |FINE%=MUSIC%+SPA|
00015c80  43 45 25 3a f4 20 45 6e  64 20 6f 66 20 6d 75 73  |CE%:. End of mus|
00015c90  69 63 20 6d 65 6d 6f 72  79 0d 75 12 2c 47 41 54  |ic memory.u.,GAT|
00015ca0  45 25 3d 4d 55 53 49 43  25 3a f4 20 4e 6f 20 67  |E%=MUSIC%:. No g|
00015cb0  61 74 65 20 73 70 61 63  65 20 75 73 65 64 20 61  |ate space used a|
00015cc0  73 20 79 65 74 0d 75 1c  0b e3 43 25 3d 30 b8 37  |s yet.u...C%=0.7|
00015cd0  0d 75 26 25 4d 55 53 49  43 25 28 43 25 29 3d 4d  |.u&%MUSIC%(C%)=M|
00015ce0  55 53 49 43 25 2b 28 43  25 2b 31 29 2a 53 50 41  |USIC%+(C%+1)*SPA|
00015cf0  43 45 25 2f 39 0d 75 30  3e ed 3a f4 20 53 68 61  |CE%/9.u0>.:. Sha|
00015d00  72 65 20 6f 75 74 20 73  74 6f 72 61 67 65 20 28  |re out storage (|
00015d10  4e 42 20 4e 6f 20 62 6f  75 6e 64 73 20 63 68 65  |NB No bounds che|
00015d20  63 6b 69 6e 67 20 65 76  65 72 20 6f 63 63 75 72  |cking ever occur|
00015d30  73 21 29 0d 75 3a 2b 46  49 4e 45 25 28 29 3d 4d  |s!).u:+FINE%()=M|
00015d40  55 53 49 43 25 28 29 3a  f4 20 4e 6f 20 6d 75 73  |USIC%():. No mus|
00015d50  69 63 20 64 65 66 69 6e  65 64 20 79 65 74 0d 75  |ic defined yet.u|
00015d60  44 3b 50 67 61 70 25 3d  58 25 28 32 29 81 32 2b  |D;Pgap%=X%(2).2+|
00015d70  31 3a f4 20 53 79 6d 62  6f 6c 20 73 70 61 63 69  |1:. Symbol spaci|
00015d80  6e 67 20 28 68 61 6c 66  20 6e 6f 74 65 20 62 6c  |ng (half note bl|
00015d90  6f 62 20 77 69 64 74 68  29 0d 75 4e 05 3a 0d 75  |ob width).uN.:.u|
00015da0  58 1c f4 20 4e 6f 77 20  73 65 74 20 75 70 20 62  |X.. Now set up b|
00015db0  61 73 69 63 20 73 63 6f  72 65 0d 75 62 12 f2 43  |asic score.ub..C|
00015dc0  6c 65 61 72 41 6c 6c 4d  75 73 69 63 0d 75 6c 05  |learAllMusic.ul.|
00015dd0  e1 0d 75 76 04 0d 75 80  19 dd 20 f2 69 6e 69 74  |..uv..u... .init|
00015de0  69 61 6c 69 73 65 5f 6f  70 74 69 6f 6e 73 0d 75  |ialise_options.u|
00015df0  8a 0a ea 4e 25 2c 43 25  0d 75 94 0f 4e 54 65 6d  |...N%,C%.u..NTem|
00015e00  70 6f 73 25 3d 31 34 0d  75 9e 16 de 20 54 65 6d  |pos%=14.u... Tem|
00015e10  70 6f 25 28 4e 54 65 6d  70 6f 73 25 29 0d 75 a8  |po%(NTempos%).u.|
00015e20  10 54 65 6d 70 6f 25 28  30 29 3d 34 30 0d 75 b2  |.Tempo%(0)=40.u.|
00015e30  10 54 65 6d 70 6f 25 28  31 29 3d 35 30 0d 75 bc  |.Tempo%(1)=50.u.|
00015e40  10 54 65 6d 70 6f 25 28  32 29 3d 36 30 0d 75 c6  |.Tempo%(2)=60.u.|
00015e50  10 54 65 6d 70 6f 25 28  33 29 3d 36 35 0d 75 d0  |.Tempo%(3)=65.u.|
00015e60  10 54 65 6d 70 6f 25 28  34 29 3d 37 30 0d 75 da  |.Tempo%(4)=70.u.|
00015e70  10 54 65 6d 70 6f 25 28  35 29 3d 38 30 0d 75 e4  |.Tempo%(5)=80.u.|
00015e80  10 54 65 6d 70 6f 25 28  36 29 3d 39 30 0d 75 ee  |.Tempo%(6)=90.u.|
00015e90  11 54 65 6d 70 6f 25 28  37 29 3d 31 30 30 0d 75  |.Tempo%(7)=100.u|
00015ea0  f8 11 54 65 6d 70 6f 25  28 38 29 3d 31 31 35 0d  |..Tempo%(8)=115.|
00015eb0  76 02 11 54 65 6d 70 6f  25 28 39 29 3d 31 33 30  |v..Tempo%(9)=130|
00015ec0  0d 76 0c 12 54 65 6d 70  6f 25 28 31 30 29 3d 31  |.v..Tempo%(10)=1|
00015ed0  34 35 0d 76 16 12 54 65  6d 70 6f 25 28 31 31 29  |45.v..Tempo%(11)|
00015ee0  3d 31 36 30 0d 76 20 12  54 65 6d 70 6f 25 28 31  |=160.v .Tempo%(1|
00015ef0  32 29 3d 31 37 35 0d 76  2a 12 54 65 6d 70 6f 25  |2)=175.v*.Tempo%|
00015f00  28 31 33 29 3d 31 39 30  0d 76 34 12 54 65 6d 70  |(13)=190.v4.Temp|
00015f10  6f 25 28 31 34 29 3d 32  31 30 0d 76 3e 04 0d 76  |o%(14)=210.v>..v|
00015f20  48 4b de 20 54 49 4d 45  5f 53 49 47 25 28 31 29  |HK. TIME_SIG%(1)|
00015f30  3a f4 20 43 75 72 72 65  6e 74 20 74 69 6d 65 20  |:. Current time |
00015f40  73 69 67 6e 61 74 75 72  65 20 6e 75 6d 65 72 61  |signature numera|
00015f50  74 6f 72 28 30 29 20 61  6e 64 20 64 65 6e 6f 6d  |tor(0) and denom|
00015f60  69 6e 61 74 6f 72 28 31  29 0d 76 52 2e 54 49 4d  |inator(1).vR.TIM|
00015f70  45 5f 53 49 47 25 28 29  3d 33 3a f4 20 34 2f 34  |E_SIG%()=3:. 4/4|
00015f80  20 74 69 6d 65 20 28 3d  20 28 6e 2b 31 29 2f 32  | time (= (n+1)/2|
00015f90  5e 28 64 2d 31 29 29 0d  76 5c 04 0d 76 66 29 de  |^(d-1)).v\..vf).|
00015fa0  20 4b 45 59 5f 53 49 47  25 28 31 29 3a f4 20 43  | KEY_SIG%(1):. C|
00015fb0  75 72 72 65 6e 74 20 6b  65 79 20 73 69 67 6e 61  |urrent key signa|
00015fc0  74 75 72 65 0d 76 70 47  de 20 4b 65 79 5f 59 25  |ture.vpG. Key_Y%|
00015fd0  28 33 2c 31 2c 36 29 3a  f4 20 4b 65 79 20 73 69  |(3,1,6):. Key si|
00015fe0  67 6e 61 74 75 72 65 20  30 2d 73 68 61 72 70 2f  |gnature 0-sharp/|
00015ff0  31 2d 66 6c 61 74 20 73  74 61 76 65 20 6c 69 6e  |1-flat stave lin|
00016000  65 20 70 6f 73 69 74 69  6f 6e 73 0d 76 7a 18 ea  |e positions.vz..|
00016010  20 43 25 2c 41 25 2c 50  25 3a f4 20 49 6e 64 69  | C%,A%,P%:. Indi|
00016020  63 65 73 0d 76 84 1e e3  20 43 25 3d 30 20 b8 20  |ces.v... C%=0 . |
00016030  33 3a f4 20 46 6f 72 20  65 61 63 68 20 63 6c 65  |3:. For each cle|
00016040  66 0d 76 8e 29 e3 20 41  25 3d 30 20 b8 20 31 3a  |f.v.). A%=0 . 1:|
00016050  f4 20 46 6f 72 20 65 61  63 68 20 61 63 63 69 64  |. For each accid|
00016060  65 6e 74 61 6c 20 74 79  70 65 0d 76 98 2d e3 20  |ental type.v.-. |
00016070  50 25 3d 30 20 b8 20 36  3a f4 20 46 6f 72 20 65  |P%=0 . 6:. For e|
00016080  61 63 68 20 61 63 63 69  64 65 6e 74 61 6c 20 70  |ach accidental p|
00016090  6f 73 69 74 69 6f 6e 0d  76 a2 5a 4b 65 79 5f 59  |osition.v.ZKey_Y|
000160a0  25 28 43 25 2c 31 2d 41  25 2c 50 25 29 3d 33 2a  |%(C%,1-A%,P%)=3*|
000160b0  28 50 25 80 25 31 29 2d  50 25 81 32 2b 28 50 25  |(P%.%1)-P%.2+(P%|
000160c0  2d 33 29 2a 41 25 2b 28  41 25 80 43 25 3c 3e 32  |-3)*A%+(A%.C%<>2|
000160d0  80 28 50 25 80 35 29 3d  30 29 2a 37 2d 31 2d 28  |.(P%.5)=0)*7-1-(|
000160e0  43 25 2d 31 3e 3e 31 29  2d 32 2a 28 43 25 3d 32  |C%-1>>1)-2*(C%=2|
000160f0  29 0d 76 ac 4a f4 20 50  6f 73 69 74 69 6f 6e 20  |).v.J. Position |
00016100  6f 66 66 73 65 74 73 20  6f 66 20 6b 65 79 20 73  |offsets of key s|
00016110  69 67 6e 61 74 75 72 65  20 61 63 63 69 64 65 6e  |ignature acciden|
00016120  74 61 6c 73 20 66 72 6f  6d 20 63 65 6e 74 72 65  |tals from centre|
00016130  20 73 74 61 76 65 20 6c  69 6e 65 0d 76 b6 05 ed  | stave line.v...|
00016140  0d 76 c0 05 ed 0d 76 ca  05 ed 0d 76 d4 11 4b 45  |.v....v....v..KE|
00016150  59 5f 53 49 47 25 28 30  29 3d 31 0d 76 de 11 4b  |Y_SIG%(0)=1.v..K|
00016160  45 59 5f 53 49 47 25 28  31 29 3d 30 0d 76 e8 0b  |EY_SIG%(1)=0.v..|
00016170  ea 20 69 74 65 6d 25 0d  76 f2 10 4d 61 78 5f 53  |. item%.v..Max_S|
00016180  74 61 76 65 25 3d 33 0d  76 fc 0d 4c 69 25 3d 32  |tave%=3.v..Li%=2|
00016190  2a 56 69 25 0d 77 06 17  53 74 61 76 65 5f 48 65  |*Vi%.w..Stave_He|
000161a0  69 67 68 74 25 3d 4c 69  25 2a 38 0d 77 10 1c de  |ight%=Li%*8.w...|
000161b0  20 59 5f 53 54 41 56 45  25 28 4d 61 78 5f 53 74  | Y_STAVE%(Max_St|
000161c0  61 76 65 25 2b 32 29 0d  77 1a 1f 53 54 41 56 45  |ave%+2).w..STAVE|
000161d0  25 3d 30 20 20 20 3a f4  20 6d 65 61 6e 73 20 31  |%=0   :. means 1|
000161e0  20 73 74 61 76 65 0d 77  24 25 50 45 52 43 25 3d  | stave.w$%PERC%=|
000161f0  30 20 20 20 20 3a f4 20  6d 65 61 6e 73 20 6e 6f  |0    :. means no|
00016200  20 70 65 72 63 75 73 73  69 6f 6e 0d 77 2e 19 53  | percussion.w..S|
00016210  63 6f 72 65 5f 57 69 64  74 68 25 3d 53 5f 57 69  |core_Width%=S_Wi|
00016220  64 74 68 25 0d 77 38 14  f2 70 6f 73 69 74 69 6f  |dth%.w8..positio|
00016230  6e 5f 73 74 61 76 65 73  0d 77 42 04 0d 77 4c 0f  |n_staves.wB..wL.|
00016240  4e 56 6f 6c 75 6d 65 73  25 3d 37 0d 77 56 24 de  |NVolumes%=7.wV$.|
00016250  20 56 6f 6c 75 6d 65 25  28 4e 56 6f 6c 75 6d 65  | Volume%(NVolume|
00016260  73 25 29 2c 56 6f 6c 75  6d 65 73 25 28 37 29 0d  |s%),Volumes%(7).|
00016270  77 60 13 e3 52 25 3d 30  b8 4e 56 6f 6c 75 6d 65  |w`..R%=0.NVolume|
00016280  73 25 0d 77 6a 64 56 6f  6c 75 6d 65 25 28 52 25  |s%.wjdVolume%(R%|
00016290  29 3d 28 52 25 2b 31 29  2a 31 32 30 2f 28 4e 56  |)=(R%+1)*120/(NV|
000162a0  6f 6c 75 6d 65 73 25 2b  31 29 2d 31 20 3a f4 20  |olumes%+1)-1 :. |
000162b0  64 6f 6e 27 74 20 70 65  72 6d 69 74 20 66 75 6c  |don't permit ful|
000162c0  6c 20 76 6f 6c 75 6d 65  20 73 6f 20 74 68 61 74  |l volume so that|
000162d0  20 64 79 6e 61 6d 69 63  73 20 61 72 65 20 70 6f  | dynamics are po|
000162e0  73 73 69 62 6c 65 0d 77  74 05 ed 0d 77 7e 18 c8  |ssible.wt...w~..|
000162f0  99 20 53 6f 75 6e 64 5f  56 6f 6c 75 6d 65 20 b8  |. Sound_Volume .|
00016300  20 52 25 0d 77 88 14 52  65 73 74 6f 72 65 56 6f  | R%.w..RestoreVo|
00016310  6c 75 6d 65 3d 52 25 0d  77 92 73 56 6f 6c 75 6d  |lume=R%.w.sVolum|
00016320  65 25 3d 52 25 2a 28 4e  56 6f 6c 75 6d 65 73 25  |e%=R%*(NVolumes%|
00016330  2b 31 29 2f 31 32 30 2d  2e 35 3a e7 56 6f 6c 75  |+1)/120-.5:.Volu|
00016340  6d 65 25 3c 30 20 56 6f  6c 75 6d 65 25 3d 30 20  |me%<0 Volume%=0 |
00016350  3a f4 20 64 6f 6e 27 74  20 70 65 72 6d 69 74 20  |:. don't permit |
00016360  66 75 6c 6c 20 76 6f 6c  75 6d 65 2e 20 54 68 69  |full volume. Thi|
00016370  73 20 69 73 20 72 65 73  65 72 76 65 64 20 66 6f  |s is reserved fo|
00016380  72 20 64 79 6e 61 6d 69  63 73 0d 77 9c 24 c8 99  |r dynamics.w.$..|
00016390  20 53 6f 75 6e 64 5f 56  6f 6c 75 6d 65 2c 56 6f  | Sound_Volume,Vo|
000163a0  6c 75 6d 65 25 28 56 6f  6c 75 6d 65 25 29 0d 77  |lume%(Volume%).w|
000163b0  a6 1c e3 52 25 3d 30 b8  37 3a 56 6f 6c 75 6d 65  |...R%=0.7:Volume|
000163c0  73 25 28 52 25 29 3d 36  3a ed 0d 77 b0 04 0d 77  |s%(R%)=6:..w...w|
000163d0  ba 07 ea 53 25 0d 77 c4  69 de 20 53 74 61 76 65  |...S%.w.i. Stave|
000163e0  5f 43 68 61 6e 6e 65 6c  73 25 28 4d 61 78 5f 53  |_Channels%(Max_S|
000163f0  74 61 76 65 25 2b 32 2c  37 29 3a f4 20 50 72 69  |tave%+2,7):. Pri|
00016400  6d 61 72 79 20 73 74 61  76 65 20 61 6c 6c 6f 63  |mary stave alloc|
00016410  61 74 69 6f 6e 20 6f 66  20 63 68 61 6e 6e 65 6c  |ation of channel|
00016420  73 20 30 2d 37 20 66 6f  72 20 65 61 63 68 20 73  |s 0-7 for each s|
00016430  74 61 76 65 20 73 74 72  75 63 74 75 72 65 0d 77  |tave structure.w|
00016440  ce 17 e3 20 53 25 3d 30  20 b8 20 4d 61 78 5f 53  |... S%=0 . Max_S|
00016450  74 61 76 65 25 0d 77 d8  0e e3 20 52 25 3d 30 20  |tave%.w... R%=0 |
00016460  b8 20 37 0d 77 e2 46 53  74 61 76 65 5f 43 68 61  |. 7.w.FStave_Cha|
00016470  6e 6e 65 6c 73 25 28 53  25 2c 52 25 29 3d 28 53  |nnels%(S%,R%)=(S|
00016480  25 2b 31 29 2a 52 25 81  38 3a f4 20 43 6c 6f 73  |%+1)*R%.8:. Clos|
00016490  65 20 66 6f 72 6d 75 6c  61 20 74 6f 20 64 65 73  |e formula to des|
000164a0  69 72 65 64 20 64 61 74  61 0d 77 ec 05 ed 0d 77  |ired data.w....w|
000164b0  f6 05 ed 0d 78 00 1a 53  74 61 76 65 5f 43 68 61  |....x..Stave_Cha|
000164c0  6e 6e 65 6c 73 25 28 32  2c 31 29 3d 31 0d 78 0a  |nnels%(2,1)=1.x.|
000164d0  1a 53 74 61 76 65 5f 43  68 61 6e 6e 65 6c 73 25  |.Stave_Channels%|
000164e0  28 32 2c 32 29 3d 31 0d  78 14 3e 53 74 61 76 65  |(2,2)=1.x.>Stave|
000164f0  5f 43 68 61 6e 6e 65 6c  73 25 28 32 2c 35 29 3d  |_Channels%(2,5)=|
00016500  32 3a f4 20 43 6f 72 72  65 63 74 20 74 68 65 20  |2:. Correct the |
00016510  65 78 63 65 70 74 69 6f  6e 73 20 74 6f 20 66 6f  |exceptions to fo|
00016520  72 6d 75 6c 61 0d 78 1e  28 de 20 53 5f 43 25 28  |rmula.x.(. S_C%(|
00016530  37 29 3a f4 20 43 75 72  72 65 6e 74 20 73 74 61  |7):. Current sta|
00016540  76 65 20 61 6c 6c 6f 63  61 74 69 6f 6e 0d 78 28  |ve allocation.x(|
00016550  0b e3 52 25 3d 30 b8 37  0d 78 32 79 53 5f 43 25  |..R%=0.7.x2yS_C%|
00016560  28 52 25 29 3d 53 74 61  76 65 5f 43 68 61 6e 6e  |(R%)=Stave_Chann|
00016570  65 6c 73 25 28 53 54 41  56 45 25 2c 52 25 29 3a  |els%(STAVE%,R%):|
00016580  f4 20 49 6e 69 74 69 61  6c 69 73 65 20 63 68 61  |. Initialise cha|
00016590  6e 6e 65 6c 20 61 6c 6c  6f 63 61 74 69 6f 6e 20  |nnel allocation |
000165a0  28 41 6c 73 6f 20 72 65  73 65 74 20 65 61 63 68  |(Also reset each|
000165b0  20 74 69 6d 65 20 73 74  61 76 65 20 73 74 72 75  | time stave stru|
000165c0  63 74 75 72 65 20 69 73  20 63 68 61 6e 67 65 64  |cture is changed|
000165d0  29 0d 78 3c 05 ed 0d 78  46 3a 3a f4 20 4e 6f 77  |).x<...xF::. Now|
000165e0  20 67 65 74 20 6e 61 6d  65 73 20 61 6e 64 20 63  | get names and c|
000165f0  68 61 6e 6e 65 6c 20 61  6c 6c 6f 63 61 74 69 6f  |hannel allocatio|
00016600  6e 20 6f 66 20 69 6e 73  74 72 75 6d 65 6e 74 73  |n of instruments|
00016610  0d 78 50 53 ea 49 24 2c  4c 25 2c 4d 25 3a f4 20  |.xPS.I$,L%,M%:. |
00016620  49 6e 73 74 72 75 6d 65  6e 74 20 6e 61 6d 65 2c  |Instrument name,|
00016630  20 4e 75 6d 62 65 72 20  6f 66 20 69 6e 73 74 72  | Number of instr|
00016640  75 6d 65 6e 74 73 2c 20  49 6e 73 74 72 75 6d 65  |uments, Instrume|
00016650  6e 74 20 6e 61 6d 65 20  6c 65 6e 67 74 68 2c 20  |nt name length, |
00016660  4d 61 78 0d 78 5a 12 4d  41 58 5f 56 6f 69 63 65  |Max.xZ.MAX_Voice|
00016670  73 25 3d 32 30 0d 78 64  30 de 20 56 6f 69 63 65  |s%=20.xd0. Voice|
00016680  24 28 32 30 29 3a f4 20  49 6e 73 74 72 75 6d 65  |$(20):. Instrume|
00016690  6e 74 20 76 6f 69 63 65  20 64 65 73 63 72 69 70  |nt voice descrip|
000166a0  74 69 6f 6e 73 0d 78 6e  16 de 20 52 65 73 74 6f  |tions.xn.. Resto|
000166b0  72 65 56 6f 69 63 65 25  28 37 29 0d 78 78 40 de  |reVoice%(7).xx@.|
000166c0  20 49 6e 73 74 72 75 6d  65 6e 74 25 28 37 2c 31  | Instrument%(7,1|
000166d0  29 3a f4 20 49 6e 73 74  72 75 6d 65 6e 74 20 69  |):. Instrument i|
000166e0  6e 66 6f 72 6d 61 74 69  6f 6e 20 30 3d 53 74 61  |nformation 0=Sta|
000166f0  76 65 2c 20 31 3d 56 6f  69 63 65 0d 78 82 26 de  |ve, 1=Voice.x.&.|
00016700  20 4e 74 68 24 28 36 29  3a f4 20 46 69 72 73 74  | Nth$(6):. First|
00016710  2c 53 65 63 6f 6e 64 20  73 74 61 76 65 20 65 74  |,Second stave et|
00016720  63 0d 78 8c 79 4e 74 68  24 28 31 29 3d 22 31 73  |c.x.yNth$(1)="1s|
00016730  74 20 73 74 61 76 65 22  3a 4e 74 68 24 28 32 29  |t stave":Nth$(2)|
00016740  3d 22 32 6e 64 20 73 74  61 76 65 22 3a 4e 74 68  |="2nd stave":Nth|
00016750  24 28 33 29 3d 22 33 72  64 20 73 74 61 76 65 22  |$(3)="3rd stave"|
00016760  3a 4e 74 68 24 28 34 29  3d 22 34 74 68 20 73 74  |:Nth$(4)="4th st|
00016770  61 76 65 22 3a 4e 74 68  24 28 35 29 3d 22 31 73  |ave":Nth$(5)="1s|
00016780  74 20 70 65 72 63 22 3a  4e 74 68 24 28 36 29 3d  |t perc":Nth$(6)=|
00016790  22 32 6e 64 20 70 65 72  63 22 0d 78 96 6c c8 99  |"2nd perc".x.l..|
000167a0  20 53 6f 75 6e 64 5f 49  6e 73 74 61 6c 6c 56 6f  | Sound_InstallVo|
000167b0  69 63 65 20 b8 20 49 24  2c 4e 56 6f 69 63 65 73  |ice . I$,NVoices|
000167c0  25 3a 4e 56 6f 69 63 65  73 25 2d 3d 31 3a f4 20  |%:NVoices%-=1:. |
000167d0  4e 56 6f 69 63 65 73 25  20 69 73 20 6e 6f 77 20  |NVoices% is now |
000167e0  6e 75 6d 62 65 72 20 6f  66 20 76 6f 69 63 65 73  |number of voices|
000167f0  2f 69 6e 73 74 72 75 6d  65 6e 74 73 20 61 76 61  |/instruments ava|
00016800  69 6c 61 62 6c 65 0d 78  a0 3c e7 20 a4 61 73 73  |ilable.x.<. .ass|
00016810  65 72 74 28 4e 56 6f 69  63 65 73 25 3e 30 2c 22  |ert(NVoices%>0,"|
00016820  4e 6f 20 73 6f 75 6e 64  20 76 6f 69 63 65 73 20  |No sound voices |
00016830  61 72 65 20 69 6e 73 74  61 6c 6c 65 64 2e 22 29  |are installed.")|
00016840  20 fa 0d 78 aa 12 e3 52  25 3d 31 b8 4e 56 6f 69  | ..x...R%=1.NVoi|
00016850  63 65 73 25 0d 78 b4 2b  c8 99 20 53 6f 75 6e 64  |ces%.x.+.. Sound|
00016860  5f 49 6e 73 74 61 6c 6c  56 6f 69 63 65 2c 30 2c  |_InstallVoice,0,|
00016870  52 25 20 b8 20 56 6f 69  63 65 24 28 52 25 29 0d  |R% . Voice$(R%).|
00016880  78 be 27 ed 3a f4 20 47  65 74 20 6e 61 6d 65 73  |x.'.:. Get names|
00016890  20 6f 66 20 76 6f 69 63  65 73 2f 69 6e 73 74 72  | of voices/instr|
000168a0  75 6d 65 6e 74 73 0d 78  c8 0b e3 52 25 3d 30 b8  |uments.x...R%=0.|
000168b0  37 0d 78 d2 27 c8 99 20  53 6f 75 6e 64 5f 41 74  |7.x.'.. Sound_At|
000168c0  74 61 63 68 56 6f 69 63  65 2c 52 25 2b 31 2c 30  |tachVoice,R%+1,0|
000168d0  20 b8 20 4c 25 2c 53 25  0d 78 dc 18 52 65 73 74  | . L%,S%.x..Rest|
000168e0  6f 72 65 56 6f 69 63 65  25 28 52 25 29 3d 53 25  |oreVoice%(R%)=S%|
000168f0  0d 78 e6 4a e7 53 25 3c  31 84 53 25 3e 4e 56 6f  |.x.J.S%<1.S%>NVo|
00016900  69 63 65 73 25 20 53 25  3d 31 3a f4 20 4d 61 6b  |ices% S%=1:. Mak|
00016910  65 20 73 75 72 65 20 61  20 76 6f 69 63 65 20 69  |e sure a voice i|
00016920  73 20 61 74 74 61 63 68  65 64 20 74 6f 20 61 6c  |s attached to al|
00016930  6c 20 63 68 61 6e 6e 65  6c 73 0d 78 f0 1e c8 99  |l channels.x....|
00016940  20 53 6f 75 6e 64 5f 41  74 74 61 63 68 56 6f 69  | Sound_AttachVoi|
00016950  63 65 2c 4c 25 2c 53 25  0d 78 fa 33 49 6e 73 74  |ce,L%,S%.x.3Inst|
00016960  72 75 6d 65 6e 74 25 28  52 25 2c 30 29 3d 53 5f  |rument%(R%,0)=S_|
00016970  43 25 28 52 25 29 2b 31  3a f4 20 49 6e 73 74 72  |C%(R%)+1:. Instr|
00016980  75 6d 65 6e 74 20 73 74  61 76 65 0d 79 04 2b 49  |ument stave.y.+I|
00016990  6e 73 74 72 75 6d 65 6e  74 25 28 52 25 2c 31 29  |nstrument%(R%,1)|
000169a0  3d 53 25 3a f4 20 49 6e  73 74 72 75 6d 65 6e 74  |=S%:. Instrument|
000169b0  20 76 6f 69 63 65 0d 79  0e 2f 24 28 56 6f 69 63  | voice.y./$(Voic|
000169c0  65 53 74 72 25 28 52 25  29 29 20 3d 20 c0 56 6f  |eStr%(R%)) = .Vo|
000169d0  69 63 65 24 28 53 25 29  2c 20 56 6f 69 63 65 53  |ice$(S%), VoiceS|
000169e0  69 7a 65 25 29 0d 79 18  23 ed 3a f4 20 47 65 74  |ize%).y.#.:. Get|
000169f0  20 64 65 74 61 69 6c 73  20 6f 66 20 65 61 63 68  | details of each|
00016a00  20 63 68 61 6e 6e 65 6c  0d 79 22 17 f2 53 65 74  | channel.y"..Set|
00016a10  44 65 66 61 75 6c 74 43  68 61 6e 6e 65 6c 73 0d  |DefaultChannels.|
00016a20  79 2c 18 de 20 56 6f 6c  75 6d 65 24 28 4e 56 6f  |y,.. Volume$(NVo|
00016a30  6c 75 6d 65 73 25 29 0d  79 36 91 56 6f 6c 75 6d  |lumes%).y6.Volum|
00016a40  65 24 28 30 29 3d 22 70  70 70 22 20 3a 20 56 6f  |e$(0)="ppp" : Vo|
00016a50  6c 75 6d 65 24 28 31 29  3d 22 70 70 22 20 3a 20  |lume$(1)="pp" : |
00016a60  56 6f 6c 75 6d 65 24 28  32 29 3d 22 70 22 20 3a  |Volume$(2)="p" :|
00016a70  20 56 6f 6c 75 6d 65 24  28 33 29 3d 22 6d 70 22  | Volume$(3)="mp"|
00016a80  20 3a 20 56 6f 6c 75 6d  65 24 28 34 29 3d 22 6d  | : Volume$(4)="m|
00016a90  66 22 20 3a 20 56 6f 6c  75 6d 65 24 28 35 29 3d  |f" : Volume$(5)=|
00016aa0  22 66 22 20 3a 20 56 6f  6c 75 6d 65 24 28 36 29  |"f" : Volume$(6)|
00016ab0  3d 22 66 66 22 20 3a 20  56 6f 6c 75 6d 65 24 28  |="ff" : Volume$(|
00016ac0  37 29 3d 22 66 66 66 22  0d 79 40 0b e3 52 25 3d  |7)="fff".y@..R%=|
00016ad0  30 b8 37 0d 79 4a 39 24  28 56 6f 6c 75 6d 65 53  |0.7.yJ9$(VolumeS|
00016ae0  74 72 25 28 52 25 29 29  20 3d 20 c0 56 6f 6c 75  |tr%(R%)) = .Volu|
00016af0  6d 65 24 28 56 6f 6c 75  6d 65 73 25 28 52 25 29  |me$(Volumes%(R%)|
00016b00  29 2c 20 56 6f 6c 53 69  7a 65 25 29 0d 79 54 05  |), VolSize%).yT.|
00016b10  ed 0d 79 5e 0f 4e 53 74  65 72 65 6f 73 25 3d 36  |..y^.NStereos%=6|
00016b20  0d 79 68 41 de 20 53 74  65 72 65 6f 25 28 4e 53  |.yhA. Stereo%(NS|
00016b30  74 65 72 65 6f 73 25 29  2c 53 74 65 72 65 6f 24  |tereos%),Stereo$|
00016b40  28 4e 53 74 65 72 65 6f  73 25 2c 31 29 2c 53 74  |(NStereos%,1),St|
00016b50  65 72 65 6f 5f 50 6f 73  69 74 69 6f 6e 25 28 37  |ereo_Position%(7|
00016b60  29 0d 79 72 a2 53 74 65  72 65 6f 24 28 30 2c 30  |).yr.Stereo$(0,0|
00016b70  29 3d 22 46 75 6c 6c 20  4c 2e 22 3a 53 74 65 72  |)="Full L.":Ster|
00016b80  65 6f 24 28 31 2c 30 29  3d 22 4c 65 66 74 22 3a  |eo$(1,0)="Left":|
00016b90  53 74 65 72 65 6f 24 28  32 2c 30 29 3d 22 43 65  |Stereo$(2,0)="Ce|
00016ba0  6e 74 72 65 20 4c 2e 22  3a 53 74 65 72 65 6f 24  |ntre L.":Stereo$|
00016bb0  28 33 2c 30 29 3d 22 43  65 6e 74 72 65 22 3a 53  |(3,0)="Centre":S|
00016bc0  74 65 72 65 6f 24 28 34  2c 30 29 3d 22 43 65 6e  |tereo$(4,0)="Cen|
00016bd0  74 72 65 20 52 2e 22 3a  53 74 65 72 65 6f 24 28  |tre R.":Stereo$(|
00016be0  35 2c 30 29 3d 22 52 69  67 68 74 22 3a 53 74 65  |5,0)="Right":Ste|
00016bf0  72 65 6f 24 28 36 2c 30  29 3d 22 46 75 6c 6c 20  |reo$(6,0)="Full |
00016c00  52 2e 22 0d 79 7c 13 e3  52 25 3d 30 b8 4e 53 74  |R.".y|..R%=0.NSt|
00016c10  65 72 65 6f 73 25 0d 79  86 26 53 74 65 72 65 6f  |ereos%.y.&Stereo|
00016c20  25 28 52 25 29 3d 28 32  2a 52 25 2f 4e 53 74 65  |%(R%)=(2*R%/NSte|
00016c30  72 65 6f 73 25 2d 31 29  2a 31 32 37 0d 79 90 36  |reos%-1)*127.y.6|
00016c40  53 74 65 72 65 6f 24 28  52 25 2c 31 29 3d 22 53  |Stereo$(R%,1)="S|
00016c50  74 65 72 65 6f 20 70 6f  73 69 74 69 6f 6e 20 28  |tereo position (|
00016c60  22 2b c3 53 74 65 72 65  6f 25 28 52 25 29 2b 22  |"+.Stereo%(R%)+"|
00016c70  29 22 0d 79 9a 05 ed 0d  79 a4 0b e3 52 25 3d 30  |)".y....y...R%=0|
00016c80  b8 37 0d 79 ae 24 53 74  65 72 65 6f 5f 50 6f 73  |.7.y.$Stereo_Pos|
00016c90  69 74 69 6f 6e 25 28 52  25 29 3d 4e 53 74 65 72  |ition%(R%)=NSter|
00016ca0  65 6f 73 25 81 32 0d 79  b8 36 c8 99 20 53 6f 75  |eos%.2.y.6.. Sou|
00016cb0  6e 64 5f 53 74 65 72 65  6f 2c 52 25 2b 31 2c 53  |nd_Stereo,R%+1,S|
00016cc0  74 65 72 65 6f 25 28 53  74 65 72 65 6f 5f 50 6f  |tereo%(Stereo_Po|
00016cd0  73 69 74 69 6f 6e 25 28  52 25 29 29 0d 79 c2 45  |sition%(R%)).y.E|
00016ce0  24 28 53 74 65 72 65 6f  53 74 72 25 28 52 25 29  |$(StereoStr%(R%)|
00016cf0  29 20 3d 20 c0 53 74 65  72 65 6f 24 28 53 74 65  |) = .Stereo$(Ste|
00016d00  72 65 6f 5f 50 6f 73 69  74 69 6f 6e 25 28 52 25  |reo_Position%(R%|
00016d10  29 2c 20 30 29 2c 20 53  74 65 72 53 69 7a 65 25  |), 0), SterSize%|
00016d20  29 0d 79 cc 05 ed 0d 79  d6 04 0d 79 e0 15 4e 4d  |).y....y...y..NM|
00016d30  49 44 49 43 68 61 6e 6e  65 6c 73 25 3d 31 36 0d  |IDIChannels%=16.|
00016d40  79 ea 15 de 20 4d 49 44  49 43 68 61 6e 6e 65 6c  |y... MIDIChannel|
00016d50  25 28 37 29 0d 79 f4 0b  e3 52 25 3d 30 b8 37 0d  |%(7).y...R%=0.7.|
00016d60  79 fe 16 4d 49 44 49 43  68 61 6e 6e 65 6c 25 28  |y..MIDIChannel%(|
00016d70  52 25 29 3d 31 0d 7a 08  14 e7 20 4d 49 44 49 70  |R%)=1.z... MIDIp|
00016d80  72 65 73 65 6e 74 25 20  8c 0d 7a 12 1b 20 20 24  |resent% ..z..  $|
00016d90  28 4d 49 44 49 43 68 53  74 72 25 28 52 25 29 29  |(MIDIChStr%(R%))|
00016da0  3d 22 31 22 0d 7a 1c 05  cc 0d 7a 26 1b 20 20 24  |="1".z....z&.  $|
00016db0  28 4d 49 44 49 43 68 53  74 72 25 28 52 25 29 29  |(MIDIChStr%(R%))|
00016dc0  3d 22 20 22 0d 7a 30 07  20 20 cd 0d 7a 3a 05 ed  |=" ".z0.  ..z:..|
00016dd0  0d 7a 44 04 0d 7a 4e 05  e1 0d 7a 58 04 0d 7a 62  |.zD..zN...zX..zb|
00016de0  0e dd 20 f2 72 65 73 74  6f 72 65 0d 7a 6c 17 f4  |.. .restore.zl..|
00016df0  4f 53 43 4c 49 28 22 61  75 64 69 6f 20 6f 66 66  |OSCLI("audio off|
00016e00  22 29 0d 7a 76 32 e3 52  25 3d 30 b8 37 20 20 20  |").zv2.R%=0.7   |
00016e10  20 3a f4 20 72 65 73 74  6f 72 65 20 63 68 61 6e  | :. restore chan|
00016e20  6e 65 6c 2f 76 6f 69 63  65 20 61 6c 6c 6f 63 61  |nel/voice alloca|
00016e30  74 69 6f 6e 0d 7a 80 2f  c8 99 20 53 6f 75 6e 64  |tion.z./.. Sound|
00016e40  5f 41 74 74 61 63 68 56  6f 69 63 65 2c 52 25 2b  |_AttachVoice,R%+|
00016e50  31 2c 52 65 73 74 6f 72  65 56 6f 69 63 65 25 28  |1,RestoreVoice%(|
00016e60  52 25 29 0d 7a 8a 05 ed  0d 7a 94 34 c8 99 20 53  |R%).z....z.4.. S|
00016e70  6f 75 6e 64 5f 56 6f 6c  75 6d 65 2c 20 52 65 73  |ound_Volume, Res|
00016e80  74 6f 72 65 56 6f 6c 75  6d 65 20 3a f4 20 72 65  |toreVolume :. re|
00016e90  73 74 6f 72 65 20 76 6f  6c 75 6d 65 0d 7a 9e 24  |store volume.z.$|
00016ea0  c8 99 20 53 6f 75 6e 64  5f 43 6f 6e 66 69 67 75  |.. Sound_Configu|
00016eb0  72 65 2c 50 72 65 76 43  6f 6e 66 69 67 75 72 65  |re,PrevConfigure|
00016ec0  0d 7a a8 05 e1 0d 7a b2  04 0d 7a bc 0b dd 20 f2  |.z....z...z... .|
00016ed0  65 78 69 74 0d 7a c6 11  f2 72 65 6d 6f 76 65 5f  |exit.z...remove_|
00016ee0  70 61 6e 65 73 0d 7a d0  1e f2 43 6c 6f 73 65 57  |panes.z...CloseW|
00016ef0  69 6e 64 6f 77 28 53 63  6f 72 65 57 69 6e 64 5f  |indow(ScoreWind_|
00016f00  68 25 29 0d 7a da 0c f2  72 65 73 74 6f 72 65 0d  |h%).z...restore.|
00016f10  7a e4 05 e1 0d 7a ee 04  0d 7a f8 10 dd 20 f2 74  |z....z...z... .t|
00016f20  65 72 6d 69 6e 61 74 65  0d 7b 02 28 e7 20 49 4e  |erminate.{.(. IN|
00016f30  49 54 49 41 4c 49 53 45  44 25 20 e7 20 50 4c 41  |ITIALISED% . PLA|
00016f40  59 49 4e 47 25 20 f2 70  6c 61 79 5f 73 74 6f 70  |YING% .play_stop|
00016f50  0d 7b 0c 11 e7 20 54 61  73 6b 5f 68 25 3e 30 20  |.{... Task_h%>0 |
00016f60  8c 0d 7b 16 29 20 ee 20  85 20 c8 99 20 43 6c 6f  |..{.) . . .. Clo|
00016f70  73 65 44 6f 77 6e 2c 20  74 61 73 6b 25 2c 20 54  |seDown, task%, T|
00016f80  61 73 6b 5f 68 25 20 3a  20 e0 0d 7b 20 05 cc 0d  |ask_h% : ..{ ...|
00016f90  7b 2a 0a 20 ee 20 85 20  e0 0d 7b 34 06 20 cd 0d  |{*. . . ..{4. ..|
00016fa0  7b 3e 35 e7 20 49 4e 49  54 49 41 4c 49 53 45 44  |{>5. INITIALISED|
00016fb0  25 20 f2 65 78 69 74 20  3a f2 43 6c 6f 73 65 57  |% .exit :.CloseW|
00016fc0  69 6e 64 6f 77 28 41 62  6f 72 74 51 75 65 72 79  |indow(AbortQuery|
00016fd0  5f 68 25 29 0d 7b 48 10  f4 43 4c 4f 53 45 23 64  |_h%).{H..CLOSE#d|
00016fe0  65 62 75 67 0d 7b 52 09  ee 20 85 20 e0 0d 7b 5c  |ebug.{R.. . ..{\|
00016ff0  2e e7 20 54 61 73 6b 5f  68 25 3e 30 20 8c 20 c8  |.. Task_h%>0 . .|
00017000  99 20 43 6c 6f 73 65 44  6f 77 6e 2c 20 74 61 73  |. CloseDown, tas|
00017010  6b 25 2c 20 54 61 73 6b  5f 68 25 0d 7b 66 05 e0  |k%, Task_h%.{f..|
00017020  0d 7b 70 05 e1 0d 7b 7a  04 0d 7b 84 14 dd 20 a4  |.{p...{z..{... .|
00017030  61 73 73 65 72 74 28 45  25 2c 41 24 29 0d 7b 8e  |assert(E%,A$).{.|
00017040  08 ea 20 65 25 0d 7b 98  3f e7 45 25 20 8c 3d a3  |.. e%.{.?.E% .=.|
00017050  20 8b 20 65 25 3d a4 43  68 65 63 6b 4f 4b 28 22  | . e%=.CheckOK("|
00017060  45 52 52 4f 52 3a 20 22  2b 41 24 2b 22 20 50 72  |ERROR: "+A$+" Pr|
00017070  6f 67 72 61 6d 20 77 69  6c 6c 20 65 78 69 74 2e  |ogram will exit.|
00017080  22 2c 31 29 0d 7b a2 0e  f2 74 65 72 6d 69 6e 61  |",1).{...termina|
00017090  74 65 0d 7b ac 06 3d b9  0d 7b b6 04 0d 7b c0 0c  |te.{..=..{...{..|
000170a0  dd 20 f2 65 72 72 6f 72  0d 7b ca 08 ea 20 65 25  |. .error.{... e%|
000170b0  0d 7b d4 07 ea 20 85 0d  7b de 17 ee 20 85 20 ea  |.{... ..{... . .|
000170c0  20 f2 74 65 72 6d 69 6e  61 74 65 3a 20 fa 0d 7b  | .terminate: ..{|
000170d0  e8 18 c8 99 20 22 48 6f  75 72 67 6c 61 73 73 5f  |.... "Hourglass_|
000170e0  53 6d 61 73 68 22 0d 7b  f2 2a 45 24 3d f6 24 2b  |Smash".{.*E$=.$+|
000170f0  22 20 61 74 20 6c 69 6e  65 20 22 2b c3 9e 2b 22  |" at line "+..+"|
00017100  2e 20 45 78 69 74 20 70  72 6f 67 72 61 6d 3f 22  |. Exit program?"|
00017110  0d 7b fc 26 46 49 4c 45  25 3d 46 49 4c 45 25 3a  |.{.&FILE%=FILE%:|
00017120  e7 46 49 4c 45 25 20 d9  23 46 49 4c 45 25 3a 46  |.FILE% .#FILE%:F|
00017130  49 4c 45 25 3d a3 0d 7c  06 14 e7 20 49 4e 49 54  |ILE%=..|... INIT|
00017140  49 41 4c 49 53 45 44 25  20 8c 0d 7c 10 21 20 20  |IALISED% ..|.!  |
00017150  e7 20 a4 43 68 65 63 6b  4f 4b 28 45 24 2c 33 29  |. .CheckOK(E$,3)|
00017160  20 f2 74 65 72 6d 69 6e  61 74 65 0d 7c 1a 05 cc  | .terminate.|...|
00017170  0d 7c 24 24 20 20 65 25  3d a4 43 68 65 63 6b 4f  |.|$$  e%=.CheckO|
00017180  4b 28 45 24 2c 31 29 20  3a 20 f2 74 65 72 6d 69  |K(E$,1) : .termi|
00017190  6e 61 74 65 0d 7c 2e 07  20 20 cd 0d 7c 38 05 e1  |nate.|..  ..|8..|
000171a0  0d 7c 42 04 0d 7c 4c 1b  dd 20 f2 4f 70 65 6e 41  |.|B..|L.. .OpenA|
000171b0  62 6f 72 74 51 75 65 72  79 28 78 2c 20 79 29 0d  |bortQuery(x, y).|
000171c0  7c 56 14 ea 20 78 73 69  7a 65 25 2c 20 79 73 69  ||V.. xsize%, ysi|
000171d0  7a 65 25 0d 7c 60 21 57  69 6e 64 6f 77 25 21 68  |ze%.|`!Window%!h|
000171e0  61 6e 64 6c 65 25 3d 41  62 6f 72 74 51 75 65 72  |andle%=AbortQuer|
000171f0  79 5f 68 25 0d 7c 6a 28  c8 99 20 47 65 74 57 69  |y_h%.|j(.. GetWi|
00017200  6e 64 6f 77 53 74 61 74  65 25 2c 20 2c 57 69 6e  |ndowState%, ,Win|
00017210  64 6f 77 25 2b 68 61 6e  64 6c 65 25 0d 7c 74 24  |dow%+handle%.|t$|
00017220  78 73 69 7a 65 25 20 3d  20 57 69 6e 64 6f 77 25  |xsize% = Window%|
00017230  21 78 31 25 2d 57 69 6e  64 6f 77 25 21 78 30 25  |!x1%-Window%!x0%|
00017240  0d 7c 7e 24 79 73 69 7a  65 25 20 3d 20 57 69 6e  |.|~$ysize% = Win|
00017250  64 6f 77 25 21 79 31 25  2d 57 69 6e 64 6f 77 25  |dow%!y1%-Window%|
00017260  21 79 30 25 0d 7c 88 1e  57 69 6e 64 6f 77 25 21  |!y0%.|..Window%!|
00017270  78 30 25 20 3d 20 78 20  2d 20 78 73 69 7a 65 25  |x0% = x - xsize%|
00017280  2f 32 0d 7c 92 1e 57 69  6e 64 6f 77 25 21 78 31  |/2.|..Window%!x1|
00017290  25 20 3d 20 78 20 2b 20  78 73 69 7a 65 25 2f 32  |% = x + xsize%/2|
000172a0  0d 7c 9c 1e 57 69 6e 64  6f 77 25 21 79 30 25 20  |.|..Window%!y0% |
000172b0  3d 20 79 20 2d 20 79 73  69 7a 65 25 2f 32 0d 7c  |= y - ysize%/2.||
000172c0  a6 1e 57 69 6e 64 6f 77  25 21 79 31 25 20 3d 20  |..Window%!y1% = |
000172d0  79 20 2b 20 79 73 69 7a  65 25 2f 32 0d 7c b0 24  |y + ysize%/2.|.$|
000172e0  c8 99 20 4f 70 65 6e 57  69 6e 64 6f 77 25 2c 20  |.. OpenWindow%, |
000172f0  2c 57 69 6e 64 6f 77 25  2b 68 61 6e 64 6c 65 25  |,Window%+handle%|
00017300  0d 7c ba 05 e1 0d 7c c4  04 0d 7c ce 1a dd 20 a4  |.|....|...|... .|
00017310  43 68 65 63 6b 4f 4b 28  45 24 2c 20 62 6f 78 65  |CheckOK(E$, boxe|
00017320  73 25 29 0d 7c d8 08 ea  20 45 25 0d 7c e2 10 21  |s%).|... E%.|..!|
00017330  45 52 52 42 4c 4f 43 4b  25 3d 30 0d 7c ec 1e 24  |ERRBLOCK%=0.|..$|
00017340  28 45 52 52 42 4c 4f 43  4b 25 2b 34 29 3d c0 45  |(ERRBLOCK%+4)=.E|
00017350  24 2c 31 30 30 29 2b bd  30 0d 7c f6 3d c8 99 20  |$,100)+.0.|.=.. |
00017360  22 57 69 6d 70 5f 52 65  70 6f 72 74 45 72 72 6f  |"Wimp_ReportErro|
00017370  72 22 2c 20 45 52 52 42  4c 4f 43 4b 25 2c 20 62  |r", ERRBLOCK%, b|
00017380  6f 78 65 73 25 2c 20 22  4d 61 65 73 74 72 6f 22  |oxes%, "Maestro"|
00017390  20 b8 20 2c 45 25 0d 7d  00 28 3d 45 25 3d 31 20  | . ,E%.}.(=E%=1 |
000173a0  3a 20 20 f4 20 72 65 74  75 72 6e 20 54 52 55 45  |:  . return TRUE|
000173b0  20 69 66 20 4f 4b 20 70  72 65 73 73 65 64 0d ff  | if OK pressed..|
000173c0