
Description | Cautions | Example | Errors | See Also
Name: |
SHORT dx_playvox(chdev, filenamep, tptp, xpbp, mode) | |
Inputs: |
int chdev |
|
char *filenamep |
| |
DV_TPT *tptp |
| |
DX_XPB*xpbp |
| |
unsigned short mode |
| |
Returns: |
| |
| ||
Includes: |
| |
Category: |
Convenience function | |
Mode: |
synchronous | |
The dx_playvox( ) convenience function plays voice data stored in a single VOX file. If xpbp is set to NULL, it will interpret the data as 6KHz linear ADPCM.
Parameter |
Description |
chdev |
Channel device descriptor |
tcbp |
Pointer to termination parameter table |
filenamep |
Pointer to name of file to play |
xpbp |
Pointer to I/O transfer parameter block. Refer to the DX_XPB structure in the chapter on Data Structures for more information. |
mode |
specifies the play mode: PM_TONE play 200 ms audible tone
|
When playing or recording VOX files, the data format is specified in DX_XPB rather than through the dl_stprm( ) function.
#include "srllib.h"
#include "dxxxlib.h"
int chdev; /* channel descriptor */
DV_TPT tpt; /* termination parameter table */.
.
.
/* Open channel */
if ((chdev = dx_open("dxxxB1C1",0)) == -1) {
printf("Cannot open channel\n");
/* Perform system error processing */
exit(1);
}
/* Set to terminate play on 1 digit */
tpt.tp_type = IO_EOT;
tpt.tp_termno = DX_MAXDTMF;
tpt.tp_length = 1;
tpt.tp_flags = TF_MAXDTMF;
/* Wait forever for phone to ring and go offhook */
if (dx_wtring(chdev,1,DX_OFFHOOK,-1) == -1) {
printf("Error waiting for ring - %s\n", ATDV_LASTERR(chdev));
exit(3);
}
/* Start 6KHz ADPCM playback */
if (dx_playvox(chdev,"HELLO.VOX",&tpt,NULL,EV_SYNC) = = -1) {
printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
If this function returns -1 to indicate failure, one of the following reasons will be contained by ATDV_LASTERR( ):
Equate |
Returned When |
EDX_BUSY |
Channel is busy |
EDX_XPBPARM |
Invalid DX_XPB setting |
EDX_BADIOTT |
Invalid DX_IOTT setting |
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value. System I/O errors |
EDX_BADWAVFILE |
Invalid WAV file |
EDX_SH_BADCMD |
Unsupported command or WAV file format |
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation