SFSADC

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;	/* 0=fixed time, 1=automatic endpointing */

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 supplement these routines. The routines only support acquisition 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 indicate the maximum number of channels of simultaneous acquisition available.

ADC_CLOSE

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

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.

The flags parameter control whether the buffer should be completely filled or whether automatic end-pointing should take place. For details of the end-pointing algorithm see endpoint(SFS1).

For stereo recording, double the number of samples requested.

FILES

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

SUPPORTED TYPES

sun16 Sun SPARC DBRI mic input.

sun16-line Sun SPARC DBRI line input.

sb16 SoundBlaster-16 on DOS machine.

pclx Laryngograph PCLX card on DOS machine.

win32 Windows multi-media support

VERSION/AUTHOR

2.1 Mark Huckvale

BUGS


Fri Jul 09 14:54:19 2004