Partilhar via


AudioControlTemplate.GetChannels Method

Gets audio channels.

Namespace:  Microsoft.Rtc.Collaboration.AudioVideo
Assembly:  Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)

Syntax

'Declaration
Public Function GetChannels As IDictionary(Of ChannelLabel, AudioChannelTemplate)
'Usage
Dim instance As AudioControlTemplate
Dim returnValue As IDictionary(Of ChannelLabel, AudioChannelTemplate)

returnValue = instance.GetChannels()
public IDictionary<ChannelLabel, AudioChannelTemplate> GetChannels()

Return Value

Type: System.Collections.Generic.IDictionary<ChannelLabel, AudioChannelTemplate>
Dictionary with with an AudioChannelTemplate indexed by its ChannelLabel

Remarks

Returns a read-only dictionary of the channels held by AudioControlTemplate. Any modification of the Dictionary will not have an effect, as the returned object is a copy of the original.

Examples

The following example creates an AudioVideoFlowTemplate based on an AudioVideoFlow, modifies AudioChannelTemplate properties and apply its changes to the AudioVideoFlow.

C# Modifying AudioChannelTemplate properties.

 

            AudioVideoFlowTemplate templateToApply = new AudioVideoFlowTemplate(audioVideoFlow);
            AudioChannelTemplate audioChannelTemplate = (AudioChannelTemplate)templateToApply.Audio.GetChannels()[ChannelLabel.AudioMono];
            audioChannelTemplate.AllowedDirection = MediaChannelDirection.SendOnly;
            audioChannelTemplate.SendDirectionSamplingRate = AudioSamplingRate.EightKhz;

            // ApplyChanges
            audioVideoFlow.BeginApplyChanges(
                templateToApply,
                new AsyncCallback(delegate(IAsyncResult result)
                {
                    try
                    {
                        audioVideoFlow.EndApplyChanges(result);
                    }
                    catch (RealTimeException e)
                    {
                        // handle exception
                        throw e;
                    }

                    // ApplyChanges is done, verify changes result..
                    AudioChannel audioChannel = audioVideoFlow.Audio.GetChannels()[ChannelLabel.AudioMono];
                    if (audioChannel.Direction == MediaChannelDirection.SendOnly &&
                        audioChannel.SendDirectionSamplingRate == AudioSamplingRate.EightKhz)
                    {
                        // remote side accepted changes as they were
                    }
                    else
                    {
                        // remote side accepted changes but filtered them more.
                    }
                }),
                this);


See Also

Reference

AudioControlTemplate Class

AudioControlTemplate Members

Microsoft.Rtc.Collaboration.AudioVideo Namespace