Chord.mesa
Copyright (C) 1983, 1984 Xerox Corporation. All rights reserved.
Author: John Maxwell
Last Edited by: Maxwell, November 18, 1983 9:02 am
Last Edited by: Doug Wyatt, June 14, 1984 6:26:32 pm PDT
DIRECTORY
MusicDefs USING [BeamPTR, ChordHeapPTR, ChordPTR, NotePTR, ScorePTR, SheetPTR];
Chord: CEDAR DEFINITIONS
= BEGIN OPEN MusicDefs;
default: INTEGER = 1000;
Draw: PROC[score: ScorePTR, c: ChordPTR, stem: INTEGER ← default];
default means that the stem is drawn as part of a beam
Adjust: PROC[sheet: SheetPTR, c: ChordPTR];
SetDefaultStem: PROC[sheet: SheetPTR, c: ChordPTR];
Sort: PROC[c: ChordPTR, up: BOOLEAN] RETURNS[n: CARDINAL];
AddNote: PROC[score: ScorePTR, chord: ChordPTR, note: NotePTR];
removes the note from its chord, if any
adds the note to the chord's sync, if any
sets note.beam to the chord's beam if it has one,
otherwise the chord replaces the note in note.beam.
RemoveNote: PROC[score: ScorePTR, chord: ChordPTR, note: NotePTR,
free: BOOLEANTRUE];
removes note from chord. sets n.beam to NIL.
If chord.length < 2 and free = TRUE, then chord is freed.
New: PROC[score: ScorePTR, length: CARDINAL ← 10] RETURNS[chord: ChordPTR];
Free: PROC[score: ScorePTR, chord: ChordPTR];
removes chord from anything that points to it, then frees it.
INLINE Procedures
Beam: PROC[c: ChordPTR] RETURNS[BeamPTR] ~ INLINE {
n: NotePTR ~ c.note[0]; RETURN[IF n=NIL THEN NIL ELSE n.beam] };
SetBeam: PROC[c: ChordPTR, b: BeamPTR];
GetHeapIndex: PROC[heap: ChordHeapPTR, c: ChordPTR] RETURNS[CARDINAL];
Grace: PROC[c: ChordPTR] RETURNS[BOOLEAN];
InVoice: PROC[c: ChordPTR, voice: CARDINAL] RETURNS[BOOLEAN];
Length: PROC[c: ChordPTR] RETURNS[CARDINAL] = INLINE {RETURN[c.length]};
Width: PROC[c: ChordPTR] RETURNS[INTEGER] = INLINE {RETURN[IF Grace[c] THEN 5 ELSE 8]};
END.