Exemplo n.º 1
0
        private static unsafe bool getMuteStatus(IntPtr mHMixer, uint controlId)
        {
            MMErrors errorCode = 0;
            IntPtr   pUnsigned = IntPtr.Zero;
            bool     status    = false;

            try
            {
                // find the microphone source line connected to this wave in destination

                IntPtr pmxcdSelectValue = Marshal.AllocHGlobal((int)(1 * sizeof(MIXERCONTROLDETAILS_BOOLEAN)));

                MIXERCONTROLDETAILS mxcd = new MIXERCONTROLDETAILS();
                mxcd.cbStruct    = (uint)sizeof(MIXERCONTROLDETAILS);
                mxcd.dwControlID = controlId;
                mxcd.cChannels   = 1;
                mxcd.hwndOwner   = IntPtr.Zero;
                mxcd.cbDetails   = (uint)sizeof(MIXERCONTROLDETAILS_BOOLEAN);
                mxcd.paDetails   = pmxcdSelectValue;

                unchecked
                {
                    errorCode = (MMErrors)MixerNative.mixerGetControlDetails(mHMixer, ref mxcd, (MIXER_GETCONTROLDETAILSFLAG)(int)((uint)MIXER_OBJECTFLAG.HMIXER | (int)MIXER_GETCONTROLDETAILSFLAG.VALUE));
                }
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    throw new MixerException(errorCode, MicInterface.GetErrorDescription(FuncName.fnMixerGetControlDetails, errorCode));
                }

                status = *((uint *)pmxcdSelectValue) != 0U;

                errorCode = (MMErrors)MixerNative.mixerSetControlDetails(mHMixer, ref mxcd, MIXER_SETCONTROLDETAILSFLAG.VALUE);
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    throw new MixerException(errorCode, MicInterface.GetErrorDescription(FuncName.fnMixerSetControlDetails, errorCode));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                if (pUnsigned != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(pUnsigned);
                }
            }
            return(status);
        }
Exemplo n.º 2
0
 public static extern int mixerSetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, MIXER_SETCONTROLDETAILSFLAG fdwDetails);
Exemplo n.º 3
0
 public static extern int mixerGetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, uint fdwDetailsmixer);