# adiSubmitRecordBuffer

Supplies an empty buffer to an asynchronous
record operation that was initiated using adiRecordAsync.

#### Supported board types

- AG

- CG

#### Prototype

DWORD adiSubmitRecordBuffer ( CTAHD ctahd, void *buffer, unsigned size)

Argument | Description
ctahd | Context handle returned by ctaCreateContext or ctaAttachContext.
buffer | Pointer into process memory where recorded voice data will be written.
size | Size of the buffer (bytes).

#### Return values

Return value | Description
SUCCESS |
ADIERR_TOO_MANY_BUFFERS | More than two buffers were submitted. A maximum of two buffers can be submitted to a record operation at any given time.
CTAERR_BAD_ARGUMENT | buffer is NULL.
CTAERR_BAD_SIZE | size is 0 (zero).
CTAERR_FUNCTION_NOT_ACTIVE | Either not recording or the recording operation was not initiated by calling adiRecordAsync.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_INVALID_SEQUENCE | adiStopRecording was already invoked.
CTAERR_INVALID_STATE | Function not available in the current port state.
CTAERR_SVR_COMM | Server communication error.

#### Events

Event | Description
ADIEVN_RECORD_BUFFER_FULL | Generated by the ADI service when a buffer is filled with recorded voice data. The event contains the following fields: buffer Pointer to a previously submitted user buffer. size Number of bytes recorded into buffer. value Flags; if the ADI_RECORD_BUFFER_REQ bit is set, more buffers are needed and the application must submit another empty buffer. If the ADI_RECORD_UNDERRUN bit is set, an underrun occurred. There was no new buffer to record information when this one completed.
ADIEVN_RECORD_DONE | Generated by the ADI service when the record operation terminates. The event size field contains the total number of bytes recorded during the function instance. The value field contains one of the following termination reasons or an error code: CTA_REASON_DIGIT Aborted due to DTMF. CTA_REASON_NO_VOICE Remote party never spoke. CTA_REASON_RELEASED Call terminated. CTA_REASON_STOPPED Stopped by application request. CTA_REASON_TIMEOUT Maximum record limit reached. CTA_REASON_VOICE_END Remote party stopped speaking. CTAERR_xxx or ADIERR_xxx Record failed.

#### Details

Use adiSubmitRecordBuffer to asynchronously submit empty buffers to a record operation, provided that the:

- Record operation was initiated by adiRecordAsync.

- Record operation is active.

- Application does not already have two actively submitted buffers.

The ADI service truncates the size so that the effective size is a multiple of the encoding frame size selected in adiRecordAsync. If the effective size is zero, CTAERR_BAD_SIZE is returned.

#### See also

adiGetRecordStatus

#### Example

Refer to the playrec demonstration program.