--Author: John Maxwell
--last modified: December 2, 1981 8:49 AM
DIRECTORY
MusicDefs: FROM "MusicDefs";
Score: DEFINITIONS IMPORTS MusicDefs=
BEGIN
OPEN MusicDefs;
cache:ARRAY [0..maxCacheLength) OF SyncPTR;
maxCacheLength:CARDINAL = 200;
cacheLength:CARDINAL;
--****************************************************************************
--procedures
--****************************************************************************
--all of the Sets and Gets take "score" as the implied first parameter
BuildCache:PROCEDURE;
Draw:PROCEDURE[erase:BOOLEAN←TRUE];
DrawKey:PROCEDURE[key:INTEGER,time:Time];
DrawMetrenome:PROCEDURE[metrenome:INTEGER,time:Time];
DrawTimeSignature:PROCEDURE[ts:TimeSignature,time:Time];
GetAccidental:PROCEDURE[n:NotePTR] RETURNS[Accidental];
GetKey:PROCEDURE[t:Time] RETURNS[key:INTEGER];
GetMetrenome:PROCEDURE[t:Time] RETURNS[metrenome:INTEGER];
GetTimeSignature:PROCEDURE[t:Time] RETURNS[TimeSignature];
Justify:PROCEDURE[begin,end:Time];
LogicalToPhysical:PROCEDURE[begin,end:Time];
Look:PROCEDURE[look:LookCommand,switch:BOOLEAN,n:INTEGER];
Print:PROCEDURE[splines:BOOLEAN];
Redraw:PROCEDURE[t1,t2:Time];
ScalePhysical:PROCEDURE[k:INTEGER];
SetKey:PROCEDURE[time1,time2:Time,k:INTEGER];
SetMetrenome:PROCEDURE[time1,time2:Time,m:INTEGER];
SetTimeSignature:PROCEDURE[time1,time2:Time,ts:TimeSignature];
ShowLogical:PROCEDURE[firstSync,lastSync:CARDINAL];
--key specific procedures
AddToPitch:PROCEDURE[key,pitch,delta:INTEGER] RETURNS[INTEGER];
KeyHeight:PROCEDURE[key,pitch:INTEGER] RETURNS[INTEGER];
NormalAcc:PROCEDURE[key,pitch:INTEGER] RETURNS[Accidental];
PriorNote:PROCEDURE[pitch,height:INTEGER,index:CARDINAL] RETURNS[NotePTR];
ShowPitch:PROCEDURE[pitch:INTEGER,spelled:Accidental,key:INTEGER] RETURNS[INTEGER] =
INLINE BEGIN
IF NOT show.accidental THEN RETURN[pitch];
IF spelled=inKey THEN RETURN[pitch];
SELECT spelled FROM
doubleSharp => pitch ← pitch-2;
sharp => pitch ← pitch-1;
natural => pitch ← pitch-0;
flat => pitch ← pitch+1;
doubleFlat => pitch ← pitch+2;
ENDCASE => ERROR;
IF Mod[pitch,12]=7 AND key<-5 THEN RETURN[pitch-1];
IF Mod[pitch,12]=0 AND key<-6 THEN RETURN[pitch-1];
IF Mod[pitch,12]=1 AND key>5 THEN RETURN[pitch+1];
IF Mod[pitch,12]=8 AND key>6 THEN RETURN[pitch+1];
RETURN[pitch];
END;
--****************************************************************************
--utility procedures
--****************************************************************************
FileIn:PROCEDURE[s:STRING,append:BOOLEAN←FALSE];
FileInOld:PROCEDURE[s:STRING];
FileOut:PROCEDURE[s:STRING] RETURNS[BOOLEAN];
FileOutOld:PROCEDURE[s:STRING];
FileStats:PROCEDURE;
InitializeSynthesizer:PROCEDURE;
StartListening:PROCEDURE[s:PiecePTR];
StartPlaying:PROCEDURE[s:PiecePTR,first:CARDINAL,physical:BOOLEAN,
displayCursor:PROCEDURE[time:LONG CARDINAL]];
StopListening:PROCEDURE;
StopPlaying:PROCEDURE;
Test:PROCEDURE RETURNS[BOOLEAN];
END..