User guide

74 CHAPTER 3. THE LIBRARY
the specified value ret ur ni n g it previous setting. Setting it to a negative value disables
the tracing mechani s m. See Sys trpush for more details.
res := sys(Sys
sound, fno, a1, a2 ...) CIN:y, POS : y, NAT:y
This calls sound(args, g) where sound is a C function defined in sysc/sound.c.
The argument args points to memory loc ati on s holding fno, a1, a2, etc., and g points
to the base of the global vector. Note that it may be nec es sar y to run alsamixer to
enable the sound device and adjust its volume setting. The available soun d functions
have mnemonic names declared in g/sound.h and are described below.
res := sys(Sys
sound, snd test) CIN:y, POS:y, NAT:y
This returns TRUE is the Sys
sound functions are available on t he current syst e m.
res := sys(Sys
sound, snd waveInOpen, a1, a2 , a3 , a4 ) CIN:y, POS:y,
NAT:y
This opens a sound wave device for input. a1 is typically "/dev/dsp", "/dev/dsp1"
or a small integer, a2 is the sample format, eg 16 for S16
LE, 8 for U8. a3 is the number
of channels, typically 1 or 2 and a 4 is the number of samples per second , typically 44100.
The result is the file (or device) descriptor of the opened devic e or -1 if error.
res := sys(Sys
sound, snd waveInPause, a1) CIN:y, POS:y, NAT:y
This will pause sound wave sampling from device a1. Recently read samples can
still be read (to flush the buffered data).
res := sys(Sys
sound, snd waveInRestart, a1) CIN:y, POS:y, NAT:y
Restart sound wave sampling.
res := sys(Sys
sound, snd waveInRead, a1, a2 , a3 ) CIN:y, POS:y, NAT:y
Read samples from a sound wave input device a1, returning i mm ed i ate l y. a2 is t he
buffer in which to receive the samples and a3 i s the number of bytes to read. The result
is the number of bytes actually transferred into the buffer.
res := sys(Sys sound, snd waveInClose, a1) CIN:y, POS:y, NAT:y
This closes sound wave input device a1.
res := sys(Sys
sound, snd waveOutOpen, a1, a2 , a3 ) CIN:y, POS:y, NAT:y
This opens a sound wave device for output. a1 is typically "/dev/dsp",
"/dev/dsp1" or a small integer, a2 is the sample format, eg 16 for S16
LE, 8 for
U8. a3 is the number of channels, typically 1 or 2 and a4 is the number of samples
per second, typically 44100. The result is the file (or device) descriptor of the opened
device or -1 if error.
res := sys(Sys sound, snd waveOutWrite, a1, a2 , a3 ) CIN:y, POS:y, NAT:y
Write samples from a sound wave output device a1. a2 is the buffer holding th e
samples and a3 is the number of bytes to be written. The re sul t is the number of bytes
actually transferred from t he buffer.