
Description | Cautions | Example | Errors | See Also
Name: |
SHORT dx_playwav(chdev, filenamep, tptp, mode) | |
Inputs: |
int chdev |
|
char *filenamep |
| |
DV_TPT *tptp |
| |
unsigned short mode |
| |
Returns: |
| |
| ||
Includes: |
| |
| ||
Category: |
Convenience function | |
Mode: |
synchronous | |
The dx_playwav( ) convenience function plays voice data stored in a single WAVE file. This function calls dx_playiottdata( ).
The function does not specify a DX_XPB structure because the WAVE file contains the necessary format information.
Parameter |
Description |
chdev |
Channel device descriptor |
tcbp |
Pointer to termination parameter table |
filenamep |
Pointer to name of file to play |
mode |
specifies the play mode: PM_TONE play 200 ms audible tone
|
This function fails when an unsupported data waveform attempts to play. The supported waveforms are:
#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 playback */
if (dx_playwav(chdev,"HELLO.WAV",&tpt,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