AUpdateDataLength(3X)
NAME
AUpdateDataLength − update a file’s header
SYNOPSIS
#include <Alib.h> void
AUpdateDataLength (
Audio ∗ audio,
char ∗ pathname,
AFileFormat file_format,
long ∗ status_return );
DESCRIPTION
AUpdateDataLength() opens the file specified by pathname (if the specified file_format requires data length or file length information in its header), determines the relevant lengths, writes them to the appropriate fields and closes the file. If the specified file format does not require a header with a data or file length field, AUpdateDataLength() returns without doing anything.
audio specifies the Audio structure associated with this connection.
pathname the pathname of the audio file.
file_format the format of the audio file at pathname. One of the following values:
AFFUnknown − Let the Audio library determine the file type.
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)
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.
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.
1 AESystemCall Cannot open the pathname file for read or write.
6 AEBadFileFormat The specified file format is currently unsupported.
8 AEFileNotFound The Audio Library could not find the specified file.
11 AEBadFileHdr The specified file type requires a header, but the file lacks a valid header for that file type.
16 AECantDetermineFormat AFFUnknown was specified for either the source or destination file format, but there is no valid header or filename extension.
17 AEOutOfMemory Alib attempted to malloc space but failed.
EXAMPLE
The following example updates header of the Sun/NeXT file at /myhome/a_dir/a_file.
AFileFormat file_fmt; /* file format */
Audio *audio; /* audio connection */
long status; /* status */
char fname[] = "/myhome/a_dir/a_file";
.
.
.
/* update file header of /myhome/a_dir/a_file with relevant lengths */
file_fmt = AFFSun;
AUpdateDataLength(audio, fname, file_fmt, &status);
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
AUpdateDataLength() was developed by HP.
SEE ALSO
Hewlett-Packard Company — Audio Library: February, 1995