AFsetNH


Routine

void AFsetNH (const char String[])
struct AF_NHpar *AFgetNH (void)

Purpose

Set defaults for headerless audio files
Get defaults for headerless audio files

Description

This routine sets or gets default audio file data parameters. These parameters are used for files with unrecognized (non-standard) headers or files with no headers (raw audio files). The AFsetNH routine must be called before opening the file with AFopenRead. The parameters for AFsetNH are determined from an input string which consists of a list of parameters separated by commas. The form of the list is
  "Format, Start, Sfreq, Swapb, Nchan, ScaleF"
Format: File data format
The lowercase versions of these format specifiers cause a headerless file to be accepted only after checking for standard file headers; the uppercase versions cause a headerless file to be accepted without checking the file header.
 "undefined"                - Headerless files will be rejected
 "mu-law8" or "MU-LAW8"     - 8-bit mu-law data
 "A-law8" or "A-LAW8"       - 8-bit A-law data
 "unsigned8" or "UNSIGNED8" - offset-binary 8-bit integer data
 "integer8" or "INTEGER8"   - two's-complement 8-bit integer data
 "integer16" or "INTEGER16" - two's-complement 16-bit integer data
 "float32" or "FLOAT32"     - 32-bit floating-point data
 "text" or "TEXT"           - text data
Start: byte offset to the start of data (integer value)
Sfreq: sampling frequency in Hz (floating-point number)
Swapb: Data byte swap parameter
 "native" - no byte swapping
 "little-endian" - file data is in little-endian byte order and will
    be swapped if the current host uses big-endian byte order
 "big-endian" - data is in big-endian byte order and will be
    swapped swapped if the current host uses little-endian byte order
 "swap" - swap the data bytes
Nchan: number of channels
The data consists of interleaved samples from Nchan channels
ScaleF: Scale factor
Scale factor applied to the data from the file
The default values correspond to the following string
  "undefined, 0, 8000., native, 1, 1.0"

Leading and trailing white-space (as defined by isspace) is removed from each item. In the input string, any of the parameters may be omitted, in which case whatever value has been previously set remains in effect for that parameter. The string ",512, 10000." would set the Start and Sfreq parameters and leave the other parameters undisturbed.

If the input string contains has a leading '$', the string is assumed to specify the name of an environment variable after the '$'. This routine uses the value of this environment variable to determine the parameters. If this routine is called as AFsetNH("$RAWAUDIOFILE"), this routine would look for the parameter string in environment variable RAWAUDIOFILE.

The procedure AFgetNH is used internally by the audio file routines. It returns a pointer to a structure of type AF_NHpar.

Parameters

AFsetNH:
 -> const char String[]
String containing the list of parameters for headerless files or the name of an environment variable (with a leading $)
AFgetNH:
<- struct AF_NHpar *AFgetNH
Structure with file data parameters
  int      Accept - Headerless flag
  int      Format - Data format
  long int Start  - Offset in bytes to the start of data
  float    Sfreq  - Sampling frequency
  int      Swapb  - Byte swap flag
  long int Nchan  - Number of channels
  float    ScaleF - Scale factor

Author / revision

P. Kabal / Revision 1.31 1996/08/14

See Also

AFopenRead


Main Index libtsp