beep.cpp
Go to the documentation of this file.
1 #include <stdio.h>
2 #include "beep.h"
3 
4 /* beep function */
5 static FILE *console_fp;
6 void init_beep() {
7  /* try to snag the console */
8  if(! (console_fp = fopen("/dev/console", "w"))) {
9  fprintf(stderr, ";;\n;; Could not open /dev/console for writing.\n;;\n");
10  perror("open");
11  } else {
12  fprintf(stderr, ";; Opening /dev/console for writing.\n;;\n");
13  }
14 }
15 
16 void start_beep(int freq, int length) {
17  if ( console_fp && fileno(console_fp) > 0 ) {
18  fprintf(console_fp, "\033[10;%d]\033[11;%d]\a\n", freq, length);
19  }
20 }
21 
22 void stop_beep() {
23  if ( console_fp && fileno(console_fp) > 0 ) {
24  fprintf(console_fp,"\033[10]\033[11]\n");
25  }
26 }
27 
28 void quit_beep() {
29  if ( console_fp && fileno(console_fp) > 0 ) {
30  fclose(console_fp);
31  }
32 }
33 
void quit_beep()
Definition: beep.cpp:28
void init_beep()
Definition: beep.cpp:6
static FILE * console_fp
Definition: beep.cpp:5
void stop_beep()
Definition: beep.cpp:22
void start_beep(int freq, int length)
Definition: beep.cpp:16


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:49