/// <summary> /// Gets the control details /// </summary> protected void GetControlDetails() { mixerControlDetails.cbStruct = Marshal.SizeOf(mixerControlDetails); mixerControlDetails.dwControlID = mixerControl.dwControlID; if (IsCustom) { mixerControlDetails.cChannels = 0; } else if ((mixerControl.fdwControl & MixerInterop.MIXERCONTROL_CONTROLF_UNIFORM) != 0) { mixerControlDetails.cChannels = 1; } else { mixerControlDetails.cChannels = nChannels; } if ((mixerControl.fdwControl & MixerInterop.MIXERCONTROL_CONTROLF_MULTIPLE) != 0) { mixerControlDetails.hwndOwner = (IntPtr)mixerControl.cMultipleItems; } else if (IsCustom) { mixerControlDetails.hwndOwner = IntPtr.Zero; } else { mixerControlDetails.hwndOwner = IntPtr.Zero; } if (IsBoolean) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_BOOLEAN()); } else if (IsListText) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_LISTTEXT()); } else if (IsSigned) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_SIGNED()); } else if (IsUnsigned) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_UNSIGNED()); } else { // must be custom mixerControlDetails.cbDetails = mixerControl.Metrics.customData; } var detailsSize = mixerControlDetails.cbDetails * mixerControlDetails.cChannels; if ((mixerControl.fdwControl & MixerInterop.MIXERCONTROL_CONTROLF_MULTIPLE) != 0) { // fixing issue 16390 - calculating size correctly for multiple items detailsSize *= (int)mixerControl.cMultipleItems; } IntPtr buffer = Marshal.AllocCoTaskMem(detailsSize); // To copy stuff in: // Marshal.StructureToPtr( theStruct, buffer, false ); mixerControlDetails.paDetails = buffer; MmResult err = MixerInterop.mixerGetControlDetails(mixerHandle, ref mixerControlDetails, MixerFlags.Value | mixerHandleType); // let the derived classes get the details before we free the handle if (err == MmResult.NoError) { GetDetails(mixerControlDetails.paDetails); } Marshal.FreeCoTaskMem(buffer); if (err != MmResult.NoError) { throw new MmException(err, "mixerGetControlDetails"); } }
/// <summary> /// Gets the control details /// </summary> protected void GetControlDetails() { mixerControlDetails.cbStruct = Marshal.SizeOf(mixerControlDetails); mixerControlDetails.dwControlID = mixerControl.dwControlID; if (IsCustom) { mixerControlDetails.cChannels = 0; } else if ((mixerControl.fdwControl & MixerInterop.MIXERCONTROL_CONTROLF_UNIFORM) != 0) { mixerControlDetails.cChannels = 1; } else { mixerControlDetails.cChannels = nChannels; } if ((mixerControl.fdwControl & MixerInterop.MIXERCONTROL_CONTROLF_MULTIPLE) != 0) { mixerControlDetails.cMultipleItems = mixerControl.cMultipleItems; } else if (IsCustom) { mixerControlDetails.cMultipleItems = 0; // TODO: special cases } else { mixerControlDetails.cMultipleItems = 0; } if (IsBoolean) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_BOOLEAN()); } else if (IsListText) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_LISTTEXT()); } else if (IsSigned) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_SIGNED()); } else if (IsUnsigned) { mixerControlDetails.cbDetails = Marshal.SizeOf(new MixerInterop.MIXERCONTROLDETAILS_UNSIGNED()); } else { // must be custom mixerControlDetails.cbDetails = mixerControl.Metrics.customData; } // from the structs sample in MSDN (see MyPerson2) IntPtr buffer = Marshal.AllocCoTaskMem(mixerControlDetails.cbDetails * mixerControlDetails.cChannels); // To copy stuff in: // Marshal.StructureToPtr( theStruct, buffer, false ); mixerControlDetails.paDetails = buffer; MmResult err = MixerInterop.mixerGetControlDetails(mixerHandle, ref mixerControlDetails, MixerFlags.Value | mixerHandleType); // let the derived classes get the details before we free the handle if (err == MmResult.NoError) { GetDetails(mixerControlDetails.paDetails); } Marshal.FreeCoTaskMem(buffer); if (err != MmResult.NoError) { throw new MmException(err, "mixerGetControlDetails"); } }
/// <summary> /// Gets the control details /// </summary> // Token: 0x060005CD RID: 1485 RVA: 0x00012F18 File Offset: 0x00011118 protected void GetControlDetails() { this.mixerControlDetails.cbStruct = Marshal.SizeOf(this.mixerControlDetails); this.mixerControlDetails.dwControlID = this.mixerControl.dwControlID; if (this.IsCustom) { this.mixerControlDetails.cChannels = 0; } else if ((this.mixerControl.fdwControl & 1u) != 0u) { this.mixerControlDetails.cChannels = 1; } else { this.mixerControlDetails.cChannels = this.nChannels; } if ((this.mixerControl.fdwControl & 2u) != 0u) { this.mixerControlDetails.hwndOwner = (IntPtr)((long)((ulong)this.mixerControl.cMultipleItems)); } else if (this.IsCustom) { this.mixerControlDetails.hwndOwner = IntPtr.Zero; } else { this.mixerControlDetails.hwndOwner = IntPtr.Zero; } if (this.IsBoolean) { this.mixerControlDetails.cbDetails = Marshal.SizeOf(default(MixerInterop.MIXERCONTROLDETAILS_BOOLEAN)); } else if (this.IsListText) { this.mixerControlDetails.cbDetails = Marshal.SizeOf(default(MixerInterop.MIXERCONTROLDETAILS_LISTTEXT)); } else if (this.IsSigned) { this.mixerControlDetails.cbDetails = Marshal.SizeOf(default(MixerInterop.MIXERCONTROLDETAILS_SIGNED)); } else if (this.IsUnsigned) { this.mixerControlDetails.cbDetails = Marshal.SizeOf(default(MixerInterop.MIXERCONTROLDETAILS_UNSIGNED)); } else { this.mixerControlDetails.cbDetails = this.mixerControl.Metrics.customData; } int num = this.mixerControlDetails.cbDetails * this.mixerControlDetails.cChannels; if ((this.mixerControl.fdwControl & 2u) != 0u) { num *= (int)this.mixerControl.cMultipleItems; } IntPtr intPtr = Marshal.AllocCoTaskMem(num); this.mixerControlDetails.paDetails = intPtr; MmResult mmResult = MixerInterop.mixerGetControlDetails(this.mixerHandle, ref this.mixerControlDetails, this.mixerHandleType); if (mmResult == MmResult.NoError) { this.GetDetails(this.mixerControlDetails.paDetails); } Marshal.FreeCoTaskMem(intPtr); if (mmResult != MmResult.NoError) { throw new MmException(mmResult, "mixerGetControlDetails"); } }