-- Author: John Maxwell
-- Last Edited by: Maxwell, November 22, 1983 11:52 am
DIRECTORY
MusicDefs: FROM "MusicDefs";
Piece: DEFINITIONS IMPORTS MusicDefs =
BEGIN
OPEN MusicDefs;
default: INTEGER = 1000;
AddEvent: PROCEDURE[score: ScorePTR, event: EventPTR] RETURNS[new: ScorePTR];
-- may raise Piece.Overflow.
RemoveEvent: PROCEDURE[score: ScorePTR, event: EventPTR, free: BOOLEAN ← FALSE];
-- removes event from score. IF free = TRUE, then frees EVENT.
Overflow: SIGNAL[old, new: ScorePTR]; -- raised whenever the score is extended.
Copy: PROCEDURE[score: ScorePTR, time1, time2: Time] RETURNS[ScorePortionPTR];
Merge: PROCEDURE[score, new: ScorePTR, begin, end: Time];
Replace: PROCEDURE[score: ScorePTR, new: ScorePortionPTR, delete1, delete2: Time];
-- new gets deleted when done. may raise Piece.Overflow
Insert: PROCEDURE[score: ScorePTR, new: ScorePortionPTR, begin: Time] =
INLINE {Replace[score, new, begin, begin]};
Delete: PROCEDURE[score: ScorePTR, begin, end: Time] =
INLINE {Replace[score, NIL, begin, end]};
New: PROC[length: CARDINAL, auxiliary: BOOLEAN ← FALSE, old: ScorePTR ← NIL]
RETURNS[score: ScorePTR]; -- frees old after copying data
Free: PROC[score: ScorePTR]; -- utterly destroys score. removes from anything that might point to it. Raises Piece.Overflow with new = NIL.
Sort: PROCEDURE[score: ScorePTR];
CleanUpNotes: PROCEDURE[score: ScorePTR];
CleanUpEvents: PROCEDURE[score: ScorePTR];
MaxToc: PROCEDURE[score: ScorePTR, time1, time2: Time, duration: BOOLEAN] RETURNS[Time];
NearestNote: PROCEDURE[score: ScorePTR, x, y: INTEGER ← default] RETURNS[NotePTR]; -- x and y default to mouse.
NearestObject: PROCEDURE[score: ScorePTR, x, y: INTEGER ← default] RETURNS[obj: ObjectType, p: LONG POINTER]; -- x and y default to mouse.
NearestEvent: PROCEDURE[score: ScorePTR, t: Time, syncsOnly: BOOLEAN ← FALSE] RETURNS[index: CARDINAL]; -- returns score.length if none found
END..