Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ AWriteAFile(3X) — HP-UX ANSI C A.10.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

AUpdateDataLength(3X)

AWriteAFileHeader(3X)

NAME

AWriteAFileHeader − write a header for an audio file

SYNOPSIS

#include <Alib.h> long
AWriteAFileHeader (

Audio ∗  audio,

char ∗  pathname,

AFileFormat file_format,

AudioAttributes ∗  audio_attributes,

long ∗  status_return );

DESCRIPTION

AWriteAFileHeader() opens the specified file (truncating it to zero if it exists, or creating it if it does not exist), and writes a file header suitable for the specified file format and attributes. 

audio specifies the Audio structure associated with this connection. 

pathname the pathname of the audio data file for which a header will be written. 

file_format specifies format of the file for which the header will be written. Must be a valid format (not AFFUnknown).  Use one of the following values:

AFFRiffWave − Microsoft RIFF waveform

AFFSun − Sun(NeXT) format

These are the only file type values that make sense for this routine since other file types do not have header information. 

audio_attributes specifies attributes of the audio file for which the header will be written.  Must be a complete audio attributes structure. The header’s data length will be written as zero if the duration field of audio_attributes is set to ATTFullLength. 

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, AWriteAFileHeader() returns the length of the file header. 

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 Could not open the file for writing. 

6   AEBadFileFormat The specified file format is currently unsupported. 

7   AEBadDataFormat The data format specified in the audio_attributes structure is either not appropriate for the file format or is not one of the supported data formats. 

17  AEOutOFMemory Alib attempted to malloc space but failed.  A possible cause is the use of sound buckets with large audio files. 

EXAMPLE

The following example writes a file header to the file /myhome/a_dir/a_file.au. 

 AFileFormat     file_fmt;   /* file format */
 Audio          *audio;      /* audio connection */
 long            header_len; /* length of header */
 AudioAttributes attribs;    /* previously defined attributes */
 long status;                /* status */
 char  fname[] = "/myhome/a_dir/a_file.au";
 .
 .
 .
/* write a Sun/NeXT file header to /myhome/a_dir/a_file */
  file_fmt   = AFFSun;
 header_len = AWriteAFileHeader(audio, fname, file_fmt,
                               &attribs, &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

AWriteAFileHeader() was developed by HP. 

SEE ALSO

AUpdateDataLength(3X). 

Hewlett-Packard Company  —  Audio Library: February, 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026