private MIXERCONTROL GetLineControl(int controlType) { MIXERCONTROL mxc = new MIXERCONTROL(); mxc.Bounds = new Volume(); MIXERLINECONTROLS mxlc = new MIXERLINECONTROLS(); IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(MIXERCONTROL))); Marshal.StructureToPtr(mxc, p, true); mxlc.cbStruct = Marshal.SizeOf(typeof(MIXERLINECONTROLS)); mxlc.dwLineID = this.lineid; mxlc.dwControlType = controlType; mxlc.cControls = 1; mxlc.cbmxctrl = Marshal.SizeOf(typeof(MIXERCONTROL)); mxlc.pamxctrl = p; Mixer.mixerGetLineControls((int)mixer.Handle, ref mxlc, Mixer.MIXER_OBJECTF_HMIXER | Mixer.MIXER_GETLINECONTROLSF_ONEBYTYPE); mxc = (MIXERCONTROL)Marshal.PtrToStructure(mxlc.pamxctrl, typeof(MIXERCONTROL)); return(mxc); }
private MIXERCONTROL GetLineControl(int controlType) { MIXERCONTROL mxc=new MIXERCONTROL();mxc.Bounds=new Volume(); MIXERLINECONTROLS mxlc=new MIXERLINECONTROLS(); IntPtr p=Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(MIXERCONTROL))); Marshal.StructureToPtr(mxc,p,true); mxlc.cbStruct = Marshal.SizeOf(typeof(MIXERLINECONTROLS)); mxlc.dwLineID =this.lineid; mxlc.dwControlType =controlType; mxlc.cControls = 1; mxlc.cbmxctrl = Marshal.SizeOf(typeof(MIXERCONTROL)); mxlc.pamxctrl = p; Mixer.mixerGetLineControls((int)mixer.Handle,ref mxlc,Mixer.MIXER_OBJECTF_HMIXER |Mixer.MIXER_GETLINECONTROLSF_ONEBYTYPE); mxc=(MIXERCONTROL)Marshal.PtrToStructure(mxlc.pamxctrl,typeof(MIXERCONTROL)); return mxc; }