VoiceRope.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, July 24, 1987 2:46:10 pm PDT
Polle Zellweger (PTZ) July 27, 1987 11:09:43 am PDT
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
FinchSmarts USING [ ConvDesc ],
Rope USING [ROPE],
Thrush USING [ConversationID, NB, nullConvID],
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: ROPENIL, localName: ROPENIL, 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
Simple interface.
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: BOOLTRUE, wait: BOOLFALSE];
Play a specified voice rope. The boolean arguments are interpreted as follows:
queueIt => play after all other record/playback requests are satisfied.
wait => wait until things appear to be started properly, or have failed.
Stop: PROC[handle: Handle←NIL];
Stops any recording or playback in progress.
More complex interface for clients who wish to follow the progress of voice rope requests (most useful if the client registers for reports with FinchSmarts).
NB: TYPE = Thrush.NB;
RequestID: TYPE = CARD;
nullRequestID: RequestID = 0;
ConversationID: TYPE = Thrush.ConversationID;
nullConvID: ConversationID = Thrush.nullConvID;
NewRequestID: PROC RETURNS [RequestID];
RecordNB: PROC[handle: Handle←NIL, requestID: RequestID←nullRequestID, convID: ConversationID←nullConvID, clientData: REFNIL] RETURNS [nb: NB, voiceRope: VoiceRope, newConvID: ConversationID];
Records a voice rope, registers it, and returns its ID. A NIL return value indicates that something went wrong.
Parameters used to filter reports of progress & conversation state: requestID should come from NewRequestID above. clientData will be stored in the convDesc for this request and can be retrieved via the GetClientData procedure below. [However, since VoiceRope reuses a conversation whenever possible, the existence of the correct clientData is merely a strong hint.]
PlayNB: PROC[handle: Handle←NIL, voiceRope: VoiceRope, queueIt: BOOLTRUE, wait: BOOLFALSE, requestID: RequestID←nullRequestID, convID: ConversationID←nullConvID, clientData: REFNIL] RETURNS [nb: NB, newConvID: ConversationID];
Play a specified voice rope. The boolean arguments are interpreted as follows:
queueIt => play after all other record/playback requests are satisfied.
wait => wait until things appear to be started properly, or have failed.
StopNB: PROC[handle: Handle←NIL, convID: ConversationID←nullConvID] RETURNS [nb: NB];
Stops any recording or playback in progress.
GetClientData: PROC[handle: Handle←NIL, cDesc: FinchSmarts.ConvDesc]
RETURNS[clientData: REF];
Allows clients of VoiceRope to directly register with FinchSmarts to receive event reports and to filter them. The cDesc will be a parameter to the reports.
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: ROPENIL];
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: INTLAST[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: INTLAST[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
Polle Zellweger (PTZ) July 20, 1987 5:54:43 pm PDT
Changes to allow TiogaVoice to monitor conversation state/reports about voicerope operations.
changes to: Record, Play, Stop, NB, NewRequestID, Retain, Forget, GetByInterest
Polle Zellweger (PTZ) July 20, 1987 6:07:40 pm PDT
changes to: DIRECTORY, Record, Play, Stop, NB, NewRequestID, Retain, Forget, GetByInterest
Polle Zellweger (PTZ) July 21, 1987 11:55:37 am PDT
changes to: Record, Play, Stop, RequestID, NewRequestID, RecordNB, PlayNB, StopNB
Polle Zellweger (PTZ) July 27, 1987 11:09:06 am PDT
changes to: nullRequestID, ConversationID, nullConvID, RecordNB, PlayNB, StopNB, GetClientData