
Description | Example | Errors | Cautions | See Also
Name: |
int dx_settonelen(tonelength) | |
Inputs: |
int tonelength |
|
Returns: |
0 |
|
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
I/O | |
The dx_settonelen( ) function changes the duration of the built-in beep tone (sometimes referred to as a pre-record beep), which some application programs make use of to indicate the start of a recording or playback.
When a record or playback function specifies RM_TONE or PM_TONE (respectively) in the mode parameter, a beep tone will be transmitted immediately before the record or play is initiated. The duration of the beep tone can be altered by this function.
A device handle is not used when calling dx_settonelen( ). The beep tone will be modified for all voice resources used in the current process. The beep tone will not be affected in other processes.
Parameter |
Description |
tonelength |
specifies the duration of the tone in 200 ms units. Default: 1 (200 ms). Range: 1 - 65535. |
#include "srllib.h" #include "dxxxlib.h" int chdev; /* channel descriptor */ DV_TPT tpt; /* termination parameter table */ DX_XPB xpb; /* I/O transfer parameter block */ . . . /* Increase beep tone len to 800ms */ dx_settonelen (4); /* 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(2); } /* Start playback */ if (dx_playwav(chdev,"HELLO.WAV",&tpt,PM_TONE|EV_SYNC) == -1) { printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev)); exit(3); } /* clear digit buffer */ dx_clrdigbuf(chdev); /* Start 6KHz ADPCM recording */ if (dx_recvox(chdev,"MESSAGE.VOX", &tpt, NULL,RM_TONE|EV_SYNC) == -1) { printf("Error recording file - %s\n", ATDV_ERRMSGP(chdev)); exit(4); } /* hang up the phone*/ if (dx_sethook (chdev,DX_ONHOOK,EV_SYNC)) { printf("Error putting phone on hook - %s\n", ATDV_ERRMSGP(chdev)); exit(5); } /* close the channel */ if (dx_close (chdev,DX_ONHOOK,EV_SYNC)) { printf("Error closing channel - %s\n", ATDV_ERRMSGP(chdev)); exit(6); }
None.
When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in "Bad Tone Template ID" errors.
Record and Play functions
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation