Event.mesa
Copyright (C) 1983, 1984 Xerox Corporation. All rights reserved.
Author: John Maxwell
Last Edited by: Maxwell, November 22, 1983 12:06 pm
Last Edited by: Doug Wyatt, June 14, 1984 6:35:33 pm PDT
DIRECTORY
MusicDefs USING [EventPTR, KeySignaturePTR, MeasurePTR, MetronomePTR, NotePTR, ScorePTR, Staff, StavesPTR, SyncPTR, Time, TimeSignaturePTR];
Event: CEDAR DEFINITIONS
= BEGIN OPEN MusicDefs;
Draw: PROC[score: ScorePTR, event: EventPTR];
Invisible: PROC[score: ScorePTR, index: CARDINAL, leftEdge: Time]
RETURNS[BOOLEAN]; -- Hidden
GetScoreIndex: PROC[score: ScorePTR, event: EventPTR] RETURNS[index: CARDINAL];
returns score.length if not found (score[score.length] is always NIL)
************************************************
Type coercion
************************************************
Sync: PROC[event: EventPTR] RETURNS[SyncPTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: SyncPTR => e, ENDCASE => NIL];
};
Staves: PROC[event: EventPTR] RETURNS[StavesPTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: StavesPTR => e, ENDCASE => NIL];
};
Measure: PROC[event: EventPTR] RETURNS[MeasurePTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: MeasurePTR => e, ENDCASE => NIL];
};
Metronome: PROC[event: EventPTR] RETURNS[MetronomePTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: MetronomePTR => e, ENDCASE => NIL];
};
TimeSignature: PROC[event: EventPTR] RETURNS[TimeSignaturePTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: TimeSignaturePTR => e, ENDCASE => NIL];
};
KeySignature: PROC[event: EventPTR] RETURNS[KeySignaturePTR] ~ INLINE {
RETURN[WITH event SELECT FROM e: KeySignaturePTR => e, ENDCASE => NIL];
};
************************************************
Procedures that only apply to staves
************************************************
Octava: PROC[event: EventPTR] RETURNS[BOOLEAN] ~ INLINE {
RETURN[WITH event SELECT FROM
ev: StavesPTR => ev.staves IN[octava1..octava2], ENDCASE => FALSE]
};
Clef: PROC[event: EventPTR] RETURNS[BOOLEAN] ~ INLINE {
RETURN[WITH event SELECT FROM
ev: StavesPTR => ev.staves=clef, ENDCASE => FALSE]
};
GetOctava: PROC[score: ScorePTR, octava: StavesPTR] RETURNS[other: StavesPTR];
SetStave: PROC[score: ScorePTR, oldS, newS: StavesPTR]; -- copy info from old to new
GetStaff: PROC[staves: StavesPTR, staff: CARDINAL] RETURNS[Staff];
************************************************
Procedures that only apply to syncs
************************************************
AddNote: PROC[score: ScorePTR, sync: SyncPTR, note: NotePTR];
RemoveNote: PROC[score: ScorePTR, sync: SyncPTR, note: NotePTR, free: BOOLEANFALSE];
removes note from sync. If sync.length = 0 and free = TRUE, then sync is freed.
Adjust: PROC[score: ScorePTR, s: SyncPTR]; -- space the notes so they don't overlap
NewSync: PROC[score: ScorePTR, length: CARDINAL ← 12] RETURNS[sync: SyncPTR];
Free: PROC[score: ScorePTR, event: EventPTR];
removes sync from anything that points to it
INLINE Procedures
AddTimes: PROC[event: EventPTR, time, toc: Time];
Grace: PROC[sync: SyncPTR] RETURNS[BOOLEAN];
InVoice: PROC[sync: SyncPTR, voice: CARDINAL] RETURNS[BOOLEAN];
END.