Example #1
0
        /// <summary>Connects to the specified mixer</summary>
        /// <param name="mixerIndex">The index of the mixer to use.
        /// This should be between zero and NumberOfDevices - 1</param>
        public Mixer(int mixerIndex)
        {
            if (mixerIndex < 0 || mixerIndex >= NumberOfDevices)
            {
                throw new ArgumentOutOfRangeException("mixerID");
            }
            caps = new MixerInterop.MIXERCAPS();
            MmException.Try(MixerInterop.mixerGetDevCaps((IntPtr)mixerIndex, ref caps, Marshal.SizeOf(caps)), "mixerGetDevCaps");
            this.mixerHandle     = (IntPtr)mixerIndex;
            this.mixerHandleType = MixerFlags.Mixer;

            // TODO: optionally support really opening the mixer device
            //MmException.Try(MixerInterop.mixerOpen(out mixerHandle, mixerIndex, IntPtr.Zero, IntPtr.Zero, 0), "mixerOpen");
        }