-=> Quoting zoop@clubi.ie to All <=-
zo> I need to produce a sound (siren to be exact), I have no idea how to
zo> do this.
For PC's & Turbo Pascal only:
USES Crt;
PROCEDURE FlushKbdBuffer;
{ -- Empty the keyboard buffer, i.e. ignore all pending key presses. }
INLINE($B4/$0C/ { -- mov AH, $0C }
$B0/$FF/ { -- mov AL, $FF ; value of AL is irrelevant, as long as }
{ -- ; it doesn't equal 1, 6, 7, 8 or $0A. }
$CD/$21); { -- int $21 }
PROCEDURE siren(CONST nbr: word);
{ -- Note: leave out the "CONST" in the line above if you are using TP 6 or
-- earlier. }
CONST minval = 800; { -- Adapt as necessary. }
maxval = 2000; { -- Ditto. }
VAR i, counter: word;
BEGIN IF nbr = 0 THEN exit;
FlushKbdBuffer;
counter:=0;
REPEAT inc(counter);
FOR i:=minval TO maxval DO BEGIN delay(1); sound(i) END;
FOR i:=maxval DOWNTO minval DO BEGIN delay(1); sound(i) END
UNTIL KeyPressed OR (counter = nbr);
nosound { -- Do not omit ! }
END;
{ -- Main: }
BEGIN write('Press a key to end this infernal racket ... ');
siren($FFFF)
END.
Peter
.. If Windows sucked it would be good for something.
/======================================================================
| Orange County Usenet Fidonet gateway
|
| User email address: Peter.Louwen.noemail@webworldinc.com
| FTN email: Peter Louwen[RemoveThis]@f901.n280.z2.fidonet.org
| User FidoNet address: 2:280/901
| Report abuse of this service to joejared@webworldinc.com
|