Closes a voice object.
DWORD vceClose ( VCEHD vh)
|
Argument |
Description |
|
vh |
Handle of an open voice object. |
|
Return value |
Description |
|
SUCCESS |
|
|
CTAERR_INVALID_HANDLE |
vh is not a valid handle to an open voice object. |
|
CTAERR_SVR_COMM |
Server communication error. |
vceClose closes a voice file or a memory block. If the object is a memory block, the memory is not freed. If vceAssignHandle creates the object, the application must close the associated file descriptor.
Note: If play or record is currently active on a message in the voice object, the play or record function is terminated. The reason in the DONE event is CTA_REASON_STOPPED.
Refer to Managing voice objects for more information.
Shared voice objects
A call to vceClose closes the voice object to all applications with an open handle to the voice object. Subsequent calls to the voice object return an error. For example, an attempt to play a message using the handle to the voice object results in VCEERR_NO_MESSAGE being returned.
The application launching vceClose must notify the other applications that the voice object is closing. Upon notification or upon receiving an error message, applications sharing the voice object must call ctaDetachObject to deallocate local resources associated with the shared voice object.
Note: When an invalid vh calls vceClose, the function automatically destroys the local handle. In this case, the application does not need to launch ctaDetachObject.
For more information on shared service objects, refer to the Natural Access Developer's Reference Manual.
vceCreateFile, vceOpenFile, vceOpenMemory
/* Close an open memory block and free the memory */
void myclosememory (VCEHD vh, BYTE *address)
{
free (address); /* OK to free first if not playing.*/
vceClose (vh);
}