MidiRenderers Property

Summary
Gets the registered midi renderers collection object.
Syntax
C#
C++/CLI
[EditorAttribute(System.Type, System.Type)] 
public MidiRenderers MidiRenderers { get; } 
public: 
property MidiRenderers^ MidiRenderers { 
   MidiRenderers^ get(); 
} 

Property Value

A MidiRenderers collection object representing the available midi renderers.

Remarks

Gets the registered audio renderers collection object. The MidiRenderers object is used to enumerate the available mide renderers, and to select a midi renderer for audio output.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public bool _result = false; 
public PlayCtrlForm _form = new PlayCtrlForm(); 
public PlayCtrl _playctrl; 
public TestCtrlSubForm _pcsbform; 
 
public void MidiRenderersExample() 
{ 
   // reference the play control 
   _playctrl = _form.PlayCtrl; 
 
   // input file 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_SourceVideoOnly.avi"); 
 
   try 
   { 
      // create the sub form for renderers listbox 
      _pcsbform = new TestCtrlSubForm(); 
 
      _pcsbform.Load += new EventHandler(Form_Load); 
      _pcsbform.buttonRefresh.Click += new EventHandler(Refresh_Click); 
      _pcsbform.List.Click += new EventHandler(List_Click); 
 
      // set autostart to false 
      _playctrl.AutoStart = false; 
 
      // set our source media file 
      _playctrl.SourceFile = inFile; 
 
      // show the renderers form 
      _pcsbform.ShowDialog(); 
 
      // get the selected renderer index 
      int selectedRenderer = _playctrl.MidiRenderers.Selection; 
 
      // set the result to what we expect  
      _result = (_pcsbform.List.SelectedItem != null && _playctrl.MidiRenderers.Selection != -1); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
 
void Form_Load(object sender, EventArgs e) 
{ 
   //  build the audio renderer list 
   EnumerateRenderers(_playctrl.MidiRenderers, _pcsbform.List); 
} 
 
void List_Click(object sender, EventArgs e) 
{ 
   //  select the audio renderer 
   SelectRenderer(_playctrl.MidiRenderers, _pcsbform.List); 
} 
 
void Refresh_Click(object sender, EventArgs e) 
{ 
   //  refresh audio renderers 
   RefreshRenderers(_playctrl.MidiRenderers, _pcsbform.List); 
} 
 
void EnumerateRenderers(MidiRenderers midiRenderers, 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 <= (midiRenderers.Count - 1)); i++) 
   { 
      List.Items.Add(midiRenderers[i]); 
      if (midiRenderers[i].Selected) 
      { 
         Selected = i; 
      } 
   } 
   //  highlight the current selection 
   List.SelectedIndex = Selected; 
} 
 
void RefreshRenderers(MidiRenderers midiRenderers, ListBox List) 
{ 
   string SelectedName = string.Empty; 
 
   //  save the currently selected renderer's name 
   if (midiRenderers.Selection >= 0) 
      SelectedName = midiRenderers[midiRenderers.Selection].FriendlyName; 
 
   //  refresh the renderer collection 
   midiRenderers.Refresh(); 
 
   //  if there was a previously selected renderer, reselect it 
   if (SelectedName != string.Empty) 
      midiRenderers.Selection = midiRenderers.IndexOf(SelectedName); 
 
   //  rebuild the listbox 
   EnumerateRenderers(midiRenderers, List); 
} 
 
void SelectRenderer(MidiRenderers midiRenderers, ListBox List) 
{ 
   //  select the highlighted renderer 
   midiRenderers.Selection = midiRenderers.IndexOf(List.Items[List.SelectedIndex] as Renderer); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS23\Media"; 
} 
Requirements

Target Platforms

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

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