LarkPlay.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Pier, May 4, 1984 11:58:31 am PDT
Last Edited by: Swinehart, November 26, 1985 0:20:57 am PST
DIRECTORY
Lark USING [ Tone ],
Rope USING [ROPE];
LarkPlay: CEDAR DEFINITIONS = {
Tone: TYPE = Lark.Tone;
ToneSpec: TYPE = REF ToneSpecRec;
ToneList: TYPE = LIST OF Tone;
ToneSpecRec:
TYPE =
RECORD [
repeatIndefinitely: BOOL←TRUE, -- else play just once
volume: CARDINAL𡤀, -- "WaveTable": entire sequence played at one volume
tones: LIST OF ToneList←NIL,
asRope: Rope.ROPE←NIL -- if derived from a rope, here it is
];
<<totalTime field should be removed from Lark version next time Lark changes.>>
PlayString:
PROCEDURE [music: Rope.
ROPE, file:
BOOLEAN ←
FALSE, volume:
CARDINAL]
RETURNS[tones: ToneSpec];
music is either a rope of musical characters encoded via the Play encoding or, if file=TRUE, the name of a file to read for such a musical encoding.
Volume is a default: can be overridden in tune. It should be specified first, though, and be constant throughout.
MergeToneSpecs:
PROCEDURE [t1, t2: ToneSpec, t2Divisor:
NAT𡤁, t2Delay:
NAT𡤀, volumeIncrement:
NAT𡤀]
RETURNS [ts: ToneSpec];
Divisor and delay apply to the second tune. Delay is an additional rest applied to the beginning of t2; divisor is used to change its frequency downward (designed to be used with values 1 and 2). This is specifically designed to deal with Thrush ring tunes, where the caller's tune is to be delayed by a measure and dropped an octave.
Volume of result is volumeIncrement + volume of first tune, or something.
ts.repeatIndefinitely ← t1.repeatIndefinitely
}.