<> <> <> <> <> <> DIRECTORY IntervalTimer USING [Pulses], IO USING [STREAM], Jukebox USING [Handle, RunData, RunDataObject, Tune, WindowOrigin, RunArrayRange], PrincOps USING [ByteBltBlock], PupSocket USING [Socket], Rope USING [ROPE], VM USING [Interval], VoiceTemp USING [ IntervalSpec, VoiceDirection ] ; VoiceStream: DEFINITIONS = BEGIN <> <<>> ErrorCode: TYPE = {Bug, BadPiece, StreamClosed, Timeout, Hungup}; <> <> <> <> <> <> Error: ERROR[reason: ErrorCode, rope: Rope.ROPE, clientData: REF]; <> ReportError: PROC[handle: Handle]; <> VoiceStreamEvent: TYPE = ATOM; -- For reporting what happened. <> <> wholeTune: INT; Open: PROC [jukebox: Jukebox.Handle, proc: NotifyProc _ NIL] RETURNS [handle: Handle]; <> Close: PROC [handle: Handle]; <> SetSocket: PROC [handle: Handle, socket: PupSocket.Socket]; <> AddPiece: PROC [handle: Handle, intervalSpec: VoiceTemp.IntervalSpec, direction: VoiceTemp.VoiceDirection _ play, clientData: REF ]; <> FlushPieces: PROC [handle: Handle]; <> IsEmpty: PROC [handle: Handle] RETURNS[BOOLEAN]; <> WaitEmpty: PROC [handle: Handle]; <> Get: PROC [handle: Handle, maxSilentBytes: NAT, block: PrincOps.ByteBltBlock, wait: BOOL _ FALSE] RETURNS[silence: NAT, bytesTransferred: NAT, keyIndex: NAT]; <> <<>> Put: PROC [handle: Handle, silentBytes: NAT, block: PrincOps.ByteBltBlock, energy: CARDINAL] RETURNS [bytesTransferred: NAT]; <> Check: PROC [handle: Handle] RETURNS[BOOLEAN]; <> StartServer: PROC [stream: IO.STREAM]; <> Handle: TYPE = REF VSRecord; NotifyProc: TYPE = PROC [self: Handle, event: VoiceStreamEvent, clientData: REF ANY]; <> <<-------------------------------------------------------->> <> <<-------------------------------------------------------->> buffersPerStream: INTEGER = 3; VSRecord: TYPE = RECORD [ <<>> <> jukebox: Jukebox.Handle, firstServerBuffer: REF Buffer_NIL, firstClientBuffer: REF Buffer_NIL, firstIdleBuffer: REF Buffer_NIL, piece: Piece_NIL, next: REF VSRecord_NIL, errorRope: Rope.ROPE_NIL, errorCode: ErrorCode, proc: NotifyProc, connection: Connection_NIL, newPiece: CONDITION, action: BOOL_FALSE, pieceInProgress: BOOL_FALSE ]; Connection: TYPE = REF ConnectionObject; ConnectionObject: TYPE = RECORD [ socket: PupSocket.Socket, packetSize: NAT, -- Packet size when we're sending. bufferSpace: NAT, -- Milliseconds of buffering in Lark. probeLaunchTime: IntervalTimer.Pulses, -- time probe was transmitted probeSequenceNumber: CARDINAL, -- last probe fingerprint <> larkEpoch: CARDINAL, -- Lark clock (milliseconds) localEpoch: IntervalTimer.Pulses, roundTripMS: CARDINAL, -- milliseconds initialProbeDone: CONDITION, initialProbeFinished: BOOL, drift: INT, -- accumulated clock error sendNext: IntervalTimer.Pulses, pollStreamNext: IntervalTimer.Pulses, sequenceNumber: CARDINAL, timeToPlay: CARDINAL, -- lark time to play next packet packetMS: NAT -- Milliseconds in most recent packet ]; Buffer: TYPE = RECORD [ <> chirp: LONG INTEGER, chirpSpace: VM.Interval, window: Jukebox.WindowOrigin, block: PrincOps.ByteBltBlock, runData: RunData, runIndex: Jukebox.RunArrayRange, bytesAccountedFor: NAT, next: REF Buffer, toJukebox: BOOLEAN, keyIndex: NAT, valid: BOOLEAN, playedBytes: CARDINAL ]; RunDataObject: TYPE = Jukebox.RunDataObject; RunData: TYPE = Jukebox.RunData; Piece: TYPE = REF PieceObject; PieceObject: TYPE = RECORD [ <> next: Piece_NIL, intervalSpec: VoiceTemp.IntervalSpec, clientData: REF, tune: Jukebox.Tune_NIL, playback: BOOLEAN, flush: BOOLEAN_FALSE, packetsSinceLastNonSilence: INT -- used in both recording and playback: indicates how long since last sound worth playing occured; preset to Jukebox.hangoverPackets by AddPiece ]; <> Lock: MONITORLOCK; <> serverCondition: CONDITION; client: CONDITION; <> waitCondition: CONDITION; <> closeCondition: CONDITION; <> ioStream: IO.STREAM; <> vSList: Handle; SetError: PROC [handle: Handle, rope: Rope.ROPE, code: ErrorCode]; <> FlushBuffer: PROC [handle: Handle]; <> END. April 5, 1983 2:35 pm, Stewart, add RunData to Buffer record June 4, 1983 5:39 pm, Stewart, add notified to VSRecord in order to notify only once L. Stewart, June 20, 1983 4:52 pm, Try using Pulses instead of Microseconds L. Stewart, December 26, 1983 7:41 pm, Cedar 5 <> <> <> <<>> <> <> <> <<>>