senf::Beeper Class Reference

Helper class to beep the pc speaker. More...

#include <senf/Utils/Beeper.hh>

List of all members.


Detailed Description

Helper class to beep the pc speaker.

This helper class allows you to beep the pc speaker with precision like frequency and duration. The beep can be played synchronous and asynchronous.

Typically the /dev/console device is used to control the local pc speaker. Note, that opening /dev/console is a privileged operation on most systems.

See also:
manual page console_ioctl(4) for the according ioctl KIOCSOUND

Definition at line 48 of file Beeper.hh.


Public Member Functions

  Beeper (std::string const &device="/dev/console")
  Construct a new Beeper for the given device.
  ~Beeper ()
void  beep_sync (float freq, unsigned length, unsigned count=1, unsigned delay=100)
  play beep synchronous
void  beep_async (float freq, unsigned length, unsigned count=1, unsigned delay=100)
  play beep asynchronous
void  stop_beep ()
  stop playing.
bool  start_beep (float freq)
  start playing.

Constructor & Destructor Documentation

senf::Beeper::
Beeper ( std::string const &  device = "/dev/console" )

Construct a new Beeper for the given device.

Definition at line 41 of file Beeper.cc.

senf::Beeper::
~Beeper ()

Definition at line 49 of file Beeper.cc.


Member Function Documentation

void senf::Beeper::
beep_async ( float  freq,
unsigned  length,
unsigned  count = 1,
unsigned  delay = 100 )

play beep asynchronous

Parameters:
freq  frequency in Hz, where 0 < freq < 20000. The regular terminal beep is around 750Hz.
length  duration in milliseconds.
count  number of repetitions (defaults to 1).
delay  delay between repetitions in milliseconds.

Definition at line 66 of file Beeper.cc.

void senf::Beeper::
beep_sync ( float  freq,
unsigned  length,
unsigned  count = 1,
unsigned  delay = 100 )

play beep synchronous

Parameters:
freq  frequency in Hz, where 0 < freq < 20000. The regular terminal beep is around 750Hz.
length  duration in milliseconds.
count  number of repetitions (defaults to 1).
delay  delay between repetitions in milliseconds.

Definition at line 55 of file Beeper.cc.

bool senf::Beeper::
start_beep ( float  freq )

start playing.

start playing until any other member is called.

Parameters:
freq  frequency in Hz, where 0 < freq < 20000.
Returns:
true on success.

Definition at line 36 of file Beeper.cci.

void senf::Beeper::
stop_beep ()

stop playing.

Definition at line 41 of file Beeper.cci.


The documentation for this class was generated from the following files: