afInitSampleFormat(3dm) afInitSampleFormat(3dm)
afInitSampleFormat, AFinitsampfmt, afInitByteOrder, afInitChannels,
afInitRate - initialize the audio data format in an AFfilesetup for a
specified audio track
#include <dmedia/audiofile.h>
void afInitSampleFormat(AFfilesetup setup, int track,
int sampfmt, int sampwidth)
void afInitByteOrder(AFfilesetup setup, int track, int byteorder)
void afInitChannels(AFfilesetup setup, int track, int channels)
void afInitRate(AFfilesetup setup, int track, double rate)
setup is an AFfilesetup structure, previously created by a call to
afNewFileSetup(3dm).
track is an integer which identifies an audio track in setup.
Since all currently supported file formats contain only one
audio track, the value AF_DEFAULT_TRACK should always be used
here.
sampfmt an integer constant which denotes a sample format.
sampwidth a positive integer value which specifies the number of bits
in a sample data point.
channels is a positive integer value which indicates the number of
interleaved audio channels in the audio track.
byteorder is a positive integer token which indicates the byte order of
the samples in the audio track.
rate is a positive double-precision floating point value which
specifies an audio sample rate in Hz to be associated with
track.
afInitSampleFormat() initializes the sample format and width parameters
in an AFfilesetup structure for an audio track.
The following values may be used for sampfmt
AF_SAMPFMT_TWOSCOMP [Toc] [Back]
Two's complement samples. This is currently the only legal value
for AIFF(4)/AIFF-C and 9-32 bit WAVE(4) format files, and is a legal
value for all other supported file formats as well.
Page 1
afInitSampleFormat(3dm) afInitSampleFormat(3dm)
AF_SAMPFMT_UNSIGNED [Toc] [Back]
Unsigned samples. This is the standard value for 1-8 bit WAVE(4)
format files.
AF_SAMPFMT_FLOAT [Toc] [Back]
32-bit floating point samples. This may be used with NeXT(4) and
BICSF(4) format files, as may AF_SAMPFMT_TWOSCOMP.
AF_SAMPFMT_DOUBLE [Toc] [Back]
64-bit double-precision floating point samples. Currently, this may
only be used with the NeXT(4) format files.
afInitByteOrder() initializes the byte order (big- or little-endian) of
the samples in an AFfilesetup structure for an audio track.
The following values may be used for byteorder
AF_BYTEORDER_BIGENDIAN [Toc] [Back]
Big-endian byte order samples. This is the only legal value for
AIFF/AIFF-C, NeXT(4), BICSF(4) and Sound Designer II (sd2(4)) files,
and is the default value.
AF_BYTEORDER_LITTLEENDIAN [Toc] [Back]
Little-endian byte order samples. This is the standard value for
WAVE(4) format files.
afInitChannels() initializes the number of interleaved channels
in an AFfilesetup structure for an audio track. Legal values vary
depending on the file format (see afInitFileFormat(3dm)).
afInitRate() initializes the sample rate in Hz in an AFfilesetup
structure for an audio track. Most file formats have no restrictions on
sample rate values, the exception being the NeXT(4) format, which
requires integer values only.
When a file is opened for writing by passing setup to afOpenFile(3dm),
the track will be configured to store data according to the data format,
width, number of channels, or sample rate specified.
The Audio File Library will continue to support additional file formats.
The ability of these file formats to store data of various sample formats
will vary. If you are choosing a file format other than the default
format, you should make sure that you explicitly specify a sample format
for this file's tracks which is compatible with that file format. See
afGetSampleFormat(3dm) for important information about handling this
situation.
In the case where the audio track in a file is configured for
compression, sampfmt and sampwidth should match the data format specified
by the compression algorithm. For example, the software G.722 compressor
expects to encode 16-bit two's complement linear PCM input data. In
Page 2
afInitSampleFormat(3dm) afInitSampleFormat(3dm)
addition, many compression formats have restrictions on sample rate
and/or channel count as well. See afInitCompression(3dm) for more
information.
afNewFileSetup(3dm), afOpenFile(3dm), afWriteFrames(3dm),
afSetVirtualSampleFormat(3dm), afGetVirtualSampleFormat(3dm),
afInitCompression(3dm)
PPPPaaaaggggeeee 3333 [ Back ]
|