This  is a modified work of Andre Fuechsel from wavplay021_patch.tar.gz.
His copy of README read:

> Please note:
> 
> Normally I would *NEVER* publish a program which is not finished yet and
> needs a lot of further development. But it may be that I will have no
> further time to finish the programming in the next months so I am going to
> publish it in it's current state. I will try to continue the development but
> I don't know exactly when. The application itself is really not an example
> of a good programming style!  
> 
> Andre Fuechsel
> 
> ---------------------------------------------------------------------------
> 
> PLAY / RECORD for Linux -- Release 0.21, November, 1993
> ======================================================= 
> 
> - Play plays wav-file through your sound card. It checks the header
>   of the file to set the correct mode, speed, bit per sample...
> 
> - Record records sound data and saves the data in a wav-file. 

So what's new?
==============

The  phylosophy  behind this release is to simply provide a simple shell
command  to play 8 or 16 bit .wav files. I particularly wanted something
simple  that could  be  run from  the /etc/rc.d/* startup scripts. Andre
Fuechsel's play command came very close but it needed locking.

Locking was implemented using semaphores.  This avoids ugly file locking
hacks and pathnames, but still requires that the administrator decide on
a unique IPC key.

This  implementation  was  further  extended  to  allow the shell script
writer  to  take  advantage of the semaphore locking capability, without
actually  playing sound  (and does  not  require sound capability to use
this).  Many different semaphore locks can be utilized by careful use of
the -k option.


Changes:
========

Files  play.h,  play.c  and  recplay.c have been overhaulled somewhat to
suit  my  fickle tastes :)  and to tightened up error checking and error
reporting.

In  addition to artistic license, I have added the module locks.c to the
group,  which adds locking functionality to the original 'play' program.
Its  purpose is to prevent various forks from trying to play to /dev/dsp
at the same time (easily happens in /etc/rc.d scripts where & is used to
overlap sound with startup procedures).

play/record Options:
=======================

Usage: play [opts] [filename(s)...]

Options:
	-h	This info.
	-q	Quiet mode (no messages)
	-s rate	Set sampling rate
	-S	Stereo
	-t secs	Set time limit
	-b bits	Set number of bits (8/12/16)
	-i      Ignore Header, play eyerything
	-k key	Set different IPC Key for lock
	-r	Remove and recreate semaphore locks.

	-l	Lock for play.
	-u	Unlock for play.
	-L	Lock for record.
	-U	Unlock for record.

Normally audio settings are taken from input file, but command options will
override them. If you like to ignore any header, please use the -i switch.

Options  -h,  -q, -s, -S, -t, and -b are unchanged from Andre Fuechsel's
play program. Options -k, -r and -i are new, and locking options -l, -u, -L
and -U have been added also.

	-k key

forces  the  program  to  use  another  IPC Key.  There is a compiled in
default,  which  is described under installation.  Normally, the default
will be used for conveniance.

	-r

forces  the  program  to  remove  the  existing IPC resource, and create
another.  This  is useful when it appears that the locking semaphore has
been messed up.

Options  -l,  -u operate on the play locking semaphore, while the -L and
-U options operate on the record locking semaphore.  When _ANY_ of these
options  are  used,  only  the  lock/unlock is performed and the program
exits.  These options allow the shell  script writer  to make use of the
same locking mechanism used within wavplay for other purposes and can be
used on systems without sound capability. Different locks can be used by
careful use  of the -k option. Option -r can also be used in combination
with -l, -u, -L or -U options.


Locking Mechanism:
==================

The locking mechanism is a simple pair of semaphores which persist after
the program exits.  This allows you to prevent more than one instance of
'wavplay'  from  trying  to write  to  /dev/dsp  at  the  same time. The
semaphore lock will cause the programs without the lock to suspend until
the  program with the lock, releases that resource. This is particularly
useful  when  you  want  to  play  wav  files  in your startup /etc/rc.d
scripts,  and you  run  them  as forked  process(es).

There  are  two  locks:  playing  and  recording.  The record locking is
perhaps overkill, but it was simple to add in light of the need for play
locks.

These  are implemented with 2 semaphores, in one semaphore set.  Because
the  creation  of  a  semaphore set and its initialization is NOT atomic
(two system  calls),  the  program leaves the semaphore set in existance
after  the  program  exits.  In  this  manner,  it need not risk another
initialization  at  a later time, and the existing semaphores are simply
reused  as  they  are  found.  This  avoids  various  nasties  and  race
conditions.


Xplay:
======

Xplay  was  omitted  from  this  release,  since  it was my goal to only
provide  a simple command to play 8/16 bit wav files from shell scripts.
Look for the file wavplay021_patch.tar.gz if you need Xplay.


Program Hangs:
==============

If  the  program  seems  to  hang,  it  is likely because of the locking
semaphore.  This  could happen if the program has been aborted or killed
with -SIGKILL (kill -9).  Alternatively, if you are developing software,
or  using  software  with  a conflicting IPC Key, there is a chance that
other  software  has  diddled  with  these  semaphores.  These  are  all
potential  problems.  Note  also, that the semaphore set is created with
mode  0666 allowing  world  access,  so  if run in a hostile environment
(students?), then they might be tampering with them as well.

If  you  suspect  that  the locking semaphores are messed up, use the -r
option on the command line to remove the existing set and recreate a new
locking  semaphore  set.  Note that if another program is this semaphore
set,  it may receive the EIDRM error and exit as a result of this.

Note  also,  that  -r  will  only  work  if you are root, or you are the
creator  of  the  original semaphore set.  Otherwise the kernel will not
allow  you  to remove  that  set.  Administrators  may prefer that their
hostile  user's not  be able  to  remove  the  semaphore.  To force root
ownership,  without  actually  playing a wav file, add this to a startup
script:

	play /dev/null

Option -r can be thrown in if you are really paranoid :

	play -r /dev/null

From this point on, only root will be able to remove the semaphore set.


Using for Lock/Unlock Only:
===========================

Shell  script  writers  can  delight!  play  can be used only for its
semaphore locking and unlocking capability.  Initially this was provided
to allow different sound packages to obey the same locks:

	$ play -l		# Lock for playing
	$ some_other_sound_pkg	# other package writing to /dev/dsp now
	$ play -u		# Unlock for playing

Notice  that  when  any  of  the  -l,  -u, -L or -U options are used, no
playing or  recording  is done.  Only the locks are affected.  When used
this  way,  the  return value is ZERO if the lock/unlock was successful.
Otherwise the exit value is 1.

Other locks can be administered in shell scripts this way in addition to
the default sound semaphores:

	$ play -l -k 4004	# Lock out some other resource (lpt1?)
	$ cat somefile >/dev/lpt1
	$ play -u -k 4004	# resource is now free


Installation:
=============

This  release  just  uses  make, since it is such a simple collection of
programs. Two values should be examined and adjusted to suit your system
needs:

	AUDIOLCK = -DAUDIOLCK=0x33333333

By  default,  Makefile  defines  the default IPC Key (-k option)  to hex
33333333.  If you  have other software using this IPC key, you will need
to change this. One way to check is to type the 'ipcs' command.

	AUDIODEV = -DAUDIODEV="\"/dev/dsp\""

This is simply the pathname of your audio special file.

Then type 'make'.


COPYRIGHT NOTE: 
===============

Some code comes from the recplay.c written by Liam Corner, posted in the
"Audio Utilities for Linux 2.0" - Package.

Much   of   the   remaining   code   comes  from  Andre  Fuechsel,  from
wavplay021_patch.tar.gz.

The  remaining  changes, and the module locks.c are my creation.  Please
feel free to do as you like with locks.c and my alterations. Just please
leave credit to all the authors in place.

	Warren W. Gay VE3WWG
	5535 Montevideo Road #2,
	Mississauga, Ontario.
	L5N 2P4

Currently reachable at:

	bx249@freenet.toronto.on.ca
	wwg@ica.net

Correct wav header generation for record after receiving SIGINT and -i
Option by Carsten Gross <carsten@siski.de>

Additionally added display of "Aussteurung" if not in quit mode

