beep.cpp
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include "beep.h"
00003 
00004 /* beep function */
00005 static FILE *console_fp;
00006 void init_beep() {
00007   /* try to snag the console */
00008   if(! (console_fp = fopen("/dev/console", "w"))) {
00009     fprintf(stderr, ";;\n;; Could not open /dev/console for writing.\n;;\n");
00010     perror("open");
00011   } else {
00012     fprintf(stderr, ";; Opening /dev/console for writing.\n;;\n");
00013   }
00014 }
00015 
00016 void start_beep(int freq, int length) {
00017   if ( console_fp && fileno(console_fp) > 0 ) {
00018     fprintf(console_fp, "\033[10;%d]\033[11;%d]\a\n", freq, length);
00019   }
00020 }
00021 
00022 void stop_beep() {
00023   if ( console_fp && fileno(console_fp) > 0 ) {
00024     fprintf(console_fp,"\033[10]\033[11]\n");
00025   }
00026 }
00027 
00028 void quit_beep() {
00029   if ( console_fp && fileno(console_fp) > 0 ) {
00030     fclose(console_fp);
00031   }
00032 }
00033 


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:54