afInitFormatParams - initialize the audio data format in an AFfilesetup
for a specified audio track via dmParams
DMstatus afInitFormatParams(AFfilesetup setup, int track,
setup is an AFfilesetup structure, previously created by a call to
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 be used here for
params a DMparams list, previously created by a call to
afInitFormatParams() returns DM_SUCCESS on success, otherwise it returns
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
The following parameters are defined in dmedia/dm_audio.h and may be set
DM_AUDIO_FORMAT Sample format. Must be DM_AUDIO_TWOS_COMPLEMENT,
DM_AUDIO_UNSIGNED, DM_AUDIO_FLOAT, or
DM_AUDIO_WIDTH Sample width in bits. For integer sample formats,
it must be an integer value between 1 and 32,
inclusive. For formats DM_AUDIO_FLOAT and
DM_AUDIO_DOUBLE, this parameter is ignored.
DM_AUDIO_CHANNELS Channel count. Integer value greater than or equal
DM_AUDIO_RATE Sampling rate. Must be a positive, double
precision floating point value.
DM_AUDIO_COMPRESSION Compression type. Will be DM_AUDIO_UNCOMPRESSED or
one of the supported compression parameter values.
In addition, any parameters associated with the
compression, such as DM_AUDIO_BITRATE, should be
set here (see afInitCompression(3dm) and
DM_AUDIO_PCM_MAP_SLOPE [Toc] [Back]
DM_AUDIO_PCM_MAP_INTERCEPT [Toc] [Back]
DM_AUDIO_PCM_MAP_MAXCLIP [Toc] [Back]
DM_AUDIO_PCM_MAP_MINCLIP [Toc] [Back]
Slope, intercept, minimum and maximum clipping
values for PCM mapping (see
afGetVirtualPCMMapping(3dm) for a detailed
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 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 DM_AUDIO_FORMAT and DM_AUDIO_WIDTH
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.
afNewFileSetup(3dm), afOpenFile(3dm), afWriteFrames(3dm),
PPPPaaaaggggeeee 2222 [ Back ]