public static extern int mixerGetLineControls(IntPtr hmxobj, ref MIXERLINECONTROLS pmxlc, MIXER_GETLINECONTROLSFLAG fdwControls);
private void ReloadLines() { MMErrors errorCode = 0; mLines.Clear(); mUserLines.Clear(); MIXERLINE mxl = new MIXERLINE(); MIXERLINECONTROLS mlc = new MIXERLINECONTROLS(); MIXERCONTROL mc = new MIXERCONTROL(); uint dwDestination; unchecked { dwDestination = (uint)-1; } mxl.cbStruct = (uint)Marshal.SizeOf(mxl); if (mMixerType == MixerType.Recording) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_WAVEIN; errorCode = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) { throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); } } else if (mMixerType == MixerType.Playback) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_SPEAKERS; errorCode = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_UNDEFINED; errorCode = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) { throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); } } } dwDestination = mxl.dwDestination; MixerLine mixLine = new MixerLine(); if (mMixerType == MixerType.Recording) { mixLine.Direction = MixerType.Recording; } else if (mMixerType == MixerType.Playback) { mixLine.Direction = MixerType.Playback; } mixLine.Mixer = this; mixLine.Channels = mxl.cChannels; mixLine.CControls = mxl.cControls; mixLine.Connections = mxl.cConnections; mixLine.Flag = mxl.fdwLine; mixLine.Destination = dwDestination; mixLine.Name = mxl.szName; mixLine.Id = mxl.dwLineID; mixLine.ComponentType = mxl.dwComponentType; mixLine.Source = mxl.dwSource; mixLine.HMixer = mHMixer; if (mixLine.CControls != 0 && !(mixLine.CControls == 1 && mixLine.Controls[0].Type == MIXERCONTROL_CONTROLTYPE.MUX)) { mUserLines.Add(mixLine); } mLines.Add(mixLine); int cConnections = (int)mxl.cConnections; for (int i = 0; i < cConnections; i++) { mxl.cbStruct = (uint)Marshal.SizeOf(mxl); mxl.dwDestination = dwDestination; mxl.dwSource = (uint)i; errorCode = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.SOURCE); if (errorCode != MMErrors.MMSYSERR_NOERROR) { throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); } MixerLine mixLineNew = new MixerLine(); if (mMixerType == MixerType.Recording) { mixLineNew.Direction = MixerType.Recording; } else if (mMixerType == MixerType.Playback) { mixLineNew.Direction = MixerType.Playback; } mixLineNew.Mixer = this; mixLineNew.Channels = mxl.cChannels; mixLineNew.CControls = mxl.cControls; mixLineNew.Connections = mxl.cConnections; mixLineNew.Flag = mxl.fdwLine; mixLineNew.Destination = dwDestination; mixLineNew.Name = mxl.szName; mixLineNew.Id = mxl.dwLineID; mixLineNew.ComponentType = mxl.dwComponentType; mixLineNew.Source = mxl.dwSource; mixLineNew.HMixer = mHMixer; if (mixLineNew.CControls != 0) { mUserLines.Add(mixLineNew); } mLines.Add(mixLineNew); } }
private void ReloadLines() { MMErrors errorCode = 0; mLines.Clear(); mUserLines.Clear(); MIXERLINE mxl = new MIXERLINE(); MIXERLINECONTROLS mlc = new MIXERLINECONTROLS(); MIXERCONTROL mc = new MIXERCONTROL(); uint dwDestination; unchecked { dwDestination = (uint) -1; } mxl.cbStruct = (uint) Marshal.SizeOf(mxl); if (mMixerType == MixerType.Recording) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_WAVEIN; errorCode = (MMErrors) MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); } else if (mMixerType == MixerType.Playback) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_SPEAKERS; errorCode = (MMErrors) MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) { mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_UNDEFINED; errorCode = (MMErrors) MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE); if (errorCode != MMErrors.MMSYSERR_NOERROR) throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); } } dwDestination = mxl.dwDestination; MixerLine mixLine = new MixerLine(); if (mMixerType == MixerType.Recording) mixLine.Direction = MixerType.Recording; else if (mMixerType == MixerType.Playback) mixLine.Direction = MixerType.Playback; mixLine.Mixer = this; mixLine.Channels = mxl.cChannels; mixLine.CControls = mxl.cControls; mixLine.Connections = mxl.cConnections; mixLine.Flag = mxl.fdwLine; mixLine.Destination = dwDestination; mixLine.Name = mxl.szName; mixLine.Id = mxl.dwLineID; mixLine.ComponentType = mxl.dwComponentType; mixLine.Source = mxl.dwSource; mixLine.HMixer = mHMixer; if (mixLine.CControls != 0 && !(mixLine.CControls == 1 && mixLine.Controls[0].Type == MIXERCONTROL_CONTROLTYPE.MUX)) mUserLines.Add(mixLine); mLines.Add(mixLine); int cConnections = (int) mxl.cConnections; for(int i=0; i<cConnections; i++) { mxl.cbStruct = (uint) Marshal.SizeOf(mxl); mxl.dwDestination = dwDestination; mxl.dwSource = (uint) i; errorCode = (MMErrors) MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.SOURCE); if (errorCode != MMErrors.MMSYSERR_NOERROR) throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode)); MixerLine mixLineNew = new MixerLine(); if (mMixerType == MixerType.Recording) mixLineNew.Direction= MixerType.Recording; else if (mMixerType == MixerType.Playback) mixLineNew.Direction= MixerType.Playback; mixLineNew.Mixer = this; mixLineNew.Channels = mxl.cChannels; mixLineNew.CControls = mxl.cControls; mixLineNew.Connections = mxl.cConnections; mixLineNew.Flag = mxl.fdwLine; mixLineNew.Destination = dwDestination; mixLineNew.Name = mxl.szName; mixLineNew.Id = mxl.dwLineID; mixLineNew.ComponentType = mxl.dwComponentType; mixLineNew.Source = mxl.dwSource; mixLineNew.HMixer = mHMixer; if (mixLineNew.CControls != 0) mUserLines.Add(mixLineNew); mLines.Add(mixLineNew); } }