vceSetPosition

Sets the current position in the current message.

Prototype

DWORD vceSetPosition ( CTAHD ctahd, int msec, unsigned seekmode, unsigned *actual)

Argument

Description

ctahd

Handle returned by ctaCreateContext or ctaAttachContext.

msec

Number of milliseconds to reposition.

seekmode

Type of repositioning. Refer to the Details section for acceptable values.

actual

Pointer to returned new position.


Return values

Return value

Description

SUCCESS

 

CTAERR_FUNCTION_ACTIVE

Playing or recording is active on the context.

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_SVR_COMM

Server communication error.

VCEERR_NO_MESSAGE

No current message in the context.


Details

vceSetPosition changes the current position in the current message for the context that ctahd specified. The new position is returned in actual, unless actual is NULL.

The msec argument can be a negative value when seekmode is VCE_SEEK_CUR. For other modes, msec must be a positive value.

Valid values for seekmode are:

Value

Description

VCE_SEEK_SET

Absolute position.

VCE_SEEK_CUR

Relative position (+ or -).

VCE_SEEK_END

Backward from end.


Use this function when preparing to use functions that operate at the current position, including vcePlay, vceRecord, vceErase, vceRead, and vceWrite.

You cannot change the position while play or record is active.

To query the current position without changing it, set msec to zero (0) and seekmode to VCE_SEEK_CUR, even when a function is active.

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.

If you attempt to seek beyond the end or beginning of the current message, SUCCESS is returned. The new position is set to the current size if seeking beyond the end, or to zero (0) if seeking before the beginning.

See also

vceSetCurrentList, vceSetCurrentMessage

Example

/* Report the current position in the current message.*/

unsigned MyTell (CTAHD ctahd)
{
    unsigned position;

    if (vceSetPosition (ctahd, 0, VCE_SEEK_CUR, &position) != SUCCESS)
        return 0;
    return position;
}