AudioControlTemplate.GetChannels Method

Definition

Gets audio channels.

public:
 System::Collections::Generic::IDictionary<Microsoft::Rtc::Collaboration::AudioVideo::ChannelLabel, Microsoft::Rtc::Collaboration::AudioVideo::AudioChannelTemplate ^> ^ GetChannels();
public System.Collections.Generic.IDictionary<Microsoft.Rtc.Collaboration.AudioVideo.ChannelLabel,Microsoft.Rtc.Collaboration.AudioVideo.AudioChannelTemplate> GetChannels ();
member this.GetChannels : unit -> System.Collections.Generic.IDictionary<Microsoft.Rtc.Collaboration.AudioVideo.ChannelLabel, Microsoft.Rtc.Collaboration.AudioVideo.AudioChannelTemplate>
Public Function GetChannels () As IDictionary(Of ChannelLabel, AudioChannelTemplate)

Returns

IDictionary<ChannelLabel,AudioChannelTemplate>

Dictionary with with an AudioChannelTemplate indexed by its ChannelLabel

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 &amp;&amp;
            audioChannel.SendDirectionSamplingRate == AudioSamplingRate.EightKhz)
        {
            // remote side accepted changes as they were
        }
        else
        {
            // remote side accepted changes but filtered them more.
        }
    }),
    this);



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.

Applies to