--Author: John Maxwell -- Last Edited by: Maxwell, November 18, 1983 2:12 pm -- This module gives the format for the file on the disk. -- Changing this module may make old music files obsolete. -- MusicDefs imports from here whenever its types exactly match these. MusicFileDefs: DEFINITIONS= BEGIN versionID: INTEGER = 3; nullID: INTEGER = 0; scoreID: INTEGER = 1; eventID: INTEGER = 2; noteID: INTEGER = 3; chordHeapID: INTEGER = 4; chordID: INTEGER = 5; beamHeapID: INTEGER = 6; beamID: INTEGER = 7; viewID: INTEGER = 8; tieID: INTEGER = 9; -- MusicFile is just a conceptual tool to help one understand the file format. -- the identifiers are used to make sure that the file has been read in correctly. -- (You may wish to eliminate these, but then old files will no longer work.) -- MusicFile: TYPE = MACHINE DEPENDENT RECORD[ -- version: INTEGER, -- score: RECORD[ -- identifier: INTEGER ← scoreID, -- events: SEQUENCE length: CARDINAL OF EventFormat], -- chordHeap: RECORD[ -- identifier: INTEGER ← chordHeapID, -- chords: SEQUENCE length: CARDINAL OF ChordFormat], -- beamHeap: RECORD[ -- identifier: INTEGER ← beamHeapID, -- beams: SEQUENCE length: CARDINAL OF BeamFormat], -- spare1: INTEGER ← nullID, ++ spare identifiers. -- spare2: INTEGER ← nullID, ++ all spares are set to zero until needed -- spare3: INTEGER ← nullID, ++ these spares are for: ties, slurs, -- spare4: INTEGER ← nullID, ++ eventExeptions, noteExceptions, and strings. -- spare5: INTEGER ← nullID, -- spare6: INTEGER ← nullID, -- spare7: INTEGER ← nullID, -- spare8: INTEGER ← nullID, -- spare9: INTEGER ← nullID, -- view: ViewFormat]; EventFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← eventID, time: LONG INTEGER ← 0, type: EventTypeFormat ← notes, ignore: BOOLEAN ← FALSE, -- do not use this bit spare1: [0..1000) ← 0, value: INTEGER ← 0, -- may be a time signature spare2: CARDINAL ← 0, length: CARDINAL ← 0]; -- followed by: -- notes: ARRAY [0..length) OF NoteFormat OR -- sheet: SheetFormat depending on 'type' TimeFormat: TYPE = LONG INTEGER; EventTypeFormat: TYPE = {notes, measure, repeat1, repeat2, endMeasure, doubleMeasure, m5, timeSignature, keySignature, metrenome, staves, clef, octava1, octava2, spare5, spare6, spare7, spare8, spare9, spare10, spare11, spare12, spare13, spare14}; SheetFormat: TYPE = MACHINE DEPENDENT RECORD[ junk: LONG CARDINAL ← 0, -- garbage filler height: INTEGER ← 0, offset: INTEGER ← 0, sl: CARDINAL ← 0, staff: ARRAY [0..6) OF Staff ← ALL[[]]]; Staff: TYPE = RECORD[ pitch: INTEGER ← 0, -- pitch of note on bottom line y: INTEGER ← 0]; -- height relative to bottom line NoteFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← noteID, pitch: INTEGER ← 40, voice: CARDINAL ← 0, value: NoteValueFormat ← unknown, --3 bits spelled: AccidentalFormat ← inKey, --3 bits rest: BOOLEAN ← FALSE, dotted: BOOLEAN ← FALSE, doubleDotted: BOOLEAN ← FALSE, grace: BOOLEAN ← FALSE, stemUp: BOOLEAN ← FALSE, exception: BOOLEAN ← FALSE, embellish: EmbellishmentFormat ← none, --3 bits tie: BOOLEAN ← FALSE, -- if TRUE, a TieFormat follows show: BOOLEAN ← FALSE, spare4: [0..2000) ← 0, staff: [0..16) ← 1, spare2: CARDINAL ← 0, --legato, stacatto, accents spare3: CARDINAL ← 0, toc: LONG CARDINAL ← 0, duration: CARDINAL ← 0]; NoteValueFormat: TYPE= {whole, half, quarter, eighth, sixteenth, thirtysecond, sixtyfourth, unknown}; AccidentalFormat: TYPE = {doubleSharp, sharp, natural, inKey, flat, doubleFlat}; EmbellishmentFormat: TYPE = {none, trill, mordent1, mordent2, e1, e2, e3, e4}; ChordFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← chordID, stemUp: BOOLEAN ← FALSE, exception: BOOLEAN ← FALSE, spare1: [0..16000) ← 0, exceptionPTR: CARDINAL ← 0, spare2: INTEGER ← 0, length: CARDINAL ← 0]; -- notePTRs: ARRAY [0..length) OF RelativePTR; BeamFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← beamID, tilt: REAL ← 0, beamed: BOOLEAN ← FALSE, exception: BOOLEAN ← FALSE, ntuple: [0..128) ← 0, against: [0..128) ← 0, height: INTEGER ← 0, invisible: BOOLEAN ← FALSE, spare1: [0..1024) ← 0, staff: [0..32) ← 0, spare2: CARDINAL ← 0, length: CARDINAL ← 0]; -- chordPTRs: ARRAY [0..length) OF RelativePTR; TieFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← tieID, height: INTEGER ← 0, heap: CARDINAL ← 0, index: CARDINAL ← 0]; RelativePTR: TYPE = MACHINE DEPENDENT RECORD[ heap: CARDINAL, index: CARDINAL]; beams: CARDINAL = 64000; -- used in RelativePTR chords: CARDINAL = 64001; -- used in RelativePTR ViewFormat: TYPE = MACHINE DEPENDENT RECORD[ identifier: INTEGER ← viewID, scale: INTEGER ← 0, accidental: BOOLEAN ← FALSE, notehead: BOOLEAN ← FALSE, sync: BOOLEAN ← FALSE, display: DisplayModeFormat ← physical, noCarry: BOOLEAN ← FALSE, hardcopy: BOOLEAN ← FALSE, spare1: [0..512) ← 0, sheet: INTEGER ← 0, --will later be made obselete speed: INTEGER ← 0, --will later be made obselete key: INTEGER ← 0, --will later be made obselete spare5: INTEGER ← 0, spare6: INTEGER ← 0]; DisplayModeFormat: TYPE = {physical,logical,graphical}; END.