PlayNoiseImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, September 15, 1987 8:33:05 am PDT
Doug Terry, July 30, 1986 5:00:49 pm PDT
DIRECTORY
Booting USING [ RegisterProcs, CheckpointProc ],
Process USING [ Detach, MsecToTicks, Pause ],
Rope USING [ ROPE ],
UserProfile USING [ Boolean ],
VoiceRope USING [ GetByInterest, Handle, Open, Play, VoiceRope ]
;
PlayNoiseImpl: CEDAR PROGRAM
IMPORTS Booting, Process, UserProfile, VoiceRope = {
reallyBoot: BOOLTRUE;
didOurBest: BOOL;
maxTime: CARDINAL ← 4000;
PlayTheRollbackButton: Booting.CheckpointProc = TRUSTED {
IF ~UserProfile.Boolean["Finch.NoisyBoot"] THEN RETURN;
PlayAButton["Rollback"];
IF ~reallyBoot THEN rejection ← "Just pretending";
};
PlayAButton: PROC[name: Rope.ROPE] = TRUSTED {
didOurBest ← FALSE;
Process.Detach[FORK ReallyPlayAButton[name]];
FOR i: NAT IN [0..100) DO
Process.Pause[Process.MsecToTicks[maxTime/100]];
IF didOurBest THEN EXIT;
ENDLOOP;
};
ReallyPlayAButton: PROC[name: Rope.ROPE] = {
C: PROC[complaint: Rope.ROPE] = {NULL}; -- Don't bother complaining.
handle: VoiceRope.Handle = VoiceRope.Open[Complain: C];
vr: VoiceRope.VoiceRope = VoiceRope.GetByInterest[handle: handle, class: "SysNoises", refID: name];
VoiceRope.Play[handle: handle, voiceRope: vr, wait: TRUE];
didOurBest ← TRUE;
};
Booting.RegisterProcs[c: PlayTheRollbackButton, r: NIL, b: PlayTheRollbackButton];
}.
Doug Terry, July 30, 1986 5:00:08 pm PDT
Upgraded to use VoiceRope
changes to: DIRECTORY, PlayNoiseImpl, ReallyPlayAButton