Tik-76.115 Individual Project: Guinea Pig
$Id: gpPlayer.html,v 1.4 1996/04/22 12:17:40 hynde Exp $
The sound player program
The gpPlayer program handles the audio mixing and output of the
GuineaPig system. It communicates with the
test logic using a text based
protocol. A python module
gpSoundPlayer provides an easy
object oriented access to the player program and hides the
communication protocol from the user.
Starting the player
Usually there is no need to start the player manually, the
Test Logic will start the
player automatically. However, if the player is to be run on a remote
host, you have to start it manually. In that case, just run the player
program with the parameters you need
(see below: Player options).
The player will initialize itself and then waits for a connection to
the communication socket (can be specified with the
'-p port' option). After the connection is
established, the player starts producing audio output and accepts
commands through the socket. When the player receives a quit-command,
it will shut down and the player exits.
If one is using the player outside test logic, the
gpSoundPlayer python module can
start the player with the
launch() method.
Player options
The player program prints the available options with the '-h'
option:
# gpPlayer -h
gpPlayer - Sound player server for Guinea Pig
Usage:
gpPlayer [ options ... ]
Options:
-h print help and exit
-m MONO (1 channel) output
-s STEREO (2 channel) output (default)
-1 same as -m
-2 same as -s
-4 4 channel output
-r rate set sampling rate (allowed rates: 44100, 22050 and 11025)
-p port port number for comm. socket (default 10000)
-B bufsize audio buffer size (in sample frames)
-D detach from process group
-N level set NICE for process
The options are:
- -h
- Prints the help text above and exits.
- -m or -1
- Select mono output.
- -s or -2
- Select stereo output.
- -4
- Select 4 channel output. Only available in the
version for Silicon Graphics machines.
- -r samplrate
- Selects the output sampling rate. For Linux/MSND allowed values
are: 44100 (default), 22050 and 11025. For SGI, the same plus:
48000, 32000, 16000.
- -p port
- Select port number to use for communications. Default is 10000.
- -B bufsize
- Set the audio buffer size (in sample frames).
- -D
- Detach from process group. Prevents a kill signal received by
the test logic program from killing the sound player process
(when player is launched by the logic module). The test logic
usually catches the interrupt and deals with it.
- -N nicevalue
- Sets nice value of process. If run as root, may be given negative
values for more favourable scheduling. May help on systems with
no real time priorities.
Features/bugs
Sometimes when the process using the player exits before quitting the
player program (does not send the QUIT command to the player),
the player program may be left running. Starting a new player process
after that will fail because the socket is still in use and the player may
have reserved the audio device for itself. If that happens, just kill
the old player process with the kill(1) command.
The player can be installed as a SUID root program. It will use
the root privileges only when it needs to, that is, during
initialization when setting the nice lever for process (running as
root allows negative nice values) or when setting real time priority
priority. After that the player will switch to the real user id and
will not use root privileges any more.
·
Sound Player Index
·
Document index
·
Guinea Pig
·