sfsdac -- SFS support for digital to analogue converters


int dac_open(name)
char *name;	/* device name - supply as NULL for auto-detection */

int dac_playback(buf,numf,srate,nbit,nchan,ntime)
short *buf;	/* sample buffer */
int numf;	/* number of samples in buffer */
double srate;	/* sampling rate */
int nbit;	/* number of bits in waveform (=12 or =16 only) */
int nchan;	/* number of channels of data in buffer */
int ntime;	/* number of times to play buffer */

void dac_close(rapid)
int rapid;	/* flag to shut down device immediately */

int dac_repeat(offset,numf,ntime)
int offset;	/* sample offset into last buffer */
int numf;	/* number of sample to replay */
int ntime;	/* number of times to replay */

void playback(buff,numf,srate)
short *buff;	/* sample buffer */
int numf;	/* number of samples */
double srate;	/* sampling rate */

extern int dac_available_channels;	/* # available channels */
extern double dac_selected_rate;	/* selected sampling rate */


The support for Digital-to-Analogue conversion within SFS is wholly confined to this set of routines. All programs access any DAC through these routines. DAC devices are given types which are selected by name. These names are coded into sfsdac.c and which types are available depend on the machine configuration specified in SFSCONFG.h. The name of the DAC is discovered at open time from a supplied name, or from a DAC environment variable, or from a file $(SFSBASE)/data/dactable.


The open routine attempts to find a suitable DAC type and device and opens it to give the user unique access. The mnemonic name for the device may be given in the routine call, or if NULL is found from the DAC environment variable, or if DAC is NULL from the file $(SFSBASE)/data/dactable - which identifies DAC types from specific terminal names. dac_open() returns the DAC type if successful, otherwise -1. The external variable dac_available_channels is set to indicate the maximum number of channels of simultaneous replay available.


This routine closes the DAC device and frees any allocated memory.


This routine takes details of a waveform supplied in a short buffer and replays it a given number of times through the currently opened DAC device. Note that many DACs have a limited range of sampling frequencies and that the required rate may not be available. In this case, dac_playback() silently selects the nearest frequency. The selected frequency may be recovered from the global variable dac_selected_rate. Behaviour for multiple-channel data played through single channel DACs is undefined. Future dac_getconfig() and dac_setconfig() routines will allow more control. A repetition count of zero will only set sampling rate.


This routine allows parts of the immediately previous buffer supplied to dac_playback() to be replayed. It assumes that the buffer still exists and contains valid data. This routine can be used to great effect in systems which allow caching of DAC data (e.g. the PC 'login' terminal emulator) whereby only a replay command rather than a replay buffer needs to be transported over a network.


This routine provides backward compatibility with the old SFS playback() routine. It opens, replays and closes the default DAC device. Note that this compatibility routine expects 16-bit single-channel data.


SFSBASE/data/dacmap Table of mappings from ttynames to DAC name.


sun SPARC-2 with 8-bit ulaw

sparc2 SPARC-2 with 8-bit ulaw

sun8 SPARC-2 with 8-bit ulaw

sun8-spkr SPARC-2 with 8-bit ulaw (speaker output)

sun8-phone SPARC-2 with 8-bit ulaw (headphone output)

sun8-line SPARC-2 with 8-bit ulaw (line output)

sparc10 SPARC-10 with ISDN 16bit sound interface

sun16 SPARC-10 with ISDN 16bit sound interface

dbri SPARC-10 with ISDN 16bit sound interface

sun16-spkr SPARC-10 with ISDN 16bit sound interface (speaker output)

sun16-phone SPARC-10 with ISDN 16bit sound interface (headphone output)

sun16-line SPARC-10 with ISDN 16bit sound interface (line output)

0..7 Masscomp DA08 - channel 0..7

ansi UCL/ANSI stdout transport - 16 bit

ansi16 UCL/ANSI stdout transport - 16 bit

ansi12 UCL/ANSI stdout transport - 12 bit

pp PC: UCL Parallel printer DAC

dt2811 PC: Data Translation DT2811 board

pclx PC: Laryngograph PC/LX board

eb12 PC: UCL expansion-bus 12-bit DAC

sb8 PC: SoundBlaster 8 bit

sb16 PC: SoundBlaster 16 bit

extend Vista Extend, (X-Server/PC) UCL Replay daemon

pipe sends data to $SFSBASE/bin/dacpipe

linux standard LINUX soundcard /dev/dsp

win32 sends data to Windows Multimedia API on Windows-95/NT.


1.6 Mark Huckvale


Fri Jul 09 14:54:19 2004