VoiceRope.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, January 31, 1986 7:11:13 pm PST
Doug Terry, October 3, 1986 4:41:15 pm PDT
This interface is an update of the old Intervoice interface to include routines for editing voice ropes, as well as recording and playing them. Routines also exist for registering interests in voice ropes. Eventually this may be renamed to replace the current Intervoice.
DIRECTORY
Rope USING [ROPE],
VoiceRopeServer USING [VoiceRope, VoiceRopeInterval, IntervalSpecs];
VoiceRope:
CEDAR
DEFINITIONS = {
ROPE: TYPE ~ Rope.ROPE;
All of the VoiceRope operations actually deal with intervals of voice ropes. Naive clients can simply ignore the start and length fields and treat a voice rope as simply an ID; clients concerned about performance can alter the interval values associated with a voice rope as an alternative to performing Substr operations. For newly created voice ropes, the start field is always 0 and the length field contains the actual number of samples in the voice rope.
VoiceRope: TYPE = VoiceRopeServer.VoiceRope;
VoiceRopeInterval: TYPE = VoiceRopeServer.VoiceRopeInterval;
VoiceRope: TYPE = REF VoiceRopeInterval;
VoiceRopeInterval: TYPE = RECORD [
ropeID: ROPE,
start: INT,
length: INT
];
IntervalSpecs: TYPE = VoiceRopeServer.IntervalSpecs;
Interval: TYPE = RECORD[start, length: INT];
IntervalSpecs: TYPE = LIST OF Interval;
Voice rope operations take a handle as their first parameter; if handle is omitted, one will be invented using all the defaults.
Handle: TYPE = REF HandleRec;
HandleRec:
TYPE =
RECORD [
-- Used to be opaque, but changed for now
procs: FinchSmarts.Procs←NIL,
vdbHandle: VoiceRopeDB.Handle,
Complain: PROC[complaint: ROPE]
];
Open:
PROC [voiceRopeDBName:
ROPE ←
NIL, localName:
ROPE ←
NIL,
Complain:
PROC[complaint:
ROPE] ←
NIL]
RETURNS [handle: Handle];
If voiceRopeDBName or localName is omitted, a default based on the user profile choice of Thrush Server is invented. If Complain is omitted, Log.Problem[...$Finch] is used.
Creating and playing voice ropes
Record:
PROC[handle: Handle←
NIL]
RETURNS [voiceRope: VoiceRope];
Records a voice rope, registers it , and returns its ID. A NIL return value indicates that something went wrong.
Play:
PROC[handle: Handle←
NIL, voiceRope: VoiceRope, queueIt:
BOOL←
TRUE, failOK:
BOOL←
FALSE, wait:
BOOL←
FALSE];
Play a specified voice rope. The boolean arguments are interpreted as follows:
queueIt => play after all other record/playback requests are satisfied.
failOK => playing is optional; leave connection open if tune doesn't exist.
wait => wait until things appear to be started properly, or have failed.
Stop:
PROC[handle: Handle ←
NIL];
Stops any recording or playback in progress.
Interests in voice ropes
Clients must explicitly express an interest in retaining a voice rope in order to prevent it from being garbage collected. Interests belong to a particular class; different applications employing voice ropes can use different interest classes to control how those voice ropes are managed.
The refID and other parameters are class-specific. For instance, a class "TiogaVoice" may use refID to record the name of the Tioga file containing a voice rope. The other field can be used to store data such as a timeout.
InterestClass: TYPE ~ ROPE;
Retain:
PROC [handle: Handle ←
NIL, vr: VoiceRope, class: InterestClass, refID:
ROPE, other:
ROPE ←
NIL];
Registers a new interest in the voice rope. The voice rope will be retained until either a corresponding Forget is done or the class' garbage collection process determines that the voice rope is no longer referenced, e.g. refID no longer exists. Taken together, the vr, class, and refID must be unique. Repeated calls of Retain with the same parameters (ignoring other) will only register a single interest.
Forget:
PROC [handle: Handle ←
NIL, vr: VoiceRope, class: InterestClass, refID:
ROPE];
The specified refID of the specified class drops its interest in the voice rope. The voice rope is not necessarily deleted, however, since other interests in the same voice rope may exist.
GetByInterest:
PROC [handle: Handle ←
NIL, class: InterestClass, refID:
ROPE]
RETURNS [voiceRope: VoiceRope];
Returns any voice rope that is of interest to the given class and refID; returns NIL if no such voice rope exists.
N.B.: System noises, like Beeps and intolerably cute rollback tunes are indexed in the interest database as refID's like "beep", "rollback", and so on, under the class "SysNoises".
Editing voice ropes
Cat:
PROC [handle: Handle ←
NIL, vr1, vr2, vr3, vr4, vr5: VoiceRope ←
NIL]
RETURNS [new: VoiceRope];
Concatenates together the non-NIL voice ropes to produce a new voice rope.
Substr:
PROC [handle: Handle ←
NIL, vr: VoiceRope, start:
INT ← 0, len:
INT ←
LAST[
INT]]
RETURNS [new: VoiceRope];
Creates a new voice rope that is a substring of an existing voice rope.
Replace:
PROC [handle: Handle ←
NIL, vr: VoiceRope, start:
INT ← 0, len:
INT ←
LAST[
INT], with: VoiceRope ←
NIL]
RETURNS [new: VoiceRope];
Creates a new voice rope in which the given interval of the voice rope "vr" is replaced by the voice rope "with".
Length:
PROC [handle: Handle ←
NIL, vr: VoiceRope]
RETURNS [len:
INT];
Returns the actual length of the voice rope. This operation ignores the start and length values specified in the voice rope. Thus, vr.start ← 0; vr.length ← Length[handle, vr] will restore a voice rope to its full contents.
Information about voice ropes
DescribeRope: PROC [handle: Handle ← NIL, vr: VoiceRope, minSilence: INT ← -1] RETURNS [noise: IntervalSpecs];
Fetch: PROC [handle: Handle ← NIL, vr: VoiceRope, index: INT] RETURNS [VoiceSample];
}.
Swinehart, January 30, 1986 9:34:42 am PST
Created from WalnutVoiceImpl routines; voice message facilities, without Walnut specifics
Doug Terry, March 22, 1986 1:32:03 pm PST
Changed recording and playback routines to deal in voice ropes instead of tunes; upgraded interest management; added facilities for editing voice ropes.
changes to: VoiceRope, Record, Play, Retain, Forget, Cat, Substr, Replace, Length
Doug Terry, April 8, 1986 11:12:55 pm PST
Changed voice ropes from simple IDs to IDs and intervals.
changes to: VoiceRope, Record, Play, Retain, Cat, Substr, Replace, Length, Retain, DescribeRope
Doug Terry, April 9, 1986 10:24:11 am PST
All operations can now default their handle parameter to NIL.
changes to: VoiceRope, Record, Play, Stop, Retain, Forget, Cat, Substr, Replace, Length, DescribeRope
Doug Terry, June 10, 1986 2:46:51 pm PDT
Changed interface operations for expressing interests in voice ropes.
changes to: VoiceRope, InterestClass, Retain, Forget, GetByInterest