(Page 4 of 8 in this chapter)


6.3 Data Transfer Methods

AG Access provides three methods by which the application can transfer voice data to and from the AG board:

The AG Access functions an application uses to initiate play or record operations depend upon the data transfer method selected, as shown below:

Memory Transaction

Asynchronous

Callback

Play

adiPlayFromMemory

adiPlayAsync

adiStartPlaying

Record

adiRecordToMemory

adiRecordAsync

adiStartRecording

The following three sections describe the general mechanics for the three transfer methods. These methods are described in greater detail in Section 6.5 and Section 6.6. AG Access contains the playrec demonstration program, which demonstrates play and record operations for both callback and asynchronous data transfer methods.

6.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 operation. AG Access divides the submitted buffer into AG physical segments and performs all handshaking with the board.

Note: A buffer submitted for playing can be shared by multiple instances of the play operation (within the same process) but a buffer submitted for recording 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.

In summary:

6.3.2 Asynchronous Data Transfer

The asynchronous transfer method gives an application maximum latitude with buffer address, size, and submission. An initial buffer is submitted when the play or record operation is started by calling adiPlayAsync or adiRecordAsync. AG Access generates events whenever more voice data is required (during a play operation) or when another buffer is required (during a record operation). The application is responsible for submitting buffers in a timely manner by calling adiSubmitPlayBuffer or adiSubmitRecordBuffer.

In summary:

6.3.3 Callback Data Transfer

The callback transfer method strikes a balance between simplicity in programming and resource consumption. AG Access allocates the buffers and invokes an application-specified callback function whenever a buffer needs to be filled (during a play operation) or when a buffer needs to be emptied (during a record operation). Within the callback routine, the application synchronously accesses the storage medium before returning.

In summary:



(Page 4 of 8 in this chapter)


tech_support@nmss.com
Copyright © 1997, Natural MicroSystems, Inc. All rights reserved.