afInitFormatParams(3dm) afInitFormatParams(3dm) NAME afInitFormatParams - initialize the audio data format in an AFfilesetup for a specified audio track via dmParams SYNOPSIS #include <dmedia/dm_audio.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 AF_DEFAULT_TRACK 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: DM_AUDIO_FORMAT Sample format. Must be DM_AUDIO_TWOS_COMPLEMENT, DM_AUDIO_UNSIGNED, DM_AUDIO_FLOAT, or DM_AUDIO_DOUBLE. 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 to 1. 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 afInitCompressionParams(3dm)). DM_AUDIO_PCM_MAP_SLOPE DM_AUDIO_PCM_MAP_INTERCEPT DM_AUDIO_PCM_MAP_MAXCLIP DM_AUDIO_PCM_MAP_MINCLIP 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 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. SEE ALSO afNewFileSetup(3dm), afOpenFile(3dm), afWriteFrames(3dm), afSetVirtualSampleFormat(3dm), afGetVirtualSampleFormat(3dm), afInitCompression(3dm) Page 2