AChooseAFileAttributes(3X)
NAME
AChooseAFileAttributes − select attributes to use when creating a new file
SYNOPSIS
#include <Alib.h> void
AChooseAFileAttributes (
Audio ∗ audio,
AudioAttributes ∗ src_attributes,
AFileFormat file_format,
AudioAttrMask user_mask,
AudioAttributes ∗ attributes,
AByteOrder ∗ byte_order,
long ∗ status_return );
DESCRIPTION
AChooseAFileAttributes() selects attributes to use when creating a new file.
The calling program may only care about some attributes (for example, sampling rate). It would then fill in those attributes and let AChooseAFileAttributes() select the remaining attributes.
audio specifies the Audio structure associated with this connection.
src_attributes specifies the audio attributes of the source stream.
file_format specifes the target file format. One of the following values:
AFFUnknown − see Note.
AFFRiffWave − Microsoft RIFF waveform
AFFSun − Sun(NeXT) 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. AChooseAFileAttributes() will write appropriate values to those attributes not supplied by the user.
byte_order receives byte ordering for the audio 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.
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.
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.
13 AEBadAttribute The specified audio attributes structure contains an unsupported or inconsistent value.
EXAMPLE
The following example chooses attributes for use when creating a new Sun/NeXT file.
Audio ∗ audio; /∗ audio connection ∗/
AudioAttributes ∗ src_attribs; /∗ source stream attributes ∗/
AFileFormat dest_file_format; /∗ file format ∗/
AudioAttrMask dest_mask; /∗ attributes set by user ∗/
AudioAttributes dest_attribs; /∗ returned attributes ∗/
AByteOrder dest_byte_order; /∗ returned byte order ∗/
long status; /∗ status ∗/
dest_file_format = AFFSun;
.
.
.
/∗ Get the attribute structure for the target file. ∗/
/∗ Specify MuLaw data format and 8k samples/second ∗/
dest_attribs.type = ATSampled;
dest_attribs.attr.sampled_attr.data_format = ADFMuLaw;
dest_attribs.attr.sampled_attr.sampling_rate = 8000;
dest_mask = ASDataFormatMask | ASSampling Rate Mask;
AChooseAFileAttributes(audio, src_attribs, dest_file_format,
dest_mask, &dest_attribs, &dest_byte_order, &status);
NOTES
If you specify a file format, this call will check to make sure that the selected attributes are restricted to types that apply to that format. If you specify AFFUnknown, the attributes will not be restricted except that they must make sense with each other. For example, if 8 bits/sample is specified then linear16 will not be selected as the data format.
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
AChooseAFileAttributes() was developed by HP.
SEE ALSO
AGetAFileAttributes(3X), ABestAudioAttributes(3X).
Hewlett-Packard Company — Audio Library: February, 1995