The topics in this section describe the audio devices that are available in Microsoft Unified Communications Managed API 2.0 Core SDK: Player, Recorder, ToneController, SpeechRecognitionConnector, and SpeechSynthesisConnector. These devices, respectively, can be used to play recorded audio, record audio, send and receive telephone dial tones, convert speech to text, or convert text to speech.

In Unified Communications Managed API 2.0 Core SDK, devices are users of media data, and have AudioVideoFlowinstances attached to them. Although these devices are represented as properties on the AudioVideoFlowclass, they are not automatically instantiated and each device is independent of the AudioVideoFlowinstance that is attached to it. Before any of these devices can be used, it must be created, and then attached to an AudioVideoFlowinstance. Although most of the devices are associated with a single AudioVideoFlowinstance, a Playerdevice can have multiple AudioVideoFlowinstances attached to it. In addition, an AudioVideoFlowinstance can be detached from a given Player, and another AudioVideoFlowinstance can be attached.

The following code example shows the steps required to create a Playerand attach an existing AudioVideoFlowinstance to it.

Copy Code
Player myPlayer = new Player();
myPlayer.AttachFlow(avFlow);

Each of the devices has an AttachFlowmethod that it uses to attach an AudioVideoFlowinstance. Simillarly, each device has a DetachFlowmethod that it uses to detach the previously-attached AudioVideoFlowinstance. The AttachFlowand DetachFlowoperations can happen at any time, independent of the state of the AudioVideoFlowinstance.

Except for a Playerdevice, a given AudioVideoFlowinstance can be attached to only one device at a time. The AudioVideoFlowcan remove the channel spontaneously if the Real-Time Protocol (RTP) connection is broken or if the far end requests a hold or renegotiation.

When a device is shut down, the attached AudioVideoFlowis not automatically detached. The AudioVideoFlowremains attached until it is detached. The AudioVideoFlowmust eventually be detached, or a memory leak will result. A long-lived device such as a Playercan have many flows attached to it, and each flow and all related objects remain in memory even when the Playeris shut down.

This section contains the following topics: