File: VoiceRope.mesa
Contents:
Procedures for creating, recording, and playing voice ropes
Procedures for managing the permanent storage and multi-user access to voice ropes.
Last Edited by: Swinehart, November 2, 1984 4:40:45 pm PST
DIRECTORY
GVBasics USING [RName],
IO USING [STREAM],
Rope USING [ROPE],
BasicTime USING [GMT, nullGMT],
Thrush USING [EncryptionKey, nullKey, Tune, VoiceInterval];
VoiceRope: CEDAR DEFINITIONS =
BEGIN
ID: TYPE = Rope.ROPE;
EncryptionKey: TYPE = Thrush.EncryptionKey;
Handle: TYPE = Thrush.ThHandle; -- Means for communicating with voice rope manager.
InitializeNuthatch: PROC[
userName: GVBasics.RName←NIL, 
logFileName: Rope.ROPENIL,
RefIDType: Rope.ROPENIL, close: BOOLTRUE] RETURNS [success: BOOLTRUE, nuthatchUserHandle: NuthatchUserHandle];
InitializeNuthatch verifies that the nuthatch database is around and usable, and then looks for the user's log file. In nuthatchUserHandle, InitializeNuthatch initializes the logstream as the current log stream, userName as the current user, RefIDType as the current ID type for voice messages, and updateProcess as the identifier of the process that updates the database from the user's log.
CatalogVoiceFile: PROC[
nuthatchUserHandle: NuthatchUserHandle,
creator: GVBasics.RName, get this from current user name --
voiceFileID: VoiceFileID,
tuneNumber: INT,
recordedTime: BasicTime.GMT,
referenceCount: INT← 0, 
samples: INT← 0,    
startingSample: INT← 0,  
encryptionKey: EncryptionKey← NULL,  
time: BasicTime.GMT,
type: Rope.ROPE
];
Sets up a new directory entry for a voice file if none exists, or updates the information about an old entry. --
MakeInterestEntry: PROC[
nuthatchUserHandle: NuthatchUserHandle,
voiceFileID: VoiceFileID← NIL,
refIDType: Rope.ROPE← NIL, find this out from the user handle --
refID: Rope.ROPENIL,
time: BasicTime.GMT�sicTime.nullGMT] ;
Writes a log entry to create an entry in the InterestList relation for this voice file, associating the RefID with the voiceFileID.
AddInterest: PROC[
nuthatchUserHandle: NuthatchUserHandle,
voiceFileID: VoiceFileID ← NIL, --optional --
refIDType: Rope.ROPE← NIL, find this out from the user handle --
refID: Rope.ROPENIL,
time: BasicTime.GMT�sicTime.nullGMT] ;  -- Writes a log entry to increment the reference count for this voice file. If the voice message does not have an entry in the database, ignore it (can't tell till DB update time if that's so.) Either voiceFileID or RefID must be non-NIL.
LoseInterest: PROC[
nuthatchUserHandle: NuthatchUserHandle,
voiceFileID: VoiceFileID ← NIL, --optional --
refIDType: Rope.ROPE← NIL, find this out from the user handle --
refID: Rope.ROPENIL,
time: BasicTime.GMT�sicTime.nullGMT] ;
Writes a log entry to decrement the reference count for this voice file. If the database has no record of this message containing voice, that's OK; it will be ignored. (Happens after doing an expunge in Walnut, for example.)
RemoveInterestEntry: PROC[
nuthatchUserHandle: NuthatchUserHandle,
voiceFileID: VoiceFileID ← NIL, --optional --
refIDType: Rope.ROPE← NIL, find this out from the user handle --
refID: Rope.ROPENIL,
time: BasicTime.GMT�sicTime.nullGMT] ;
Writes a log entry to remove the entry in the InterestList relation for this voice file.
GetFileID: PROC[
ID: Rope.ROPE, nuthatchUserHandle: Nuthatch.NuthatchUserHandle] RETURNS [voiceFileID: VoiceFileID] ;
Given the user's ID for a voice message, return its voiceFileID. --
GetTune: PROC[
voiceFileID: VoiceFileID] RETURNS [tune: Tune] ;
Given the voiceFileID for a voice message, return its tune number. --
GetDirectoryEntry: PROC [voiceFileID: VoiceFileID] RETURNS [
tuneNumber: Nuthatch.Tune← -1,
recordTime: BasicTime.GMT�sicTime.nullGMT,
creator: GVBasics.RName← NIL,
samples: INT← -1,
startSample: INT← -1,
expirationDate: BasicTime.GMT�sicTime.nullGMT,
encryptionKey: Nuthatch.EncryptionKey←Thrush.nullKey,
type: Rope.ROPENIL ,
referenceCount: INT← 0,
found: BOOLFALSE];
NHTime: PROC[time: BasicTime.GMT] RETURNS [nhTime: BasicTime.GMT];
currentNUH: NuthatchUserHandle; -- right now, there's just one of them.
END.