Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > c0f2fdaca4897316bde134c2ce358115 > files > 3

gnubeep-0.8-1mdk.i586.rpm

Shaun Colley <shaunige@yahoo.co.uk>, 2004
patch written by Olivier Thauvin

gnubeep 0.8


In this version, gnubeep has been cleaned up a little, and a few pieces of code
were rewritten more tidily.  There is a patch file, gnubeep-0.8.patch, which
is the patch to apply the changes in gnubeep 0.8.  gnubeep.c is ALREADY
patched, so simply typing 'make' will install gnubeep 0.8


gnubeep is a simple program to generate `beeps` by programming the system's
internal PIT (programmable interrupt timer) directly via the I/O ports..  I have so many times needed to generate custom tones in shell scripts and programs, and when '\a' doesn't suffice, this can be a problem which requires overcoming.  For this reason, I decided to write gnubeep.  As the name suggests, this program and it's source is released under the terms of the GNU GPL.  One of the prime reasons I saw 
fit to release this piece of software was to serve as an example of how to program the PIT for sound in Linux.  gnubeep is intended to be used as a utility for use in shell scripts and when you need most to generate those cute little beeps in programs where necessary.

gnubeep is very simple, and consequently has a simple syntax:

gnubeep <frequency> [duration] (in microseconds)

Examples:
gnubeep 1000 350000 - play 1000hz tone for 350ms
gnubeep 200 1000000 - play 200hz tone for 1 second

If the user does not specify tone duration on the command line, the default
is used (1 second, or 1000000 microseconds).

I have also included the file 'soundlib.h' in the tarball.  This header has
in it the sound functions found in gnubeep.c.  soundlib.h is intended for
other programs which want to make use of the PIT for sound in the same way
that gnubeep does.


In this version, gnubeep has been patched so that it exits with the error code
1 if the invoking user is not root.  This is so that users who don't really
like SUID root binaries laying around can take the SUID bit off gnubeep.  Then
any users who run gnubeep not as root will get an error message saying they 
don't have the necessary privileges to grab the I/O ports via ioperm().  Before
the patch was applied, gnubeep would crash if the user didn't have the right
privileges (although it is SUID root by default).  The patch was written by
Olivier Thauvin, and is ./gnubeep-patch.diff.


Feel free to copy, hack, modify and distribute under the terms of the GNU GPL.
I hope you enjoy gnubeep.



-Shaun