Ejemplo n.º 1
0
        public MixerInfo GetMixerControls()
        {
            MIXERLINE         mxl = new MIXERLINE();
            MIXERLINECONTROLS mlc = new MIXERLINECONTROLS();

            mxl.cbStruct = (uint)Marshal.SizeOf(typeof(MIXERLINE));
            mlc.cbStruct = (uint)Marshal.SizeOf(typeof(MIXERLINECONTROLS));

            WinMNWarpConstants.mixerGetLineInfo(IntPtr.Zero, ref mxl, MIXER.OBJECTF_MIXER | MIXER.GETLINEINFOF_DESTINATION);

            mlc.dwLineID  = mxl.dwLineID;
            mlc.cControls = mxl.cControls;
            mlc.cbmxctrl  = (uint)Marshal.SizeOf(typeof(MIXERCONTROL));
            mlc.pamxctrl  = Marshal.AllocHGlobal((int)(mlc.cbmxctrl * mlc.cControls));

            WinMNWarpConstants.mixerGetLineControls(IntPtr.Zero, ref mlc, MIXER.OBJECTF_MIXER | MIXER.GETLINECONTROLSF_ALL);

            MixerInfo rtn = new MixerInfo();

            for (int i = 0; i < mlc.cControls; i++)
            {
                MIXERCONTROL mxc = (MIXERCONTROL)Marshal.PtrToStructure((IntPtr)((int)mlc.pamxctrl + (int)mlc.cbmxctrl * i), typeof(MIXERCONTROL));
                switch (mxc.dwControlType)
                {
                case MIXERCONTROL_CONTROLTYPE.VOLUME:
                    rtn.volumeCtl = mxc.dwControlID;
                    rtn.minVolume = mxc.Bounds.lMinimum;
                    rtn.maxVolume = mxc.Bounds.lMaximum;
                    break;

                case MIXERCONTROL_CONTROLTYPE.MUTE:
                    rtn.muteCtl = mxc.dwControlID;
                    break;
                }
            }

            Marshal.FreeHGlobal(mlc.pamxctrl);

            return(rtn);
        }
Ejemplo n.º 2
0
 internal static extern uint mixerGetLineControls(IntPtr hmxobj, ref MIXERLINECONTROLS pmxlc, MIXER flags);