# Generating tones

NMS Communications boards are capable of generating single and dual frequency tones.

## Playing tones

adiStartTones enables the application to play a list of single or dual frequency tones. Each individual tone has the following attributes, which are stored in the ADI_TONE_PARMS structure:

Parameter | Description
--- | ---
ontime | A configurable active time period.
offtime | A configurable inactive time period following the active time period.
iterations | Number of times to repeat the tone.

The combined duration of ontime and offtime represents one complete cycle.

adiStartDTMF is a DTMF tone generator with programmable interdigit delays. The function accepts a string of digits and an ADI_DTMF_PARMS structure. The parameter structure allows you to specify interdigit pause duration for the comma and period characters, which can be interspersed with the DTMFs in the digit string.

## Terminating tone generation

adiStopTones immediately terminates active tone generation. Regardless of which tone type is active, the ADI service generates ADIEVN_TONES_DONE with the value set to CTA_REASON_STOPPED.

The number of iterations is specified in ADI_TONE_PARMS, which is passed to adiStartTones. If the specified number of iterations is completed, the ADI service generates ADIEVN_TONES_DONE with the value set to CTA_REASON_FINISHED.

If an error occurs in starting the function, the DONE event is sent with the value set to ADIERR_xxx or CTAERR_xxx.

## System restrictions

Because only one function can drive the output of the telephone line, the following functions are mutually exclusive:

- Tone generation

- Voice playback

- Voice record when beep is enabled