(Page 19 of 80 in this chapter)


adiGetEncodingInfo

Description

Returns data size parameters for a given voice encoding format on a specified context.

Prototype

DWORD adiGetEncodingInfo( CTAHD ctahd,
unsigned encoding,
unsigned *framesize,
unsigned *datarate,
unsigned *maxbufsize )

ctahd Context handle returned by adiOpenPort.

encoding Data encoding method.

framesize Pointer to returned size in bytes, of a single voice frame for given encoding format.

datarate Pointer to returned required throughput in bytes/second, for given encoding format.

maxbufsize Pointer to returned AG buffer size in bytes, for given encoding format on the specified context.

Return Values

Events

None.

Details

This function returns data size information for the given encoding format on the specified context.

The encoding argument must be one of the valid encoding selectors contained in adidef.h. Each selector is prefixed with ADI_ENCODE_xxx (e.g., ADI_ENCODE_NMS_24).

When submitting buffers of voice data for play or record, the buffers must be an integral multiple of the encoding framesize, and should be a multiple of the AG board's physical buffer (maxbufsize). All buffers of voice data submitted to AG Access must be an integral number of framesize bytes. For example, if the frame size is 62 bytes, a submitted buffer must be sized as n*62 bytes where n=1,2,3....

The datarate is provided to assist resource management optimization. The datarate defines the required throughput between the host CPU and AG board (in bytes/second). It can be used for positioning. For example, to skip ahead four seconds in a message, you would move your data pointer 4*datarate bytes (modulo framesize).

The maxbufsize is the maximum physical AG buffer size for the ctahd's AG board for the given encoding. The AG board's physical buffer size varies depending upon the board type and configured software. The size returned here is rounded to a multiple of the framesize.

You may pass NULL for any of the function arguments that are pointers to returned values.

Data sizes and encoding are discussed in the AG Access Developer's Manual.

See Also

adiRecordToMemory, adiRecordAsync, adiStartRecording, adiPlayFromMemory, adiPlayAsync, adiStartPlaying

Example


void myShowEncodingInfo( CTAHD ctahd, unsigned encoding )
{
    unsigned framesize, datarate, maxbufsize;

    if( adiGetEncodingInfo( ctahd, encoding,
                            &framesize, &datarate, &maxbufsize ) == SUCCESS )
    {
        printf( "Frame size   = %d bytes\n",     framesize  );
        printf( "Data rate    = %d bytes/sec\n", datarate   );
        printf( "Max buf size = %d bytes\n",     maxbufsize );
    }
}



(Page 19 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.