-- Author: John Maxwell
-- last modified: November 4, 1983 2:12 pm
-- Last Edited by: Maxwell, November 17, 1983 2:35 pm

DIRECTORY
    MusicDefs: FROM "MusicDefs";

Note: DEFINITIONS IMPORTS MusicDefs = 
BEGIN
OPEN MusicDefs;

default: INTEGER = 1000;

Draw: PROCEDURE[score: ScorePTR, n: NotePTR, stem: INTEGER ← default];
DrawHead: PROCEDURE[score: ScorePTR, n: NotePTR, x, y, dotX: INTEGER];
DrawTie: PROCEDURE[score: ScorePTR, n: NotePTR];

Free: PROCEDURE[score: ScorePTR, n: NotePTR]; 
-- removes note from anything that points to it, then frees it.
GetBackTie: PROCEDURE[score: ScorePTR, n: NotePTR] RETURNS[NotePTR];

Duration: PROCEDURE[n: NotePTR, metrenome: INTEGER] RETURNS[Time]; 
SetAccidental: PROCEDURE[score: ScorePTR, n: NotePTR, a: Accidental];
SetEmbellishment: PROCEDURE[score: ScorePTR, n: NotePTR, e: Embellishment];

-- inline procedures

Delta: PROCEDURE[sheet: SheetPTR, n: NotePTR] RETURNS[INTEGER] = INLINE 
   {IF sheet.display # graphical THEN RETURN[0] ELSE
    RETURN[n.delta + (IF FindChord[n] = NIL THEN 0 ELSE FindChord[n].delta)]};

InVoice: PROCEDURE[n: NotePTR, voice: CARDINAL] RETURNS[BOOLEAN] = INLINE 
   {RETURN[voice = noVoice OR n.voice = voice]};

FindChord: PROCEDURE[n: NotePTR] RETURNS[c: ChordPTR] = INLINE 
   {RETURN[n.chord]};

GetSyncIndex: PROCEDURE[s: SyncPTR, p: NotePTR] RETURNS[CARDINAL] = INLINE
   {FOR i: CARDINAL IN [0..s.length) DO 
   	IF s.note[i] = p THEN RETURN[i]; 
   	ENDLOOP; 
    ERROR};

Width: PROC[n: NotePTR] RETURNS[INTEGER] = INLINE 
   {RETURN[IF n.grace THEN 6 ELSE IF n.value = whole THEN 10 ELSE 8]};

END..