


SFSADC(3)              C LIBRARY FUNCTIONS              SFSADC(3)



NAME
     sfsadc -- SFS support for analogue to digital converters

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

     int adc_record(buf,numf,srate,nchan,flags)
     short *buf;    / sample buffer */
     int numf; / number of samples to record */
     double srate;  / sampling rate */
     int nchan;     / number of channels of data to record */
     int flags;     / to be used for future expansion */

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

     extern int adc_available_channels; / # available channels */
     extern double adc_selected_rate;   / selected sampling rate */

DESCRIPTION
     Primitive support for Analogue-to-Digital conversion  for  a
     number of devices is supported through these routines.  Many
     machines have their own specific acquisition systems to sup-
     plement  these routines.  The routines only support acquisi-
     tion of a maximum sized block into memory.

     ADC devices are given types  which  are  selected  by  name.
     These  names  are  coded  into  sfsadc.c and which types are
     available depend on the machine configuration  specified  in
     SFSCONFG.h.   The name of the ADC is discovered at open time
     from a supplied name, or from the ADC environment  variable,
     or    using    the    terminal    name    from    the   file
     $(SFSBASE)/data/adctable.

  ADC_OPEN
     The open routine attempts to find a suitable  ADC  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 ADC environment variable,
     or if ADC is NULL from the file  $(SFSBASE)/data/adctable  -
     which  identifies  ADC  types  with specific terminal names.
     adc_open() returns the ADC type if successful, otherwise -1.
     The external variable adc_available_channels is set to indi-
     cate the maximum number of channels of simultaneous acquisi-
     tion available.

  ADC_CLOSE
     This routine closes the ADC device and frees  any  allocated
     memory.





UCL                     Last change: SFS                        1






SFSADC(3)              C LIBRARY FUNCTIONS              SFSADC(3)



  ADC_RECORD
     This routine takes a buffer and a maximum size of  waveform,
     and fills it from the current input channel according to the
     given sample rate and number of channels.   Data  is  always
     signed  16-bit  samples with linear quantisation.  Note that
     many ADCs have a limited range of sampling  frequencies  and
     that  the required rate may not be available.  In this case,
     adc_record() silently selects the  nearest  frequency.   The
     selected frequency may be recovered from the global variable
     adc_selected_rate.  A buffer count of zero will only set the
     sampling rate.

     For  stereo  recording,  double  the   number   of   samples
     requested.

FILES
     SFSBASE/data/adcmap
          Table of mappings from ttynames to ADC name.

SUPPORTED TYPES
     sb16       SoundBlaster-16 on DOS machine.

VERSION/AUTHOR
     1.0  Mark Huckvale

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



























UCL                     Last change: SFS                        2



