Browse Source

* Implemented "Sound" and "NoSound". Please notice that these normally only
work on Linux textmode console, as the sound is created using special
Linux terminal IOCTLs.

sg 25 years ago
parent
commit
ab65042172
1 changed files with 12 additions and 7 deletions
  1. 12 7
      rtl/linux/crt.pp

+ 12 - 7
rtl/linux/crt.pp

@@ -1470,21 +1470,21 @@ Begin
 End;
 End;
 
 
 
 
+const
+  KIOCSOUND = $4B2F;	// start sound generation (0 for off)
 
 
 Procedure Sound(Hz: Word);
 Procedure Sound(Hz: Word);
-{
-  Does nothing under linux
-}
 begin
 begin
+  if not OutputRedir then
+    ioctl(TextRec(Output).Handle, KIOCSOUND, Pointer(1193180 div Hz));
 end;
 end;
 
 
 
 
 
 
 Procedure NoSound;
 Procedure NoSound;
-{
-  Does nothing under linux
-}
 begin
 begin
+  if not OutputRedir then
+    ioctl(TextRec(Output).Handle, KIOCSOUND, nil);
 end;
 end;
 
 
 
 
@@ -1662,7 +1662,12 @@ Begin
 End.
 End.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2000-06-05 08:35:28  jonas
+  Revision 1.28  2000-06-06 08:22:41  sg
+  * Implemented "Sound" and "NoSound". Please notice that these normally only
+    work on Linux textmode console, as the sound is created using special
+    Linux terminal IOCTLs.
+
+  Revision 1.27  2000/06/05 08:35:28  jonas
     * in readkey, check if keypresses are waiting using sysKeyPressed instead
     * in readkey, check if keypresses are waiting using sysKeyPressed instead
       of simply checking if there are keys left in the ttyRecvChar buffer
       of simply checking if there are keys left in the ttyRecvChar buffer
     * CrtRead supports the backspace key when reading from a TTY.
     * CrtRead supports the backspace key when reading from a TTY.