afInitFormatParams(3dm) afInitFormatParams(3dm)
NAME
afInitFormatParams - initialize the audio data format in an AFfilesetup
for a specified audio track via dmParams
SYNOPSIS
#include <dmedia/dmaudio.h>
#include <dmedia/audiofile.h>
DMstatus afInitFormatParams(AFfilesetup setup, int track,
DMparams *params)
PARAMETER
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 AFDEFAULTTRACK should be used here for
now.
params a DMparams list, previously created by a call to
dmParamsCreate(3dm).
RETURN VALUE
afInitFormatParams() returns DM_SUCCESS on success, otherwise it returns
DM_FAILURE.
DESCRIPTION
afInitFormatParams() initializes all parameters associated with the audio
data in an AFfilesetup structure for an audio track. It obsoletes the
individual routines afInitSampleFormat(3dm), afInitChannels(3dm),
afInitRate(3dm) and afInitCompression(3dm), and
afInitCompressionParams(3dm).
The following parameters are defined in dmedia/dm_audio.h and may be set
via params:
DMAUDIOFORMAT Sample format. Must be DMAUDIOTWOSCOMPLEMENT,
DMAUDIOUNSIGNED, DMAUDIOFLOAT, or
DMAUDIODOUBLE.
DMAUDIOWIDTH Sample width in bits. For integer sample formats,
it must be an integer value between 1 and 32,
inclusive. For formats DMAUDIOFLOAT and
DMAUDIODOUBLE, this parameter is ignored.
DMAUDIOCHANNELS Channel count. Integer value greater than or equal
to 1.
Page 1
afInitFormatParams(3dm) afInitFormatParams(3dm)
DMAUDIORATE Sampling rate. Must be a positive, double
precision floating point value.
DMAUDIOCOMPRESSION Compression type. Will be DMAUDIOUNCOMPRESSED or
one of the supported compression parameter values.
In addition, any parameters associated with the
compression, such as DMAUDIOBITRATE, should be
set here (see afInitCompression(3dm) and
afInitCompressionParams(3dm)).
DMAUDIOPCMMAPSLOPE
DMAUDIOPCMMAPINTERCEPT
DMAUDIOPCMMAPMAXCLIP
DMAUDIOPCMMAPMINCLIP
Slope, intercept, minimum and maximum clipping
values for PCM mapping (see
afGetVirtualPCMMapping(3dm) for a detailed
explanation).
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.
CAVEATS
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 either explicitly specify format
params for this file's tracks which are compatible with that file format,
or do not set them at all (in which case they will be set to default
values for the format).
In the case where the audio track in a file is configured for
compression, the parameter values for DMAUDIOFORMAT and DMAUDIOWIDTH
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 addition, many compression formats
have restrictions on sample rate and/or channel count as well.
SEE ALSO
afNewFileSetup(3dm), afOpenFile(3dm), afWriteFrames(3dm),
afSetVirtualSampleFormat(3dm), afGetVirtualSampleFormat(3dm),
afInitCompression(3dm)
Page 2