# vceGetContextInfo

Returns the current Voice Message service status of the specified context.

#### Prototype

DWORD vceGetContextInfo ( CTAHD ctahd, VCE_CONTEXT_INFO *status, unsigned size)

Argument | Description
ctahd | Handle returned by ctaCreateContext or ctaAttachContext.
status | Pointer to a buffer to receive the VCE_CONTEXT_INFO structure: typedef struct { DWORD size; DWORD numcurrent; DWORD position; DWORD reasondone; DWORD auxerror; DWORD function; DWORD underruns; DWORD currentgain; DWORD currentspeed; DWORD encoding; DWORD framesize; DWORD frametime; } VCE_CONTEXT_INFO; Refer to the Details section for a description of these fields.
size | Size in bytes of the status buffer.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_SIZE | size is less than the size of DWORD.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_SVR_COMM | Server communication error.

#### Details

vceGetContextInfo returns the current Voice Message service status information of the context that ctahd specifies, including information about the current or most recent play or record operation on a context.

A context contains a current message and current position, used by functions including vcePlay, vceRecord, vceErase, vceRead, and vceWrite. The current message can consist of a list of messages that are treated as one contiguous message. The numcurrent field in the VCE_CONTEXT_INFO structure gives the number of messages in the list.

Use vceGetCurrentList to view the current message or list.

Note: During play or record, the current position is updated as each buffer is internally submitted for play or completed for record. When play ends, the values can be adjusted downward if not all of the bytes submitted to the device were actually played.

The VCE_CONTEXT_INFO structure contains the following fields:

Field | Description
--- | ---
size | Number of bytes written to the buffer to which status pointed.
numcurrent | Number of messages that compose the current message list. Use vceGetCurrentList to see the messages.
position | Current position, in milliseconds, in the current message.
reasondone | Reason for completion of the most recent play or record.
auxerror | Auxiliary error code (for example, OS error).
function | VCE_PLAY or VCE_RECORD if a function is currently active, otherwise zero (0).
underruns | Count of underruns. An underrun occurs when the system is unable to supply buffers to the hardware fast enough to keep up with speech. The underrun count is cumulative from when the context is opened.
currentgain | Current value of play gain. This value is set to the value of the play gain parameter when play starts. vceSetPlayGain can change the value when play is active.
currentspeed | Current value of play speed. This value is set to the value of the play speed parameter when play starts. vceSetPlaySpeed can change the value when play is active.
encoding | Encoding of the current message.
framesize | Frame size of the current encoding. See vceGetEncodingInfo.
frametime | Frame duration of the current encoding. See vceGetEncodingInfo.

#### See also

vceGetOpenInfo

#### Example

/* Get the underrun count */
unsigned myGetUnderruns (CTAHD ctahd)
{
VCE_CONTEXT_INFO contextinfo;
vceGetContextInfo (ctahd, &contextinfo, sizeof contextinfo);
return contextinfo.underruns;
}