Voice Record and
Playback Functions
4.3 Data Transfer Methods
(Page 4 of 8 in this chapter)
- AG Access employs a double-buffering scheme when recording and playing
speech files. This means that when the AG board finishes processing a speech
buffer, the subsequent speech buffer must already be allocated and submitted to
AG Access by the application.
- Failure to maintain pace with the AG board causes underruns in the record or
playback. Underruns are manifested as gaps in the speech. AG Access counts the
number of underruns that occur but not their duration. The underrun count is
retrieved via adiGetRecordStatus and adiGetPlayStatus functions.
- Note: It is important not to submit small buffers (e.g., buffers that hold less than
one second of data) because small buffers can also cause underruns. The data
throughput for a given encoding method can be derived from the values returned
by adiGetEncodingInfo.
- AG Access provides three methods by which the application can transfer speech
data to and from the AG board:
- The functions used to initiate play or record depends upon the data transfer
method selected as shown below:
- The following three sections describe the general mechanics for the three transfer
methods. These methods are described in greater detail in Section 4.5 and
Section 4.6. The AG Access development kit contains the playrec demo, which
demonstrates the play and record functions for both the callback and
asynchronous methods.
4.3.1 Single Memory Transaction
- If the application invokes adiPlayFromMemory or adiRecordToMemory, it
supplies a single buffer that is retained by AG Access for the duration of the
function. AG Access divides the application buffer into AG physical segments
and performs all handshaking with the board.
- A play buffer can be shared by multiple instances of the play function (within the
same process) but the record buffer must be unique for each active recording
instance. When AG Access delivers the ADIEVN_PLAY_DONE or
ADIEVN_RECORD_DONE event to the application, the buffer is then available
for reuse or disposal.
4.3.2 Asynchronous Transfer
- The asynchronous transfer method gives you maximum latitude with buffer
address, size, and submission. An initial buffer is submitted when the play/record
function is started via adiPlayAsync or adiRecordAsync. AG Access generates
events whenever more speech data is required (play) or when a buffer is filled
(record). The application is responsible for submitting buffers in a timely manner
via adiSubmitPlayBuffer or adiSubmitRecordBuffer.
4.3.3 Callback Transfer
- The callback transfer method strikes a balance between simplicity and resource
consumption. AG Access allocates the buffers and invokes an application callback
function whenever a buffer needs to be filled (playing) or when a buffer needs to
be emptied (record). Within the callback, the application synchronously accesses
the storage medium before returning.
(Page 4 of 8 in this chapter)
Copyright 1996 Natural MicroSystems, Inc. All Rights Reserved.