# adiStartEnergyDetector

Starts the energy detector.

Note: Do not use the energy detector if you are using voice activity detection.

#### Supported board types

- AG

- CG

#### Prototype

DWORD adiStartEnergyDetector ( CTAHD ctahd, unsigned energyqual, unsigned silencequal, ADI_ENERGY_PARMS *parms)

Argument | Description
ctahd | Context handle returned by ctaCreateContext or ctaAttachContext.
energyqual | Qualification time for energy (in milliseconds).
silencequal | Qualification time for silence (in milliseconds).
parms | Pointer to energy detector parameters according to the following structure (NULL designates default values): typedef struct { /* parameters for energy detection:*/ DWORD size; /* size of this structure */ INT32 thresholdampl; /* silence level (dBm) */ DWORD deglitch; /* ms deglitch during transitions */ DWORD autostop; /* on detection, 1=autostop 0=don't*/ } ADI_ENERGY_PARMS; Refer to ADI_ENERGY_PARMS for field descriptions.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_RESOURCE_CONFLICT | Silence detector in use by a record function.
CTAERR_SVR_COMM | Server communication error.

#### Events

Event | Description
ADIEVN_ENERGY_DETECTED | Energy detector reporting energy.
ADIEVN_ENERGY_DETECT_DONE | Energy detector terminated.
ADIEVN_SILENCE_DETECTED | Energy detector reporting silence.

#### Details

The following DSP
file must be loaded to the board before running adiStartEnergyDetector:

For these boards... | Load this DSP file...
AG | dtmf.m54 or dtmfe.m54
CG | dtmf.f54 or dtmfe.f54

See DSP file summary for DSP file descriptions. Refer to the board installation and developer's manual for a table of MIPS
usage for all functions.

Use this function to start a low-level energy detector that reports energy and silence transitions.

The thresholdampl is the dBm threshold below which is considered silence. Once energy or silence is internally qualified as detected, the deglitch time is used during transitions above and below the threshold. The autostop field indicates that the function stops once energy or silence is detected. The maximum valid value for energyqual and silencequal is 65535.

If autostop is set, ADIEVN_ENERGY_DETECT_DONE is received with the value field set to CTA_REASON_FINISHED and the size field is set to either ADIEVN_ENERGY_DETECTED or ADIEVN_SILENCE_DETECTED.

In continuous mode, ADIEVN_ENERGY_DETECTED and ADIEVN_SILENCE_DETECTED are received as the detector changes between these states.

ADIEVN_ENERGY_DETECT_DONE can also be returned with the value field set to an error or CTA_REASON_STOPPED if adiStopEnergyDetector is called.

Note: You cannot start the energy detector while a record operation is active unless both ADI_RECORD.novoicetime and ADI_RECORD.silencetime are 0 (zero) when the record operation was started. For a voice record operation, the relevant parameters are VCE_RECORD.novoicetime and VCE_RECORD.silencetime.

For more information, refer to Detecting energy.