Table of Contents Index NMS Glossary Previous Page Next Page (Page 28 of 69 in this chapter) Version


adiRecordAsync

Description

Initiates recording in asynchronous buffer mode.

Prototype

DWORD adiRecordAsync ( CTAHD ctahd,
unsigned encoding,
unsigned maxmsec,
void *buffer,
unsigned bufsize,
ADI_RECORD_PARMS *parms )

ctahd CTA context handle returned by ctaCreateContext.

encoding Encoding type (refer to adidef.h for a complete list of ADI_ENCODING_xxx values).

maxmsec Maximum duration for recording (milliseconds).

buffer Pointer to buffer to receive recorded data.

bufsize Number of bytes available at buffer (bufsize can be arbitrarily large and is truncated to a multiple of the framesize for the selected encoding).

parms Pointer to record parameters according to the following structure (NULL uses default values):

typedef struct
{
DWORD size; /* size of this structure */

DWORD DTMFabort;

/* mask that specifies DTMF tones to abort; */

/* INT32 gain; recording gain in dB SLC parms */

/* (used if silence det)] */

DWORD novoicetime;

/* length of initial silence to stop */

/* recording (ms);use 0 to deactivate initial */

/* silence detection. */

DWORD silencetime;

/* length of silence to stop recording after */

/* voice has been detected ; use 0 to deactivate. */

INT32 silenceampl; /* qualif level for silence (dBm) */

DWORD silencedeglitch;
/* deglitch while qualifying silence */

/*-[Beep for record] ---------------------*/

DWORD beepfreq; /* beep frequency (Hz) */

INT32 beepampl; /* beep amplitude (dBm) */

DWORD beeptime; /* beep time (ms) 0=no beep */

/*--[AGC parms] --------------------------*/

DWORD AGCenable; /* enable AGC; use 1 to activate */

INT32 AGCtargetampl; /* target AGC level (dBm) */

INT32 AGCsilenceampl; /* silence level (dBm) */

DWORD AGCattacktime; /* attack time (ms) */

DWORD AGCdecaytime; /* decay time (ms) */

} ADI_RECORD_PARMS;

Return Values

Events

DSP File

For AG and CG hardware, each encoding rate of this function requires a specific DSP file to be loaded. For more information about DSP files and encoding rates refer to adiPlayAsync.

Note: Refer to the QX 2000 Installation and Developer's Manual for DSP file information specific to the QX board family. Refer to the AG 2000 Installation and Developer's Manual, the AG 4000 Installation and Developer's Manual and the AG 4000C Installation and Developer's Manual for the DSP files for the AG 2000 and AG 4000/C boards. Refer to the CG 6000C Installation and Developer's Manual for the DSP files for CG 6000C boards.

Details

This function initiates a voice record operation. The data is supplied to the application in a sequence of buffers. The application submits empty buffers using adiSubmitRecordBuffer for the duration of the operation. These buffers are then filled with recorded voice data and ADIEVN_RECORD_BUFFER_FULL events are returned. The application has complete latitude and responsibility for allocating, flushing, and submitting the buffers.

When the ADI service needs another buffer, it sets the ADI_RECORD_BUFFER_REQ bit in the event value field for the ADIEVN_RECORD_STARTED and ADIEVN_RECORD_BUFFER_FULL events. The application responds by submitting another empty buffer using adiSubmitRecordBuffer. The application should not submit buffers unless requested by the ADI service. The ADI service owns the buffer until either a ADIEVN_RECORD_BUFFER_FULL event or a ADIEVEN_RECORD_DONE event is delivered to the application.

The last buffer before the DONE event may be a partial buffer. The DONE event itself will not include a buffer of data. The record operation terminates when the application receives the ADIEVN_RECORD_DONE event. You can also stop a record operation by sending a 0 (zero) length buffer.

For optimum performance, the bufsize should be the largest frame multiple that will fit in one AG board buffer. You can obtain this size by calling adiGetEncodingInfo (refer to the maxbufsize argument).

For proper operation, each buffer must be submitted while the previous buffer is being filled. If a buffer is submitted too late, an underrun occurs and the input data is lost. You can monitor for underruns by checking the ADI_RECORD_UNDERRUN bit in the value field of the ADIEVN_RECORD_BUFFER_FULL event. Use adiGetRecordStatus to retrieve a count of underruns that occurred since record started.

Note: You cannot initiate a record operation while playing voice or generating tones unless beeptime or beepfreq is 0. You cannot start a record operation if the energy detector is active, unless both novoicetime and silencetime are zero.

See Also

adiSubmitRecordBuffer, adiRecordToMemory, adiStartRecording, adiStopRecording, adiGetEncodingInfo

Example

Refer to the playrec demonstration program.



Table of Contents Index NMS Glossary Previous Page Next Page (Page 28 of 69 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2000, Natural MicroSystems, Inc. All rights reserved.