Chapter 3. Audio Data Conversion

The Digital Media Audio Conversion Library provides data format conversion for applications that do real-time audio capture, playback, and file conversion. This library lets you move data efficiently between any audio producer and any audio consumer, regardless of their native formats.

This chapter describes the Digital Media Audio Conversion Library, its converters, and its use, in these sections:

Digital Media Audio Conversion Library

The Digital Media Audio Conversion library provides a single API for performing memory-to-memory sound compression and format conversion. This library serves as a “wrapper” around the standalone Digital Media Audio Codecs and Digital Media Audio Rate Conversion Library, allowing conversion of audio data without the need to keep track of buffer sizes and other such issues.

In addition to the compression and decompression done by the codec, an audio converter may perform the following transformations:

  • audio sampling rate conversion

  • conversion between different numerical sample representations, such as unsigned integer and two's complement signed integer

  • conversion between big-endian and little-endian byte orders

  • conversion between different numbers of interleaved channels, such as mono and stereo

  • pulse code modulation (PCM) mapping

  • scaling or offsetting samples by arbitrary amounts

Compression, decompression, and audio sampling rate conversion can be accomplished using either the Digital Media Audio Conversion Library or standalone conversion-specific routines (see “DV Audio Compression Library”). All other conversions listed above can be accomplished only with the Digital Media Audio Conversion Library.

The commonly used codec accessed through the Audio Conversion API is DM_AUDIO_DV, which is DV and DVCPRO audio compression and decompression. See “DV Audio Compression Library” for more information about the DV standalone routines.DM_AUDIO_DV is the identification value used with dmACSetParams() as described in “Configuring a Converter Instance”

Table 3-1 lists the functions of the Digital Media Audio Conversion Library API. These functions are described more fully in the sections mentioned in the Description column. More details about the specific functions, such as the errors they return, can be found by looking at the man pages also mentioned in the Description column.

Table 3-1. Digital Media Audio Conversion API

Function

Parameters

Description

DMstatus dmACConvert 

(DMaudioconverter converter,
void *inbuffer,
void *outbuffer,
int *in_amount,
int *out_amount)

Convert the audio data format, sampling rate, and compression. See “Converting Data Using a Converter Instance”

 and the dmACConvert(3dm) man page for more details.

DMstatus dmACCreate 

(DMaudioconverter *converter)

Create a DMaudioconverter handle to use for audio format conversion. See “Creating a Converter Instance”

 and the dmACCreate(3dm) man page for more details.

DMstatus dmACDestroy 

(DMaudioconverter converter)

Destroy a DMaudioconverter handle used for audio format conversion. See “Destroying a Converter Instance”

 and the dmACDestroy(3dm) man page for more details.

DMstatus dmACReset 

(DMaudioconverter converter)

Reset a DMaudioconverter handle to its default state. See “Configuring a Converter Instance”

 and the dmACReset(3dm) man page for more details.

DMstatus dmACSetParams 

(DMaudioconverter converter,
DMparams *sourceparams,
DMparams *destparams,
DMparams *conversionparams)

Set the DMaudioconverter parameter values. See “Configuring a Converter Instance”

  and the dmACSetParams(3dm) man page for more details.

DMstatus dmACGetParams 

(DMaudioconverter converter,
DMparams *sourceparams,
DMparams *destparams,
DMparams *conversionparams)

Get the DMaudioconverter parameter values. See “Configuring a Converter Instance”

  and the dmACGetParams(3dm) man page for more details.


Using the Audio Conversion API

When an application uses the Digital Media Audio Conversion API to perform conversions, it creates a converter instance (also referred to simply as a converter). A converter instance includes an input buffer, an output buffer, and state information in the form of parameters that describe the input data, output data, and conversion process.

A converter instance can be viewed as a pipeline. At the input end of the pipeline is data in the unconverted format. At the output end is data in the requested format. The pipeline processing is done by the codec and/or converter. When multiple transformations are required, the converter makes sure that they are done in an order that best maintains the quality of the data.

The next four sections describe the steps an application follows when performing an audio conversion:

To use the digital media conversion libraries to create a converter instance, you must link your application with libdmedia.so. To use the Audio Conversion API, include these header files:

#include <dmedia/dm_audioconvert.h>
#include <dmedia/dm_audioutil.h>

Creating a Converter Instance

To create an audio converter instance, use dmACCreate():

DMstatus dmACCreate (DMaudioconverter* converter)

This function creates and initializes converter, a handle to a DMaudioconverter instance. All of the Audio Conversion Library functions use this handle, which is declared as follows:

typedef struct _DMaudioconverter *DMaudioconverter;


Note: All of the Audio Conversion Library functions return a DMstatus value of DM_SUCCESS if they succeed, DM_FAILURE if not. After a receiving a DM_FAILURE, your application can call the function dmGetErrorForPID() or dmGetError() to retrieve an error message and error number. See the DMPG for more information on error handling.


Configuring a Converter Instance

Once a converter instance has been created, it must be configured. An application does this by using DMparams data structures to specify a set of source parameters, a set of destination parameters, and, optionally, a set of conversion parameters. See the DMPG for more information on DMparams.

The Audio Conversion Library lets you:

  • Configure an audio converter by setting the source, destination, and conversion parameters with dmACSetParams():

    DMstatus dmACSetParams (DMaudioconverter converter,
                            DMparams *sourceparams, 
                            DMparams *destparams,
                            DMparams *conversionparams)
    

    • converter is a DMaudioconverter handle created by a previous call to dmACCreate().

    • sourceparams and destparams point to DMparams structures that describe the formats of the audio data prior to and after conversion.

    • conversionparams points to a DMparams structure that contains parameters specific to the conversion process.

      destparams and conversionparams are optional and may be set to NULL. The output format defaults to the input values, with the exception of compression (defaults to uncompressed) and byte order (defaults to big-endian).

  • Retrieve the source, destination, and conversion parameter settings of a configured audio converter with dmACGetParams():

    DMstatus dmACGetParams (DMaudioconverter converter,
                            DMparams *sourceparams, 
                            DMparams *destparams,
                            DMparams *conversionparams)
    

    • converter is a DMaudioconverter handle created by a previous call to dmACCreate().

    • sourceparams and destparams point to DMparams structures that describe the formats of the audio data prior to and after conversion.

    • conversionparams points to a DMparams structure that contains parameters specific to the conversion process.

      Any parameter list pointer may be set to NULL if the application does not need to retrieve that parameter set.

  • Reset an audio converter's internal state with dmACReset():

    DMstatus dmACReset (DMaudioconverter converter)
    

    converter is a DMaudioconverter handle created by a previous call to dmACCreate().

    dmACReset() clears out any internal buffers and/or state associated with compression, decompression, and/or rate conversion, and resets all counters, essentially returning the converter to the state it was in immediately following a call to dmACSetParams(). This might be desirable in a case where an existing stream of data is interrupted and replaced with a new stream, and you want to be certain that all of the previously processed data was cleared.

The rest of this section consists of the following:

Source and Destination Parameters

The source parameters describe the data to be converted and are contained in the DMparams structure indicated by sourceparams. The destination parameters describe the output audio data and are contained in the DMparams structure indicated by destparams. Any excess or unrecognized parameters in sourceparams or destparams are ignored.

Table 3-2 lists the source and destination parameters, their data types, legal values, and any pertinent information about their use. There are no default values for source parameters—they must be specified.

Table 3-2. Source and Destination Parameters

Parameter
(Data Type)

Legal Values

Other Info

DM_AUDIO_BYTE_ORDER
(DM_TYPE_ENUM)

DM_AUDIO_BIG_ENDIAN

DM_AUDIO_LITTLE_ENDIAN

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to DM_AUDIO_BIG_ENDIAN

DM_AUDIO_CHANNELS
(DM_TYPE_INT)

The number of audio channels. An integer value greater than 0.

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to source value.

DM_AUDIO_COMPRESSION
(DM_TYPE_STRING)

DM_AUDIO_UNCOMPRESSED or DM_AUDIO_DV.

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to DM_AUDIO_UNCOMPRESSED.

DM_AUDIO_FORMAT
(DM_TYPE_ENUM)

DM_AUDIO_TWOS_COMPLEMENT

DM_AUDIO_UNSIGNED

DM_AUDIO_FLOAT

DM_AUDIO_DOUBLE

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to source value.

DM_AUDIO_RATE
(DM_TYPE_FLOAT)

The audio sampling rate in Hz. A float value greater than 0.0.

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to source value.

DM_AUDIO_WIDTH
(DM_TYPE_INT)

The width of the data in bits. An integer value between 1 and 32, inclusive.

As source parameter:
No default value. Must be specified.

As destination parameter:
Defaults to source value.


PCM Mapping Parameters

Table 3-3 lists the four parameters for PCM mapping whose values, although they can be set for source data, are normally specified only for destination data. These parameters are useful when you need to convert integer data to floating point or vice versa. The parameters specify the numeric mapping of one format to another, using one PCM value that corresponds to zero voltage and a differential value that corresponds to full voltage. See the afIntro(3dm) man page for a more detailed discussion of the PCM mapping model.

The function dmACSetParams() automatically calculates default input and output PCM parameters from the input and output data format specifications. (For instance, the default values for 16 bit, two's complement data are 0.0 for intercept, 32767.0 for maxclip, -32768.0 for minclip, and 32767.0 for slope.)

Your application needs to set these parameters only if it has special mapping requirements, such as input data with a fixed offset like a DC bias. If your application sets any of these parameters, it must set all of them.

Table 3-3. Parameters for PCM Mapping

Parameter
(Date Type)

Description

Other Info

DM_AUDIO_PCM_MAP_INTERCEPT
(DM_TYPE_FLOAT)

The zero voltage PCM value.

As source parameter:
Rarely used.

As destination parameter:
Default is calculated from the output data format specifications.

DM_AUDIO_PCM_MAP_MAXCLIP
(DM_TYPE_FLOAT)

Clip all PCM values to this maximum value.

As source parameter:
Rarely used.

As destination parameter:
Default is calculated from the output data format specifications.

DM_AUDIO_PCM_MAP_MINCLIP
(DM_TYPE_FLOAT)

Clip all PCM values to this minimum value.

As source parameter:
Rarely used.

As destination parameter:
Default is calculated from the output data format specifications.

DM_AUDIO_PCM_MAP_SLOPE
(DM_TYPE_FLOAT)

The full voltage PCM value.

As source parameter:
Rarely used.

As destination parameter:
Default is calculated from the output data format specifications.


Compression Parameters

Compression parameters that modify DM_AUDIO_DV and their values are outlined in the following sections:

When working with codecs, keep these points in mind:

  • All format parameters interact with the codec parameters. For instance, some codecs work only at certain rates or channel counts. Refer to the relevant man pages for each codec for more information about using specific parameters.

  • No cross-compression is supported; that is, input and output cannot both be compressed. Applications must create two converter instances and handle the intermediate uncompressed buffer themselves.

  • The particular codec being used cannot be changed during the lifetime of the converter instance. If this needs to be done, destroy and recreate the converter.

  • All other parameters may be changed without recreating the converter. The Digital Media Audio Conversion Library is designed to allow real-time tracking of changes in audio input and output format, such as sampling rate and number of interleaved channels.

Compression Parameters Common to All Codecs

The parameters listed in Table 3-4 apply to all codecs and can be queried using the dmACGetParams().

Ordinarily, when your application is using the Digital Media Audio Conversion library to control the standalone codec routines, these parameters are solely informational—your application uses the buffer length parameters instead (see “Buffer Length Parameters ”). For DV and MPEG1 codecs operating in decode mode, however, these parameters must be set (see “DV Audio Parameters”). Table 3-4 gives query parameters for all codecs.

Table 3-4. Query Parameters for All Codecs

Parameter
(Data Type)

Description

DM_AUDIO_CODEC_FILTER_DELAY

(DM_TYPE_INT)

Indicates delay, in sample frames, introduced by compression and decompression processing. This is usually different for compression and decompression.

DM_AUDIO_CODEC_FRAMES_PER_BLOCK

(DM_TYPE_INT)

Specifies how many sample frames are contained in each compressed data block.

DM_AUDIO_CODEC_MAX_BYTES_PER_BLOCK

(DM_TYPE_INT)

Indicates the maximum number of bytes that will make up a compressed data block.


DV Audio Parameters

The DV Audio codec implements DV and DVCPRO audio compression and decompression.

Table 3-5 lists the codec-specific parameters used with the DV Audio codec. See the dmDVAudioEncode(3dm) man page and dmedia/dm_audioutil.h for more information on using these and other source and destination parameters with this codec.

Table 3-5. DV Audio Parameters

Parameter (Data Type)

Legal Values, Default Values

Encoding, Decoding, or Query

DM_AUDIO_MEDIUM

(DM_TYPE_ENUM)

DM_AUDIO

Encoding and decoding

DM_DVAUDIO_FORMAT

(DM_TYPE_INT)

DM_DVAUDIO_NTSC

DM_DVAUDIO_PAL

Encoding only

DM_DVAUDIO_LOCK_MODE

(DM__TYPE_INT)

Non-zero if audio is locked according to the DV audio specification, zero if it is not locked (default = locked)

Encoding only

DM_DVAUDIO_TYPE

(DM_TYPE_INT)

DM_DVAUDIO_DV

DM_DVAUDIO_DVCPRO

(default = DM_DVAUDIO_DV)

Encoding only

DM_DVAUDIO_CHANNEL_MODE

(DM_TYPE_INT)

DM_DVAUDIO_SD_2CH

DM_DVAUDIO_SD_4CH
(Not currently supported for encoding)

Query only

DM_DVAUDIO_CHANNEL_POLICY

(DM_TYPE_INT)

See dmedia/dm_audioutil.h for more information about this parameter.

With DM_DVAUDIO_SD_2CH mode: 

DM_DVAUDIO_SD_2CH_STEREO

DM_DVAUDIO_SD_2CH_2CH_MONO *

DM_DVAUDIO_SD_2CH_MONO

With DM_DVAUDIO_SD_4CH mode: 

DM_DVAUDIO_SD_4CH_STEREO_STEREO *

DM_DVAUDIO_SD_4CH_STEREO_2CH_MONO *

DM_DVAUDIO_SD_4CH_STEREO_1CH_MONO *

DM_DVAUDIO_SD_4CH_STEREO **

DM_DVAUDIO_SD_4CH_2CH_MONO_STEREO *

DM_DVAUDIO_SD_4CH_4CH_MONO *

DM_DVAUDIO_SD_4CH_3CH_MONO_1 *

DM_DVAUDIO_SD_4CH_2CH_MONO_1 *

DM_DVAUDIO_SD_4CH_1CH_MONO_STEREO *

DM_DVAUDIO_SD_4CH_3CH_MONO_2 *

DM_DVAUDIO_SD_4CH_2CH_MONO_2 *

DM_DVAUDIO_SD_4CH_1CH_MONO *

DM_DVAUDIO_SD_4CH_3_1_STEREO *

DM_DVAUDIO_SD_4CH_3_0_STEREO_1CH_MONO *

DM_DVAUDIO_SD_4CH_3_0_STEREO *

DM_DVAUDIO_SD_4CH_2_2_STEREO *

* Not currently supported for encoding.

Query only



Note: If you use the Digital Media Audio Conversion Library to control standalone DV Audio decoder functions, your application must call dmDVAudioHeaderGetParams() to get the parameter values to pass to dmDVAudioDecoderSetParams(). See the dm_dv(3dm) and dmDVAudioHeaderGetParams(3dm) man pages for more details (and sample code) on this process.


Conversion Parameters

The conversion parameters, which modify the codec settings and other aspects of the conversion process, are contained in the DMparams structure indicated by conversionparams.

The five categories of conversion parameters are discussed in these subsections:

Processing Mode Parameter

The DM_AUDIO_PROCESS_MODE (DM_TYPE_INT) parameter determines the converter's processing mode. It can also be used to set the processing mode when both the input and output data are uncompressed. Its legal values are DM_AUDIO_PROCESS_PULL and DM_AUDIO_PROCESS_PUSH:

  • In pull mode, the application requests a fixed number of frames from the converter, and the converter determines how much input data to consume in order to satisfy this request. Decompression requires pull mode, and the application must use the dmACConvert() argument out_amount (see “Converting Data Using a Converter Instance”) to specify how many frames of uncompressed data the converter instance should put in the output buffer of dmACConvert().

  • In push mode, the application gives the converter a fixed number of frames, and the converter produces a (possibly variable) amount of output, depending on the conversion being done. Compression requires push mode, and the application must use the dmACConvert() argument in_amount (see “Converting Data Using a Converter Instance”) to specify how many frames of data need to be compressed.

Buffer Length Parameters

The three buffer length parameters are used to determine appropriate sizes for the input or output buffers. Your application must specify them only during compression, decompression, or rate conversion because the input and output buffer lengths are equal at all other times.

When performing compression, decompression, or rate conversion, your application must follow these steps:

  1. Set DM_AUDIO_MAX_REQUEST_LEN equal to the maximum amount of data the application will push to or pull from the converter, using dmParamsSetInt(). (For information on DMparams, see the Digital Media Programming Guide.)

  2. Call dmACSetParams() with the DMParams list from the call to dmParamsSetInt().

  3. Call dmACGetParams() to obtain the correct values for DM_AUDIO_MIN_INPUT_LEN and DM_AUDIO_MIN_OUTPUT_LEN.

If the converter is operating in pull mode, DM_AUDIO_MIN_INPUT_LEN specifies the minimum number of frames or bytes the converter requires in the input buffer. If the converter is operating in push mode, DM_AUDIO_MIN_OUTPUT_LEN specifies the minimum number of frames or bytes the converter requires in the output buffer. Your application can use buffers equal to or longer than the specified values. See “Processing Mode Parameter” for more information on push and pull modes.

Table 3-6 lists the buffer length parameters and their data types and legal values.

Table 3-6. Buffer Length Parameters

Parameter
(Data Type)

Legal Values

DM_AUDIO_MAX_REQUEST_LEN
(DM_TYPE_INT)

Integer value greater than 0

DM_AUDIO_MIN_INPUT_LEN
(DM_TYPE_INT)

Integer value

DM_AUDIO_MIN_OUTPUT_LEN
(DM_TYPE_INT)

Integer value


Dithering Parameter

The DM_AUDIO_DITHER_ALGORITHM parameter (DM_TYPE_INT) is used only when data is converted from a larger to a smaller data type, such as when converting from floating point to 16-bit integer samples. The dithering algorithm is applied to reduce the quantization error distortion inherent in reducing resolution.

The possible values for this parameter are DM_AUDIO_DITHER_NONE (default) and DM_AUDIO_DITHER_LSB_TPDF. The latter specifies the Least Significant Bit—Triangular Probability Density Function described by John Watkinson in The Art of Digital Audio (Focal Press, 1994).

Rate Conversion Parameters

Rate conversion parameters affect the rate conversion algorithm and are used only when the input and output sampling rates are not equal (see the dmAudioRateConverterSetParams(3dm) man page for more information). Table 3-7 lists the rate conversion parameters and their data types and legal values.

Table 3-7. Rate Conversion Parameter

Parameter (Data Type)

Legal Values

DM_AUDIO_RC_ALGORITHM

(DM_TYPE_STRING)

DM_AUDIO_RC_JITTER_FREE (default)
(jitter-free interpolation/decimation)

DM_AUDIO_RC_POLYNOMIAL_ORDER_1 (first order polynomial, linear interpolation)

DM_AUDIO_RC_POLYNOMIAL_ORDER_3 (third order polynomial)

DM_AUDIO_RC_JITTER_FREE_STOPBAND_ATTENUATION

(DM_TYPE_FLOAT)

Applies only to JITTER_FREE.

DM_AUDIO_RC_JITTER_FREE_STOPBAND_
ATTENUATION_78_DB

DM_AUDIO_RC_JITTER_FREE_STOPBAND_
ATTENUATION_96_DB

DM_AUDIO_RC_JITTER_FREE_STOPBAND_
ATTENUATION_120_DB

(default = DM_AUDIO_RC_JITTER_FREE_
STOPBAND_ATTENUATION_78_DB)

DM_AUDIO_RC_JITTER_FREE_TRANSITION_BANDWIDTH

(DM_TYPE_FLOAT)

Applies only to JITTER_FREE.

DM_AUDIO_RC_JITTER_FREE_TRANSITION_
BANDWIDTH_1_PERCENT

DM_AUDIO_RC_JITTER_FREE_TRANSITION_
BANDWIDTH_10_PERCENT

DM_AUDIO_RC_JITTER_FREE_TRANSITION_
BANDWIDTH_20_PERCENT

DM_AUDIO_RC_FLUSH_VALUE

(DM_TYPE_FLOAT)

The value used to flush the rate converter during dmAC flush mode (to avoid an audible click).


Channel Conversion Parameter

DM_AUDIO_CHANNEL_MATRIX (DM_TYPE_FLOAT_ARRAY), the channel conversion or channel matrix parameter, determines the manner in which the input channels are mapped into the output channels. The matrix is a one-dimensional array representing a two-dimensional array in row-major order, where each row represents an output channel and each column represents an input channel. Its legal values are a DMfloatarray of double-precision floating point numbers. For a detailed explanation, see the afSetChannelMatrix(3dm) man page.

Figure 3-1 illustrates a channel conversion from four input channels to two output channels. Inputs 1 and 2 are split between the outputs.

Figure 3-1. Channel Conversion

Channel Conversion

Converting Data Using a Converter Instance

Use dmACConvert() to convert the audio data's format, sampling rate, and compression. This function performs the data format, sampling rate, and compression or decompression specified by the previous call to dmACSetParams():

DMstatus dmACConvert (DMaudioconverter converter,
                      void *inbuffer,
                      void *outbuffer, 
                      int *in_amount,
                      int *out_amount)

  • converter is a handle to an audio converter previously created with dmACCreate() and configured with dmACSetParams().

  • inbuffer and outbuffer point to the buffers that contain the audio data prior to and after conversion. As described in “Configuring a Converter Instance” your application may need to determine the number of frames or bytes these buffers hold using the DM_AUDIO_MIN_INPUT_LEN or DM_AUDIO_MIN_OUTPUT_LEN parameters.

  • in_amount points to an integer containing the number of frames (bytes if the input is compressed) of input data available to the converter instance. This can be any value greater than 0. In pull mode, dmACConvert() resets this value to the number of frames (bytes) read from inbuffer by the converter. (To review the push and pull modes, see the discussion in “Processing Mode Parameter”.)

  • out_amount is a pointer to an integer containing the number of frames (bytes if the output is compressed) of converted data your application is requesting from the converter. In push mode, the initial value is ignored. After processing the data, dmACConvert() resets out_amount to the number of frames (bytes) actually placed into outbuffer. If the conversion involves rate conversion, compression, or decompression, this value can vary significantly from the in_amount value. out_amount can be zero even when in_amount was positive. This is because the converter must often do internal buffering to allow the application to request arbitrary amounts of data.


    Note: Flushing the converter is advisable in certain situations. Many conversion operations, such as rate conversion, cause the converter to store portions of the audio signal in internal buffers. When your application has no more data to pass to the converter, it should flush these buffers into the output buffer to avoid losing the end of the audio stream. To flush these buffers, call dmACConvert() with inbuffer set to NULL until *out_amount equals 0. This action usually takes only one call.


Destroying a Converter Instance

The Audio Conversion library provides the function dmACDestroy() to destroy an audio converter instance:

DMstatus dmACDestroy (DMaudioconverter converter)

The function frees the memory associated with the DMaudioconverter handle. The handle is not valid after this call returns.

DV Audio Compression Library

The DV Audio codec implements DV and DVCPRO audio compression and decompression. Table 3-8 summarizes the calls. For an example, see recdvaudio.c and playdvaudio.c in /usr/share/src/dmedia/dvaudiotest.

Table 3-8. DV Audio Library API

Function

Parameters

Description

DMstatus dmDVAudioDecode 

(DMDVaudiodecoder decoder,
void *inbuf,
void *outbuf,
int *nsamples)

Do DV and DVCPRO audio decompression. See also dmDVAudioDecode(3dm) .

DMstatus dmDVAudioDecoderCreate 

(DMDVaudiodecoder *decoder)

Allocate new DMDVaudiodecoder structure. See also dmDVAudioDecoderCreate(3dm) .

DMstatus dmDVAudioDecoderDestroy 

(DMDVaudiodecoder decoder)

Deallocate a DMDVaudiodecoder structure. See also dmDVAudioDecoderDestroy(3dm) .

DMstatus dmDVAudioDecoderGetParams 

(DMDVaudiodecoder decoder,
DMparams *params)

Get DV audio decoder parameter values. See also dmDVAudioDecoderGetParams(3dm) .

DMstatus dmDVAudioDecoderReset 

(DMDVaudiodecoder decoder)

Fill decoder internal buffers with zeros. See also dmDVAudioDecoderReset(3dm) .

DMstatus dmDVAudioDecoderSetParams 

(DMDVaudiodecoder decoder,
DMparams *params)

Set DV Audio decoder parameter values. See also dmDVAudioDecoderSetParams(3dm) .

DMstatus dmDVAudioEncode 

(DMDVaudioencoder encoder,
void *inbuf,
void *outbuf,
int *nsamples)

Do DV and DVCPRO audio compression. See also dmDVAudioEncode(3dm) .

DMstatus dmDVAudioEncoderCreate 

(DMDVaudioencoder *encoder)

Allocate new DMDVaudioencoder structure. See also dmDVAudioEncoderCreate(3dm) .

DMstatus dmDVAudioEncoderDestroy 

(DMDVaudioencoder encoder)

Deallocate DMDVaudioencoder structure. See also dmDVAudioEncoderDestroy(3dm) .

DMstatus dmDVAudioEncoderGetFrameSize 

(DMDVaudioencoder handle,
int *numSampFrame)

Get number of audio samples required for DIF frame.

DMstatus dmDVAudioEncoderGetParams 

(DMDVaudioencoder encoder,
DMparams *params)

Get DV audio encoder parameter values. See also dmDVAudioEncoderGetParams(3dm) .

DMstatus dmDVAudioEncoderReset 

(DMDVaudioencoder encoder)

Fill encoder internal buffers with zeros. See also dmDVAudioEncoderReset(3dm) .

DMstatus dmDVAudioEncoderSetParams 

(DMDVaudioencoder encoder, DMparams *params)

Set DV audio encoder parameter values. See also dmDVAudioEncoderSetParams(3dm) .

DMstatus dmDVAudioHeaderGetParams 

(void *dif,
DMparams *params,
int *numSampFrames)

Get DV audio decoder parameter values based on the information in a DIF block handed to the routine. See also dmDVAudioHeaderGetParams(3dm) .


Audio Rate Conversion Library

The Audio Rate Conversion library enables the sampling rate conversion of single-channel, 32-bit, floating point audio data. Table 3-9 summarizes the functions in this library.

Table 3-9. Audio Rate Conversion Library API

Function

Parameters

Description

DMstatus dmAudioRateConvert 

(DMaudiorateconverter handle, float *inbuf, float *outbuf, int inlen, int *numout)

Convert the data sampling rate.
See also dmAudioRateConvert(3dm) .

DMstatus dmAudioRateConverterCreate

(DMaudiorateconverter *converter)

Allocate a new DMaudiorateconverter structure.
See also dmAudioRateConverterCreate(3dm) .

DMstatus dmAudioRateConverterDestroy 

(DMaudiorateconverter handle)

Deallocate an DMaudiorateconverter structure.
See also dmAudioRateConverterDestroy(3dm) .

DMstatus dmAudioRateConverterGetParams 

(DMaudiorateconverter handle, DMparams *params)

Get the parameter values of a DMaudiorateconverter structure. See also dmAudioRateConverterGetParams(3dm) .

DMstatus dmAudioRateConverterSetParams

(DMaudiorateconverter handle, DMparams *params)

Set the parameter values of a DMaudiorateconverter structure. See also dmAudioRateConverterSet Params(3dm) .

DMstatus dmAudioRateConverterReset 

(DMaudiorateconverter handle, float resetval)

Fill the internal buffers of a DMaudiorateconverter structure with a constant value. See also dmAudioRateConverterReset(3dm) .