playrec demonstrates voice play and record using asynchronous buffer submission and play and record callback routines. This demonstration operates in two phases: asynchronous voice play and record operations, and callback voice play and record operations.
If you do not specify a buffer size on the command line (-z), playrec retrieves the board physical buffer using adiGetEncodingInfo.
The demonstration is constructed so that the play and record functions are synchronous within the application. This is a single-port, single-threaded demonstration.
Note: adiStartPlaying and adiStartRecording (and consequently, this demonstration program) are not supported while Natural Access is running in client/server mode.
playrec [options]
where options are:
|
Option |
Use this option to... |
|---|---|
|
-? |
Display command line options. |
|
-h |
Display command line options. |
|
-b n |
Specify the board number n. Default is 0. |
|
-s n:m |
Specify MVIP stream and timeslot. Default is 0:0. |
|
-r n |
Specify the maximum recording duration (in seconds). |
|
-z n |
Specify the application buffer size. Must be a multiple of NMS_24 frame size (62). |
adiGetEncodingInfo, adiPlayAsync, adiRecordAsync, adiStartPlaying, adiStartRecording, adiSubmitPlayBuffer, adiSubmitRecordBuffer
The following procedure assumes that you are using an AG 2000 DID board with a 2500-type telephone connected to one of the lines.
To run playrec:
|
Step |
Action |
|
1 |
Navigate to the \nms\ctaccess\demos\playrec directory. |
|
2 |
Start playrec by entering the following command at the prompt: playrec [-b n -s n:m -r n -z n] Make sure that you specify the proper board and timeslot. The default value for both arguments is 0 (zero). You are prompted to record a brief message. The prompt is played using asynchronous buffer submission and ADIEVN_PLAY_BUFFER_REQ is displayed on your screen (assuming you did not specify an application buffer large enough to fit the whole prompt file). You can prematurely terminate the prompt by entering a touchtone. |
|
3 |
At the record beep prompt, begin speaking. ADIEVN_RECORD_BUFFER_FULL displays on your screen for each buffer_size time period. |
|
4 |
You can prematurely terminate the recording by entering a touchtone or by ceasing to speak. The recording you just made is played back. Again, the message ADIEVN_PLAY_BUFFER_REQ displays on your screen. |
|
5 |
Repeat steps 2 and 3. The process repeats using callback mode. Since Natural Access automatically invokes the callback routine, the displayed event messages are replaced with the corresponding callback events. |
Note: This demonstration program enables 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.