AudioRenderers Property

Summary
Gets the registered audio renderer collection object.
Syntax
C#
C++/CLI
public AudioRenderers AudioRenderers { get; } 
public: 
property AudioRenderers^ AudioRenderers { 
   AudioRenderers^ get(); 
} 

Property Value

An AudioRenderers collection object representing the available audio renderers.

Remarks

The AudioRenderers object is used to enumerate the available audio renderers, and to select a renderer for audio output. For more information, refer to AudioRenderers.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public bool _result = false; 
public CaptureCtrlForm _form = new CaptureCtrlForm(); 
public CaptureCtrl _capturectrl; 
public TestCtrlSubForm _csbform; 
 
public void RenderersExample() 
{ 
   // reference the capture control 
   _capturectrl = _form.CaptureCtrl; 
 
   // input file 
   string outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_Source.avi"); 
 
   try 
   { 
      // create the sub form for renderers listbox 
      _csbform = new TestCtrlSubForm(); 
 
      _csbform.Load += new EventHandler(Form_Load); 
      _csbform.buttonRefresh.Click += new EventHandler(Refresh_Click); 
      _csbform.List.Click += new EventHandler(List_Click); 
 
      // show the renderers form 
      _csbform.ShowDialog(); 
 
      // get the selected renderer index 
      int selectedRenderer = _capturectrl.AudioRenderers.Selection; 
 
      // set the result to what we expect  
      _result = (_csbform.List.SelectedItem != null && _capturectrl.AudioRenderers.Selection != -1); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
 
void Form_Load(object sender, EventArgs e) 
{ 
   //  build the audio renderer list 
   EnumerateRenderers(_capturectrl.AudioRenderers, _csbform.List); 
} 
 
void List_Click(object sender, EventArgs e) 
{ 
   //  select the audio renderer 
   SelectRenderer(_capturectrl.AudioRenderers, _csbform.List); 
} 
 
void Refresh_Click(object sender, EventArgs e) 
{ 
   //  refresh audio renderers 
   RefreshRenderers(_capturectrl.AudioRenderers, _csbform.List); 
} 
 
void EnumerateRenderers(AudioRenderers Renderers, ListBox List) 
{ 
   //  Build the renderers list box 
   int Selected = -1; 
 
   // empty the list box 
   List.Items.Clear(); 
 
   // add the available audio renderers to the list box 
   for (int i = 0; (i <= (Renderers.Count - 1)); i++) 
   { 
      List.Items.Add(Renderers[i]); 
      if (Renderers[i].Selected) 
      { 
         Selected = i; 
      } 
   } 
   //  highlight the current selection 
   List.SelectedIndex = Selected; 
} 
 
void RefreshRenderers(AudioRenderers Renderers, ListBox List) 
{ 
   string SelectedName = string.Empty; 
 
   //  save the currently selected renderer's name 
   if (Renderers.Selection >= 0) 
      SelectedName = Renderers[Renderers.Selection].FriendlyName; 
 
   //  refresh the renderer collection 
   Renderers.Refresh(); 
 
   //  if there was a previously selected renderer, reselect it 
   if (SelectedName != string.Empty) 
      Renderers.Selection = Renderers.IndexOf(SelectedName); 
 
   //  rebuild the listbox 
   EnumerateRenderers(Renderers, List); 
} 
 
void SelectRenderer(AudioRenderers Renderers, ListBox List) 
{ 
   //  select the highlighted renderer 
   Renderers.Selection = Renderers.IndexOf(List.Items[List.SelectedIndex] as Renderer); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.