Table of Contents Index NMS Glossary Previous Page Next Page (Page 26 of 69 in this chapter) Version


adiPlayFromMemory

Description

Initiates a voice play operation using data from a single memory-resident buffer.

Prototype

DWORD adiPlayFromMemory ( CTAHD ctahd,
unsigned encoding,
void *buffer,
unsigned bufsize,
ADI_PLAY_PARMS *parms )

ctahd CTA context handle returned by ctaCreateContext.

encoding Encoding type (refer to adidef.h for a complete list of ADI_ENCODING_xxx values).

buffer Pointer to voice data buffer.

bufsize Number of bytes stored at the address in buffer (bufsize can be arbitrarily large).

parms Pointer to play parameters according to the structure below (NULL uses default values):

typedef struct

{ /* parms related to adiStartPlaying: */

DWORD size ; /* size of this structure */

DWORD DTMFabort; /* abort on DTMF; */

DWORD speed; /* initial speed in percent */

DWORD maxspeed; /* maximum play speed in percent */

} ADI_PLAY_PARMS;

Return Values

Events

DSP File

For AG and CG hardware, each encoding rate of this function requires a specific DSP file to be loaded. For more information about DSP files and encoding rates refer to adiPlayAsync.

Note: Refer to the QX 2000 Installation and Developer's Manual for DSP file information specific to the QX board family. Refer to the AG 2000 Installation and Developer's Manual, the AG 4000 Installation and Developer's Manual and the AG 4000C Installation and Developer's Manual for the DSP files for the AG 2000 and AG 4000/C boards. Refer to the CG 6000C Installation and Developer's Manual for the DSP files for the CG 6000C board.

Details

The adiPlayFromMemory starts playing a single memory-resident buffer of bufsize bytes. The ADI service generates an ADIEVN_PLAY_DONE event when the function terminates. To avoid unintentionally modifying data, the application should not attempt to modify the buffer until it receives the DONE event.

See Also

adiStartPlaying, adiPlayAsync, adiStopPlaying, adiGetPlayStatus, adiGetEncodingInfo, adiModifyPlayGain, adiModifyPlaySpeed

Example


int myPlayMemory( CTAHD ctahd, unsigned encoding,
                  void *buffer, unsigned bufsize )
{
 CTA_EVENT event;

    if( adiPlayFromMemory( ctahd, encoding, buffer, bufsize, NULL ) != SUCCESS)
        return MYFAILURE;

    do 
    {
        myGetEvent( &event );           /* see ctaWaitEvent example        */
    } while( event.id != ADIEVN_PLAY_DONE );

    if( event.value == CTA_REASON_RELEASED )
        return MYDISCONNECT;            /* call has been terminated        */
    else if( CTA_IS_ERROR( event.value ) )
        return MYFAILURE;           /* API error        */
    else
        return SUCCESS;           /* stopped normally        */
}




Table of Contents Index NMS Glossary Previous Page Next Page (Page 26 of 69 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2000, Natural MicroSystems, Inc. All rights reserved.