146 Voice API Programming Guide — June 2005
Cached Prompt Managementtpt.tp_flags = TF_MAXDTMF;
/* Open VOX file to play -- Linux only */
if ((fd = open("HELLO.VOX",O_RDONLY)) == -1) {
printf("File open error\n");
exit(2);
}
/* Open VOX file to play -- Windows only */
if ((fd = dx_fileopen("HELLO.VOX",O_RDONLY|O_BINARY)) == -1) {
printf("File open error\n");
exit(2);
}
/* Set up DX_IOTT */
/*This block specifies a regular data file */
iottplay[0].io_fhandle = fd;
iottplay[0].io_bufp = 0;
iottplay[0].io_offset = 0;
iottplay[0].io_length = -1;
iottplay[0].io_type = IO_DEV | IO_CONT;
/*This block specifies the downloaded cached prompt */
iottplay[1].io_type = IO_CACHED | IO_EOT
iottplay[1].io_fhandle = promptHandle;
iottplay[1].io_offset = 0;
iottplay[1].io_length = -1;
/*
* Specify VOX file format for ADPCM at 8KHz
*/
xpb.wFileFormat = FILE_FORMAT_VOX;
xpb.wDataFormat = DATA_FORMAT_DIALOGIC_ADPCM;
xpb.nSamplesPerSec = DRT_8KHZ;
xpb.wBitsPerSample = 4;
/* Start playback */
if (dx_playiottdata(chdev,iottplay,&tpt,&xpb,EV_SYNC)==-1) {
printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
.
.
.
//Shutdown
//free allocated memory
//close opened devices
dx_close(chdev);
//loop and close all physical device handles
dx_close(devh[n]);