DIRECTORY FinchSmarts USING [Procs], Rope USING [ROPE], VoiceRopeDB USING [Handle]; VoiceRope: CEDAR DEFINITIONS = { ROPE: TYPE ~ Rope.ROPE; VoiceRope: TYPE = REF VoiceRopeInterval; VoiceRopeInterval: TYPE = RECORD [ ropeID: ROPE, start: INT, length: INT ]; Interval: TYPE = RECORD[start, length: INT]; IntervalSpecs: TYPE = LIST OF Interval; 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]; Record: PROC[handle: Handle_NIL] RETURNS [voiceRope: VoiceRope]; Play: PROC[handle: Handle_NIL, voiceRope: VoiceRope, queueIt: BOOL_TRUE, failOK: BOOL_FALSE, wait: BOOL_FALSE]; Stop: PROC[handle: Handle _ NIL]; InterestClass: TYPE ~ ROPE; Retain: PROC [handle: Handle _ NIL, vr: VoiceRope, class: InterestClass, refID: ROPE, other: ROPE _ NIL]; Forget: PROC [handle: Handle _ NIL, vr: VoiceRope, class: InterestClass, refID: ROPE]; GetByInterest: PROC [handle: Handle _ NIL, class: InterestClass, refID: ROPE] RETURNS [voiceRope: VoiceRope]; Cat: PROC [handle: Handle _ NIL, vr1, vr2, vr3, vr4, vr5: VoiceRope _ NIL] RETURNS [new: VoiceRope]; Substr: PROC [handle: Handle _ NIL, vr: VoiceRope, start: INT _ 0, len: INT _ LAST[INT]] RETURNS [new: VoiceRope]; Replace: PROC [handle: Handle _ NIL, vr: VoiceRope, start: INT _ 0, len: INT _ LAST[INT], with: VoiceRope _ NIL] RETURNS [new: VoiceRope]; Length: PROC [handle: Handle _ NIL, vr: VoiceRope] RETURNS [len: INT]; DescribeRope: PROC [handle: Handle _ NIL, vr: VoiceRope, minSilence: INT _ -1] RETURNS [noise: IntervalSpecs]; }. ¨VoiceRope.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last Edited by: Swinehart, January 31, 1986 7:11:13 pm PST Doug Terry, July 1, 1986 10:01:35 am 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. 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. Voice rope operations take a handle as their first parameter; if handle is omitted, one will be invented using all the defaults. 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 Records a voice rope, registers it , and returns its ID. A NIL return value indicates that something went wrong. 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. 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. 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. 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. 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 Concatenates together the non-NIL voice ropes to produce a new voice rope. Creates a new voice rope that is a substring of an existing voice rope. Creates a new voice rope in which the given interval of the voice rope "vr" is replaced by the voice rope "with". 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 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 Κ˜šœ™Icodešœ Οmœ1™