AudioLibrary.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Last modified by D. Swinehart, October 19, 1992 9:38 am PDT
This interface describes functions that control the SPARC audio device and the audio mixer enhancements developed by Ron Frederick. It includes record definitions for the structures in which information is returned by some of these procedures.
See ~frederic/src/audio/*.docs and ~frederic/src/audiolib/* for documentation.
DIRECTORY
Arpa USING [ Address, nullAddress ],
ArpaUDP USING [ Port ],
UnixTypes USING [ FD ]
;
AudioLibrary: CEDAR DEFINITIONS = {
Types
AudioInfo: TYPE ~ REF AudioInfoBody;
AudioInfoBody: TYPE ~ RECORD [
play: AudioPRInfoBody ¬ [], -- output status information
record: AudioPRInfoBody ¬ [], -- input status information
monitorGain: INT ¬ defaultINT, -- input to output mix: 0 - 255
dummy: ARRAY [0..4) OF INT ¬ ALL[defaultINT] -- Reserved for future use.
];
AudioPRInfo: TYPE ~ REF AudioPRInfoBody;
AudioPRInfoBody: TYPE ~ RECORD [
The following values describe the audio data encoding.
They are read-only for SPARCstation audio, but may be
dynamically configurable for other audio devices.
sampleRate: INT ¬ defaultINT, -- sample frames per second
channels: INT ¬ defaultINT, -- number of interleaved channels
precision: INT ¬ defaultINT, -- bits per sample
encoding: DataEncodingMethod ¬ demDefault,
The following values control audio device configuration
gain: INT ¬ defaultINT, -- gain level: 0-255
port: INT ¬ defaultINT, -- Selected I/O port (see below)
dummy: ARRAY [0..4) OF INT ¬ ALL[defaultINT], -- Reserved for future use.
The following values describe driver state
samples: INT ¬ defaultINT, -- number of samples converted
eof: INT ¬ defaultINT, -- number of EOF records (play only)
pause: CharBool ¬ cbDefault, -- TRUE to pause, FALSE to resume
error: CharBool ¬ cbDefault, -- TRUE if overflow/underflow
waiting: CharBool ¬ cbDefault, -- TRUE if a process wants access
cdummy1: CharBool ¬ cbDefault, -- Reserved for future use
cdummy2: CharBool ¬ cbDefault, -- Reserved for future use
cdummy3: CharBool ¬ cbDefault, -- Reserved for future use
The following values are read-only state flags
open: CharBool ¬ cbDefault, -- TRUE if access requested at open
active: CharBool ¬ cbDefault -- TRUE if HW I/O active
];
CharBool: TYPE ~ [0..256);
cbFalse: CharBool = 0;
cbTrue: CharBool = 1;
cbDefault: CharBool = LAST[CharBool];
DataEncodingMethod: TYPE ~ INT;
demDefault: DataEncodingMethod = -1;
defaultINT: INT = -1;
ErrCode: TYPE ~ MACHINE DEPENDENT {
success(0),
error (1), -- The standard default error
. . .
(LAST[INT]) -- INT-wide value
};
FD: TYPE ~ UnixTypes.FD; -- Unix File Descriptors
For the purposes of this interface, these are generated only here and used only here.
IPAddress: TYPE ~ Arpa.Address;
nullAddress: IPAddress = Arpa.nullAddress;
IPPort: TYPE ~ ArpaUDP.Port;
nullPort: IPPort = [0,0];
MixerID: TYPE~ MACHINE DEPENDENT {
mixer0A (0),
mixer0B (1), -- Mixer 0 is connected to the real /dev/audio. Clients connect to B side.
mixer1A (2),
mixer1B (3),
. . .
mixer7B (15)
};
General audio control
AudioGetInfo: PROC [fd: FD] RETURNS [err: ErrCode, info: AudioInfo];
AudioSetInfo: PROC [fd: FD, info: AudioInfo, returnCurrentValue: BOOL¬FALSE]
RETURNS [err: ErrCode, newInfo: AudioInfo];
In addition, the audio device can be opened ordinarily via ordinary Cedar stream operations:
Insert documentation here.
Mixer Control
MixerLinkStream: PROC [mixerID: MixerID¬mixer0B, fd: FD] RETURNS [err: ErrCode];
MixerUnlinkStream: PROC [fd: FD] RETURNS [err: ErrCode];
Net Audio
TransmitStreamCreate: PROC [groupAddr: IPAddress, groupPort: IPPort, packetLen: INT, voxEnable: BOOL] RETURNS [fd: FD];
ReceiveStreamCreate: PROC [groupAddr: IPAddress, groupPort: IPPort, remoteAddr: IPAddress, remotePort: IPPort, jitterDelay: INT] RETURNS [fd: FD];
StreamDestroy: PROC [fd: FD] RETURNS [err: ErrCode];
StreamGetLocalAddr: PROC [fd: FD]
RETURNS [err: ErrCode, localAddr: IPAddress, localPort: IPPort];
StreamSetGroupAddr: PROC [fd: FD, groupAddr: IPAddress, groupPort: IPPort]
RETURNS [err: ErrCode];
StreamSetRemoteAddr: PROC [fd: FD, remoteAddr: IPAddress, remotePort: IPPort]
RETURNS [err: ErrCode];
}.
Swinehart, September 8, 1992 9:57:40 am PDT
Created