private static MixerControl GetControl(Mixer mx, MixerLine ml, MIXERCONTROL mc) { MixerControl result = new MixerControl(mx, ml, mc); if (result.Class == MixerControlClass.FADER && ((uint)result.ControlType & MIXERCONTROL_CT_UNITS_MASK) == (uint)MixerControlType.MIXERCONTROL_CT_UNITS_UNSIGNED) { result = new FaderMixerControl(mx, ml, mc); } else if (result.Class == MixerControlClass.SWITCH && ((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 BooleanMixerControl(mx, ml, mc); } return result; }
internal FaderMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
/// <summary> /// Initializes a new instance of the /// <see cref="MixerEventArgs">MixerEventArgs</see> class. /// </summary> /// <param name="mixer">The affected mixer</param> /// <param name="line">The affected line</param> /// <param name="control">The affected control, or <code>null</code> /// if this is a LineChanged event.</param> public MixerEventArgs(Mixer mixer, MixerLine line, MixerControl control) { this.mixer = mixer; this.line = line; this.control = control; }
internal static MixerControl[] GetControls(Mixer mx, MixerLine line, int controlCount) { if (controlCount == 0) return new MixerControl[0]; MIXERCONTROL[] mc = new MIXERCONTROL[controlCount]; int mxsize = Marshal.SizeOf(mc[0]); if (mxsize != 148) throw new Exception("" + mxsize); //mxsize = 148; MIXERLINECONTROLS mlc = new MIXERLINECONTROLS(); mlc.cbStruct = Marshal.SizeOf(mlc); mlc.cControls = controlCount; mlc.dwLineID = line.Id; mlc.pamxctrl = Marshal.AllocCoTaskMem(mxsize * controlCount); mlc.cbmxctrl = mxsize; int err; if ((err = mixerGetLineControlsA(mx.Handle, ref mlc, MIXER_GETLINECONTROLSF_ALL)) != 0) { throw new Win32Exception("Error #" + err + " calling mixerGetLineControls()\n"); } for (int i = 0; i < controlCount; i++) { mc[i] = (MIXERCONTROL)Marshal.PtrToStructure(new IntPtr(mlc.pamxctrl.ToInt64() + mxsize * i), typeof(MIXERCONTROL)); } Marshal.FreeCoTaskMem(mlc.pamxctrl); MixerControl[] result = new MixerControl[controlCount]; for (int i = 0; i < controlCount; i++) { result[i] = GetControl(mx, line, mc[i]); } return result; }
private SourceLine(Mixer m, MIXERLINE l) : base(m, l) { }
internal static SourceLine GetLine(Mixer mixer, int destIndex, int srcIndex) { MIXERLINE m = new MIXERLINE(); m.cbStruct = Marshal.SizeOf(m); m.dwDestination = destIndex; m.dwSource = srcIndex; mixerGetLineInfoA(mixer.Handle, ref m, MIXER_GETLINEINFOF_SOURCE); return new SourceLine(mixer, m); }
internal static DestinationLine GetLine(Mixer mixer, int index) { MIXERLINE m = new MIXERLINE(); m.cbStruct = Marshal.SizeOf(m); m.dwDestination = index; mixerGetLineInfoA(mixer.Handle, ref m, MIXER_GETLINEINFOF_DESTINATION); return new DestinationLine(mixer, m); }
private SourceLine(Mixer m, MIXERLINE l) : base(m, l) { }
/// <summary> /// Initializes a new instance of the /// <see cref="MixerEventArgs">MixerEventArgs</see> class. /// </summary> /// <param name="mixer">The affected mixer</param> /// <param name="line">The affected line</param> /// <param name="control">The affected control, or <code>null</code> /// if this is a LineChanged event.</param> public MixerEventArgs(Mixer mixer, MixerLine line, MixerControl control) { this.mixer = mixer; this.line = line; this.control = control; }
private DestinationLine(Mixer mixer, MIXERLINE line) : base(mixer, line) { }
internal BooleanMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
internal FaderMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
internal MixerControl(Mixer mx, MixerLine ml, MIXERCONTROL ctrl) { this.mx = mx; this.ml = ml; this.ctrl = ctrl; }
internal BooleanMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
internal MixerLine(Mixer mixer, MIXERLINE line) { this.mixer = mixer; this.line = line; }
internal MixerControl(Mixer mx, MixerLine ml, MIXERCONTROL ctrl) { this.mx = mx; this.ml = ml; this.ctrl = ctrl; }
private void mixers_SelectedIndexChanged(object sender, EventArgs e) { if (mixers.SelectedIndex == -1) return; if (mix != null) mix.Dispose(); mix = Mixer.OpenMixer((uint)mixers.SelectedIndex); mix.CreateEvents = true; destLines.Items.Clear(); foreach (DestinationLine dl in mix.DestinationLines) { destLines.Items.Add(dl.Name); } destLines_SelectedIndexChanged(this, e); }