Intel 05-1832-002 IP Phone User Manual


 
152 Voice API for Windows Operating Systems Library Reference — November 2003
dx_cacheprompt( ) — download a cached prompt from multiple sources
If the function is called in asynchronous mode (mode = EV_ASYNC), then the cached prompt
handle returned should be used only after the TDX_CACHEPROMPT event is received.
When iottp parameter points to an array of DX_IOTT data structures (voice data being
specified from multiple sources), the cached prompt handle that is returned refers to the
beginning of the combined set of voice data that is downloaded. It is not possible to select an
individual data item for playing from the cached prompt.
WAVE files cannot be played from on-board cache memory.
When dx_cacheprompt( ) is issued on a physical board device in asynchronous mode, and the
function is immediately followed by another similar call prior to completion of the previous
call on the same device, the subsequent call will fail with device busy.
!
!!
! Errors
In asynchronous mode, the function returns immediately and a TDX_CACHEPROMPT event is
queued upon completion. Check the extended attribute function ATDX_TERMMSK( ) for the
termination reason. If a failure occurs, then a TDX_ERROR event will be queued. Use the
Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to determine
the reason for error.
In synchronous mode, if this function returns -1 to indicate failure, call ATDV_LASTERR( ) to
obtain the error code, or use ATDV_ERRMSGP( ) to obtain a descriptive error message. For a list
of error codes returned by ATDV_LASTERR( ), see the Error Codes chapter.
!
!!
! Example
#include <windows.h>
#include <stdio.h>
#include "srllib.h"
#include "dxxxlib.h"
main()
{
int brdhdl; /* physical board device handle */
int promptHandle; /* Handle of the prompt to be downloaded */
int fd1; /* First file descriptor for file to be downloaded */
int fd2; /* Second file descriptor for file to be downloaded */
DX_IOTT iott[2]; /* I/O transfer table to download cached prompt */
.
.
.
/* Open board */
if ((brdhdl = dx_open("brdB1",0)) == -1) {
printf("Cannot open board\n");
/* Perform system error processing */
exit(1);
}
/* Open first VOX file to cache */
if ((fd1 = dx_fileopen("HELLO.VOX",O_RDONLY|O_BINARY)) == -1) {
printf("File open error\n");
exit(2);
}
/* Open second VOX file to cache */
if ((fd2 = dx_fileopen("GREETING.VOX",O_RDONLY|O_BINARY)) == -1) {
printf("File open error\n");
exit(2);
}