Previous PageTable Of Contents../index.htmlIndexNext Page

dx_playtone( )

Description | Cautions | Example | Errors | See Also

Name:

int dx_playtone(chdev,tngenp,tptp,mode)

Inputs:

int chdev

  valid Dialogic channel device handle

 

TN_GEN *tngenp

  pointer to the TN_GEN structure

 

DV_TPT *tptp

  pointer to the DV_TPT structure

 

int mode

  asynchronous/synchronous

Returns:

0 if success

 

-1 if failurewhat error

Includes:

srllib.h

 

dxxxlib.h

Category:

Global Tone Generation

Mode:

asynchronous/synchronous

Top Of PageDescription

The dx_playtone( ) function plays tone defined by TN_GEN template, which defines the frequency amplitude and duration of a single or dual frequency tone to be played.

NOTE:
The dx_playtone( ) function is necessary for supporting the R2MF protocol in an application. See r2_playbsig( ) for information.

Asynchronous Operation

To run this function asynchronously set the mode field to EV_ASYNC. When running asynchronously, this function will return 0 to indicate it has initiated successfully, and will generate a TDX_PLAYTONE termination event to indicate completion.

Set termination conditions using the DV_TPT structure. This structure is pointed to by the tptp parameter described below.

Termination of this function is indicated by a TDX_PLAYTONE event.

After dx_playtone( ) terminates, use the ATDX_TERMMSK( ) function to determine the reason for termination.

Synchronous Operation

By default, this function runs synchronously, and will return a 0 to indicate that it has completed successfully.

Set termination conditions using the DV_TPT structure. This structure is pointed to by the tptp parameter described below.

Termination of synchronous play is indicated by a return value of 0.

After dx_playtone( ) terminates, use the ATDX_TERMMSK( ) function to determine the reason for termination.

Parameter

Description

chdev

specifies the valid channel device handle obtained when the channel was opened using dx_open( ).

tngenp

points to the TN_GEN template structure, which defines the frequency, amplitude and duration of a single or dual frequency tone. See the chapter on Data Structures for a full description of this template. dx_bldtngen( ) can be used to set up the structure.

tptp

points to the DV_TPT data structure, which specifies one of the following terminating conditions for this function:

 

DX_DIGTYPE

  Digit termination for user-defined tone

 

DX_MAXDTMF

  Maximum number of digits received

 

DX_MAXSIL

  Maximum silence

 

DX_MAXNOSIL

  Maximum non-silence

 

DX_LCOFF

  Loop current off

 

DX_IDDTIME

  Inter-digit delay

 

DX_MAXTIME

  Function time

 

DX_DIGMASK

  Digit mask termination

 

DX_PMOFF

  Pattern match silence off

 

DX_PMON

  Pattern match silence on

 

DX_TONE

  Tone-off or Tone-on detection

mode

specifies whether to run this function asynchronously or synchronously. Set to one of the following:

 

EV_ASYNC:

Run dx_playtone( ) asynchronously.

 

EV_SYNC:

Run dx_playtone( ) synchronously (default).

Top Of PageCautions

    1. The channel must be idle when calling this function.
    2. If the tone generation template contains an invalid tg_dflag, or the specified amplitude or frequency is outside the valid range, dx_playtone( ) will generate a TDX_ERROR event if asynchronous, or
      -1 if synchronous.

Top Of PageExample

Top Of PageErrors

If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:

EDX_BADPARM

  • Invalid parameter

EDX_BADPROD

  • Function not supported on this board

EDX_BADTPT

  • Invalid DV_TPT entry

EDX_BUSY

  • Busy executing I/O function

EDX_AMPLGEN

  • Invalid amplitude value in TN_GEN structure

EDX_FREQGEN

  • Invalid frequency component in TN_GEN structure

EDX_FLAGGEN

  • Invalid tn_dflag field in TN_GEN structure

EDX_SYSTEM

Top Of PageSee Also

Related to Tone Generation:

R2MF functions:

Handling and Retrieving dx_playtone( ) Termination Events:


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2002, Dialogic Corporation
All rights reserved
This page generated February, 2002