29 #include <sys/types.h> 32 #include <sys/ioctl.h> 48 #define CLOCK_TICK_RATE 1193180 50 #define CONSOLE_FILE "/dev/console" 60 __disable_beeping =
false;
69 if (__disable_beeping)
return;
71 int beep_fd = open(CONSOLE_FILE, O_WRONLY);
74 strerror_r(errno, errstr,
sizeof(errstr));
77 __disable_beeping =
true;
79 if (ioctl(beep_fd, KIOCSOUND, (
int)(CLOCK_TICK_RATE/freq)) < 0) {
81 __disable_beeping =
true;
92 if (__disable_beeping)
return;
94 int beep_fd = open(CONSOLE_FILE, O_WRONLY);
97 strerror_r(errno, errstr,
sizeof(errstr));
100 __disable_beeping =
true;
102 if (ioctl(beep_fd, KIOCSOUND, 0) < 0) {
105 __disable_beeping =
true;
void beep_on(float freq=1000)
Enable beeping.
void beep_off()
Disable beeping.
BeepController()
Constructor.