vceStop

Stops the currently active play or record.

Prototype

DWORD vceStop ( CTAHD ctahd)

Argument

Description

ctahd

Handle returned by ctaCreateContext or ctaAttachContext.


Return values

Return value

Description

SUCCESS

 

CTAERR_INVALID_CTAHD

Context handle is invalid.

CTAERR_INVALID_SEQUENCE

Already stopping.

CTAERR_SVR_COMM

Server communication error.


Events

Event

Description

VCEEVN_PLAY_DONE or VCEEVN_RECORD_DONE

Playing or recording completed. The value field of the event contains CTA_REASON_STOPPED.


Details

vceStop sends a command to the play or record service to stop playing or recording. A VCEEVN_PLAY_DONE or VCEEVN_RECORD_DONE event with the value field containing CTA_REASON_STOPPED indicates successful completion of the command. If playing or recording ended before the stop command was sent, the event contains a different reason code.

Because play or record may have already ended, this function returns SUCCESS even if play and record is not active. Therefore, a return of SUCCESS does not guarantee that a DONE event is pending. It is up to the application to determine whether play or record was started and whether to expect a DONE event.

See also

vcePlay, vcePlayList, vcePlayMessage, vceRecord, vceRecordMessage

Example

/* Play message until stopped by keyboard event*/
extern CTAHD      CtaHd;
extern CTAQUEUEHD CtaQueueHd;

void myPlayMessage (VCEHD vh, unsigned message)
{
    CTA_EVENT event;

    vcePlayMessage (vh, message, NULL);
    do
    {
        ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
        if (event.id == KBDEVN_KEY)
            vceStop(CtaHd);
    } while (event.id != VCEEVN_PLAY_DONE); /* Ignore other events */
}