AChooseSourceAttributes(3X)
NAME
AChooseSourceAttributes − select attributes to associate with an existing file or a stream
SYNOPSIS
#include <Alib.h>
#include <stdio.h> AFileFormat
AChooseSourceAttributes (
Audio ∗ audio,
char ∗ pathname,
FILE ∗ audiofile,
AFileFormat file_format,
AudioAttrMask user_mask,
AudioAttributes ∗ attributes,
long ∗ offset,
long ∗ data_length,
AByteOrder ∗ byte_order,
long ∗ status_return );
DESCRIPTION
audio specifies the Audio structure associated with this connection.
pathname specifies the pathname of the audio file. Ignored if audiofile is NULL.
audiofile specifies the file pointer if the source is a file. If the source is a stream, such as stdin, set audiofile to NULL.
file_format specifies the format of the file. One of the following values:
AFFUnknown − Have the Audio library determine the file type.
AFFRiffWave − Microsoft RIFF waveform
AFFSun − Sun(NeXT) format. This is the default format.
AFFRawMuLaw − MuLaw format
AFFRawALaw − ALaw format
AFFRawLin16 − Linear16 (16-bit signed) format
AFFRawLin8 − Linear8 (8-bit signed) format
AFFRawLin8Offset − Linear8Offset (8-bit unsigned)
user_mask specifies which of the audio attributes in the attributes structure have been supplied by the user (mask bit set to 1). These attributes will be checked for validity, but will not be changed.
The mask is the bitwise inclusive OR of one or more of the mask values listed in the Structures section.
attributes is an input/output parameter that contains user-supplied attributes (if any) as indicated by user_mask. AChooseSourceAttributes() will write appropriate values to those attributes not supplied by the user.
offset receives the location, in bytes, where the audio data begins.
data_length receives the length, in bytes, of the audio data.
byte_order receives the byte ordering of the data in the file. One of the following values:
ALSBFirst − Least significant byte first.
AMSBFirst − Most significant byte first.
status_return receives the returned status of the operation, unless this parameter is passed in as a NULL pointer. If status_return is set to NULL, Alib will do the error handling.
RETURN VALUE
Upon successful completion, AChooseSourceAttributes() returns the format of the file if the source is a file. If the source is a stream or the file format cannot be determined, AFFUnknown is returned.
STRUCTURES
The following are defined in /opt/audio/include/Alib.h.
typedef long AudioAttrMask;
#define ASDataFormatMask ( 1 << ASAFDataFormat )
#define ASBitsPerSampleMask ( 1 << ASAFBitsPerSample )
#define ASSamplingRateMask ( 1 << ASAFSamplingRate )
#define ASChannelsMask ( 1 << ASAFChannels )
#define ASInterleaveMask ( 1 << ASAFInterleave )
#define ASDurationMask ( 1 << ASAFDuration )
ERRORS
If status_return is not set to NULL, it can return one of the following values:
0 AENoError No error - the call completed successfully.
2 AEBadAudio The audio structure is invalid. A pointer to a valid audio structure may be missing (use AOpenAudio() to get a valid pointer).
6 AEBadFileFormat The specified file format is currently unsupported.
7 AEBadDataFormat The data format specified in the attributes structure is either not appropriate for the file format or is not one of the supported data formats.
11 AEBadFileHdr The specified file type requires a header, but the file lacks a valid header for that file type.
13 AEBadAttribute The specified audio attributes structure contains an unsupported or inconsistent value.
17 AEOutOfMemory Alib attempted to allocate space but failed.
NOTE
In order to ensure that the compiler finds the Audio Library (libAlib.sl) and the Alib.h header file, you must add the following switches:
-L /opt/audio/lib
-I/opt/audio/include
DEPENDENCIES
This function belongs to the Audio Library of functions that manage connections to an audio server. The audio server must run on a system that has audio hardware. To find out whether or not your system has audio hardware, refer to Using the Audio Developer’s Kit or the online help for the Audio control panel. For information about the audio capabilities of a particular system use the online example audioinfo.c.
AUTHOR
AChooseSourceAttributes() was developed by HP.
SEE ALSO
Hewlett-Packard Company — Audio Library: February, 1995