
Description | Cautions | Example | Errors | See Also
Name: |
void dx_bldtngen(tngenp,freq1,freq2,ampl1,ampl2,duration) | |
Inputs: |
TN_GEN *tngenp |
|
unsigned short freq1 |
| |
unsigned short freq2 |
| |
short ampl1 |
| |
short ampl2 |
| |
short duration |
| |
Returns: |
none | |
Includes: |
srllib.h | |
Category: |
Global Tone Generation | |
The dx_bldtngen( ) function is a convenience function that defines a tone for generation by setting up the tone generation template (TN_GEN) and assigning specified values to the appropriate fields. The tone generation template is placed in the user's return buffer and can then be used by the dx_playtone( ) function to generate the tone.
Parameter |
Description |
tngenp |
points to the TN_GEN data structure where the tone generation template is output. |
freq1 |
specifies the frequency of tone 1 in Hz. Valid range is 200 to 3000 Hz. |
freq2 |
specifies the frequency of tone 2 in Hz. Valid range is 200 to 3000 Hz. To define a single tone, set freq1 to the desired frequency and set freq2 to 0. |
ampl1 |
specifies the amplitude of tone 1 in dB. Valid range is 0 to -40 dB. Calling this function with ampl1 set to R2_DEFAMPL will set the amplitude to -10 dB. |
ampl2 |
specifies the amplitude of tone 2 in dB. Valid range is 0 to -40 dB. Calling this function with ampl2 set to R2_DEFAMPL will set the amplitude to -10 dB. |
duration |
specifies the duration of the tone in 10 ms units. A value of -1 specifies infinite duration (the tone will only terminate upon an external terminating condition). |
Generating a tone with a high frequency component (approximately 700 Hz or higher) will cause the amplitude of the tone to increase. The increase will be approximately 1 dB at 1000 Hz. Also, the amplitude of the tone will increase by 2 dB if an analog (loop start) device is used, such as the LSI/120 board or the analog device on a D/4xD, D/41E, D/41ESC, or D/160SC-LS board.
None.
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
TN_GEN tngen;
int dxxxdev;
/*
* Open the Voice Channel Device and Enable a Handler
*/
if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) {
perror( "dxxxB1C1" );
exit( 1 );
}
/*
* Build a Tone Generation Template.
* This template has Frequency1 = 1140,
* Frequency2 = 1020, amplitute at -10dB for
* both frequencies and duration of 100 * 10 msecs.
*/
dx_bldtngen( &tngen, 1140, 1020, -10, -10, 100 );
/*
* Continue Processing
* .
* .
* .
*/
/*
* Close the opened Voice Channel Device
*/
if ( dx_close( dxxxdev ) != 0 ) {
perror( "close" );
}
/* Terminate the Program */
exit( 0 );
}
None.
Generating Tones:
R2MF functions:
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation