r117: *** empty log message ***
[ctsim.git] / libctsupport / consoleio.cpp
index bc6df45616097ad93b83514dff67dec8e4750006..fd895e861474dd31e6abcd45224f4bff96a3d634 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: consoleio.cpp,v 1.2 2000/06/19 19:04:05 kevin Exp $
+**  $Id: consoleio.cpp,v 1.3 2000/06/22 10:17:28 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -144,3 +144,36 @@ cio_kb_waitc (const char *astr, int beep_on_error)
 }
 
 
+/* NAME
+ *    beep                             sound a beep to user
+ *
+ * SYNOPSIS
+ *    beep()
+ */
+
+void cio_beep (void)
+{
+       cio_tone (2000.0, 0.3);
+}
+
+/* NAME
+ *    tone             play a frequency sound for some duration
+ *
+ * SYNOPSIS
+ *    tone (freq, length)
+ *    double freq      frequency to play in Hertz
+ *    double length    duration to play note in seconds
+ */
+
+void 
+cio_tone (double freq, double length)
+{
+#if 1
+  fprintf(stdout, "\007");
+#else
+  cio_spkr_freq (freq);                /* Set frequency of tone */
+  cio_spkr_on ();                      /* Turn on speaker */
+  pause (length);                      /* Pause for length seconds */
+  cio_spkr_off ();                     /* Turn off speaker */
+#endif
+}