(Page 2 of 40 in this chapter)


vceAssignHandle

Description

Assigns a voice handle to an open file.

Prototype

DWORD vceAssignHandle ( CTAHD ctahd,
int filedes,
unsigned
encoding,
VCEHD
*vh)

ctahd Handle returned by ctaCreateContext.

filedes File descriptor returned by an operating system open function.

encoding Encoding of all messages in the file.

vh Pointer to a returned voice handle.

Return Values

E vents

Details

This function assigns a voice handle to a file that is already opened, or to some other data stream such as stdin.

When the voice handle is closed with vceClose, filedes is not automatically closed.

You can only record to or edit a file that has been opened for writing. Otherwise, the record or edit function returns a write failed error code.

Note: In Unix, you can use the file descriptor returned by the C open function, or the C fileno function. Under Windows NT some compilers will not return the OS file descriptor, so you can only use file descriptors returned by system calls, e.g.CreateFile under Windows NT.

See Also

vceClose, vceCreateFile, vceOpenFile, vceOpenMemory

Example


/* Play from standard input */
#if defined _WIN32 && defined _MSC_VER
#include <io.h>
#define STDIN_FILENO _get_osfhandle (0)
#endif

extern CTAHD Ctahd;
extern CTAQUEUEHD CtaQueueHd;
void myplaystdin( unsigned encoding )
{
VCEHD vh;
CTA_EVENT event;

vceAssignHandle (Ctahd, STDIN_FILENO, encoding, &vh );
vcePlayMessage (vh, 0, NULL);
do
{
ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
} while (event.id != VCEEVN_PLAY_DONE); /* Ignore other events */
}


(Page 2 of 40 in this chapter)


tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights reserved.