X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FBeeper.hh;fp=senf%2FUtils%2FBeeper.hh;h=7a29d6060893c7c66de6a469422a8ccd9c97881b;hb=0b8ca53e27f21515b66491c8df3d480c77810346;hp=0000000000000000000000000000000000000000;hpb=a2f8706e1e8e95dcdef15a5c50cb098bfda1500a;p=senf.git diff --git a/senf/Utils/Beeper.hh b/senf/Utils/Beeper.hh new file mode 100644 index 0000000..7a29d60 --- /dev/null +++ b/senf/Utils/Beeper.hh @@ -0,0 +1,109 @@ +// $Id$ +// +// Copyright (C) 2010 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief Beeper public header */ + +#ifndef HH_SENF_Utils_Beeper_ +#define HH_SENF_Utils_Beeper_ 1 + +// Custom includes +#include +#include + +///////////////////////////////hh.p//////////////////////////////////////// + +namespace senf { + + /** \brief 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 manual page console_ioctl(4) for the according ioctl KIOCSOUND + */ + class Beeper + { + public: + 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 + /**< \param freq frequency in Hz, where 0