Exemple #1
0
 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;
 }
Exemple #2
0
 internal FaderMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
Exemple #3
0
 /// <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;
 }
Exemple #4
0
        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;
        }
Exemple #5
0
 private SourceLine(Mixer m, MIXERLINE l)
     : base(m, l)
 {
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 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);
 }
Exemple #8
0
 private SourceLine(Mixer m, MIXERLINE l) : base(m, l)
 {
 }
Exemple #9
0
 /// <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;
 }
Exemple #10
0
 private DestinationLine(Mixer mixer, MIXERLINE line)
     : base(mixer, line)
 {
 }
Exemple #11
0
 internal BooleanMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc)
 {
 }
Exemple #12
0
 internal FaderMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc)
 {
 }
Exemple #13
0
 internal MixerControl(Mixer mx, MixerLine ml, MIXERCONTROL ctrl)
 {
     this.mx   = mx;
     this.ml   = ml;
     this.ctrl = ctrl;
 }
Exemple #14
0
 internal BooleanMixerControl(Mixer mx, MixerLine ml, MixerControl.MIXERCONTROL mc) : base(mx, ml, mc) { }
Exemple #15
0
 internal MixerLine(Mixer mixer, MIXERLINE line)
 {
     this.mixer = mixer;
     this.line = line;
 }
Exemple #16
0
 internal MixerControl(Mixer mx, MixerLine ml, MIXERCONTROL ctrl)
 {
     this.mx = mx;
     this.ml = ml;
     this.ctrl = ctrl;
 }
Exemple #17
0
 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);
 }