8.3 Play and Record

(Page 4 of 12 in this chapter)
Name: playrec

Purpose: Demonstrates alternate means for voice play and record using asynchronous buffer submission and play and record callbacks.

Usage: playrec [options]

where options are:

Option

Description

-? -h

Displays command line options.

-b n

Specifies the AG board <n>. Default=0.

-s n:m

Specifies MVIP stream and timeslot.
Default=0:0.

-r

Specifies the maximum recording duration (seconds).

-z

Specifies the application buffer size. Must be a multiple of NMS_24 frame size (62).

Highlights:

adiPlayAsync
adiSubmitPlayBuffer
adiStartPlaying
adiRecordAsync
adiSubmitRecordBuffer
adiStartRecording
adiGetEncodingInfo

Description:

This demo operates in two phases -- asynchronous voice function and callback voice functions. If you do not specify a buffer size on the command line (-z), the demo will retrieve the AG physical buffer via adiGetEncodingInfo.

The demo is constructed such that the play and record functions are synchronous within the application. This is a single-port/single-thread demo.

Procedure:

The following assumes that you are testing on an AG-8 DID with a 2500-type telephone connected to one of the lines.

Begin execution of playrec. Ensure that you specify the proper AG board and MVIP stream.

You will be prompted to record a brief message. The prompt is played via asynchronous buffer submission and you should see ADIEVN_PLAY_BUFFER_REQ displayed on your screen (assuming you haven't specified an application buffer large enough to fit the whole prompt file). You can terminate the prompt prematurely by entering a touch-tone.

At the record beep, begin speaking. You should see ADIEVN_RECORD_BUFFER_FULL displayed on your screen each "buffer size" time periods. You can terminate the recording prematurely by entering a touch- tone or by ceasing to speak.

The recording you just made is played back. Again, the message ADIEVN_PLAY_BUFFER_REQ is displayed on your screen.

The sequence of the above procedure is repeated with callbacks. The event messages displayed on the monitor are replaced with callback messages because the callback is invoked by AG Access.

Note:

This demo allows you to experiment with buffer sizes. The encoding format for the files is ADI_ENCODE_NMS_24 which has a 62-byte frame size. Buffer sizes you specify with the -z option must therefore be multiples of 62.


(Page 4 of 12 in this chapter)

Copyright 1996 Natural MicroSystems, Inc. All Rights Reserved.