Native play

To implement native play functionality, the application performs the following tasks:

The following illustration shows an overview of the native play mechanism:

Sample procedure

When implementing native play functionality, applications use functions from the following resources:

The following procedure shows the function sequence used to implement a typical native play operation:

Step

Action

1

ctaCreateQueue creates a NaturalAccess event queue.

ctaCreateQueue (&queuehd)

2

ctaCreateContext creates a NaturalAccess context for the audio channel.

ctaCreateContext (queuehd, &ctahd)

3

ctaOpenServices opens the ADI and MSPP APIs on the context.

ctaOpenServices (ctahd, svclist, nsvcs)

4

adiStartProtocol starts the nocc protocol on the ADI port.

adiStartProtocol (ctahd, "nocc", NULL, startparms)

5

mspCreateEndpoint creates an audio MSPP API RTP endpoint and returns an MSPP API endpoint handle (ephd).

mspCreateEndpoint (ctahd, mspaddrstruct, mspparmstruct, &rtpephd)

6

mspGetFilterHandle retrieves the runtime filter ID (fltID) associated with the RTP endpoint handle (ephd). The application uses the returned fltID as the destination for the audio stream played out from the ADI port.

mspGetFilterHandle (rtpephd, MSP_ENDPOINT_RTPFDX, &fltID)

7

adiSetNativeInfo specifies both the context handle of the ADI port and the RTP endpoint fltID returned by mspGetFilterHandle, sets NMS native play parameters.

adiSetNativeInfo (ctahd, NULL, fltID, fltID_parms)

8

adiPlayFromMemory starts playing a message.

adiPlayFromMemory (ctahd, encoding, buffer, bufsize, parms)

9

adiStopPlaying stops playing the message.

adiStopPlaying (ctahd)

Example

The following example shows how to perform a native play operation:

ret = ctaCreateQueue( NULL, 0, &hCtaQueueHd );

ret = ctaCreateContext( hCtaQueueHd, 0, "Play", &ctahd );

ServiceCount = 2;
ServDesc[0].name.svcname         = "ADI";
ServDesc[0].name.svcmgrname      = "ADIMGR";
ServDesc[0].mvipaddr.board       = board;
ServDesc[0].mvipaddr.mode        = 0;
ServDesc[1].name.svcname         = "MSP";
ServDesc[1].name.svcmgrname      = "MSPMGR";
ret = ctaOpenServices( ctahd, ServDesc, ServiceCount );
ret = WaitForSpecificEvent( CTAEVN_OPEN_SERVICES_DONE, &event );

ret = adiStartProtocol( ctahd, "nocc", NULL, NULL );
ret = WaitForSpecificEvent( ADIEVN_STARTPROTOCOL_DONE, &event );

// create mspp RTP endpoint
ret = mspCreateEndpoint( ctahd, &mspAddr, &mspParm, &ephd );
ret = WaitForSpecificEvent( MSPEVN_CREATE_ENDPOINT_DONE, &event );

// get cg6xxx board handle
ret = mspGetFilterHandle( msphd, MSP_FILTER_RTPFDX_EPH, rtp_play_filter_handle );
ret = adiSetNativeInfo( ctahd, NULL,  /* no ingress handle, as this is a play only */
          rtp_play_filter_handle, &natpr_ctl );  /* RTP endpoint filter ID
          specified as a destination for audio */
ret = adiPlayFromMemory( ctahd, ADI_ENCODE_EDTX_AMRNB,  /* audio play */
           MemoryBuffer, RecordedBytes, NULL );