


SFSDAC(3)              C LIBRARY FUNCTIONS              SFSDAC(3)



NAME
     sfsdac -- SFS support for digital to analogue converters

SYNOPSIS
     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 */

DESCRIPTION
     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.

  DAC_OPEN
     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 indi-
     cate the maximum number of channels of  simultaneous  replay



UCL                     Last change: SFS                        1






SFSDAC(3)              C LIBRARY FUNCTIONS              SFSDAC(3)



     available.

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

  DAC_PLAYBACK
     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 fre-
     quency  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.

  DAC_REPEAT
     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  rou-
     tine  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.

  PLAYBACK
     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.

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

SUPPORTED TYPES
     sun  11
          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)



UCL                     Last change: SFS                        2






SFSDAC(3)              C LIBRARY FUNCTIONS              SFSDAC(3)



     sparc10    SPARC-10 with ISDN 16bit sound interface

     sun16     11
                SPARC-10 with ISDN 16bit sound interface

     dbri 11    SPARC-10 with ISDN 16bit sound interface

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

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

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

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

     ansi 11    UCL/ANSI stdout transport - 16 bit

     ansi16    11
                UCL/ANSI stdout transport - 16 bit

     ansi12    11
                UCL/ANSI stdout transport - 12 bit

     pp   11    PC: UCL Parallel printer DAC

     dt2811    11
                PC: Data Translation DT2811 board

     pclx 11    PC: Laryngograph PC/LX board

     eb12 11    PC: UCL expansion-bus 12-bit DAC

     sb8  11    PC: SoundBlaster 8 bit

     sb16 11    PC: SoundBlaster 16 bit

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

     pipe 11    sends data to $SFSBASE/bin/dacpipe

     linux     11
                standard LINUX soundcard /dev/dsp

VERSION/AUTHOR
     1.5  Mark Huckvale



UCL                     Last change: SFS                        3






SFSDAC(3)              C LIBRARY FUNCTIONS              SFSDAC(3)



BUGS
SOURCE
     /ptemp/mark/sfs/libsfs/sfsdac.c




















































UCL                     Last change: SFS                        4



