DECLARE FUNCTION ChangeDirectory$ (Dir$) DECLARE FUNCTION RaisePitch% (OrigPitch%) DECLARE FUNCTION LowerPitch% (OrigPitch%) ' Music Editor version 1.0 (beta) ` ' ` ' This program requires Microsoft QBasic to run. If you are reading this ` ' message using a different application you will not be able to run the Music` ' Editor. Please close the application and open MUSIC2.BAS using QBasic. ` ' ` ' To run this program, press F5. To exit QBasic, type Alt, F, X. ` ' ` ' For installation and distribution information read the README.TXT file ` ' which should have been supplied with the program. ` ' ` ' Robert Munster ` ' September 1999 ` ' ` DECLARE SUB RenumberGroups () DECLARE SUB SortNotesSelected () DECLARE SUB UpdateDrawPositions () DECLARE SUB InsertCursor () DECLARE SUB RemoveCursor () DECLARE SUB CursorLedgerLines (HorPos%, VertPos%, Colour%) DECLARE SUB LedgerLine (col%, Row%, Colour%) DECLARE SUB Digit (Dgt%, Hor%, Vert%, Colour%) DECLARE FUNCTION GetFileName$ () DECLARE SUB FileNew () DECLARE SUB FileOpen () DECLARE SUB FileSave () DECLARE SUB FindNoteType () DECLARE SUB FindRestType () DECLARE SUB Delete (Note%) DECLARE SUB FindNotes (StartStaff%, StartCol%, EndStaff%, EndCol%, NoteTypes%) DECLARE SUB CompileIndex () DECLARE SUB Help (HelpScreen%) CONST False = 0 CONST True = -1 CONST MAXNUMBEROFNOTES = 1000 CONST MAXNUMBEROFGROUPS2 = 1500 CONST MaxGroupSize = 100 CONST WorkingDirectory$ = "C:\RPM\programs\" CONST DefaultFileDirectory$ = "C:\RPM\MUSIC\" CONST Program1$ = "MUSIC2.BAS" CONST Program2$ = "MUSIC3.BAS" TYPE NoteType Staff AS INTEGER Vertical AS INTEGER Horizontal AS INTEGER Selected AS INTEGER group AS INTEGER Kind AS INTEGER Pitch AS INTEGER Length AS INTEGER tail AS INTEGER END TYPE TYPE CursorType Staff AS INTEGER Vertical AS INTEGER Horizontal AS INTEGER END TYPE TYPE StaffInitialType Ky AS INTEGER Staves AS INTEGER Staff2 AS INTEGER Staff3 AS INTEGER Staff4 AS INTEGER DrawPosition AS INTEGER END TYPE TYPE ClipboardType Posn AS INTEGER Vertical AS INTEGER group AS INTEGER Kind AS INTEGER Pitch AS INTEGER Length AS INTEGER tail AS INTEGER END TYPE DIM SHARED NoteData(MaxGroupSize) AS NoteType DIM SHARED FileNos(MaxGroupSize) AS INTEGER DIM SHARED StaffInitial(-121 TO 121) AS StaffInitialType DIM SHARED Header(3) AS STRING * 80 DIM SHARED NotesSelected(MAXNUMBEROFNOTES) AS INTEGER DIM SHARED GroupedNotes(MAXNUMBEROFNOTES) AS INTEGER DIM SHARED RefNos(MAXNUMBEROFGROUPS2) AS INTEGER DIM CursorData(11) AS INTEGER COMMON SHARED CurrentNote AS NoteType DIM CurrentNote1 AS NoteType, CurrentNote2 AS NoteType COMMON SHARED Cursor AS CursorType COMMON SHARED ClipboardBuffer AS ClipboardType COMMON SHARED StaffInitial() AS StaffInitialType COMMON SHARED Header() AS STRING * 80 COMMON SHARED NotesSelected() AS INTEGER COMMON SHARED GroupedNotes() AS INTEGER COMMON SHARED RefNos() AS INTEGER COMMON SHARED NextNote%, NextGroup% COMMON SHARED TiePosition% COMMON SHARED SelectedNote%, NumberOfNotesSelected%, SelectionColour%, DrawNotesBlue% COMMON SHARED SizeOfClipboard% COMMON SHARED FirstStaffShown%, NumberOfStavesShown%, UpperStaff%, LowerStaff% COMMON SHARED AnchorCol%, StartCol%, EndCol%, AnchorStaff%, StartStaff%, EndStaff% COMMON SHARED DisplayMode% COMMON SHARED Mode%, IncludeCursor%, FileExists%, ChangesMade% COMMON SHARED DefaultCol% COMMON SHARED CurrentDirectory$, FileName$, S3MFileName$ COMMON SHARED NoteTypeDetermined% CONST MAXNUMBEROFGROUPS = MAXNUMBEROFGROUPS2 \ 2 OPEN WorkingDirectory$ + "NOTEDATA.TMP" FOR RANDOM AS #2 LEN = 18 IF NOT FileExists% THEN CurrentDirectory$ = DefaultFileDirectory$ TiePosition% = 0 SizeOfClipboard% = 0 SelectionColour% = 10 Mode% = 0 IncludeCursor% = True SCREEN 0 WIDTH 80, 25 COLOR 13, 1 LOCATE 1, 1 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT "³ Music editor version 1.3.0 ³ This is a program for typesetting music. It ³" PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ does NOT require any special equipment (such as ³" PRINT "³ a music keyboard) and is designed to be as fast and efficient to use as ³" PRINT "³ possible. However, it is not capable of producing publication quality ³" PRINT "³ material and should therefore be regarded as an alternative to hand copying. ³" PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" PRINT "³ This product is under continual review and cannot ³ Disclaimer: The author ³" PRINT "³ be guaranteed free of bugs. If the program crashes, ³ of this program will ³" PRINT "³ or something unexpected happens, you have just made ³ not accept responsi- ³" PRINT "³ an important discovery - you must never do what you ³ bility for any damage, ³" PRINT "³ just did again! Save your work regularly, and ³ loss, or inconvenience,³" PRINT "³ please report any bugs you may discover to the ³ howsoever occasioned, ³" PRINT "³ author, giving clear information about the nature of³ resulting from the use ³" PRINT "³ the bug: how and when it happened, and the effect. ³ (or misuse) of this ³" PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄ´ program and its ³" PRINT "³ This program is freeware, and as such may be ³ ³ associated files. ³" PRINT "³ distributed to anyone interested, so long as ÃÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" PRINT "³ no payment is involved. It should be noted, ³ Any comments, suggestions, ³" PRINT "³ however, that Microsoft QBasic, required to ³ requests please by email to ³" PRINT "³ run the program, is NOT freeware. It is ³ ³" PRINT "³ supplied (by Microsoft) with certain versions ³ robert@londonbusroutes.net ³" PRINT "³ of MS-DOS and with Windows 95 (at least). See ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" PRINT "³ README.TXT for more info. ³ (Press any key to continue) ³"; LOCATE 25, 1 PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND FileName$ = ENVIRON$("MUSICFILENAME") IF FileName$ <> "" THEN FileExists% = True ReDrawScreen% = True IF LEFT$(FileName$, 1) = CHR$(34) THEN FileName$ = MID$(FileName$, 2, LEN(FileName$) - 2) GOTO OpenSpecifiedFile END IF ReDraw = True DO IF ReDraw THEN SCREEN 0 WIDTH 80, 25 COLOR 7, 0 CLS LOCATE 6 PRINT " ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" PRINT " º Music editor startup screen: please select an option ... º" PRINT " ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" PRINT " º 1. Create a new file º" PRINT " º 2. Open an existing file º" PRINT " º 3. Quit (!) º" PRINT " ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" PRINT " º 4. Help contents º" PRINT " º 5. Getting started tutorial º" PRINT " ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" PRINT " º 6. Distribution and installation information º" PRINT " ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹" PRINT " º Remember: to obtain help on the current screen at any º" PRINT " º stage just press F1, or shift+F1 for the help index. º" PRINT " ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" WHILE INKEY$ <> "": WEND END IF ReDraw = True key$ = INKEY$ SELECT CASE key$ CASE "1" FileNew FileExists% = True CASE "2" FileExists% = True ReDrawScreen% = True key$ = CHR$(15) GOTO SelectKey CASE "3" SCREEN 0 CLOSE ON ERROR GOTO FileError KILL WorkingDirectory$ + "NOTEDATA.TMP" ON ERROR GOTO 0 COLOR 13, 1 CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Going already? ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" PLAY "mbo0l64EeFfGgEeFfDdCc" SLEEP 2 COLOR 7, 0 CLS SYSTEM CASE "4", CHR$(0) + CHR$(84) Help 1 CLS key$ = "" CASE "5" Help 3 CLS key$ = "" CASE "6" CLS SHELL "more " + WorkingDirectory$ + "readme.txt" PRINT COLOR 15, 0 PRINT "(The above is the text of the README.TXT file" PRINT "located in "; WorkingDirectory$; ")" PRINT PRINT "-- Press any key to continue --"; COLOR 7, 0 WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND WIDTH 40, 25 key$ = "" CASE "" ReDraw = False CASE ELSE key$ = "" BEEP WHILE INKEY$ <> "": WEND END SELECT LOOP WHILE key$ = "" ChangesMade% = False NoteTypeDetermined% = False SCREEN 12 CLOSE #2 CHAIN WorkingDirectory$ + Program2$ ELSE StartOfMainBlock: IF Cursor.Vertical < 17 - (StaffInitial(Cursor.Staff).Staves AND 1920) \ 128 THEN Cursor.Vertical = 17 - (StaffInitial(Cursor.Staff).Staves AND 1920) \ 128 IF Cursor.Vertical > 33 + ((StaffInitial(Cursor.Staff).Staves AND 24) \ 8) * 50 + (StaffInitial(Cursor.Staff).Staves AND 30720) \ 2048 THEN Cursor.Vertical = 33 + ((StaffInitial(Cursor.Staff).Staves AND 24) \ 8) * 50 + (StaffInitial(Cursor.Staff).Staves AND 30720) \ 2048 IF IncludeCursor% THEN InsertCursor ReDrawScreen% = False IncludeCursor% = True VertPos% = StaffInitial(Cursor.Staff).DrawPosition + ((StaffInitial(Cursor.Staff).Staves AND 1920) \ 128) * 3 + (Cursor.Vertical MOD 50) * 3 - 48 HorPos% = Cursor.Horizontal * 5 + 31 SELECT CASE Cursor.Vertical CASE 50 TO 99 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff2 \ 128 CASE 100 TO 149 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff3 \ 128 CASE 150 TO 199 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff4 \ 128 END SELECT GET (HorPos% - 2, VertPos% - 2)-(HorPos% + 2, VertPos% + 2), CursorData DO key$ = INKEY$ SELECT CASE (TIMER * 100 MOD 100) \ 50 CASE 0 LINE (HorPos% - 2, VertPos% - 2)-(HorPos% + 2, VertPos% + 2), 12, BF CASE 1 PUT (HorPos% - 2, VertPos% - 2), CursorData, PSET END SELECT LOOP WHILE key$ = "" PUT (HorPos% - 2, VertPos% - 2), CursorData, PSET SelectKey: SELECT CASE key$ ' CASE "m" 'FOR n% = 1 TO NextNote% - 1 'gET #2, n%, CurrentNote 'IF CurrentNote.vertical > 50 THEN CurrentNote.vertical = CurrentNote.vertical + 1 'PUT #2, n%, CurrentNote 'NEXT n% 'Special symbols: CASE "p", "P" CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = 21 CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = False CurrentNote.group = 0 CurrentNote.Length = 0 CurrentNote.Kind = 4 CurrentNote.Pitch = 0 SELECT CASE Cursor.Vertical CASE 0 TO 49 CurrentNote.tail = 0 CASE 50 TO 99 CurrentNote.tail = 2 CASE 100 TO 149 CurrentNote.tail = 4 CASE 150 TO 199 CurrentNote.tail = 6 END SELECT PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 CurrentNote.tail = CurrentNote.tail + 1 PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 NoteTypeDetermined% = False ChangesMade% = True ReDrawScreen% = True CASE "c", "C" CLS LOCATE 3 PRINT " 1. G clef (Trebles)" PRINT " 2. C clef (Sopranos)" PRINT " 3. C clef (Altos)" PRINT " 4. C clef (Tenors)" PRINT " 5. F clef (Basses)" PRINT " (0 for no clef on staff)" PRINT FOR Clf% = 0 TO (StaffInitial(Cursor.Staff).Staves AND 24) \ 8 SELECT CASE Clf% CASE 0 PRINT " Enter clef type for top staff: "; CASE 1 PRINT " Enter clef type for second staff: "; CASE 2 PRINT " Enter clef type for third staff: "; CASE 3 PRINT " Enter clef type for bottom staff: "; END SELECT DO key$ = INKEY$ SELECT CASE key$ CASE "0" PRINT "None" CASE "1", "2", "3", "4", "5" PRINT VAL(key$) CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = 21 CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = False CurrentNote.group = 0 CurrentNote.Kind = 11 CurrentNote.Length = 0 CurrentNote.Pitch = VAL(key$) CurrentNote.tail = Clf% PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 NoteTypeDetermined% = False ChangesMade% = True CASE "" CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" NEXT Clf% ReDrawScreen% = True CASE "K", "k" CLS LOCATE 3 PRINT " A. Cb (7 flats)" PRINT " B. Gb (6 flats)" PRINT " C. Db (5 flats)" PRINT " D. Ab (4 flats)" PRINT " E. Eb (3 flats)" PRINT " F. Bb (2 flats)" PRINT " G. F (1 flat)" PRINT " H. C (natural)" PRINT " I. G (1 sharp)" PRINT " J. D (2 sharps)" PRINT " K. A (3 sharps)" PRINT " L. E (4 sharps)" PRINT " M. B (5 sharps)" PRINT " N. F# (6 sharps)" PRINT " O. C# (7 sharps)" PRINT PRINT " Enter key signature" DO key$ = INKEY$ SELECT CASE ASC(UCASE$(key$) + "GOBBLYDEGOOK") CASE 13 KeyType% = 8 CASE 65 TO 79 KeyType% = ASC(UCASE$(key$) + "SDG") - 64 CASE 0 CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = 21 CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = False CurrentNote.group = 0 CurrentNote.Kind = 10 CurrentNote.Length = 0 CurrentNote.Pitch = KeyType% CurrentNote.tail = 0 PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 NoteTypeDetermined% = False ChangesMade% = True ReDrawScreen% = True CASE "t", "T" IF SelectedNote% = 0 THEN CLS LOCATE 3 PRINT " :" PRINT PRINT " (Type in value and then press enter)" DO LOCATE 2 INPUT " Input time signature: ", TopHalf$ LOOP UNTIL VAL(TopHalf$) < 40 AND VAL(TopHalf$) > 0 DO LOCATE 3, 25 INPUT ": ", BottomHalf$ LOOP UNTIL VAL(BottomHalf$) < 40 AND VAL(BottomHalf$) > 0 CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = 21 CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = 0 CurrentNote.group = 0 CurrentNote.Kind = 9 CurrentNote.Length = VAL(TopHalf$) CurrentNote.Pitch = VAL(BottomHalf$) CurrentNote.tail = 0 PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 NoteTypeDetermined% = False ChangesMade% = True ReDrawScreen% = True ELSE 'Changing note properties GET #2, SelectedNote%, CurrentNote IF CurrentNote.group = 0 THEN SELECT CASE CurrentNote.Kind CASE 1, 2, 5, 7, 8 CurrentNote.tail = 1 - CurrentNote.tail PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE 4 CurrentNote.tail = (CurrentNote.tail + 1) MOD 8 PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE 6 CurrentNote.tail = -CurrentNote.tail PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT END IF END IF CASE "s", "S" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1: CurrentNote.Kind = 7 CASE 2: CurrentNote.Kind = 8 CASE 7: CurrentNote.Kind = 1 CASE 8: CurrentNote.Kind = 2 CASE ELSE: BEEP: WHILE INKEY$ <> "": WEND END SELECT IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote: ChangesMade% = True ReDrawScreen% = True CASE "a", "A" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1, 2, 7, 8 CLS LOCATE 4 PRINT " 1. (None)" PRINT " 2. Natural" PRINT " 3. Flat" PRINT " 4. Sharp" PRINT " 5. Double flat" PRINT " 6. Double sharp" PRINT PRINT " Choose accidental for note" DO key$ = INKEY$ SELECT CASE key$ CASE "1", "2", "3", "4", "5", "6", "" CurrentNote.Pitch = VAL(key$) CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT CASE "#" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1, 2, 7, 8 CurrentNote.Pitch = 4 IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT CASE "~" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1, 2, 7, 8 CurrentNote.Pitch = 3 IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT CASE "'" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1, 2, 7, 8 CurrentNote.Pitch = 2 IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT CASE "@" IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1, 2, 7, 8 CurrentNote.Pitch = 1 IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote ChangesMade% = True ReDrawScreen% = True CASE ELSE BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False END SELECT CASE "." IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote SELECT CASE CurrentNote.Kind CASE 1: CurrentNote.Kind = 2 CASE 2: CurrentNote.Kind = 1 CASE 7: CurrentNote.Kind = 8 CASE 8: CurrentNote.Kind = 7 CASE 6: CurrentNote.Kind = 12 CASE 12: CurrentNote.Kind = 6 CASE ELSE: BEEP: WHILE INKEY$ <> "": WEND END SELECT IF SelectedNote% > 0 THEN PUT #2, SelectedNote%, CurrentNote: ChangesMade% = True ReDrawScreen% = True CASE "g", "G" ' IF SelectedNote% > 0 AND NoteData(SelectedNote%).group > 0 THEN ' Gp% = Position(SelectedNote%).group ' NumberOfNotesSelected% = 0 ' EditGroup% = TRUE ' FOR Note% = 1 TO NextNote% - 1 ' IF Position(Note%).group = Gp% THEN ' IF Position(Note%).staff <> Position(SelectedNote%).staff THEN EditGroup% = FALSE: BEEP: WHILE INKEY$ <> "": WEND: EXIT FOR ' NotesSelected(NumberOfNotesSelected%) = Note% ' NumberOfNotesSelected% = NumberOfNotesSelected% + 1 ' END IF ' NEXT Note% ' IF EditGroup% THEN ' DO ' Position(0).staff = Position(SelectedNote%).staff ' FOR Stf% = -120 TO 120 ' StaffInitial(Stf%).DrawPosition = 640 ' NEXT Stf% ' DrawScreen ' DrawGroup Gp%, 7 ' LOCATE 23, 1 ' PRINT " Choose to: " ' PRINT " 0. Accept group design " ' PRINT " 1. Toggle direction of point " ' PRINT " 2. Alter initial displacement of bar " ' PRINT " 3. Alter final displacement of bar " ' PRINT " 4. Alter displacement of entire bar " ' PRINT " 5. Re-align group " ' print " 6. Re-align group, together with other ' PRINT " notes in same alignments " ' print " 10. Delete group " ' LOCATE 23 ' INPUT " Choose to:"; Choice% ' SELECT CASE Choice% ' CASE 1 ' '??? ' CASE 2 ' 'find start note ' DO ' DO ' key$ = INKEY$ ' LOOP WHILE key$ <> "" ' SELECT CASE key$ ' CASE CHR$(0) + CHR$(72) 'up ' NoteType(NextNote%).pitch = NoteType(NextNote%).pitch - 1 ' CASE CHR$(0) + CHR$(80) 'down ' NoteType(NextNote%).pitch = NoteType(NextNote%).pitch + 1 ' CASE CHR$(13) 'enter ' EXIT DO ' CASE ELSE ' BEEP ' WHILE INKEY$ <> "": WEND ' END SELECT ' LOOP ' CASE 3 ' 'find end note ' DO ' DO ' key$ = INKEY$ ' LOOP WHILE key$ <> "" ' SELECT CASE key$ ' CASE CHR$(0) + CHR$(72) 'up ' NoteType(NextNote%).length = NoteType(NextNote%).length - 1 ' CASE CHR$(0) + CHR$(80) 'down ' NoteType(NextNote%).length = NoteType(NextNote%).length + 1 ' CASE CHR$(13) 'enter ' EXIT DO ' CASE ELSE ' BEEP ' WHILE INKEY$ <> "": WEND ' END SELECT ' LOOP ' CASE 4 ' 'find start and end notes ' DO ' DO ' key$ = INKEY$ ' LOOP WHILE key$ <> "" ' SELECT CASE key$ ' CASE CHR$(0) + CHR$(72) 'up ' NoteType(NextNote%).pitch = NoteType(NextNote%).pitch - 1 ' NoteType(NextNote%).length = NoteType(NextNote%).length - 1 ' CASE CHR$(0) + CHR$(80) 'down ' NoteType(NextNote%).pitch = NoteType(NextNote%).pitch + 1 ' NoteType(NextNote%).length = NoteType(NextNote%).length + 1 ' CASE CHR$(13) 'enter ' EXIT DO ' CASE ELSE ' BEEP ' WHILE INKEY$ <> "": WEND ' END SELECT ' LOOP ' CASE 5 ' '??????????????: ' CASE ELSE ' EXIT DO ' END SELECT ' LOOP ' END IF ' ChangesMade% = TRUE ' ELSE NumberOfNotesSelected% = 0 FOR Note% = 1 TO NextNote% - 1 GET #2, Note%, CurrentNote1 IF CurrentNote1.Selected THEN NotesSelected(NumberOfNotesSelected%) = Note%: NumberOfNotesSelected% = NumberOfNotesSelected% + 1 NEXT Note% IF NumberOfNotesSelected% < 2 OR NumberOfNotesSelected% > MaxGroupSize THEN LOCATE 1 PRINT "You have"; NumberOfNotesSelected%; "notes selected; a group must consist of between 2 and"; MaxGroupSize; "notes. " LOCATE 2 PRINT "You may wish to increase the MaxGroupSize constant (this refers to the maximum " PRINT "number of notes you may select before forming a group); alternatively, deselect " PRINT "any unnecessary notes before forming the group. " PRINT PRINT "(Press any key to continue) " WHILE INKEY$ <> "": WEND BEEP WHILE INKEY$ = "": WEND IncludeCursor% = False ELSEIF NextGroup% > MAXNUMBEROFGROUPS2 / 2 THEN LOCATE 1, 1 PRINT "No more groups can presently be created: to create more groups increase the " PRINT "MAXNUMBEROFGROUPS2 constant in the main program. (Save your work and quit the " PRINT "program straight away. Increase the MAXNUMBEROFGROUPS2 to twice " PRINT "the maximum number of groups you want to allow, and you will need to change it " PRINT "in both parts of the program, MUSIC2.BAS and MUSIC3.BAS. Beware that setting " PRINT "it too high may cause the program to crash due to insufficient memory.) " PRINT PRINT "(Press any key to continue) " WHILE INKEY$ <> "": WEND BEEP WHILE INKEY$ = "": WEND ReDrawScreen% = True ELSE NoteStaff% = 121 LeftNote% = 0 RightNote% = 0 IncludeGroup = True NumberOfNotesInGroup% = 0 FOR Note% = 0 TO NumberOfNotesSelected% - 1 GET #2, NotesSelected(Note%), NoteData(0) SELECT CASE NoteData(0).Kind CASE 1, 2, 7, 8 IF NoteData(0).Length < 3 OR NoteData(0).Length = 4 OR NoteData(0).Length > 8 OR NoteStaff% < 121 AND NoteStaff% <> NoteData(0).Staff OR NoteData(0).group > 0 THEN IncludeGroup = False EXIT FOR ELSE NumberOfNotesInGroup% = NumberOfNotesInGroup% + 1 NoteData(NumberOfNotesInGroup%) = NoteData(0) NoteData(NumberOfNotesInGroup%).group = NextGroup% FileNos(NumberOfNotesInGroup%) = NotesSelected(Note%) NoteStaff% = NoteData(0).Staff IF LeftNote% = 0 OR NoteData(0).Horizontal < CurrentNote1.Horizontal THEN LeftNote% = NumberOfNotesInGroup%: CurrentNote1 = NoteData(0) IF RightNote% = 0 OR NoteData(0).Horizontal > CurrentNote2.Horizontal THEN RightNote% = NumberOfNotesInGroup%: CurrentNote2 = NoteData(0) END IF END SELECT NEXT Note% IF CurrentNote1.Horizontal = CurrentNote2.Horizontal THEN IncludeGroup = False IF IncludeGroup AND NumberOfNotesSelected% > 1 THEN NextGroup% = NextGroup% + 1 LeftDirection% = NoteData(LeftNote%).tail RightDirection% = NoteData(RightNote%).tail SWAP NoteData(LeftNote%), NoteData(1) SWAP FileNos(LeftNote%), FileNos(1) IF RightNote% = 1 THEN SWAP NoteData(LeftNote%), NoteData(NumberOfNotesInGroup%) SWAP FileNos(LeftNote%), FileNos(NumberOfNotesInGroup%) ELSE SWAP NoteData(RightNote%), NoteData(NumberOfNotesInGroup%) SWAP FileNos(RightNote%), FileNos(NumberOfNotesInGroup%) END IF FOR Ref% = 2 TO NumberOfNotesInGroup% - 2 LastRef% = Ref% FOR TryRef% = Ref% + 1 TO NumberOfNotesInGroup% - 1 IF NoteData(TryRef%).Horizontal < NoteData(LastRef%).Horizontal THEN LastRef% = TryRef% NEXT TryRef% SWAP NoteData(Ref%), NoteData(LastRef%) SWAP FileNos(Ref%), FileNos(LastRef%) NEXT Ref% CurrentRef% = 1 NextRef% = 2 DO WHILE NoteData(NextRef%).Horizontal = NoteData(CurrentRef%).Horizontal NextRef% = NextRef% + 1 LOOP IF NoteData(CurrentRef%).Length = 3 THEN tails% = 3 ELSE tails% = NoteData(CurrentRef%).Length - 4 DO WHILE CurrentRef% < NextRef% NoteData(CurrentRef%).tail = tails% * 16 CurrentRef% = CurrentRef% + 1 LOOP IF NoteData(NextRef%).Length = 3 THEN NextTails% = 3 ELSE NextTails% = NoteData(NextRef%).Length - 4 DO WHILE NoteData(CurrentRef%).Horizontal < NoteData(NumberOfNotesInGroup%).Horizontal DO NextRef% = NextRef% + 1 LOOP WHILE NoteData(NextRef%).Horizontal = NoteData(CurrentRef%).Horizontal PrevTails% = tails% tails% = NextTails% IF NoteData(NextRef%).Length = 3 THEN NextTails% = 3 ELSE NextTails% = NoteData(NextRef%).Length - 4 IF PrevTails% < tails% THEN LeftTails% = PrevTails% ELSE LeftTails% = tails% IF tails% < NextTails% THEN RightTails% = tails% ELSE RightTails% = NextTails% IF RightTails% < tails% THEN LeftTails% = tails% DO WHILE CurrentRef% < NextRef% NoteData(CurrentRef%).tail = LeftTails% * 2 + RightTails% * 16 CurrentRef% = CurrentRef% + 1 LOOP LOOP DO WHILE CurrentRef% <= NumberOfNotesInGroup% NoteData(CurrentRef%).tail = NextTails% * 2 CurrentRef% = CurrentRef% + 1 LOOP IF LeftDirection% = RightDirection% THEN Displace% = 16 Gradient! = -((NoteData(NumberOfNotesInGroup%).Vertical - NoteData(1).Vertical) * 3) / ((NoteData(NumberOfNotesInGroup%).Horizontal - NoteData(1).Horizontal) * 5) FOR Ref% = 2 TO NumberOfNotesInGroup% - 1 Height% = (NoteData(Ref%).Horizontal - NoteData(1).Horizontal) * 5 * Gradient! + Displace% * (LeftDirection% * 2 - 1) + (NoteData(Ref%).Vertical - NoteData(1).Vertical) * 3 LeftTails% = (NoteData(Ref%).tail AND 14) \ 2 RightTails% = (NoteData(Ref%).tail AND 112) \ 16 IF LeftTails% > RightTails% THEN tails% = LeftTails% ELSE tails% = RightTails% IF LeftDirection% = 1 THEN Difference% = Height% - tails% * 3 ELSE Difference% = -Height% - tails% * 3 END IF IF Difference% < 7 THEN Displace% = Displace% - Difference% + 7 NEXT Ref% IF Displace% > 127 THEN Displace% = 127 NoteData(1).tail = NoteData(1).tail + Displace% * 128 + LeftDirection% NoteData(NumberOfNotesInGroup%).tail = NoteData(NumberOfNotesInGroup%).tail + Displace% * 128 + RightDirection% + 16384 ELSE NoteData(1).tail = NoteData(1).tail + 2176 + LeftDirection% NoteData(NumberOfNotesInGroup%).tail = NoteData(NumberOfNotesInGroup%).tail + 18560 + RightDirection% END IF FOR Note% = 1 TO NumberOfNotesInGroup% PUT #2, FileNos(Note%), NoteData(Note%) NEXT Note% ChangesMade% = True ELSE CLS LOCATE 1 PRINT "Could not create group: selection includes invalid notes, group has only one " PRINT "chord, or selection is split between staves. " PRINT PRINT "(Press any key to continue) " WHILE INKEY$ <> "": WEND BEEP WHILE INKEY$ = "": WEND END IF ReDrawScreen% = True END IF ' END IF 'Navigation keys: CASE CHR$(0) + CHR$(72) 'up RemoveCursor SELECT CASE Cursor.Vertical CASE 64, 114, 164 Cursor.Vertical = Cursor.Vertical - 29 CASE 18 - (StaffInitial(Cursor.Staff).Staves AND 1920) \ 128 TO 199 Cursor.Vertical = Cursor.Vertical - 1 CASE ELSE BEEP WHILE INKEY$ <> "": WEND END SELECT CASE CHR$(0) + CHR$(80) 'down RemoveCursor SELECT CASE Cursor.Vertical CASE 35, 85, 135 Cursor.Vertical = Cursor.Vertical + 29 CASE 0 TO 32 + ((StaffInitial(Cursor.Staff).Staves AND 24) \ 8) * 50 + (StaffInitial(Cursor.Staff).Staves AND 30720) \ 2048 Cursor.Vertical = Cursor.Vertical + 1 CASE ELSE BEEP WHILE INKEY$ <> "": WEND END SELECT CASE CHR$(0) + CHR$(75) 'left RemoveCursor SELECT CASE Cursor.Horizontal CASE 2 TO 120 Cursor.Horizontal = Cursor.Horizontal - 1 CASE 1 Cursor.Staff = Cursor.Staff - 1 Cursor.Horizontal = 120 ReDrawScreen% = True END SELECT CASE CHR$(0) + CHR$(77) 'right RemoveCursor SELECT CASE Cursor.Horizontal CASE 1 TO 119 Cursor.Horizontal = Cursor.Horizontal + 1 CASE 120 Cursor.Staff = Cursor.Staff + 1 Cursor.Horizontal = 1 ReDrawScreen% = True END SELECT CASE CHR$(0) + CHR$(15) 'shift + tab RemoveCursor SELECT CASE Cursor.Horizontal CASE 5 TO 120 Cursor.Horizontal = Cursor.Horizontal - 4 CASE 1 TO 4 Cursor.Staff = Cursor.Staff - 1 Cursor.Horizontal = Cursor.Horizontal + 116 ReDrawScreen% = True END SELECT CASE CHR$(9) 'tab RemoveCursor SELECT CASE Cursor.Horizontal CASE 1 TO 116 Cursor.Horizontal = Cursor.Horizontal + 4 CASE 117 TO 120 Cursor.Staff = Cursor.Staff + 1 Cursor.Horizontal = Cursor.Horizontal - 116 ReDrawScreen% = True END SELECT CASE CHR$(0) + CHR$(73) 'PgUp Cursor.Staff = Cursor.Staff - 1 ReDrawScreen% = True CASE CHR$(0) + CHR$(81) 'PgDn Cursor.Staff = Cursor.Staff + 1 ReDrawScreen% = True CASE CHR$(0) + CHR$(71) 'Home RemoveCursor Cursor.Horizontal = DefaultCol% + 4 CASE CHR$(0) + CHR$(79) 'End RemoveCursor Cursor.Horizontal = 120 'Notes and rests CASE CHR$(0) + CHR$(82) 'insert IF (NOT NoteTypeDetermined%) OR CurrentNote.Kind > 2 AND CurrentNote.Kind < 7 OR CurrentNote.Kind > 8 THEN FindNoteType CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = Cursor.Vertical CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = False CurrentNote.group = 0 PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 ChangesMade% = True AnchorCol% = 0 StartCol% = 0 EndCol% = 0 ReDrawScreen% = True CASE CHR$(114), CHR$(82) 'r or R IF (NOT NoteTypeDetermined%) OR CurrentNote.Kind <> 3 THEN FindRestType CurrentNote.Staff = Cursor.Staff CurrentNote.Vertical = (Cursor.Vertical \ 2) * 2 CurrentNote.Horizontal = Cursor.Horizontal CurrentNote.Selected = False CurrentNote.group = 0 PUT #2, NextNote%, CurrentNote NextNote% = NextNote% + 1 ChangesMade% = True AnchorCol% = 0 StartCol% = 0 EndCol% = 0 ReDrawScreen% = True 'File commands: CASE CHR$(14) 'ctrl+N SCREEN 0 IF ChangesMade% THEN GOSUB LoseChanges CreateNewFileAgain: FileNew ChangesMade% = False NoteTypeDetermined% = False TiePosition% = 0 SCREEN 12 ReDrawScreen% = True CASE CHR$(15) 'ctrl+O SCREEN 0 IF ChangesMade% THEN GOSUB LoseChanges FileName$ = GetFileName$ OpenSpecifiedFile: Errorr% = 0 ON ERROR GOTO FileError OPEN FileName$ FOR INPUT AS #1 CLOSE #1 ON ERROR GOTO 0 SELECT CASE Errorr% CASE 0 CASE 53 CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ File does not exist. ³" PRINT " ³ (Press any key to continue) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND GOTO CreateNewFileAgain CASE ELSE OpenError: CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Unexpected problem opening file. ³" PRINT " ³ (Press any key to continue) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND GOTO CreateNewFileAgain END SELECT ON ERROR GOTO OpenError2 FileOpen ON ERROR GOTO 0 ChangesMade% = False NoteTypeDetermined% = False TiePosition% = 0 SCREEN 12 ReDrawScreen% = True CASE CHR$(19) 'ctrl + S SCREEN 0 PRINT "Saving ..." GOSUB Save ChangesMade% = False SCREEN 12 ReDrawScreen% = True CASE CHR$(1) 'ctrl + A SCREEN 0 GOSUB SaveAs ChangesMade% = False SCREEN 12 ReDrawScreen% = True CASE CHR$(17) 'ctrl + Q SCREEN 0 IF ChangesMade% THEN GOSUB LoseChanges CLOSE ON ERROR GOTO FileError KILL WorkingDirectory$ + "NOTEDATA.TMP" KILL WorkingDirectory$ + "CLIPBRD.TMP" KILL WorkingDirectory$ + "DIRECTS.TMP" KILL WorkingDirectory$ + "DDIRECTS.TMP" KILL WorkingDirectory$ + "FILES.TMP" KILL WorkingDirectory$ + "DFILES.TMP" ON ERROR GOTO 0 COLOR 13, 1 CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Thank you for using the music editor! ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" PLAY "mbo3l18e-dcdcc" SLEEP 3 COLOR 7, 0 CLS SYSTEM ReDrawScreen% = True CASE CHR$(2) 'ctrl + B SCREEN 0 CLS PRINT "Scream Tracker 3 file conversion utility." IF FileName$ = "" THEN S3MFileName$ = DefaultFileDirectory + "TEMP.S3M" ELSE Posn% = LEN(FileName$) WHILE MID$(FileName$, Posn%, 1) <> "\" AND MID$(FileName$, Posn%, 1) <> "." Posn% = Posn% - 1 WEND IF MID$(FileName$, Posn%, 1) = "." THEN S3MFileName$ = LEFT$(FileName$, Posn%) + "S3M" ELSE S3MFileName$ = FileName$ + ".S3M" END IF PRINT "This action will create a file called " + S3MFileName$ PRINT "(Note down this name now! You are advised to rename the file immediately after" PRINT "it has been created, especially if it is going to be named TEMP.S3M !!!)" PRINT "Warning: If you already have a file with the above name this will be erased!!!" PRINT " Re-name before running this utility!!!" PRINT PRINT "Warning: This action is dangerous and may cause the program to crash." PRINT "You should save your work before continuing." PRINT "Do you wish to continue (y/n)?" WHILE INKEY$ <> "": WEND DO key$ = UCASE$(INKEY$) LOOP UNTIL key$ = "Y" OR key$ = "N" SCREEN 12 IF key$ = "Y" THEN Mode% = 15 ReDrawScreen% = True CASE "x", "X" 'Export to bitmap Mode% = 2 ReDrawScreen% = True 'Function keys: CASE CHR$(0) + CHR$(59) 'F1 Help 1 SCREEN 12 ReDrawScreen% = True 'CASE CHR$(0) + CHR$(60) 'F2 'SCREEN 0 'CLS 'Menu% = 5 'DO 'COLOR 0, 7 'LOCATE 1, 1 'LOOP 'SCREEN 12 CASE CHR$(0) + CHR$(62) 'F4 SCREEN 0 CLS PRINT "Jump to position" PRINT " Staff:"; Cursor.Staff PRINT " Column:"; Cursor.Horizontal PRINT " Row:"; Cursor.Vertical PRINT PRINT "(Enter to remain in present place)" LOCATE 2 INPUT " Staff: ", Place$ IF Place$ <> "" AND ABS(VAL(Place$)) < 121 THEN Cursor.Staff = VAL(Place$) LOCATE 3 INPUT " Column: ", Place$ IF VAL(Place$) > 0 AND VAL(Place$) < 121 THEN Cursor.Horizontal = VAL(Place$) LOCATE 4 INPUT " Row: ", Place$ IF Place$ <> "" AND VAL(Place$) > -1 AND VAL(Place$) < 201 THEN Cursor.Vertical = VAL(Place$) SCREEN 12 ReDrawScreen% = True CASE CHR$(0) + CHR$(63) 'F5 ReDrawScreen% = True CASE CHR$(0) + CHR$(88) 'shift+F5 IncludeCursor% = False ChangesMade% = True ReDrawScreen% = True CASE CHR$(0) + CHR$(64) 'F6 IF AnchorCol% = 0 THEN NumberOfNotesSelected% = 0 AnchorStaff% = Cursor.Staff AnchorCol% = Cursor.Horizontal SELECT CASE (StaffInitial(AnchorStaff%).Staves AND 24) \ 8 CASE 0 LineLength% = 54 CASE 1 LineLength% = 54 + (StaffInitial(AnchorStaff%).Staff2 AND 32640) \ 128 CASE 2 LineLength% = 54 + (StaffInitial(AnchorStaff%).Staff3 AND 32640) \ 128 CASE 3 LineLength% = 54 + (StaffInitial(AnchorStaff%).Staff4 AND 32640) \ 128 END SELECT LINE (31 + AnchorCol% * 5, StaffInitial(AnchorStaff%).DrawPosition + ((StaffInitial(AnchorStaff%).Staves AND 1920) \ 128) * 3)-(32 + AnchorCol% * 5, StaffInitial(AnchorStaff%).DrawPosition + ((StaffInitial(AnchorStaff%).Staves AND 1920) \ 128) * 3 + LineLength%), 1, BF ReDrawScreen% = False ELSE IF AnchorStaff% = Cursor.Staff AND AnchorCol% <= Cursor.Horizontal OR AnchorStaff% < Cursor.Staff THEN EndStaff% = Cursor.Staff EndCol% = Cursor.Horizontal StartStaff% = AnchorStaff% StartCol% = AnchorCol% ELSE StartStaff% = Cursor.Staff StartCol% = Cursor.Horizontal EndStaff% = AnchorStaff% EndCol% = AnchorCol% END IF NumberOfNotesSelected% = 0 FindNotes StartStaff%, StartCol%, EndStaff%, EndCol%, 0 IF NumberOfNotesSelected% = 0 THEN AnchorCol% = 0 StartCol% = 0 EndCol% = 0 BEEP END IF ReDrawScreen% = True END IF IF NumberOfNotesSelected% > 0 THEN Mode% = 6 CASE CHR$(0) + CHR$(65) 'F7 Mode% = 7 ReDrawScreen% = True CASE CHR$(0) + CHR$(90) 'shift + F7 Mode% = 1 ReDrawScreen% = True CASE CHR$(0) + CHR$(66) 'F8 IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote: NoteTypeDetermined% = True IncludeCursor% = False CASE CHR$(0) + CHR$(67) 'F9 CLS LOCATE 2 PRINT " Apply changes to staves: -120" PRINT " to: 120" PRINT PRINT " (Type in value and then press enter)" DO LOCATE 2 INPUT " Apply changes to staves: ", UpperStaff$ LOOP UNTIL VAL(UpperStaff$) > -121 AND VAL(UpperStaff$) < 0 OR UpperStaff$ = "0" OR UpperStaff$ = "" OR VAL(UpperStaff$) > 0 AND VAL(UpperStaff$) < 121 DO LOCATE 3 INPUT " to: ", LowerStaff$ LOOP UNTIL VAL(LowerStaff$) > -121 AND VAL(LowerStaff$) < 0 OR LowerStaff$ = "0" OR LowerStaff$ = "" OR VAL(LowerStaff$) > 0 AND VAL(LowerStaff$) < 121 IF UpperStaff$ = "" THEN UpperStaff% = -120 ELSE UpperStaff% = VAL(UpperStaff$) IF LowerStaff$ = "" THEN LowerStaff% = 120 ELSE LowerStaff% = VAL(LowerStaff$) IF LowerStaff% < UpperStaff% THEN SWAP LowerStaff%, UpperStaff% LOCATE 5 PRINT " A. Cb (7 flats) " PRINT " B. Gb (6 flats)" PRINT " C. Db (5 flats)" PRINT " D. Ab (4 flats)" PRINT " E. Eb (3 flats)" PRINT " F. Bb (2 flats)" PRINT " G. F (1 flat)" PRINT " H. C (natural)" PRINT " I. G (1 sharp)" PRINT " J. D (2 sharps)" PRINT " K. A (3 sharps)" PRINT " L. E (4 sharps)" PRINT " M. B (5 sharps)" PRINT " N. F# (6 sharps)" PRINT " O. C# (7 sharps)" PRINT PRINT " Press letter for key signature" PRINT " (or press Enter to leave unchanged)" DO key$ = INKEY$ SELECT CASE ASC(UCASE$(key$) + "GOBBLEDEGOOK") CASE 13 KeyType% = 0 CASE 65 TO 79 KeyType% = ASC(UCASE$(key$) + "GOBBLEDEGOOK") - 64 CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" LOCATE 5 PRINT " Key signatures: "; SELECT CASE KeyType% CASE 0 PRINT "leave unchanged" CASE 1 TO 15 PRINT "change to "; FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Ky = KeyType% NEXT Staff% ChangesMade% = True END SELECT SELECT CASE KeyType% CASE 1 PRINT "Cb (7 flats) " CASE 2 PRINT "Gb (6 flats)" CASE 3 PRINT "Db (5 flats)" CASE 4 PRINT "Ab (4 flats)" CASE 5 PRINT "Eb (3 flats)" CASE 6 PRINT "Bb (2 flats)" CASE 7 PRINT "F (1 flat)" CASE 8 PRINT "C (natural)" CASE 9 PRINT "G (1 sharp)" CASE 10 PRINT "D (2 sharps)" CASE 11 PRINT "A (3 sharps)" CASE 12 PRINT "E (4 sharps)" CASE 13 PRINT "B (5 sharps)" CASE 14 PRINT "F# (6 sharps)" CASE 15 PRINT "C# (7 sharps)" END SELECT FOR r% = 1 TO 17 PRINT SPACE$(80) NEXT r% LOCATE 8 PRINT " (enter to leave unchanged, or escape to abort)" LOCATE 7 PRINT " How many short staves to show (1 to 4): "; DO key$ = INKEY$ LOOP UNTIL VAL(key$) > 0 AND VAL(key$) < 5 OR key$ = CHR$(27) OR key$ = CHR$(13) IF key$ = CHR$(27) THEN CLOSE #2: CHAIN WorkingDirectory$ + Program2$ ChangesMade% = True IF key$ = CHR$(13) THEN key$ = "Leave unchanged" PRINT key$ PRINT SPACE$(80) ShortStaves% = VAL(key$) IF ShortStaves% > 0 THEN FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staves = (StaffInitial(Staff%).Staves AND 7) + (ShortStaves% - 1) * 8 + (StaffInitial(Staff%).Staves \ 32) * 32 NEXT Staff% ELSE ShortStaves% = 4 END IF PRINT " Have brace on upper staff pair (y/n or enter to leave unchaged)?"; LOCATE , 35 DO key$ = INKEY$ SELECT CASE UCASE$(key$) CASE "Y" PRINT ": Y " FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff2 = (StaffInitial(Staff%).Staff2 \ 128) * 128 + 64 + (StaffInitial(Staff%).Staff2 AND 63) NEXT Staff% CASE "N" PRINT ": N " FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff2 = (StaffInitial(Staff%).Staff2 \ 128) * 128 + (StaffInitial(Staff%).Staff2 AND 63) NEXT Staff% CASE CHR$(13) PRINT ": Leave unchanged " CASE "" CASE ELSE WHILE INKEY$ <> "": WEND BEEP key$ = "" END SELECT LOOP WHILE key$ = "" IF (StaffInitial(UpperStaff%).Staff2 AND 64) <> 0 THEN GOTO ChangeAnyway3 PRINT " Have brace on centre staff pair (y/n or enter to leave unchaged)?"; LOCATE , 36 DO key$ = INKEY$ SELECT CASE UCASE$(key$) CASE "Y" PRINT ": Y " FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff3 = (StaffInitial(Staff%).Staff3 \ 128) * 128 + 64 + (StaffInitial(Staff%).Staff3 AND 63) NEXT Staff% CASE "N" PRINT ": N " ChangeAnyway3: FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff3 = (StaffInitial(Staff%).Staff3 \ 128) * 128 + (StaffInitial(Staff%).Staff3 AND 63) NEXT Staff% key$ = "N" CASE CHR$(13) PRINT ": Leave unchanged " CASE "" CASE ELSE WHILE INKEY$ <> "": WEND BEEP key$ = "" END SELECT LOOP WHILE key$ = "" IF (StaffInitial(UpperStaff%).Staff3 AND 64) <> 0 THEN GOTO ChangeAnyway4 PRINT " Have brace on lower staff pair (y/n or enter to leave unchaged)?"; LOCATE , 35 DO key$ = INKEY$ SELECT CASE UCASE$(key$) CASE "Y" PRINT ": Y " FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff4 = (StaffInitial(Staff%).Staff4 \ 128) * 128 + 64 + (StaffInitial(Staff%).Staff4 AND 63) NEXT Staff% CASE "N" PRINT ": N " ChangeAnyway4: FOR Staff% = UpperStaff% TO LowerStaff% StaffInitial(Staff%).Staff4 = (StaffInitial(Staff%).Staff4 \ 128) * 128 + (StaffInitial(Staff%).Staff4 AND 63) NEXT Staff% key$ = "N" CASE CHR$(13) PRINT ": Leave unchanged " CASE "" CASE ELSE WHILE INKEY$ <> "": WEND BEEP key$ = "" END SELECT LOOP WHILE key$ = "" PRINT PRINT " 1. G clef (Trebles)" PRINT " 2. C clef (Sopranos)" PRINT " 3. C clef (Altos)" PRINT " 4. C clef (Tenors)" PRINT " 5. F clef (Basses)" PRINT " (0 or Enter to leave unchanged)" PRINT FOR Clf% = 0 TO ShortStaves% - 1 SELECT CASE Clf% CASE 0 PRINT " Enter clef type for top staff: "; StaffInitial(Staff%).Staves AND 7; LOCATE , 39 CASE 1 PRINT " Enter clef type for second staff: "; StaffInitial(Staff%).Staff2 AND 7; LOCATE , 39 CASE 2 PRINT " Enter clef type for third staff: "; StaffInitial(Staff%).Staff3 AND 7; LOCATE , 39 CASE 3 PRINT " Enter clef type for bottom staff: "; StaffInitial(Staff%).Staff4 AND 7; LOCATE , 39 END SELECT DO key$ = INKEY$ SELECT CASE key$ CASE "1", "2", "3", "4", "5" PRINT VAL(key$) FOR Staff% = UpperStaff% TO LowerStaff% SELECT CASE Clf% CASE 0 StaffInitial(Staff%).Staves = VAL(key$) + (StaffInitial(Staff%).Staves \ 8) * 8 CASE 1 StaffInitial(Staff%).Staff2 = VAL(key$) + (StaffInitial(Staff%).Staff2 \ 8) * 8 CASE 2 StaffInitial(Staff%).Staff3 = VAL(key$) + (StaffInitial(Staff%).Staff3 \ 8) * 8 CASE 3 StaffInitial(Staff%).Staff4 = VAL(key$) + (StaffInitial(Staff%).Staff4 \ 8) * 8 END SELECT NEXT Staff% CASE "0", CHR$(13) PRINT CASE "" CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" NEXT Clf% PRINT PRINT " Do you wish to alter the staff spacing (y/n)?" DO key$ = UCASE$(INKEY$) LOOP WHILE key$ <> "Y" AND key$ <> "N" IF key$ = "Y" THEN Mode% = 13: FirstStaffShown% = UpperStaff% UpdateDrawPositions ReDrawScreen% = True CASE CHR$(0) + CHR$(68), CHR$(0) + CHR$(93) 'F10, shift + F10 LOCATE 1, 1 PRINT "Working ..." FOR Note% = 1 TO NextNote% - 1 GET #2, Note%, CurrentNote1 SELECT CASE CurrentNote1.Kind CASE 1, 2, 3, 6, 7, 8, 12 IF key$ = CHR$(0) + CHR$(93) THEN SELECT CASE StaffInitial(CurrentNote1.Staff).Ky CASE 9 TO 15 SELECT CASE CurrentNote1.Vertical \ 50 CASE 0 Clef% = StaffInitial(CurrentNote1.Staff).Staves AND 7 CASE 1 Clef% = StaffInitial(CurrentNote1.Staff).Staff2 AND 7 CASE 2 Clef% = StaffInitial(CurrentNote1.Staff).Staff3 AND 7 CASE 3 Clef% = StaffInitial(CurrentNote1.Staff).Staff4 AND 7 END SELECT MaxHor% = 0 FOR n% = 1 TO NextNote% - 1 GET #2, n%, CurrentNote2 IF CurrentNote2.Kind = 11 AND CurrentNote2.Staff = CurrentNote1.Staff AND CurrentNote2.tail = CurrentNote1.Vertical \ 50 AND CurrentNote2.Horizontal <= CurrentNote1.Horizontal AND CurrentNote2.Horizontal > MaxHor% THEN Clef% = CurrentNote2.Pitch MaxHor% = CurrentNote2.Horizontal END IF NEXT n% SELECT CASE Clef% CASE 1 Increment% = 4 CASE 2 Increment% = 6 CASE 3 Increment% = 3 CASE 4 Increment% = 5 CASE 5 Increment% = 2 END SELECT IF ((CurrentNote1.Vertical MOD 50) + Increment%) MOD 7 <> 1 AND ((CurrentNote1.Vertical MOD 50) + Increment%) MOD 7 <> 5 THEN CurrentNote1.Pitch = LowerPitch%(CurrentNote1.Pitch) IF StaffInitial(CurrentNote1.Staff).Ky > 12 THEN CurrentNote1.Pitch = LowerPitch%(CurrentNote1.Pitch) CurrentNote1.Vertical = (CurrentNote1.Vertical + 199) MOD 200 CASE 1 TO 8 CurrentNote1.Pitch = RaisePitch%(CurrentNote1.Pitch) END SELECT ELSE SELECT CASE StaffInitial(CurrentNote1.Staff).Ky CASE 1 TO 7 SELECT CASE CurrentNote1.Vertical \ 50 CASE 0 Clef% = StaffInitial(CurrentNote1.Staff).Staves AND 7 CASE 1 Clef% = StaffInitial(CurrentNote1.Staff).Staff2 AND 7 CASE 2 Clef% = StaffInitial(CurrentNote1.Staff).Staff3 AND 7 CASE 3 Clef% = StaffInitial(CurrentNote1.Staff).Staff4 AND 7 END SELECT MaxHor% = 0 FOR n% = 1 TO NextNote% - 1 GET #2, n%, CurrentNote2 IF CurrentNote2.Kind = 11 AND CurrentNote2.Staff = CurrentNote1.Staff AND CurrentNote2.tail = CurrentNote1.Vertical \ 50 AND CurrentNote2.Horizontal <= CurrentNote1.Horizontal AND CurrentNote2.Horizontal > MaxHor% THEN Clef% = CurrentNote2.Pitch MaxHor% = CurrentNote2.Horizontal END IF NEXT n% SELECT CASE Clef% CASE 1 Increment% = 4 CASE 2 Incrememt% = 6 CASE 3 Increment% = 3 CASE 4 Incrememt% = 5 CASE 5 Increment% = 2 END SELECT IF ((CurrentNote1.Vertical MOD 50) + Increment%) MOD 7 <> 0 AND ((CurrentNote1.Vertical MOD 50) + Increment%) MOD 7 <> 4 THEN CurrentNote1.Pitch = RaisePitch%(CurrentNote1.Pitch) IF StaffInitial(CurrentNote1.Staff).Ky < 4 THEN CurrentNote1.Pitch = RaisePitch%(CurrentNote1.Pitch) CurrentNote1.Vertical = (CurrentNote1.Vertical + 1) MOD 200 CASE 8 TO 15 CurrentNote1.Pitch = LowerPitch%(CurrentNote1.Pitch) END SELECT END IF CASE 10 IF key$ = CHR$(0) + CHR$(93) THEN SELECT CASE CurrentNote1.Pitch CASE 1 CurrentNote1.Pitch = 8 CASE 8 CurrentNote1.Pitch = 15 CASE 15 CurrentNote1.Pitch = 3 CASE 3 CurrentNote1.Pitch = 10 CASE 10 CurrentNote1.Pitch = 5 CASE 5 CurrentNote1.Pitch = 12 CASE 12 CurrentNote1.Pitch = 7 CASE 7 CurrentNote1.Pitch = 14 CASE 14 CurrentNote1.Pitch = 2 CASE 2 CurrentNote1.Pitch = 9 CASE 9 CurrentNote1.Pitch = 4 CASE 4 CurrentNote1.Pitch = 11 CASE 11 CurrentNote1.Pitch = 6 CASE 6 CurrentNote1.Pitch = 13 CASE 13 CurrentNote1.Pitch = 1 END SELECT ELSE SELECT CASE CurrentNote1.Pitch CASE 1 CurrentNote1.Pitch = 13 CASE 13 CurrentNote1.Pitch = 6 CASE 6 CurrentNote1.Pitch = 11 CASE 11 CurrentNote1.Pitch = 4 CASE 4 CurrentNote1.Pitch = 9 CASE 9 CurrentNote1.Pitch = 2 CASE 2 CurrentNote1.Pitch = 14 CASE 14 CurrentNote1.Pitch = 7 CASE 7 CurrentNote1.Pitch = 12 CASE 12 CurrentNote1.Pitch = 5 CASE 5 CurrentNote1.Pitch = 10 CASE 10 CurrentNote1.Pitch = 3 CASE 3 CurrentNote1.Pitch = 15 CASE 15 CurrentNote1.Pitch = 8 CASE 8 CurrentNote1.Pitch = 1 END SELECT END IF END SELECT PUT #2, Note%, CurrentNote1 NEXT Note% FOR Staff% = -120 TO 120 IF key$ = CHR$(0) + CHR$(93) THEN SELECT CASE StaffInitial(Staff%).Ky CASE 1 StaffInitial(Staff%).Ky = 8 CASE 8 StaffInitial(Staff%).Ky = 15 CASE 15 StaffInitial(Staff%).Ky = 3 CASE 3 StaffInitial(Staff%).Ky = 10 CASE 10 StaffInitial(Staff%).Ky = 5 CASE 5 StaffInitial(Staff%).Ky = 12 CASE 12 StaffInitial(Staff%).Ky = 7 CASE 7 StaffInitial(Staff%).Ky = 14 CASE 14 StaffInitial(Staff%).Ky = 2 CASE 2 StaffInitial(Staff%).Ky = 9 CASE 9 StaffInitial(Staff%).Ky = 4 CASE 4 StaffInitial(Staff%).Ky = 11 CASE 11 StaffInitial(Staff%).Ky = 6 CASE 6 StaffInitial(Staff%).Ky = 13 CASE 13 StaffInitial(Staff%).Ky = 1 END SELECT ELSE SELECT CASE StaffInitial(Staff%).Ky CASE 1 StaffInitial(Staff%).Ky = 13 CASE 13 StaffInitial(Staff%).Ky = 6 CASE 6 StaffInitial(Staff%).Ky = 11 CASE 11 StaffInitial(Staff%).Ky = 4 CASE 4 StaffInitial(Staff%).Ky = 9 CASE 9 StaffInitial(Staff%).Ky = 2 CASE 2 StaffInitial(Staff%).Ky = 14 CASE 14 StaffInitial(Staff%).Ky = 7 CASE 7 StaffInitial(Staff%).Ky = 12 CASE 12 StaffInitial(Staff%).Ky = 5 CASE 5 StaffInitial(Staff%).Ky = 10 CASE 10 StaffInitial(Staff%).Ky = 3 CASE 3 StaffInitial(Staff%).Ky = 15 CASE 15 StaffInitial(Staff%).Ky = 8 CASE 8 StaffInitial(Staff%).Ky = 1 END SELECT END IF NEXT Staff% ChangesMade% = True ReDrawScreen% = True CASE CHR$(0) + CHR$(133) 'F11 CurrentNote1.Staff = Cursor.Staff CurrentNote1.Vertical = 21 CurrentNote1.Horizontal = Cursor.Horizontal CurrentNote1.Selected = False CurrentNote1.group = 0 CurrentNote1.Length = 0 CurrentNote1.Kind = 5 CurrentNote1.Pitch = 0 CurrentNote1.tail = 1 PUT #2, NextNote%, CurrentNote1 NextNote% = NextNote% + 1 ChangesMade% = True ReDrawScreen% = True CASE CHR$(0) + CHR$(135) 'shift + F11 CurrentNote1.Staff = Cursor.Staff CurrentNote1.Vertical = 21 CurrentNote1.Horizontal = Cursor.Horizontal CurrentNote1.Selected = False CurrentNote1.group = 0 CurrentNote1.Length = 0 CurrentNote1.Kind = 5 CurrentNote1.Pitch = 0 CurrentNote1.tail = 0 PUT #2, NextNote%, CurrentNote1 NextNote% = NextNote% + 1 ChangesMade% = True ReDrawScreen% = True CASE CHR$(0) + CHR$(134), CHR$(0) + CHR$(136) 'F12, shift+F12 IF SelectedNote% > 0 THEN GET #2, SelectedNote%, CurrentNote1 SELECT CASE CurrentNote1.Kind CASE 6 ' reposition/align tie PUT #2, SelectedNote%, CurrentNote1 ChangesMade% = True 'RedrawScreen% = TRUE CASE 1, 2, 7, 8 IF CurrentNote1.Staff <> Cursor.Staff OR CurrentNote1.Staff = Cursor.Staff AND CurrentNote1.Horizontal >= Cursor.Horizontal THEN BEEP IncludeCursor% = False ELSE CurrentNote2.Staff = CurrentNote1.Staff CurrentNote2.Vertical = CurrentNote1.Vertical CurrentNote2.Horizontal = CurrentNote1.Horizontal CurrentNote2.Selected = False CurrentNote2.group = 0 IF key$ = CHR$(0) + CHR$(134) THEN CurrentNote2.Kind = 6 ELSE CurrentNote2.Kind = 12 END IF CurrentNote2.Pitch = (Cursor.Vertical - CurrentNote1.Vertical) * 3 CurrentNote2.Length = (Cursor.Horizontal - CurrentNote1.Horizontal) * 5 IF CurrentNote1.Kind = 1 OR CurrentNote1.Kind = 2 THEN CurrentNote2.tail = 15 ELSE CurrentNote2.tail = 11 IF CurrentNote1.tail MOD 2 = 0 THEN CurrentNote2.tail = -CurrentNote2.tail PUT #2, NextNote%, CurrentNote2 NextNote% = NextNote% + 1 ChangesMade% = True ReDrawScreen% = True END IF CASE ELSE BEEP END SELECT ELSEIF TiePosition% = 0 AND SelectedNote% = 0 THEN TiePosition% = NextNote% CurrentNote1.Staff = Cursor.Staff CurrentNote1.Vertical = Cursor.Vertical CurrentNote1.Horizontal = Cursor.Horizontal CurrentNote1.Selected = True CurrentNote1.group = 0 CurrentNote1.Length = 0 IF key$ = CHR$(0) + CHR$(134) THEN CurrentNote1.Kind = 6 ELSE CurrentNote1.Kind = 12 END IF CurrentNote1.Pitch = 0 CurrentNote1.tail = 0 PUT #2, NextNote%, CurrentNote1 NextNote% = NextNote% + 1 ChangesMade% = True ReDrawScreen% = True ELSE GET #2, TiePosition%, CurrentNote1 IF CurrentNote1.Staff <> Cursor.Staff OR CurrentNote1.Staff = Cursor.Staff AND CurrentNote1.Horizontal >= Cursor.Horizontal THEN BEEP IncludeCursor% = False ELSE CLS LOCATE 2, 5: PRINT "1. up" LOCATE 3, 5: PRINT "2. down" DO LOCATE 1, 1: INPUT "Tie to curve: ", Curve$ LOOP UNTIL Curve$ = "u" OR Curve$ = "U" OR Curve$ = "d" OR Curve$ = "D" OR Curve$ = "1" OR Curve$ = "2" SELECT CASE Curve$ CASE "u", "U", "1" Curve% = 1 CASE "d", "D", "2" Curve% = -1 END SELECT LOCATE 4, 15: PRINT "pixels" DO LOCATE 4, 1: INPUT "Offset by: ", OffSet$ LOOP UNTIL VAL(OffSet$) > 0 AND VAL(OffSet$) < 33 CurrentNote1.Length = (Cursor.Horizontal - CurrentNote1.Horizontal) * 5 CurrentNote1.Pitch = (Cursor.Vertical - CurrentNote1.Vertical) * 3 CurrentNote1.tail = INT(VAL(OffSet$)) * Curve% CurrentNote1.Selected = False CurrentNote1.group = 0 PUT #2, TiePosition%, CurrentNote1 TiePosition% = 0 ChangesMade% = True ReDrawScreen% = True END IF END IF ReDrawScreen% = True 'selection keys CASE CHR$(27) 'escape SelectedNote% = 0 NoteTypeDetermined% = False AnchorCol% = 0 StartCol% = 0 EndCol% = 0 IF TiePosition% > 0 THEN Delete TiePosition%: TiePosition% = 0: CompileIndex FOR Note% = 1 TO NextNote% - 1 GET #2, Note%, CurrentNote CurrentNote.Selected = False PUT #2, Note%, CurrentNote NEXT Note% ReDrawScreen% = True CASE CHR$(13) 'enter IF NextNote% = 1 THEN SelectedNote% = 0 WHILE INKEY$ <> "": WEND BEEP IncludeCursor% = False ELSE IF SelectedNote% = 0 THEN Note% = 0 ELSE GET #2, SelectedNote%, CurrentNote1 IF CurrentNote1.Staff = Cursor.Staff AND CurrentNote1.Vertical = Cursor.Vertical AND CurrentNote1.Horizontal = Cursor.Horizontal THEN Note% = SelectedNote% ELSE Note% = 0 END IF DO Note% = Note% + 1 GET #2, Note%, CurrentNote2 LOOP UNTIL Note% = NextNote% OR CurrentNote2.Staff = Cursor.Staff AND CurrentNote2.Vertical = Cursor.Vertical AND CurrentNote2.Horizontal = Cursor.Horizontal IF Note% < NextNote% THEN SelectedNote% = Note% ELSE SelectedNote% = 0 AnchorCol% = 0 StartCol% = 0 EndCol% = 0 ReDrawScreen% = True END IF CASE "+" IF SelectedNote% = 0 THEN BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False ELSE GET #2, SelectedNote%, CurrentNote1 CurrentNote1.Selected = True IF CurrentNote1.group > 0 THEN FOR Ref% = RefNos(CurrentNote1.group - 1) + 1 TO RefNos(CurrentNote1.group) GET #2, GroupedNotes(Ref%), CurrentNote2 CurrentNote2.Selected = True PUT #2, GroupedNotes(Ref%), CurrentNote2 NEXT Ref% END IF PUT #2, SelectedNote%, CurrentNote1 SelectedNote% = 0 ReDrawScreen% = True END IF CASE "-" IF SelectedNote% = 0 THEN BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False ELSE GET #2, SelectedNote%, CurrentNote1 CurrentNote1.Selected = False IF CurrentNote1.group > 0 THEN FOR Ref% = RefNos(CurrentNote1.group - 1) + 1 TO RefNos(CurrentNote1.group) GET #2, GroupedNotes(Ref%), CurrentNote2 CurrentNote2.Selected = False PUT #2, GroupedNotes(Ref%), CurrentNote2 NEXT Ref% END IF PUT #2, SelectedNote%, CurrentNote1 SelectedNote% = 0 ReDrawScreen% = True END IF CASE CHR$(0) + CHR$(83) 'Delete IF SelectedNote% = 0 THEN BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False ELSE GET #2, SelectedNote%, CurrentNote1 IF CurrentNote1.group = 0 THEN Delete SelectedNote% ELSE FOR Note% = NextNote% - 1 TO 1 STEP -1 GET #2, Note%, CurrentNote2 IF CurrentNote2.group = CurrentNote1.group THEN Delete Note% NEXT Note% END IF CompileIndex ChangesMade% = True ReDrawScreen% = True END IF SelectedNote% = 0 AnchorCol% = 0 StartCol% = 0 EndCol% = 0 CASE CHR$(111), CHR$(79), CHR$(15), CHR$(118), CHR$(86), CHR$(22) 'v's and o's and variants IF SizeOfClipboard% = 0 THEN BEEP WHILE INKEY$ <> "": WEND IncludeCursor% = False ELSE PRINT "Paste in progress ... " OPEN WorkingDirectory$ + "CLIPBRD.TMP" FOR RANDOM AS #3 LEN = 14 LengthOfClipboard% = 0 FOR n% = 1 TO SizeOfClipboard% GET #3, n%, ClipboardBuffer IF ClipboardBuffer.Posn > LengthOfClipboard% THEN LengthOfClipboard% = ClipboardBuffer.Posn NEXT n% PasteEndStaff% = Cursor.Staff PasteEndCol% = Cursor.Horizontal + LengthOfClipboard% WHILE PasteEndCol% > 120 PasteEndCol% = PasteEndCol% - 120 PasteEndStaff% = PasteEndStaff% + 1 WEND IF PasteEndStaff% > 120 THEN LOCATE 1, 1 PRINT "Clipboard will not fit in paste area" WHILE INKEY$ <> "": WEND BEEP WHILE INKEY$ = "": WEND ELSE IF key$ = CHR$(118) OR key$ = CHR$(86) OR key$ = CHR$(22) THEN 'v's only NumberOfNotesSelected% = 0 FindNotes Cursor.Staff, Cursor.Horizontal, PasteEndStaff%, PasteEndCol%, 0 FOR Gp% = 1 TO NextGroup% - 1 Ref% = 0 IncludeGroup = False DO UNTIL IncludeGroup OR Ref% = NumberOfNotesSelected% GET #2, NotesSelected(Ref%), CurrentNote1 IF CurrentNote1.group = Gp% THEN IncludeGroup = True Ref% = Ref% + 1 LOOP IF IncludeGroup THEN FOR Ref% = RefNos(Gp% - 1) + 1 TO RefNos(Gp%) Ref2% = 0 WHILE Ref2% < NumberOfNotesSelected% AND NotesSelected(Ref2%) <> GroupedNotes(Ref%) Ref2% = Ref2% + 1 WEND IF NotesSelected(Ref2%) <> GroupedNotes(Ref%) THEN NotesSelected(NumberOfNotesSelected%) = GroupedNotes(Ref%) NumberOfNotesSelected% = NumberOfNotesSelected% + 1 END IF NEXT Ref% END IF NEXT Gp% SortNotesSelected FOR Note% = 0 TO NumberOfNotesSelected% - 1 Delete NotesSelected(Note%) NEXT Note% NumberOfNotesSelected% = 0 END IF HighestGroupNoFound% = 0 FOR n% = 1 TO SizeOfClipboard% GET #3, n%, ClipboardBuffer PasteStaff% = Cursor.Staff PasteCol% = Cursor.Horizontal + ClipboardBuffer.Posn WHILE PasteCol% > 120 PasteCol% = PasteCol% - 120 PasteStaff% = PasteStaff% + 1 WEND CurrentNote1.Staff = PasteStaff% CurrentNote1.Horizontal = PasteCol% CurrentNote1.Vertical = ClipboardBuffer.Vertical CurrentNote1.Selected = False IF ClipboardBuffer.group > HighestGroupNoFound% THEN HighestGroupNoFound% = ClipboardBuffer.group IF ClipboardBuffer.group > 0 THEN CurrentNote1.group = ClipboardBuffer.group + NextGroup% - 1 ELSE CurrentNote1.group = 0 CurrentNote1.Pitch = ClipboardBuffer.Pitch CurrentNote1.Length = ClipboardBuffer.Length CurrentNote1.Kind = ClipboardBuffer.Kind CurrentNote1.tail = ClipboardBuffer.tail PUT #2, NextNote%, CurrentNote1 NextNote% = NextNote% + 1 NEXT n% ChangesMade% = True NextGroup% = NextGroup% + HighestGroupNoFound% CompileIndex RenumberGroups CompileIndex IF NextGroup% - 1 > MAXNUMBEROFGROUPS THEN LOCATE 1 PRINT "Following this paste/overwrite operation you now have more groups ("; NextGroup% - 1; ") than " PRINT "the maximum number allowed ("; MAXNUMBEROFGROUPS; "), and you should therefore save the file " PRINT "immediately and increase the MAXNUMBEROFGROUPS constant in the main program, " PRINT "or alternatively delete at least"; MAXNUMBEROFGROUPS - NextGroup% + 1; "groups, before continuing. " WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND END IF END IF CLOSE #3 ReDrawScreen% = True END IF CASE "h", "H" DisplayMode% = 1 - DisplayMode% UpdateDrawPositions ReDrawScreen% = True CASE ELSE WHILE INKEY$ <> "": WEND BEEP IncludeCursor% = False END SELECT IF Cursor.Staff = -121 THEN Cursor.Staff = 120 IF Cursor.Staff = 121 THEN Cursor.Staff = -120 IF Cursor.Staff < FirstStaffShown% THEN FirstStaffShown% = -121: UpdateDrawPositions WHILE Cursor.Staff > FirstStaffShown% + NumberOfStavesShown% - 1 FirstStaffShown% = FirstStaffShown% + 1 UpdateDrawPositions WEND key$ = INKEY$ IF key$ <> "" THEN GOTO SelectKey IF ReDrawScreen% THEN LOCATE 1: PRINT "Working ... ": CLOSE #2: CHAIN WorkingDirectory$ + Program2$ ELSE GOTO StartOfMainBlock END IF LoseChanges: CLS LOCATE 10 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ You have made changes to your file. Do you ³" PRINT " ³ wish to save these changes? (y/n) ³" PRINT " ³ (Press ESC to cancel) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND DO key$ = UCASE$(INKEY$) LOOP WHILE key$ <> "Y" AND key$ <> "N" AND key$ <> CHR$(27) IF key$ = CHR$(27) THEN SCREEN 12 CLOSE #2 CHAIN WorkingDirectory$ + Program2$ END IF IF key$ = "Y" THEN Save: IF FileName$ <> "" THEN Errorr% = 0 ON ERROR GOTO FileError OPEN FileName$ FOR OUTPUT AS #1 CLOSE #1 ON ERROR GOTO 0 IF Errorr% = 0 THEN FileSave ELSE CLS LOCATE 10 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Unable to save file under existing name. ³" PRINT " ³ Press ESC to cancel, or any other key to ³" PRINT " ³ input a new file name. ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" IF key$ = CHR$(27) THEN CLOSE #2 SCREEN 12 CHAIN WorkingDirectory$ + Program2$ END IF FileName$ = "" END IF END IF WHILE FileName$ = "" SaveAs: SaveFile% = False FileName$ = GetFileName$ Errorr% = 0 ON ERROR GOTO FileError OPEN FileName$ FOR INPUT AS #1 CLOSE #1 ON ERROR GOTO 0 SELECT CASE Errorr% CASE 53 SaveFile% = True CASE 0 CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ File already exists: overwrite? (y/n) ³" PRINT " ³ (Press ESC to cancel) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND DO key$ = UCASE$(INKEY$) LOOP WHILE key$ <> "Y" AND key$ <> "N" AND key$ <> CHR$(27) IF key$ = CHR$(27) THEN CLOSE #2 SCREEN 12 CHAIN WorkingDirectory$ + Program2$ END IF IF key$ = "Y" THEN SaveFile% = True ELSE FileName$ = "" CASE ELSE CLS LOCATE 1 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Problem saving file. Press ESC to cancel, ³" PRINT " ³ or any other key to try another filename. ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" IF key$ = CHR$(27) THEN CLOSE #2 SCREEN 12 CHAIN WorkingDirectory$ + Program2$ END IF FileName$ = "" END SELECT IF SaveFile% THEN Errorr% = 0 ON ERROR GOTO FileError OPEN FileName$ FOR OUTPUT AS #1 CLOSE #1 ON ERROR GOTO 0 IF Errorr% = 0 THEN FileSave ELSE CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ Problem creating file. Press ESC to cancel, ³" PRINT " ³ or any other key to try another filename. ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" IF key$ = CHR$(27) THEN CLOSE #2 SCREEN 12 CHAIN WorkingDirectory$ + Program2$ END IF FileName$ = "" END IF END IF WEND END IF RETURN REM Heading Item 1 Item 2 Item 3 Item 4 Item 5 Item 6 Item 7 Item 8 FileMenuData: DATA File, New, Open, Save, Save As, "-", Exit FileHotLetter: DATA 1, 1, 1, 1, 6, , 1 EditMenuData: DATA EditHotLetter: DATA InsertMenuData: DATA Insert, Note, Rest, Pause Above, Pause Below, InsertHotLetter: DATA JMenuData: DATA JHotLetter: DATA HelpMenuData: DATA Help, General Help F1,Edit Selection Mode,-, ReadMe, About HelpHotLetter: DATA 1, 9, 1, , 1, 1 FileError: Errorr% = ERR RESUME NEXT OpenError2: RESUME OpenError DirError: Errorr% = ERR COLOR 3, 0 LOCATE 2, 3 PRINT "Cannot find directory " LOCATE 3, 3 PRINT SPACE$(76) BEEP LOCATE 3, 3 PRINT "(Press any key to continue) " COLOR 15, 0 WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND RESUME NEXT FUNCTION ChangeDirectory$ (Dir$) SELECT CASE LEN(Dir$) CASE IS > 3 ChangeDirectory$ = LEFT$(Dir$, LEN(Dir$) - 1) CASE ELSE ChangeDirectory$ = Dir$ END SELECT END FUNCTION SUB CompileIndex SHARED NextGroup%, NextNote% DIM CurrentNote4 AS NoteType, CurrentNote5 AS NoteType NumberOfGroupedNotes% = 0 RefNos(0) = -1 FOR Gp% = 1 TO NextGroup% - 1 FOR Note% = 1 TO NextNote% - 1 GET #2, Note%, CurrentNote4 IF CurrentNote4.group = Gp% THEN GroupedNotes(NumberOfGroupedNotes%) = Note% NumberOfGroupedNotes% = NumberOfGroupedNotes% + 1 END IF NEXT Note% RefNos(Gp%) = NumberOfGroupedNotes% - 1 IF RefNos(Gp%) > RefNos(Gp% - 1) THEN Ref% = RefNos(Gp% - 1) + 1 FOR x% = 1 TO 2 GET #2, GroupedNotes(Ref%), CurrentNote4 DO WHILE CurrentNote4.tail < 128 Ref% = Ref% + 1 GET #2, GroupedNotes(Ref%), CurrentNote4 LOOP IF CurrentNote4.tail < 16384 THEN SWAP GroupedNotes(Ref%), GroupedNotes(RefNos(Gp% - 1) + 1) Ref% = Ref% + 1 ELSE SWAP GroupedNotes(Ref%), GroupedNotes(RefNos(Gp%)) END IF NEXT x% END IF FOR Ref% = RefNos(Gp% - 1) + 2 TO RefNos(Gp%) - 2 SmallestRef% = Ref% FOR TryRef% = Ref% + 1 TO RefNos(Gp%) - 1 GET #2, GroupedNotes(TryRef%), CurrentNote4 GET #2, GroupedNotes(SmallestRef%), CurrentNote5 IF CurrentNote4.Staff < CurrentNote5.Staff OR CurrentNote4.Staff = CurrentNote5.Staff AND CurrentNote4.Horizontal < CurrentNote5.Horizontal THEN SmallestRef% = TryRef% NEXT TryRef% SWAP GroupedNotes(Ref%), GroupedNotes(SmallestRef%) NEXT Ref% NEXT Gp% END SUB SUB CursorLedgerLines (HorPos%, VertPos%, Colour%) IF Cursor.Vertical MOD 50 < 2 THEN LedgerLine HorPos%, VertPos% + 3, Colour% IF Cursor.Vertical MOD 50 < 4 THEN LedgerLine HorPos%, VertPos% + 9, Colour% IF Cursor.Vertical MOD 50 < 6 THEN LedgerLine HorPos%, VertPos% + 15, Colour% IF Cursor.Vertical MOD 50 < 8 THEN LedgerLine HorPos%, VertPos% + 21, Colour% IF Cursor.Vertical MOD 50 < 10 THEN LedgerLine HorPos%, VertPos% + 27, Colour% IF Cursor.Vertical MOD 50 < 12 THEN LedgerLine HorPos%, VertPos% + 33, Colour% IF Cursor.Vertical MOD 50 < 14 THEN LedgerLine HorPos%, VertPos% + 39, Colour% IF Cursor.Vertical MOD 50 < 16 THEN LedgerLine HorPos%, VertPos% + 45, Colour% IF Cursor.Vertical MOD 50 < 18 THEN LedgerLine HorPos%, VertPos% + 51, Colour% IF Cursor.Vertical MOD 50 < 20 THEN LedgerLine HorPos%, VertPos% + 57, Colour% IF Cursor.Vertical MOD 50 > 30 THEN LedgerLine HorPos%, VertPos% + 93, Colour% IF Cursor.Vertical MOD 50 > 32 THEN LedgerLine HorPos%, VertPos% + 99, Colour% IF Cursor.Vertical MOD 50 > 34 THEN LedgerLine HorPos%, VertPos% + 105, Colour% IF Cursor.Vertical MOD 50 > 36 THEN LedgerLine HorPos%, VertPos% + 111, Colour% IF Cursor.Vertical MOD 50 > 38 THEN LedgerLine HorPos%, VertPos% + 117, Colour% IF Cursor.Vertical MOD 50 > 40 THEN LedgerLine HorPos%, VertPos% + 123, Colour% IF Cursor.Vertical MOD 50 > 42 THEN LedgerLine HorPos%, VertPos% + 129, Colour% IF Cursor.Vertical MOD 50 > 44 THEN LedgerLine HorPos%, VertPos% + 135, Colour% IF Cursor.Vertical MOD 50 > 46 THEN LedgerLine HorPos%, VertPos% + 141, Colour% IF Cursor.Vertical MOD 50 = 49 THEN LedgerLine HorPos%, VertPos% + 147, Colour% END SUB SUB Delete (Note%) SHARED NextNote% DIM CurrentNote1 AS NoteType GET #2, NextNote% - 1, CurrentNote1 PUT #2, Note%, CurrentNote1 NextNote% = NextNote% - 1 END SUB SUB Digit (Dgt%, Hor%, Vert%, Colour%) SELECT CASE Dgt% CASE 0 CIRCLE (Hor% + 3, Vert% + 6), 5, Colour%, , , 2 CASE 1 LINE (Hor% + 3, Vert% + 1)-(Hor% + 3, Vert% + 11), Colour% LINE (Hor% + 3, Vert% + 1)-(Hor%, Vert% + 4), Colour% CASE 2 PSET (Hor%, Vert% + 3), Colour% PSET (Hor% + 1, Vert% + 2), Colour% PSET (Hor% + 2, Vert% + 2), Colour% PSET (Hor% + 3, Vert% + 1), Colour% PSET (Hor% + 4, Vert% + 1), Colour% PSET (Hor% + 5, Vert% + 2), Colour% PSET (Hor% + 6, Vert% + 3), Colour% PSET (Hor% + 6, Vert% + 4), Colour% PSET (Hor% + 6, Vert% + 5), Colour% PSET (Hor% + 5, Vert% + 6), Colour% PSET (Hor% + 4, Vert% + 7), Colour% PSET (Hor% + 3, Vert% + 8), Colour% PSET (Hor% + 2, Vert% + 9), Colour% PSET (Hor% + 1, Vert% + 10), Colour% LINE (Hor%, Vert% + 11)-(Hor% + 6, Vert% + 11), Colour% CASE 3 LINE (Hor%, Vert% + 1)-(Hor% + 6, Vert% + 1), Colour% LINE (Hor% + 5, Vert% + 2)-(Hor% + 2, Vert% + 5), Colour% PSET (Hor% + 3, Vert% + 5), Colour% PSET (Hor% + 4, Vert% + 5), Colour% PSET (Hor% + 5, Vert% + 6), Colour% PSET (Hor% + 6, Vert% + 7), Colour% PSET (Hor% + 6, Vert% + 8), Colour% PSET (Hor% + 6, Vert% + 9), Colour% PSET (Hor% + 5, Vert% + 10), Colour% PSET (Hor% + 4, Vert% + 11), Colour% PSET (Hor% + 3, Vert% + 11), Colour% PSET (Hor% + 2, Vert% + 11), Colour% PSET (Hor% + 1, Vert% + 10), Colour% PSET (Hor%, Vert% + 9), Colour% CASE 4 LINE (Hor% + 5, Vert% + 11)-(Hor% + 5, Vert% + 1), Colour% LINE (Hor% + 4, Vert% + 2)-(Hor%, Vert% + 6), Colour% LINE (Hor%, Vert% + 7)-(Hor% + 6, Vert% + 7), Colour% CASE 5 LINE (Hor% + 6, Vert% + 1)-(Hor%, Vert% + 1), Colour% LINE (Hor%, Vert% + 2)-(Hor%, Vert% + 5), Colour% LINE (Hor% + 1, Vert% + 5)-(Hor% + 4, Vert% + 5), Colour% PSET (Hor% + 5, Vert% + 6), Colour% PSET (Hor% + 6, Vert% + 7), Colour% PSET (Hor% + 6, Vert% + 8), Colour% PSET (Hor% + 6, Vert% + 9), Colour% PSET (Hor% + 5, Vert% + 10), Colour% LINE (Hor% + 4, Vert% + 11)-(Hor% + 2, Vert% + 11), Colour% PSET (Hor% + 1, Vert% + 10), Colour% PSET (Hor%, Vert% + 10), Colour% CASE 6 PSET (Hor% + 5, Vert% + 2), Colour% LINE (Hor% + 4, Vert% + 1)-(Hor% + 2, Vert% + 1), Colour% PSET (Hor% + 1, Vert% + 2), Colour% LINE (Hor%, Vert% + 3)-(Hor%, Vert% + 9), Colour% PSET (Hor% + 1, Vert% + 10), Colour% LINE (Hor% + 2, Vert% + 11)-(Hor% + 4, Vert% + 11), Colour% PSET (Hor% + 5, Vert% + 10), Colour% PSET (Hor% + 6, Vert% + 9), Colour% PSET (Hor% + 6, Vert% + 8), Colour% PSET (Hor% + 6, Vert% + 7), Colour% PSET (Hor% + 5, Vert% + 6), Colour% PSET (Hor% + 4, Vert% + 5), Colour% PSET (Hor% + 3, Vert% + 5), Colour% PSET (Hor% + 2, Vert% + 5), Colour% PSET (Hor% + 1, Vert% + 6), Colour% CASE 7 LINE (Hor%, Vert% + 1)-(Hor% + 6, Vert% + 1), Colour% LINE (Hor% + 6, Vert% + 1)-(Hor%, Vert% + 11), Colour% CASE 8 LINE (Hor% + 5, Vert% + 1)-(Hor% + 1, Vert% + 1), Colour% LINE (Hor%, Vert% + 2)-(Hor%, Vert% + 4), Colour% LINE (Hor% + 1, Vert% + 5)-(Hor% + 5, Vert% + 5), Colour% LINE (Hor% + 6, Vert% + 6)-(Hor% + 6, Vert% + 10), Colour% LINE (Hor% + 5, Vert% + 11)-(Hor% + 1, Vert% + 11), Colour% LINE (Hor%, Vert% + 10)-(Hor%, Vert% + 6), Colour% LINE (Hor% + 6, Vert% + 4)-(Hor% + 6, Vert% + 2), Colour% CASE 9 PSET (Hor% + 1, Vert% + 10), Colour% LINE (Hor% + 2, Vert% + 11)-(Hor% + 4, Vert% + 11), Colour% PSET (Hor% + 5, Vert% + 10), Colour% LINE (Hor% + 6, Vert% + 9)-(Hor% + 6, Vert% + 3), Colour% PSET (Hor% + 5, Vert% + 2), Colour% LINE (Hor% + 4, Vert% + 1)-(Hor% + 2, Vert% + 1), Colour% PSET (Hor% + 1, Vert% + 2), Colour% PSET (Hor%, Vert% + 3), Colour% PSET (Hor%, Vert% + 4), Colour% PSET (Hor%, Vert% + 5), Colour% PSET (Hor% + 1, Vert% + 6), Colour% PSET (Hor% + 2, Vert% + 7), Colour% PSET (Hor% + 3, Vert% + 7), Colour% PSET (Hor% + 4, Vert% + 7), Colour% PSET (Hor% + 5, Vert% + 6), Colour% END SELECT END SUB SUB FileNew SHARED NextNote%, NextGroup%, DisplayMode%, DefaultCol% CLS LOCATE 3 PRINT " A. Cb (7 flats)" PRINT " B. Gb (6 flats)" PRINT " C. Db (5 flats)" PRINT " D. Ab (4 flats)" PRINT " E. Eb (3 flats)" PRINT " F. Bb (2 flats)" PRINT " G. F (1 flat)" PRINT PRINT " H. C (natural)" PRINT PRINT " I. G (1 sharp)" PRINT " J. D (2 sharps)" PRINT " K. A (3 sharps)" PRINT " L. E (4 sharps)" PRINT " M. B (5 sharps)" PRINT " N. F# (6 sharps)" PRINT " O. C# (7 sharps)" PRINT PRINT " Enter key signature" DO key$ = INKEY$ SELECT CASE ASC(UCASE$(key$) + "GOBBLEDYGOOK") CASE 65 TO 79 KeyType% = ASC(UCASE$(key$) + "GOBBLEDYGOOK") - 64 CASE ELSE BEEP WHILE INKEY$ <> "": WEND key$ = "" END SELECT LOOP WHILE key$ = "" FOR Staff% = -120 TO 120 StaffInitial(Staff%).Ky = KeyType% StaffInitial(Staff%).Staves = 9 StaffInitial(Staff%).Staff2 = 5 + 66 * 128 StaffInitial(Staff%).Staff3 = 1 + 132 * 128 StaffInitial(Staff%).Staff4 = 5 + 198 * 128 StaffInitial(Staff%).DrawPosition = -1 NEXT Staff% LOCATE 22 PRINT " :" PRINT PRINT " (type in suitable top value, 1 to 39, then press enter)"; DO LOCATE 20 PRINT INPUT " Input time signature: ", TopHalf$ LOOP UNTIL VAL(TopHalf$) > 0 AND VAL(TopHalf$) < 40 LOCATE 24 PRINT " (type in suitable bottom value, 1 to 39, then press enter)"; DO LOCATE 22, 25 INPUT ": ", BottomHalf$ LOOP UNTIL VAL(BottomHalf$) > 0 AND VAL(BottomHalf$) < 40 SELECT CASE StaffInitial(1).Ky CASE 1: DefaultCol% = 5 CASE 2: DefaultCol% = 5 CASE 3: DefaultCol% = 4 CASE 4: DefaultCol% = 3 CASE 5: DefaultCol% = 3 CASE 6, 7, 9: DefaultCol% = 2 CASE 8: DefaultCol% = 1 CASE 10 TO 15: DefaultCol% = StaffInitial(0).Ky - 7 END SELECT CurrentNote.Staff = 1 CurrentNote.Vertical = 21 CurrentNote.Horizontal = DefaultCol% CurrentNote.Selected = 0 CurrentNote.group = 0 CurrentNote.Kind = 9 CurrentNote.Length = VAL(TopHalf$) CurrentNote.Pitch = VAL(BottomHalf$) CurrentNote.tail = 0 PUT #2, 1, CurrentNote NextNote% = 2 NextGroup% = 1 DisplayMode% = 1 FileName$ = "" FOR a% = 0 TO 3 Header(a%) = SPACE$(80) NEXT a% Cursor.Staff = 1 Cursor.Vertical = 25 Cursor.Horizontal = DefaultCol% + 4 FirstStaffShown% = -121 UpdateDrawPositions END SUB SUB FileOpen DIM VersionInfo AS STRING * 80 DIM CurrentNote1 AS NoteType OPEN FileName$ FOR BINARY AS #1 GET #1, , VersionInfo IF LEFT$(VersionInfo, 73) <> "Music file for Music Typesetting Program by Robert Munster, file format #" THEN CLS LOCATE 11 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ This file is not a music format file. ³" PRINT " ³ (Press any key to continue) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND FileNew EXIT SUB END IF IF VAL(RIGHT$(VersionInfo, 7)) > 1 THEN CLS LOCATE 10 PRINT " ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT " ³ This file is in a format from a later version ³" PRINT " ³ of the program and cannot be read. ³" PRINT " ³ (Press any key to continue) ³" PRINT " ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND FileNew EXIT SUB END IF FOR l% = 0 TO 3 GET #1, , Header(l%) NEXT l% FOR s% = -120 TO 120 GET #1, , StaffInitial(s%).Ky GET #1, , StaffInitial(s%).Staves GET #1, , StaffInitial(s%).Staff2 GET #1, , StaffInitial(s%).Staff3 GET #1, , StaffInitial(s%).Staff4 StaffInitial(s%).DrawPosition = -1 NEXT s% GET #1, , NextNote% FOR Note% = 1 TO NextNote% - 1 GET #1, , CurrentNote1.Staff GET #1, , CurrentNote1.Vertical GET #1, , CurrentNote1.Horizontal GET #1, , CurrentNote1.group GET #1, , CurrentNote1.Kind GET #1, , CurrentNote1.Pitch GET #1, , CurrentNote1.Length GET #1, , CurrentNote1.tail CurrentNote1.Selected = False PUT #2, Note%, CurrentNote1 NEXT Note% GET #1, , NextGroup% DisplayMode% = 1 GET #1, , DefaultCol% CLOSE #1 Cursor.Staff = 1 Cursor.Vertical = 25 Cursor.Horizontal = DefaultCol% + 4 FirstStaffShown% = -121 UpdateDrawPositions END SUB SUB FileSave DIM VersionInfo AS STRING * 80 DIM CurrentNote1 AS NoteType VersionInfo = "Music file for Music Typesetting Program by Robert Munster, file format #0000001" OPEN FileName$ FOR BINARY AS #1 PUT #1, , VersionInfo FOR l% = 0 TO 3 PUT #1, , Header(l%) NEXT l% FOR s% = -120 TO 120 PUT #1, , StaffInitial(s%).Ky PUT #1, , StaffInitial(s%).Staves PUT #1, , StaffInitial(s%).Staff2 PUT #1, , StaffInitial(s%).Staff3 PUT #1, , StaffInitial(s%).Staff4 NEXT s% PUT #1, , NextNote% FOR Note% = 1 TO NextNote% - 1 GET #2, Note%, CurrentNote1 PUT #1, , CurrentNote1.Staff PUT #1, , CurrentNote1.Vertical PUT #1, , CurrentNote1.Horizontal PUT #1, , CurrentNote1.group PUT #1, , CurrentNote1.Kind PUT #1, , CurrentNote1.Pitch PUT #1, , CurrentNote1.Length PUT #1, , CurrentNote1.tail NEXT Note% PUT #1, , NextGroup% PUT #1, , DefaultCol% CLOSE #1 END SUB SUB FindNotes (StartStaff%, StartCol%, EndStaff%, EndCol%, NoteTypes%) DIM CurrentNote1 AS NoteType FOR n% = 1 TO NextNote% - 1 GET #2, n%, CurrentNote1 IF NOT (CurrentNote1.Staff < StartStaff% OR EndStaff% < CurrentNote1.Staff OR CurrentNote1.Staff = StartStaff% AND CurrentNote1.Horizontal < StartCol% OR EndStaff% = CurrentNote1.Staff AND EndCol% < CurrentNote1.Horizontal OR NoteTypes% > 0 AND CurrentNote1.Kind <> NoteTypes%) THEN NotesSelected(NumberOfNotesSelected%) = n% NumberOfNotesSelected% = NumberOfNotesSelected% + 1 END IF NEXT n% END SUB SUB FindNoteType SHARED NoteTypeDetermined% CLS LOCATE 4 PRINT " Normal notes:" PRINT " 1. Double length (Breve)" PRINT " 2. Whole note (Semibreve)" PRINT " 3. Half note (Minim) (white)" PRINT " 4. Quarter note (Crotchet) (black)" PRINT " 5. 1/8 note (Quaver) (one tail)" PRINT " 6. 1/16 note (Semiquaver) (two tails)" PRINT " 7. 1/32 note (Demi-semiquaver) (three tails)" PRINT " 8. 1/64 note (Semi-demi-semiquaver) (four tails)" PRINT " Special notes:" PRINT " 9. Double Breve" PRINT " 10. Double Staggered Breve (joint with line above)" PRINT " 11. White note for appendage to stem of note in current horizontal alignment" PRINT " 12. Black note for appendage to stem of note in current horizontal alignment" DO LOCATE 3 INPUT "Note duration: ", Length$ LOOP UNTIL VAL(Length$) > 0 AND VAL(Length$) < 13 CurrentNote.Length = VAL(Length$) CurrentNote.Kind = 1 CurrentNote.Pitch = 1 IF CurrentNote.Length > 2 AND CurrentNote.Length <> 9 AND CurrentNote.Length <> 10 THEN CLS LOCATE 4 PRINT " 1. up" PRINT " 2. down" DO LOCATE 3 INPUT "Stem pointing: ", tail$ LOOP UNTIL VAL(tail$) > 0 AND VAL(tail$) < 3 CurrentNote.tail = VAL(tail$) MOD 2 END IF NoteTypeDetermined% = True END SUB SUB FindRestType SHARED NoteTypeDetermined% CLS LOCATE 4 PRINT " 1. Double length (Breve) (between lines)" PRINT " 2. Whole note (Semibreve) (above line)" PRINT " 3. Half note (Minim) (below line)" PRINT " 4. Quarter note (Crotchet) (tail on right)" PRINT " 5. 1/8 note (Quaver) (one tail on left)" PRINT " 6. 1/16 note (Semiquaver) (two tails on left)" PRINT " 7. 1/32 note (Demi-semiquaver) (three tails on left)" PRINT " 8. 1/64 note (Semi-demi-semiquaver) (four tails on left)" DO LOCATE 3 INPUT "Rest duration: ", Length$ LOOP UNTIL VAL(Length$) > 0 AND VAL(Length$) < 9 CurrentNote.Length = VAL(Length$) CurrentNote.Kind = 3 CurrentNote.Pitch = 1 CurrentNote.tail = 0 NoteTypeDetermined% = True END SUB FUNCTION GetFileName$ SHARED Errorr% NumberOfDirects% = 0 NumberOfFiles% = 0 DIM DirectRefs(NumberOfDirects%) AS INTEGER DIM FileRefs(NumberOfFiles%) AS INTEGER Extension$ = ".mus" Wdw% = 1 DO CHDIR ChangeDirectory$(CurrentDirectory$) CurrentFile$ = "" CLOSE #4, #5, #6, #7 SHELL LEFT$(DefaultFileDirectory$, 3) SHELL "dir /b/ad/on >" + WorkingDirectory$ + "DIRECTS.TMP" SHELL "dir /ad/on >" + WorkingDirectory$ + "DDIRECTS.TMP" SHELL "dir *" + Extension$ + " /b/a-d/on >" + WorkingDirectory$ + "FILES.TMP" SHELL "dir *" + Extension$ + " /a-d/on >" + WorkingDirectory$ + "DFILES.TMP" OPEN WorkingDirectory$ + "DIRECTS.TMP" FOR INPUT AS #4 OPEN WorkingDirectory$ + "DDIRECTS.TMP" FOR INPUT AS #6 OPEN WorkingDirectory$ + "FILES.TMP" FOR INPUT AS #5 OPEN WorkingDirectory$ + "DFILES.TMP" FOR INPUT AS #7 NumberOfDirects% = 0 WHILE NOT EOF(4) LINE INPUT #4, Buffer$ NumberOfDirects% = NumberOfDirects% + 1 WEND FOR x% = 1 TO 7 LINE INPUT #6, Buffer$ NEXT x% IF LEFT$(Buffer$, 2) = ".." THEN start% = 0 ELSE start% = 1 REDIM DirectRefs(NumberOfDirects%) AS INTEGER SEEK #4, 1 FOR Direct% = 1 TO NumberOfDirects% DirectRefs(Direct%) = SEEK(4) LINE INPUT #4, Buffer$ NEXT Direct% NumberOfFiles% = 0 WHILE NOT EOF(5) LINE INPUT #5, Buffer$ NumberOfFiles% = NumberOfFiles% + 1 WEND REDIM FileRefs(NumberOfFiles%) AS INTEGER SEEK #5, 1 FOR x% = 1 TO 5 LINE INPUT #7, Buffer$ NEXT x% FOR file% = 1 TO NumberOfFiles% FileRefs(file%) = SEEK(5) LINE INPUT #5, Buffer$ NEXT file% FirstFileShown% = 1 file% = 0 FirstDirectShown% = start% Direct% = start% - 1 DO SCREEN 0 COLOR 7, 0 CLS LOCATE 1, 1 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" ' 1 PRINT "³ ³" ' 2 PRINT "³ ³" ' 3 PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" ' 4 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" ' 5 PRINT "³ Files ³³ Directories ³" ' 6 PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" ' 7 FOR x% = 1 TO 14 PRINT "³ ³³ ³" ' 8 to 21 NEXT x% PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" ' 22 LOCATE 2, 3 PRINT LEFT$(CurrentDirectory$ + CurrentFile$, 76) LOCATE 3, 3 PRINT MID$(CurrentDirectory$ + CurrentFile$, 77, 76) FOR f% = FirstFileShown% TO FirstFileShown% + 13 IF f% > NumberOfFiles% THEN EXIT FOR LOCATE 8 + f% - FirstFileShown%, 3 IF f% = file% AND Wdw% = 1 THEN COLOR 0, 7 SEEK #5, FileRefs(f%) LINE INPUT #5, Buffer$ PRINT LEFT$(Buffer$, 40) COLOR 7, 0 NEXT f% FOR d% = FirstDirectShown% TO FirstDirectShown% + 13 IF d% > NumberOfDirects% THEN EXIT FOR LOCATE 8 + d% - FirstDirectShown%, 47 IF d% = Direct% AND Wdw% = 2 THEN COLOR 0, 7 IF d% = 0 THEN Buffer$ = ".." ELSE SEEK #4, DirectRefs(d%) LINE INPUT #4, Buffer$ END IF PRINT LEFT$(Buffer$, 32) COLOR 7, 0 NEXT d% LOCATE 23, 5 PRINT "Show all files: *.*" LOCATE 24, 5 PRINT "Show only music files: *.mus"; LOCATE 25, 5 PRINT "Show only files of extension *" + Extension$; SELECT CASE Extension$ CASE ".*" LOCATE 23, 3 PRINT "" CASE ".mus" LOCATE 24, 3 PRINT ""; CASE ELSE LOCATE 25, 3 PRINT ""; END SELECT InputKey: SELECT CASE Wdw% CASE 0 LOCATE 22 WorkingString$ = LEFT$(CurrentDirectory$ + CurrentFile$, 172) LOCATE 1, 1 COLOR 15, 0 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT "³ ³" PRINT "³ ³" PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" LOCATE 2, 3 PRINT LEFT$(WorkingString$, 76) LOCATE 3, 3 PRINT MID$(WorkingString$, 77) LOCATE 2 + LEN(WorkingString$) \ 76, 3 + LEN(WorkingString$) MOD 76, 1 InputKey0: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(9) LOCATE , , 0 Wdw% = (Wdw% + 1) MOD 4 CASE CHR$(0) + CHR$(15) LOCATE , , 0 Wdw% = (Wdw% + 3) MOD 4 CASE CHR$(8) CharacterToDelete$ = RIGHT$(WorkingString$, 1) SELECT CASE CharacterToDelete$ CASE "\" Posn% = LEN(WorkingString$) - 1 WHILE MID$(WorkingString$, Posn%, 1) <> "\" AND MID$(WorkingString$, Posn%, 1) <> ":" Posn% = Posn% - 1 WEND SELECT CASE MID$(WorkingString$, Posn%, 1) CASE "\" CurrentDirectory$ = LEFT$(WorkingString$, Posn%) CHDIR ChangeDirectory$(CurrentDirectory$) EXIT DO CASE ":" BEEP END SELECT CASE ELSE CurrentFile$ = LEFT$(CurrentFile$, LEN(CurrentFile$) - 1) END SELECT CASE "\" Errorr% = 0 ON ERROR GOTO DirError CHDIR ChangeDirectory$(WorkingString$) ON ERROR GOTO 0 IF Errorr% = 0 THEN CurrentDirectory$ = WorkingString$ + "\": CHDIR ChangeDirectory$(CurrentDirectory$): CurrentFile$ = "": EXIT DO CASE CHR$(13) AddExtension% = True FOR Posn% = 1 TO LEN(Extension$) IF MID$(Extension$, Posn%, 1) = "*" OR MID$(Extension$, Posn%, 1) = "?" THEN AddExtension% = False NEXT Posn% Posn% = LEN(WorkingString$) WHILE MID$(WorkingString$, Posn%, 1) <> "\" Posn% = Posn% - 1 WEND WHILE Posn% < LEN(WorkingString$) Posn% = Posn% + 1 IF MID$(WorkingString$, Posn%, 1) = "." THEN AddExtension% = False WEND IF AddExtension% THEN WorkingString$ = WorkingString$ + Extension$ GetFileName$ = WorkingString$ SCREEN 12 CLOSE #4, #5, #6, #7 LOCATE , , 0 EXIT FUNCTION CASE ELSE SELECT CASE ASC(key$) CASE 33, 35 TO 41, 45, 46, 48 TO 57, 64 TO 90, 94 TO 123, 125 TO 255 CurrentFile$ = CurrentFile$ + key$ CASE ELSE BEEP GOTO InputKey0 END SELECT END SELECT ' And what else? CASE 1 IF NumberOfFiles% = 0 THEN IF key$ = CHR$(0) + CHR$(15) THEN Wdw% = (Wdw% + 3) MOD 4 ELSE Wdw% = (Wdw% + 1) MOD 4 GOTO InputKey END IF COLOR 15, 0 LOCATE 5, 1 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" PRINT "³ Files ³" PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" FOR x% = 1 TO 14 PRINT "³"; LOCATE , 44 PRINT "³" NEXT x% PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" COLOR 7, 0 InputKey1: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(0) + CHR$(72) file% = file% - 1 IF file% < 1 THEN file% = 1: BEEP SEEK #5, FileRefs(file%) LINE INPUT #5, CurrentFile$ CASE CHR$(0) + CHR$(80) IF file% < NumberOfFiles% THEN file% = file% + 1 ELSE BEEP SEEK #5, FileRefs(file%) LINE INPUT #5, CurrentFile$ CASE CHR$(0) + CHR$(73) file% = file% - 14 IF file% < 1 THEN file% = 1 SEEK #5, FileRefs(file%) LINE INPUT #5, CurrentFile$ CASE CHR$(0) + CHR$(81) file% = file% + 14 IF file% > NumberOfFiles% THEN file% = NumberOfFiles% SEEK #5, FileRefs(file%) LINE INPUT #5, CurrentFile$ CASE CHR$(9) Wdw% = (Wdw% + 1) MOD 4 CASE CHR$(0) + CHR$(15) Wdw% = (Wdw% + 3) MOD 4 CASE CHR$(13) IF file% < 1 THEN BEEP GOTO InputKey1 ELSE SEEK #7, 1 FOR f% = 1 TO file% + 5 LINE INPUT #7, Buffer$ NEXT f% MID$(Buffer$, 9, 1) = "." GetFileName$ = CurrentDirectory$ + LEFT$(Buffer$, 12) SCREEN 12 CLOSE #4, #5, #6, #7 EXIT FUNCTION END IF CASE ELSE BEEP GOTO InputKey1 END SELECT IF file% >= 1 AND file% < FirstFileShown% THEN FirstFileShown% = file% IF file% > FirstFileShown% + 13 THEN FirstFileShown% = file% - 13 CASE 2 IF start% = 1 AND NumberOfDirects% = 0 THEN IF key$ = CHR$(0) + CHR$(15) THEN Wdw% = (Wdw% + 3) MOD 4 ELSE Wdw% = (Wdw% + 1) MOD 4 GOTO InputKey END IF COLOR 15, 0 LOCATE 5, 45 PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿" LOCATE , 45 PRINT "³ Directories ³" LOCATE , 45 PRINT "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´" FOR x% = 1 TO 14 LOCATE , 45 PRINT "³"; LOCATE , 80 PRINT "³" NEXT x% LOCATE , 45 PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ" COLOR 7, 0 InputKey2: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(0) + CHR$(72) Direct% = Direct% - 1 IF Direct% < start% THEN Direct% = start%: BEEP IF Direct% = 0 THEN CurrentFile$ = "..\" ELSE SEEK #4, DirectRefs(Direct%) LINE INPUT #4, CurrentFile$ CurrentFile$ = CurrentFile$ + "\" END IF CASE CHR$(0) + CHR$(80) IF Direct% < NumberOfDirects% THEN Direct% = Direct% + 1 ELSE BEEP IF Direct% = 0 THEN CurrentFile$ = "..\" ELSE SEEK #4, DirectRefs(Direct%) LINE INPUT #4, CurrentFile$ CurrentFile$ = CurrentFile$ + "\" END IF CASE CHR$(0) + CHR$(73) Direct% = Direct% - 14 IF Direct% < start% THEN Direct% = start% IF Direct% = 0 THEN CurrentFile$ = "..\" ELSE SEEK #4, DirectRefs(Direct%) LINE INPUT #4, CurrentFile$ CurrentFile$ = CurrentFile$ + "\" END IF CASE CHR$(0) + CHR$(81) Direct% = Direct% + 14 IF Direct% > NumberOfDirects% THEN Direct% = NumberOfDirects% IF Direct% = 0 THEN CurrentFile$ = "..\" ELSE SEEK #4, DirectRefs(Direct%) LINE INPUT #4, CurrentFile$ CurrentFile$ = CurrentFile$ + "\" END IF CASE CHR$(9) Wdw% = (Wdw% + 1) MOD 4 CASE CHR$(0) + CHR$(15) Wdw% = (Wdw% + 3) MOD 4 CASE CHR$(13) IF Direct% < start% THEN BEEP GOTO InputKey2 ELSEIF Direct% = 0 THEN Posn% = LEN(CurrentDirectory$) - 2 DO WHILE MID$(CurrentDirectory$, Posn%, 1) <> "\" Posn% = Posn% - 1 LOOP CurrentDirectory$ = LEFT$(CurrentDirectory$, Posn%) ELSE SEEK #6, 1 FOR f% = 1 TO Direct% + 7 - 2 * start% LINE INPUT #6, Buffer$ NEXT f% CurrentDirectory$ = CurrentDirectory$ + RTRIM$(LEFT$(Buffer$, 8)) IF MID$(Buffer$, 10, 3) <> " " THEN CurrentDirectory$ = CurrentDirectory$ + "." + RTRIM$(MID$(Buffer$, 10, 3)) CurrentDirectory$ = CurrentDirectory$ + "\" END IF EXIT DO CASE ELSE BEEP GOTO InputKey2 END SELECT IF Direct% >= start% AND Direct% < FirstDirectShown% THEN FirstDirectShown% = Direct% IF Direct% > FirstDirectShown% + 13 THEN FirstDirectShown% = Direct% - 13 CASE 3 OldExtension$ = Extension$ COLOR 15, 0 DO LOCATE 23, 3 PRINT " Show all files: *.*" LOCATE 24, 3 PRINT " Show only music files: *.mus"; LOCATE 25, 3 PRINT " Show only files of extension *" + Extension$ + " "; SELECT CASE Extension$ CASE ".*" LOCATE 23, 3 PRINT "" InputKey3: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(0) + CHR$(80) Extension$ = ".mus" CASE CHR$(9) Wdw% = (Wdw% + 1) MOD 4 EXIT DO CASE CHR$(0) + CHR$(15) Wdw% = (Wdw% + 3) MOD 4 EXIT DO CASE CHR$(13) Wdw% = 1 EXIT DO CASE ELSE BEEP GOTO InputKey3 END SELECT CASE ".mus" LOCATE 24, 3 PRINT ""; InputKey4: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(0) + CHR$(72) Extension$ = ".*" CASE CHR$(0) + CHR$(80) LOCATE 24, 3 PRINT " "; GetExtension: LOCATE 25, 35 PRINT ".ÛÛÛ"; Extension$ = "." Place% = 1 DO WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE ASC(key$) CASE 33, 35 TO 42, 45, 48 TO 57, 63 TO 90, 94 TO 123, 125 TO 255 IF Place% > 3 THEN BEEP ELSE Extension$ = Extension$ + key$ LOCATE 25, 35 + Place% PRINT key$; Place% = Place% + 1 END IF CASE 8 IF Place% = 1 THEN BEEP ELSE Extension$ = LEFT$(Extension$, LEN(Extension$) - 1) Place% = Place% - 1 LOCATE 25, 35 + Place% PRINT "Û"; END IF CASE 13 EXIT DO CASE ELSE BEEP END SELECT LOOP CASE CHR$(9) Wdw% = (Wdw% + 1) MOD 4 EXIT DO CASE CHR$(0) + CHR$(15) Wdw% = (Wdw% + 3) MOD 4 EXIT DO CASE CHR$(13) Wdw% = 1 EXIT DO CASE ELSE BEEP GOTO InputKey4 END SELECT CASE ELSE LOCATE 25, 3 PRINT ""; InputKey5: WHILE INKEY$ <> "": WEND DO key$ = INKEY$ LOOP WHILE key$ = "" SELECT CASE key$ CASE CHR$(0) + CHR$(72) Extension$ = ".mus" CASE CHR$(9) Wdw% = (Wdw% + 1) MOD 4 EXIT DO CASE CHR$(0) + CHR$(15) Wdw% = (Wdw% + 3) MOD 4 EXIT DO CASE " " GOTO GetExtension CASE CHR$(13) Wdw% = 1 EXIT DO CASE ELSE BEEP GOTO InputKey5 END SELECT END SELECT LOOP COLOR 7, 0 IF Extension$ <> OldExtension$ THEN EXIT DO END SELECT LOOP LOOP END FUNCTION SUB Help (HelpScreen%) SCREEN 0 COLOR 13, 1 CLS LOCATE 1, 1 SELECT CASE HelpScreen% CASE 1 PRINT " Help for main editing screen " PRINT " ---- --- ---- ------- ------ " PRINT PRINT " File keys:" PRINT " ctrl + N - Create new file" PRINT " ctrl + O - Open an existing file" PRINT " ctrl + S - Save file under existing name" PRINT " ctrl + A - Save file under new name" PRINT " ctrl + Q - Quit the Music Editor" PRINT PRINT " Navigational, help and miscellaneous keys: " PRINT " Up, down - Move up and down ONLY within current staff. " PRINT " Left, right - Move left and right on current staff or move onto next staff. " PRINT " shift+Tab, Tab - Move left and right 4 places at a time. " PRINT " PgUp, PgDn - Move up and down one staff at a time. " PRINT " Home, End - Move to beginning or end of staff. " PRINT " F1 - Help on current topic. " PRINT " shift+F1 - Help contents. " PRINT " F4 - Goto specified staff, column or row. " PRINT " F5 - Update (redraw) screen. " PRINT " shift+F5 - Draw screen without cursor or staff numbers. If running in a DOS box" PRINT " in Windows 95+, press the Print Screen key to capture an image of " PRINT " the screen, which can then be pasted into Paint for printing. "; LOCATE 25, 1 PRINT "(press any key for next screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CLS PRINT " Help for main editing screen (cont.) " PRINT " ---- --- ---- ------- ------ ------- " PRINT PRINT " Keys for selecting notes: " PRINT " To select notes you must perform two steps. Firstly, highlight any notes using " PRINT " the special mode activated by the F6 key, or the Enter key. Then use the + and " PRINT " - keys to select and deselect notes. Repeat as necessary to select all notes. " PRINT " F6 - Highlight block. Move cursor to desired starting position for block " PRINT " and press F6. Then move the cursor to the end of the block and press" PRINT " F6 again. Pressing F6 a third time will remove the block highlight. " PRINT " You can also use the tab and shift+tab to choose different types of " PRINT " notes in circulation, if you wish to highlight (say) only rests. " PRINT " A highlighted block appears blue. " PRINT " Enter - Highlight note under cursor. If there is more than one note under " PRINT " the cursor then pressing repeatedly will cycle through these notes. " PRINT " Note: To highlight special marks such as bars, key signatures, clefs" PRINT " and pauses, first move the cursor to the top line of the staff. " PRINT " An individual highlighted note appears dark green. " PRINT " +/- - Select/deselect block or highlighted note. " PRINT " All selected notes appear bright green. " PRINT " F7 - Toggle Edit Selection mode - more help available within this mode. " PRINT " When Edit Selection mode is running all selected notes appear red. " PRINT " ESC - Use to cancel all highlights and selections. " LOCATE 25, 1 PRINT "(press any key for next screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CLS PRINT " Help for main editing screen (cont.) " PRINT " ---- --- ---- ------- ------ ------- " PRINT PRINT " When an individual note is highlighted: " PRINT " delete - Deletes highlighted note. To delete selections, use the Edit " PRINT " Selection Mode (help). " PRINT " a - Alter accidental. Also: " PRINT " # - sharp, ~ - flat, ' - natural, @ - (none). " PRINT " t - Toggle tail (for notes), direction of curve (for ties), or position " PRINT " (for pauses). " PRINT " . - Toggle dotted status (notes and ties only). " PRINT " s - Toggle small notes. " PRINT " F12 - Draw default tie from highlighted note to current position. " PRINT " F8 - Pick up current note type for insertion. " PRINT PRINT " Groups: " PRINT " A group is a set of notes whose tails are joined. A group can consist of a " PRINT " single chord to give it a common tail. To create a group, select all the notes " PRINT " (usually using Enter and +) and then press g. The program will then run an " PRINT " algorithm to give a default configuration for the group. However, for " PRINT " complicated groups you may need to reconfigure the group. To do this, select " PRINT " any note in the group and press g. [not implemented yet] " LOCATE 25, 1 PRINT "(press any key for next screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CLS PRINT " Help for main editing screen (cont.) " PRINT " ---- --- ---- ------- ------ ------- " PRINT PRINT " Inserting and editing keys: " PRINT " insert - Insert note of the same type as the last note inserted. In order to" PRINT " specify a new note type, press ESC before pressing insert. " PRINT " r - Insert rest. Repeats last rest until ESC is pressed (as above). " PRINT " F11 - Insert bar. " PRINT " shift+F11 - Insert end-of-line mark. " PRINT " F12 - Insert user-defined tie: move to first note, press F12, then move " PRINT " to end note and press F12 again. To draw a default tie first " PRINT " highlight the first note using Enter, and then move to the last " PRINT " note and press F12. This will produce a tie pointing the same way " PRINT " as the highlighted note and lined up with the end of the tails. " PRINT " To edit a tie, highlight it using enter, and then press F12. " PRINT " shift+F12 - Same as F12, but produces a dotted tie/slur. " PRINT " p - Add pause above and below the current short-staff. The pause counts" PRINT " as two notes so you can edit the top and bottom separately. " PRINT " c - Insert new clef (at current cursor position). " PRINT " k - Insert new key signature (at current cursor position). " PRINT " t - Insert time signature (unless an individual note has been " PRINT " highlighted, in which case this alters the tail configuration). " LOCATE 25, 1 PRINT "(press any key for next screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CLS PRINT " Help for main editing screen (cont.) " PRINT " ---- --- ---- ------- ------ ------- " PRINT PRINT " Other miscellaneous keys: " PRINT " v - Paste clipboard contents. All existing notes within the range of the" PRINT " paste will be erased. For copying see Edit Selection mode. " PRINT " o - Overwrite clipboard contents. Existing notes will be unaffected. " PRINT PRINT " F9 - Update staff settings: initial key signature, number of short staves" PRINT " shown, braces, and the initial clef. You can also choose to re-space" PRINT " the staff. You can apply changes to the current staff or to a " PRINT " specified range of staves. " PRINT PRINT " h - Toggle header display. " PRINT " shift+F7 - Edit header text (instructions given). " PRINT PRINT " x - Export tune to Out.bmp in your working directory for printing. You " PRINT " are advised to re-name this file as soon as possible for future use " LOCATE 25, 1 PRINT "(press any key to return to main editing screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CASE 2 PRINT " Help for Edit Selection mode " PRINT " ---- --- ---- --------- ---- " PRINT " " PRINT " Left, right - Move selection to left or right. Notes wrap round onto next " PRINT " staff when reaching the beginning or end of current staff. " PRINT " Shift+Tab, Tab - Move selection to left or right 4 places at a time. " PRINT " PgUp, PgDn - Move selection up or down a staff at a time. " PRINT " F1 - Display help. " PRINT " escape or F7 - Exit Edit Selection mode. " PRINT " delete - Delete selection and exit Edit Selection mode. " PRINT " x - Cut selection to clipboard and exit Edit Selection mode. " PRINT " c - Copy selection to clipboard. " PRINT " g - Group notes. This will draw all selected notes as a single " PRINT " `group' - that is, with tails joined according to the usual " PRINT " conventions. " PRINT " u - Ungroup all groups with notes within the current selection. " PRINT " " PRINT "(press any key to return to Edit Selection mode) " WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CASE 3 PRINT " Getting Started Tutorial " PRINT " ------- ------- -------- " PRINT " " PRINT "(Temporary very brief version)" PRINT "Music is created by navigating a flashing cursor around the screen using arrow " PRINT "keys and other standard keys, and performing commands in the relevant place. " PRINT PRINT "Notes are added to the screen using the insert key, or r for rests. The program " PRINT "remembers the last type of note or rest you inserted until you press Esc. " PRINT "Other symbols are added by pressing other keys on the keyboard - see main help " PRINT "(F1) for details." PRINT PRINT "You should plan ahead for your layout, then try to insert a number of notes of " PRINT "the same type to speed up progress. " LOCATE 25, 1 PRINT "(press any key for next screen) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND CLS PRINT " Getting Started Tutorial (cont.) " PRINT " ------- ------- -------- ------- " PRINT " " PRINT "You can move sections of music around incrementally or using the clipboard in " PRINT "Edit Selection Mode, which is accessed by pressing F7 when a block of music is " PRINT "selected. To add blocks of music to the selection, navigate to the start of the " PRINT "block, press F6, navigate to the end of the block and press F6 again, then press" PRINT "the + key. The - key will remove these notes from the block selection. Esc " PRINT "cancels the selection. You can also select an individual note by pressing the " PRINT "return key when the flashing cursor is over it. Pressing + will add it to the " PRINT "block selection (light green). While an individual note is selected (dark green)" PRINT "you can also make modifications to it, as detailed in the main Help. " PRINT PRINT "To print music, press the x key. The music will be saved in bitmap format as " PRINT "Out.bmp in your working directory, and can then be embellished and printed using" PRINT "standard picture editing software such as Paint." PRINT PRINT "In order to save the file in Music Editor format to allow further editing press " PRINT "Ctrl+S. Other file keys are also available - see main help. " PRINT PRINT "Please note that at present there is no undo facility, but this is being " PRINT "considered for the future. In the meantime save your work before performing any " PRINT "dangerous actions!" LOCATE 25, 1 PRINT "(press any key to return to main menu) "; WHILE INKEY$ <> "": WEND WHILE INKEY$ = "": WEND END SELECT END SUB SUB InsertCursor VertPos% = StaffInitial(Cursor.Staff).DrawPosition + ((StaffInitial(Cursor.Staff).Staves AND 1920) \ 128) * 3 - 48 HorPos% = Cursor.Horizontal * 5 + 31 SELECT CASE Cursor.Vertical CASE 50 TO 99 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff2 \ 128 CASE 100 TO 149 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff3 \ 128 CASE 150 TO 199 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff4 \ 128 END SELECT CursorLedgerLines HorPos%, VertPos%, 0 FOR Stf% = FirstStaffShown% TO FirstStaffShown% + NumberOfStavesShown% - 1 LINE (0, StaffInitial(Stf%).DrawPosition)-(639, StaffInitial(Stf%).DrawPosition), 4 IF Stf% < -99 THEN LINE (1, StaffInitial(Stf%).DrawPosition + 7)-(7, StaffInitial(Stf%).DrawPosition + 7), 4 IF -100 < Stf% AND Stf% < -9 THEN LINE (10, StaffInitial(Stf%).DrawPosition + 7)-(16, StaffInitial(Stf%).DrawPosition + 7), 4 IF -10 < Stf% AND Stf% < 0 THEN LINE (19, StaffInitial(Stf%).DrawPosition + 7)-(25, StaffInitial(Stf%).DrawPosition + 7), 4 IF ABS(Stf%) = 200 THEN Digit 2, 9, StaffInitial(Stf%).DrawPosition + 1, 4 ELSE IF ABS(Stf%) > 99 THEN Digit 1, 9, StaffInitial(Stf%).DrawPosition + 1, 4 IF ABS(Stf%) > 9 THEN Digit ((ABS(Stf%) MOD 100) \ 10), 18, StaffInitial(Stf%).DrawPosition + 1, 4 Digit ABS(Stf%) MOD 10, 27, StaffInitial(Stf%).DrawPosition + 1, 4 NEXT Stf% END SUB SUB LedgerLine (col%, Row%, Colour%) LINE (col% - 6, Row%)-(col% + 6, Row%), Colour% END SUB FUNCTION LowerPitch% (OrigPitch%) SELECT CASE OrigPitch% CASE 6 LowerPitch% = 4 CASE 4 LowerPitch% = 2 CASE 2 LowerPitch% = 3 CASE 3 LowerPitch% = 5 END SELECT END FUNCTION SUB PrintNoteData (Note%) DIM CurrentNote1 AS NoteType LOCATE 16 IF Note% = 0 THEN FOR Nt% = 1 TO NextNote% - 1 GET #2, Nt%, CurrentNote1 PRINT CurrentNote1.Staff; CurrentNote1.Vertical; CurrentNote1.Horizontal; CurrentNote1.group; CurrentNote1.Selected; CurrentNote1.Kind; CurrentNote1.Length; CurrentNote1.Pitch; CurrentNote1.tail NEXT Nt% ELSE GET #2, Note%, CurrentNote1 PRINT CurrentNote1.Staff; CurrentNote1.Vertical; CurrentNote1.Horizontal; CurrentNote1.group; CurrentNote1.Selected; CurrentNote1.Kind; CurrentNote1.Length; CurrentNote1.Pitch; CurrentNote1.tail END IF END SUB FUNCTION RaisePitch% (OrigPitch%) SELECT CASE OrigPitch% CASE 5 RaisePitch% = 3 CASE 3 RaisePitch% = 2 CASE 2 RaisePitch% = 4 CASE 4 RaisePitch% = 6 END SELECT END FUNCTION SUB RemoveCursor VertPos% = StaffInitial(Cursor.Staff).DrawPosition + ((StaffInitial(Cursor.Staff).Staves AND 1920) \ 128) * 3 - 48 HorPos% = Cursor.Horizontal * 5 + 31 SELECT CASE Cursor.Vertical CASE 50 TO 99 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff2 \ 128 CASE 100 TO 149 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff3 \ 128 CASE 150 TO 199 VertPos% = VertPos% + StaffInitial(Cursor.Staff).Staff4 \ 128 END SELECT CursorLedgerLines HorPos%, VertPos%, 15 END SUB SUB RenumberGroups SHARED NextGroup% DIM CurrentNote1 AS NoteType FirstGap% = 1 DO WHILE FirstGap% < NextGroup% DO WHILE NextGroup% > FirstGap% IF RefNos(NextGroup% - 1) <> RefNos(NextGroup% - 2) THEN EXIT DO NextGroup% = NextGroup% - 1 LOOP DO WHILE FirstGap% < NextGroup% AND RefNos(FirstGap%) > RefNos(FirstGap% - 1) FirstGap% = FirstGap% + 1 LOOP IF FirstGap% < NextGroup% THEN FOR Ref% = RefNos(NextGroup% - 2) + 1 TO RefNos(NextGroup% - 1) GET #2, GroupedNotes(Ref%), CurrentNote1 CurrentNote1.group = FirstGap% PUT #2, GroupedNotes(Ref%), CurrentNote1 NEXT Ref% NextGroup% = NextGroup% - 1 FirstGap% = FirstGap% + 1 END IF LOOP END SUB SUB SortNotesSelected SHARED NumberOfNotesSelected% FOR Ref% = 0 TO NumberOfNotesSelected% - 2 LastRef% = Ref% FOR TryRef% = Ref% + 1 TO NumberOfNotesSelected% - 1 IF NotesSelected(TryRef%) > NotesSelected(LastRef%) THEN LastRef% = TryRef% NEXT TryRef% SWAP NotesSelected(Ref%), NotesSelected(LastRef%) NEXT Ref% END SUB SUB UpdateDrawPositions FOR Staff% = -120 TO 120 StaffInitial(Staff%).DrawPosition = -1 NEXT Staff% IF DisplayMode% = 1 THEN StartPosition% = 0 ELSE StartPosition% = 60 IF FirstStaffShown% = -121 THEN FirstStaffShown% = Cursor.Staff NumberOfStavesShown% = 0 WHILE StartPosition% <= 480 StaffInitial(FirstStaffShown% + NumberOfStavesShown%).DrawPosition = StartPosition% StartPosition% = StartPosition% + ((StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staves AND 1920) \ 128) * 3 + ((StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staves AND 30720) \ 2048) * 3 + 54 SELECT CASE (StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staves AND 24) \ 8 CASE 1 StartPosition% = StartPosition% + StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staff2 \ 128 CASE 2 StartPosition% = StartPosition% + StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staff3 \ 128 CASE 3 StartPosition% = StartPosition% + StaffInitial(FirstStaffShown% + NumberOfStavesShown%).Staff4 \ 128 END SELECT NumberOfStavesShown% = NumberOfStavesShown% + 1 WEND NumberOfStavesShown% = NumberOfStavesShown% - 1 StaffInitial(FirstStaffShown% + NumberOfStavesShown%).DrawPosition = -1 END SUB