home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
MM1
/
TELECOM
/
linkup12.lzh
/
DOC
/
audioplay.doc
< prev
next >
Wrap
Text File
|
1996-04-08
|
5KB
|
117 lines
AudioPlay (edition 4)
by Boisy G. Pitre/Andrzej Kotanski/Mike Haaland
AudioPlay is a program which plays .au, .wav, .voc and .iff sound
files. It is based on code that was made available to the public domain
by Andrzej Kotanski (kotanski@zeus02.desy.de) and contains several
features which make it a fairly robust audio player for the MM/1.
How does AudioPlay work?
------------------------
AudioPlay reads chunks of data from the sound file it is playing
and keeps two buffers. One buffer is the currently playing buffer
and the other buffer is the next one to be played. AudioPlay takes
advantage of the MM/1's DMA driven sound. While one buffer is playing,
AudioPlay reads the next sound chunk into alternate buffer and goes to
sleep waiting for the previous chunk to finish. This process continues
until all chunks of the sound file have been played.
The result of this dual buffer scheme is that a machine with limited
memory can play a sound file continuously without having to resort to
loading the entire file into memory.
The following paragraph is from Andrzej Kotanski:
"All files are played in stereo - the mono files are converted to stereo
by sending identical sounds to both channels. Although MM/1 has an
(undocumented) mono mode, it sends bytes to alternate channels. This causes
audible distortions of the sound (unless both channels are connected to the
same speaker)."
AudioPlay looks at the sound file being played to determine what type
it is. Therefore the filename or extension is not used to determine its
type.
What are the options available?
-------------------------------
Doing an audioplay -? at the shell prompt gives you:
Syntax: AudioPlay {[<opts>] [file] [...]}
Function: plays .AU, .WAV, .VOC and .IFF sound files
Options:
-b[=]<size> buffer size (in K-bytes)
-p[=]<pid> process to send <sig> to when done
-q quiet mode (no output)
-s[=]<sig> signal to send to <pid> when done
-f force event
More than one filename can be placed on the command line. Each will
file will be played consecutively.
An explanation of each option follows:
-b[=]size buffer size (in K-bytes)
-b allows you to specify the size of the buffer that AudioPlay can
use to play sound files. The default size is 100K and the minimum buffersize
is 10K. This is the size of one of the buffers that are allocated, so
at a minimum, size times 2 bytes of memory will be allocated (if the file is
a mono file, size times 4 bytes are allocated).
Users with fast hard drives shouldn't need to adjust the 100K default
buffer size. Users playing sound files from floppy drives and other slow
devices may need to increase the buffer size to prevent lapses between
playing chunks of audio.
-p[=]<pid> process to send <sig> to when done
-s[=]<sig> signal to send to <pid> when done
AudioPlay can send a signal to a process when it has finished
playing a sound file. This is especially useful for processes which
fork AudioPlay as a child, but who do not want to wait for the audio
file to complete before continuing execution. By passing the process
ID and a signal code, AudioPlay notifies a process that it is about
to exit. If the process receiving the signal is the parent of
AudioPlay, it can properly wait for its child to die.
-q quiet mode (no output)
By default, AudioPlay prints out verbose information to the
screen indicating the name of the file, any annotations, the sample
rate, the size of the file in bytes and how many channels it is
using. This option inhibits AudioPlay from printing any information
and is useful when being forked from another process.
Miscellaneous Notes
-------------------
AudioPlay was compiled using Microware's Ultra C compiler.
AudioPlay creates and uses an event called 'mm1_sound' to prevent
another AudioPlay process from trying to play a sound file at the same
time. If two or more AudioPlay processes are forked simultaneously,
only one will execute at a time. The others will wait on the event.
Because of this, you should never send signal 0 (the unconditional
kill signal) to an AudioPlay process, or it will not properly reset
the event so that other AudioPlay processes can function.
If by some chance the event does get 'hung', by AudioPlay aborting
abruptly, the -f option will reset the event. The only other recourse
would be to reboot the machine. This option should only be used if your
sure the event is locked and no other process is using it.
Boisy G. Pitre
Internet : boisy@os9er.waukee.ia.us
Delphi : BOISY
Mike Haaland
Internet : mhaaland@hypertech.com
Compuserve: 72300,1433