ALoadAFile(3X) — Series 700 Only
NAME
ALoadAFile − copy audio file into new sound bucket with data conversion
SYNOPSIS
#include <audio/Alib.h>
SBucket * ALoadAFile(
Audio *audio,
char *pathname,
AFileFormat file_format,
AudioAttrMask attr_mask,
AudioAttributes *sb_attributes,
long *status_return
);
DESCRIPTION
ALoadAFile() copies the audio data in pathname into a new sound bucket and returns the pointer to the sound bucket. The data is converted according to the specified attributes. The HP-UX kernel configuration sets a data size restriction. If the audio data file exceeds this size, the function returns a OutOfMemory error.
When the sound bucket is no longer needed, call ADestroySBucket() to deallocate the space.
audio is the audio structure associated with this connection.
pathname specifies the file containing the audio data.
file_format must be set to a valid enumerated value, or else an error is returned.
If this parameter is set to AFFUnknown, the conversion utility checks for an extension on pathname. Extensions can be appended to the filename as follows:
name.sampling_rate.file_type.
Valid sampling rate extensions are .n and .nk where .nk is typically 8k to 22k.
Valid file type extensions are:
.u Mulaw
.al Alaw
.au Sun (NeXT)
.wav Riff
.snd NeXT
.l16 Linear16
.l8 Linear8
.lo8 Linear8Offset
If no recognizable extension exists, the utility checks the header on the pathname file. If file format is not valid or is not determinable, an error is returned.
If you have a "Mac" file, try treating it as a raw data file in Linear8Offset with a sampling rate of 22k or another sampling rate.
attr_mask specifies the audio attributes to associate with the new sound bucket. The mask is a bitwise inclusive OR of values defined in AudioAttrMask.
If this value is set to 0 or if sb_attributes is set to NULL, the pathname attributes are used if the controller supports them. If there is an unsupported attribute, the attribute returned by ABestAudioAttributes() is used.
If the mask is set, the new attributes are used without checking for controller support. This allows ALoadAFile() to be used purely for conversion purposes.
NOTE: If ASDurationMask is set, the pathname audio data is truncated or padded with zeros to match the length specified in audio_attributes.sampled_attr.duration.
sb_attributes specifies the attributes that are affected by the mask. Audio type must be set, separate from the mask. If the attribute is different from the one used by pathname, the data is converted.
status_return receives the returned status of the operation unless it is set to NULL.
RETURN VALUE
Upon successful completion, ALoadAFile() returns a pointer to the new sound bucket.
ERRORS
If status_return is not set to NULL, one of the following is returned in status_return:
0 AENoError
2 AEBadAudio
6 AEBadFileFormat
7 AEBadDataFormat
8 AEFileNotFound
11 AEBadFileHdr
16 AECantDetermineFormat
17 AEOutOfMemory
EXAMPLES
The following example copies the file /myhome/a_dir/a_file into the new sound bucket and specifies AFFRawALaw for the file format. Specifying zero for a_mask and NULL for myAttr means that the pathname attributes will be used if the controller supports them; if there is an unsupported attribute, the attribute returned by ABestAudioAttributes() will be used:
SBucket *sb; /* sound bucket*/ Audio *audio; /* audio connection */ char a_name[30]; /* file name */ AFileFormat file_fmt; /* file format */ AudioAttrMask a_mask; /* audio attributes mask*/ AudioAttributes *myAttr; /* audio attributes */ long status; /* error status */ . . . /* load file into new sound bucket */ a_name = "/myhome/a_dir/a_file"; file_fmt = AFFRawALaw; a_mask = 0; myAttr = ""; sb = ALoadAFile(audio, a_name, file_fmt, a_mask, myAttr, &status);
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 the hardware manual that accompanies your system.
AUTHOR
ALoadAFile() was developed by HP.
SEE ALSO
ACreateSBucket(3X), ADestroySBucket(3X), AGetSBucketData(3X), APlaySBucket(3X), APutSBucketData(3X), ARecordAData(3X), ASaveSBucket(3X).
Using the Audio Application Program Interface.
Hewlett-Packard Company — HP-UX Release 9.10: April 1995