--Author: John Maxwell
--last modified: April 20, 1981 1:10 PM

DIRECTORY
MusicDefs: FROM "MusicDefs";

MusicFileDefs: DEFINITIONS=
BEGIN
OPEN MusicDefs;


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 never actually used, it is a conceptual tool that helps
--one understand the file format.
MusicFile:TYPE = MACHINE DEPENDENT RECORD[
version:INTEGER,
score:MACHINE DEPENDENT RECORD[
identifier:INTEGER ← scoreID,
length:CARDINAL,
events:ARRAY [0..0) OF EventFormat],
chordHeap:MACHINE DEPENDENT RECORD[
identifier:INTEGER ← chordHeapID,
length:CARDINAL,
chords:ARRAY [0..0) OF ChordFormat],
beamHeap:MACHINE DEPENDENT RECORD[
identifier:INTEGER ← beamHeapID,
length:CARDINAL,
beams:ARRAY [0..0) OF BeamFormat],
spare1:INTEGER ← nullID, --all spares are set to zero until needed
spare2:INTEGER ← nullID, --these spares are for: ties, slurs,
spare3:INTEGER ← nullID, --eventExeptions, noteExceptions, and strings.
spare4:INTEGER ← nullID,
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:Time←0,
type:EventType←notes,
exception:BOOLEAN ← FALSE,
spare1:[0..1000) ← 0,
value:INTEGER ← 0,
spare2:CARDINAL ← 0,
length:CARDINAL ← 0];
--
notes:ARRAY [0..length) OF NoteFormat

SheetFormat:TYPE = MACHINE DEPENDENT RECORD[
junk:NotePTR ← NIL,
height,offset:INTEGER←0,
sl:CARDINAL←0,
staff:ARRAY [0..6) OF Staff];

NoteFormat:TYPE = MACHINE DEPENDENT RECORD[
identifier:INTEGER ← noteID,
pitch:INTEGER←40,
voice:CARDINAL←0,
value:NoteValue←unknown, --3 bits
spelled:Accidental←inKey, --3 bits
rest:BOOLEAN←FALSE,
dotted:BOOLEAN←FALSE,
doubleDotted:BOOLEAN ← FALSE,
grace:BOOLEAN ← FALSE,
stemUp:BOOLEAN←FALSE,
exception:BOOLEAN ← FALSE,
embellish:Embellishment ← none, --3 bits
tie:BOOLEAN ← FALSE,
show:BOOLEAN ← FALSE,
spare4:[0..2000)←0,
staff:[0..16)←1,
spare2:CARDINAL ← 0, --legato, stacatto, accents
spare3:CARDINAL ← 0,
toc:LONG CARDINAL,
duration:CARDINAL];

ChordFormat:TYPE = MACHINE DEPENDENT RECORD[
identifier:INTEGER ← chordID,
stemUp:BOOLEAN,
exception:BOOLEAN ← FALSE,
spare1:[0..16000) ← 0,
exceptionPTR:CARDINAL ← 0,
spare2:INTEGER ← 0,
length:CARDINAL,
notePTRs:ARRAY [0..0) OF RelativePTR];

BeamFormat:TYPE = MACHINE DEPENDENT RECORD[
identifier:INTEGER ← beamID,
tilt:REAL,
beamed:BOOLEAN,
exception:BOOLEAN ← FALSE,
ntuple: [0..128),
against: [0..128),
height:INTEGER,
invisible:BOOLEAN←FALSE,
spare1:[0..1024)←0,
staff:[0..32),
spare2:CARDINAL ← 0,
length:CARDINAL,
chordPTRs:ARRAY [0..0) 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,
accidental:BOOLEAN,
notehead:BOOLEAN,
sync:BOOLEAN,
display:DisplayMode,
noCarry:BOOLEAN ← FALSE,
hardcopy:BOOLEAN,
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];


END.