[Mwinapi-commits] SF.net SVN: mwinapi:[79] trunk/ManagedWinapi/MixerControl.cs
Status: Beta
Brought to you by:
schierlm
|
From: <sch...@us...> - 2009-02-08 15:26:31
|
Revision: 79
http://mwinapi.svn.sourceforge.net/mwinapi/?rev=79&view=rev
Author: schierlm
Date: 2009-02-08 15:26:24 +0000 (Sun, 08 Feb 2009)
Log Message:
-----------
Add support for ListMixerControls (like the multiplexer of the DST_WAVEIN line)
Modified Paths:
--------------
trunk/ManagedWinapi/MixerControl.cs
Modified: trunk/ManagedWinapi/MixerControl.cs
===================================================================
--- trunk/ManagedWinapi/MixerControl.cs 2009-01-17 14:28:47 UTC (rev 78)
+++ trunk/ManagedWinapi/MixerControl.cs 2009-02-08 15:26:24 UTC (rev 79)
@@ -203,6 +203,10 @@
{
result = new BooleanMixerControl(mx, ml, mc);
}
+ else if (result.Class == MixerControlClass.LIST && ((uint)result.ControlType & MIXERCONTROL_CT_SUBCLASS_MASK) == (uint)MixerControlType.MIXERCONTROL_CT_SC_SWITCH_BOOLEAN && ((uint)result.ControlType & MIXERCONTROL_CT_UNITS_MASK) == (uint)MixerControlType.MIXERCONTROL_CT_UNITS_BOOLEAN)
+ {
+ result = new ListMixerControl(mx, ml, mc);
+ }
return result;
}
@@ -270,6 +274,15 @@
public int fValue;
}
+ internal struct MIXERCONTROLDETAILS_LISTTEXT
+ {
+ public int dwParam1;
+ public int dwParam2;
+
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
+ public string szName;
+ }
+
private static readonly int MIXER_GETLINECONTROLSF_ALL = 0x0;
private static readonly uint MIXERCONTROL_CT_CLASS_MASK = 0xF0000000;
@@ -426,6 +439,45 @@
}
/// <summary>
+ /// A control that is a list of values which can be selected or not.
+ /// Note that some lists allow only one selected element.
+ /// </summary>
+ public class ListMixerControl : BooleanMixerControl
+ {
+ internal ListMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
+
+ /// <summary>
+ /// Used to get the list text labels of this list.
+ /// </summary>
+ public string[] ListTexts
+ {
+ get
+ {
+ string[] result = new string[RawValueMultiplicity];
+ MIXERCONTROLDETAILS mcd = new MIXERCONTROLDETAILS();
+ MIXERCONTROLDETAILS_LISTTEXT mcdlt = new MIXERCONTROLDETAILS_LISTTEXT();
+ mcd.cbStruct = Marshal.SizeOf(mcd);
+ mcd.dwControlID = ctrl.dwControlID;
+ mcd.cChannels = ChannelCount;
+ mcd.cMultipleItems = ctrl.cMultipleItems;
+ mcd.paDetails = Marshal.AllocCoTaskMem(Marshal.SizeOf(mcdlt) * result.Length);
+ mcd.cbDetails = Marshal.SizeOf(mcdlt);
+ int err;
+ if ((err = mixerGetControlDetailsA(mx.Handle, ref mcd, 1)) != 0)
+ {
+ throw new Win32Exception("Error #" + err + " calling mixerGetControlDetails()");
+ }
+ for (int i = 0; i < result.Length; i++)
+ {
+ mcdlt = (MIXERCONTROLDETAILS_LISTTEXT)Marshal.PtrToStructure(new IntPtr(mcd.paDetails.ToInt64() + Marshal.SizeOf(mcdlt) * i), typeof(MIXERCONTROLDETAILS_LISTTEXT));
+ result[i] = mcdlt.szName;
+ }
+ return result;
+ }
+ }
+ }
+
+ /// <summary>
/// Mixer control type classes. These classes are roughly based upon what type of
/// value a control adjusts, and therefore what kind of graphical user interface
/// you would normally present to the enduser to let him adjust that control's value.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|