当前位置: 首页>>代码示例>>C#>>正文


C# MIXERCONTROL类代码示例

本文整理汇总了C#中MIXERCONTROL的典型用法代码示例。如果您正苦于以下问题:C# MIXERCONTROL类的具体用法?C# MIXERCONTROL怎么用?C# MIXERCONTROL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MIXERCONTROL类属于命名空间,在下文中一共展示了MIXERCONTROL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitRealtekHDaudioRecord

        public static bool InitRealtekHDaudioRecord(int mixerID, int record_level)      // yt7pwr
        {
            try
            {
                int mixer;
                int retval = -1;
                retval = mixerOpen(out mixer, mixerID, 0, 0, 0);
                if (retval != MMSYSERR_NOERROR)
                    return false;

                // turn Main Mute Off
                MIXERCONTROL ctrl = new MIXERCONTROL();
                bool success = false;

                int i;
                for (i = -1; i < 4; i++)
                {
                    success = GetControlByID(mixer, 0, i, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
                    if (success)
                    {
                        if (ctrl.szName.Contains("Master Mute"))
                        {
                            if (!SetBool(mixer, ctrl, false))
                                goto failed;
                        }
                        // turn CD volume Mute off
                        else if (ctrl.szName.Contains("CD Volume"))
                        {
                            if (!SetBool(mixer, ctrl, true))
                                goto failed;
                        }
                        // turn Line volume Mute on
                        else if (ctrl.szName.Contains("Line Volume"))
                        {
                            if (!SetBool(mixer, ctrl, false))
                                goto failed;
                        }
                        // turn Mic Mute Off
                        else if (ctrl.szName.Contains("Mic Volume"))
                        {
                            if (!SetBool(mixer, ctrl, true))
                                goto failed;
                        }
                        // turn Stereo Mix Mute on
                        else if (ctrl.szName.Contains("Stereo Mix"))
                        {
                            if (!SetBool(mixer, ctrl, true))
                                goto failed;
                        }
                    }
                }

                // set Record Main Volume to max
                success = GetControlByID(mixer, 0, -1, MIXERCONTROL_CONTROLTYPE_VOLUME, out ctrl);
                if (!success && ctrl.szName.Contains("Recording"))
                    goto failed;
                if (!SetUnsigned(mixer, ctrl, UInt16.MaxValue * record_level / 100))
                    goto failed;

                mixerClose(mixer);
                return true;

            failed:
                mixerClose(mixer);
                return false;
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
                return false;
            }
        }
开发者ID:Dfinitski,项目名称:genesisradio,代码行数:72,代码来源:mixer.cs

示例2: GetVolumeControl

    private static bool GetVolumeControl(int hmixer, int componentType, int ctrlType, out MIXERCONTROL mxc,
                                         out int vCurrentVol)
    {
      // This function attempts to obtain a mixer control. 
      // Returns True if successful. 
      MIXERLINECONTROLS mxlc = new MIXERLINECONTROLS();
      MIXERLINE mxl = new MIXERLINE();
      MIXERCONTROLDETAILS pmxcd = new MIXERCONTROLDETAILS();
      MIXERCONTROLDETAILS_UNSIGNED du = new MIXERCONTROLDETAILS_UNSIGNED();
      mxc = new MIXERCONTROL();
      int rc;
      bool retValue;
      vCurrentVol = -1;

      mxl.cbStruct = Marshal.SizeOf(mxl);
      mxl.dwComponentType = componentType;

      rc = mixerGetLineInfoA(hmixer, ref mxl, MIXER_GETLINEINFOF_COMPONENTTYPE);

      if (MMSYSERR_NOERROR == rc)
      {
        int sizeofMIXERCONTROL = 152;
        int ctrl = Marshal.SizeOf(typeof (MIXERCONTROL));
        mxlc.pamxctrl = Marshal.AllocCoTaskMem(sizeofMIXERCONTROL);
        mxlc.cbStruct = Marshal.SizeOf(mxlc);
        mxlc.dwLineID = mxl.dwLineID;
        mxlc.dwControl = ctrlType;
        mxlc.cControls = 1;
        mxlc.cbmxctrl = sizeofMIXERCONTROL;

        // Allocate a buffer for the control 
        mxc.cbStruct = sizeofMIXERCONTROL;

        // Get the control 
        rc = mixerGetLineControlsA(hmixer, ref mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);

        if (MMSYSERR_NOERROR == rc)
        {
          retValue = true;

          // Copy the control into the destination structure 
          mxc = (MIXERCONTROL)Marshal.PtrToStructure(mxlc.pamxctrl, typeof (MIXERCONTROL));
        }
        else
        {
          retValue = false;
        }
        int sizeofMIXERCONTROLDETAILS = Marshal.SizeOf(typeof (MIXERCONTROLDETAILS));
        int sizeofMIXERCONTROLDETAILS_UNSIGNED = Marshal.SizeOf(typeof (MIXERCONTROLDETAILS_UNSIGNED));
        pmxcd.cbStruct = sizeofMIXERCONTROLDETAILS;
        pmxcd.dwControlID = mxc.dwControlID;
        pmxcd.paDetails =
          Marshal.AllocCoTaskMem(sizeofMIXERCONTROLDETAILS_UNSIGNED);
        pmxcd.cChannels = 1;
        pmxcd.item = 0;
        pmxcd.cbDetails = sizeofMIXERCONTROLDETAILS_UNSIGNED;

        rc = mixerGetControlDetailsA(hmixer, ref pmxcd, MIXER_GETCONTROLDETAILSF_VALUE);

        du =
          (MIXERCONTROLDETAILS_UNSIGNED)Marshal.PtrToStructure(pmxcd.paDetails, typeof (MIXERCONTROLDETAILS_UNSIGNED));

        vCurrentVol = du.dwValue;

        return retValue;
      }

      retValue = false;
      return retValue;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:70,代码来源:AudioMixerHelper.cs

示例3: GetMinMaxVolume

 public static int GetMinMaxVolume(out int iMin, out int iMax)
 {
   int mixer;
   MIXERCONTROL volCtrl = new MIXERCONTROL();
   int currentVol;
   mixerOpen(out mixer, 0, 0, 0, 0);
   int type = MIXERCONTROL_CONTROLTYPE_VOLUME;
   GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, type, out volCtrl, out currentVol);
   mixerClose(mixer);
   iMin = volCtrl.lMinimum;
   iMax = volCtrl.lMaximum;
   return currentVol;
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:13,代码来源:AudioMixerHelper.cs

示例4: GetControlID

        public static int GetControlID( int component, int control )                                        // GetControlID
        {
            MIXERCONTROL mxc = new MIXERCONTROL();
            int _i;         // Though we won't need _i, it still must be declared                                    

            bool b = false;
            int retValue = 0;

            b = GetMixerControl(
                            0,
                            component,
                            control,
                            out mxc,
                            out _i);

            return retValue = b ? mxc.dwControlID : -1;
        }
开发者ID:andrewlouie,项目名称:AAMusicPlayer,代码行数:17,代码来源:MM.cs

示例5: GetControl

 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;
 }
开发者ID:floatas,项目名称:highsign,代码行数:13,代码来源:MixerControl.cs

示例6: SetMute

		private static bool SetMute(int mixerID, uint dst_type, uint src_type, bool val)
		{
			int mixer;
			MIXERCONTROL muteCtrl = new MIXERCONTROL();
			bool currentMute = GetMute(mixerID, dst_type, src_type);
			if(currentMute == val) return true;

			mixerOpen(out mixer, mixerID, 0, 0, 0);
			bool success = GetControlByType(mixer, dst_type, src_type, MIXERCONTROL_CONTROLTYPE_MUTE, out muteCtrl);
			if(success == true)
			{

				MIXERCONTROLDETAILS mxcd = new MIXERCONTROLDETAILS(); 
				MIXERCONTROLDETAILS_UNSIGNED mute = new MIXERCONTROLDETAILS_UNSIGNED(); 

				mxcd.item = 0; 
				mxcd.dwControlID = muteCtrl.dwControlID; 
				mxcd.cbStruct = Marshal.SizeOf(mxcd); 
				mxcd.cbDetails = Marshal.SizeOf(mute); 

				// Allocate a buffer for the control value buffer 
				mxcd.cChannels = 1; 
				if(val)	mute.dwValue = 1;
				else mute.dwValue = 0;

				// Copy the data into the control value buffer 
				mxcd.paDetails = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_UNSIGNED))); 
				Marshal.StructureToPtr(mute, mxcd.paDetails,false); 

				// Set the control value 
				int retval = mixerSetControlDetails(mixer, ref mxcd, MIXER_SETCONTROLDETAILSF_VALUE); 
				if(retval == MMSYSERR_NOERROR) 
				{
					currentMute = GetMute(mixerID, dst_type, src_type);
					if(currentMute != val)
						success = false;
					else success = true;
				}
				else success = false;
				Marshal.FreeCoTaskMem(mxcd.paDetails);
			}
			else success = false;
			mixerClose(mixer);
			return success;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:45,代码来源:wmm.cs

示例7: GetVolume

        public static int GetVolume( int control, int component )                                             // GetVolume
        {
            int hmixer = 0;
            int currVol = -1;

            MIXERCONTROL volCtrl = new MIXERCONTROL();

            int rc = mixerOpen(
                            out hmixer,
                            0,
                            0,
                            0,
                            0);

            bool b = GetMixerControl(
                                hmixer,
                                component,
                                control,
                                out volCtrl,        // Not used
                                out currVol);

            mixerClose(hmixer);

            return currVol;
        }
开发者ID:andrewlouie,项目名称:AAMusicPlayer,代码行数:25,代码来源:MM.cs

示例8: SetMux

		public static bool SetMux(int mixerID, int index)
		{
			int mixer;
			int retval = -1;
			MIXERCONTROL ctrl = new MIXERCONTROL();

			mixerOpen(out mixer, mixerID, 0, 0, 0);
			GetControlByType(mixer,MIXERLINE_COMPONENTTYPE_DST_WAVEIN, 0, MIXERCONTROL_CONTROLTYPE_MUX, out ctrl);

			MIXERCONTROLDETAILS details = new MIXERCONTROLDETAILS();
			int size = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_SIGNED));
			details.dwControlID = ctrl.dwControlID; 
			details.cbDetails = size; 
			details.item = ctrl.cMultipleItems;
			if(details.item > 0) size *= details.item;
			details.paDetails = Marshal.AllocCoTaskMem(size); 
			details.cbStruct = Marshal.SizeOf(details); 
			details.cChannels = 1; 
	
			if(details.item > 0)
			{
				int[] val = new int[details.item];
				for(int m=0; m<details.item; m++)
				{
					if(m == index) val[m] = 1;
					else val[m] = 0;
				}
				Marshal.Copy(val, 0, details.paDetails, details.item);

				retval = mixerSetControlDetails(mixer, ref details, MIXER_GETCONTROLDETAILSF_VALUE); 
			}
			if(retval == MMSYSERR_NOERROR)
				return true;
			else return false;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:35,代码来源:wmm.cs

示例9: InitSantaCruz

		public static bool InitSantaCruz(int mixerID)
		{
			int mixer;
			int retval = -1;
			retval = mixerOpen(out mixer, mixerID, 0, 0, 0);
			if(retval != MMSYSERR_NOERROR)
				return false;

			// Set Playback Wave Volume to max
			MIXERCONTROL ctrl = new MIXERCONTROL();
			bool success = GetControlByID(mixer, 0, 0, MIXERCONTROL_CONTROLTYPE_VOLUME, out ctrl);
			if(!success)
				goto failed;
			if(!SetUnsigned(mixer, ctrl, ctrl.lMaximum))
				goto failed;

			// Set Playback Wave Mute to off
			success = GetControlByID(mixer, 0, 0, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, false))
				goto failed;

			// Set Playback Synthesizer Mute to on
			success = GetControlByID(mixer, 0, 1, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback Aux Mute to on
			success = GetControlByID(mixer, 0, 2, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback CD Player Mute to on
			success = GetControlByID(mixer, 0, 3, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback Line In Mute to on
			success = GetControlByID(mixer, 0, 4, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback Synth Daughter Card Mute to on
			success = GetControlByID(mixer, 0, 5, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback Microphone Mute to on
			success = GetControlByID(mixer, 0, 6, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set Playback Telephone Mute to on
			success = GetControlByID(mixer, 0, 7, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Set 5.1 Emulation Mute to on
			success = GetControlByID(mixer, 2, 3, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Disable equalizer
			success = GetControlByID(mixer, 3, -1, MIXERCONTROL_CONTROLTYPE_ONOFF, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, false))
				goto failed;

			// Disable effects 1 channel
			success = GetControlByID(mixer, 6, -1, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

			// Disable effects 2 channel
			success = GetControlByID(mixer, 7, -1, MIXERCONTROL_CONTROLTYPE_MUTE, out ctrl);
			if(!success)
				goto failed;
			if(!SetBool(mixer, ctrl, true))
				goto failed;

//.........这里部分代码省略.........
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:101,代码来源:wmm.cs

示例10: GetMuxLineNames

		public static bool GetMuxLineNames(int mixerID, out ArrayList a)
		{
			int mixer;
			MIXERCONTROL ctrl = new MIXERCONTROL();
			a = new ArrayList();

			mixerOpen(out mixer, mixerID, 0, 0, 0);
			GetControlByType(mixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, 0, MIXERCONTROL_CONTROLTYPE_MUX, out ctrl);

			int n = ctrl.cMultipleItems;
			MIXERCONTROLDETAILS mxcd = new MIXERCONTROLDETAILS();
			mxcd.cbStruct = Marshal.SizeOf(mxcd);
			mxcd.dwControlID = ctrl.dwControlID;     // <== MIXERCONTROL.dwControlID
			mxcd.cChannels = 1;
			mxcd.item = n;   // <== MIXERCONTROL.cMultipleItems

			int size = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_LISTTEXT))*n;
			mxcd.cbDetails = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_LISTTEXT));
			mxcd.paDetails = Marshal.AllocCoTaskMem(size);

			int result = mixerGetControlDetails(mixer, ref mxcd, MIXER_GETCONTROLDETAILSF_LISTTEXT);

			if(result != MMSYSERR_NOERROR)
			{
				mixerClose(mixer);
				return false;
			}

			for(int i=0; i<mxcd.item; i++)
			{
				MIXERCONTROLDETAILS_LISTTEXT ltxt = new MIXERCONTROLDETAILS_LISTTEXT();
				IntPtr ptr = new IntPtr(mxcd.paDetails.ToInt32() + i*mxcd.cbDetails);
				
				ltxt = (MIXERCONTROLDETAILS_LISTTEXT)Marshal.PtrToStructure(ptr, typeof(MIXERCONTROLDETAILS_LISTTEXT));
				a.Add(ltxt.szName);
			}
			mixerClose(mixer);
			return true;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:39,代码来源:wmm.cs

示例11: GetMux

		public static int GetMux(int mixerID)
		{
			int mixer;
			MIXERCONTROL ctrl = new MIXERCONTROL();

			mixerOpen(out mixer, mixerID, 0, 0, 0);
			GetControlByType(mixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, 0, MIXERCONTROL_CONTROLTYPE_MUX, out ctrl);
			
			MIXERCONTROLDETAILS details = new MIXERCONTROLDETAILS();
			int size = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_UNSIGNED));
			details.dwControlID = ctrl.dwControlID; 
			details.item = ctrl.cMultipleItems;
			details.cbDetails = size;
			if(details.item > 0) size *= ctrl.cMultipleItems;
			details.paDetails = Marshal.AllocCoTaskMem(size); 
			details.cbStruct = Marshal.SizeOf(details); 
			details.cChannels = 1;									
																		
			int retval = mixerGetControlDetails(mixer, ref details, MIXER_GETCONTROLDETAILSF_VALUE); 
			if(retval == MMSYSERR_NOERROR)
			{
				if(details.item > 0)
				{
					MIXERCONTROLDETAILS_UNSIGNED[] val = new MIXERCONTROLDETAILS_UNSIGNED[details.item];
					for(int m=0; m<details.item; m++)
					{
						IntPtr ptr = new IntPtr(details.paDetails.ToInt32() + m*details.cbDetails);
						val[m] = new MIXERCONTROLDETAILS_UNSIGNED();
						val[m] = (MIXERCONTROLDETAILS_UNSIGNED)Marshal.PtrToStructure(ptr, typeof(MIXERCONTROLDETAILS_UNSIGNED));
						if(val[m].dwValue == 1)
						{
							retval = m;
							m = details.item;
						}
					}
				}
			}
			mixerClose(mixer);
			return retval;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:40,代码来源:wmm.cs

示例12: GetNumMuxLines

		public static int GetNumMuxLines(int mixerID)
		{
			int mixer;
			MIXERCONTROL ctrl = new MIXERCONTROL();

			mixerOpen(out mixer, mixerID, 0, 0, 0);
			bool response = GetControlByType(mixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, 0, MIXERCONTROL_CONTROLTYPE_MUX, out ctrl);
			mixerClose(mixer);

			if(response)
				return ctrl.cMultipleItems;
			else
				return -1;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:14,代码来源:wmm.cs

示例13: GetVolume_RealtekHDaudio

        private static int GetVolume_RealtekHDaudio(int mixerID, int dst_type, int src_type)        // yt7pwr
        {
            if (mixerID > mixerGetNumDevs() - 1 ||
                mixerID < 0)
                return -1;

            int mixer;
            int val;
            MIXERCONTROL volCtrl = new MIXERCONTROL();

            int retval = mixerOpen(out mixer, mixerID, 0, 0, 0);
            if (retval != MMSYSERR_NOERROR)
                return -1;

            bool success = GetControlByID(mixer, dst_type, src_type, MIXERCONTROL_CONTROLTYPE_VOLUME, out volCtrl);
            if (success == true)
            {
                MIXERCONTROLDETAILS details = new MIXERCONTROLDETAILS();

                int sizeofMIXERCONTROLDETAILS = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS));
                int sizeofMIXERCONTROLDETAILS_UNSIGNED = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_UNSIGNED));
                details.cbStruct = sizeofMIXERCONTROLDETAILS;
                details.dwControlID = volCtrl.dwControlID;
                details.paDetails = Marshal.AllocCoTaskMem(sizeofMIXERCONTROLDETAILS_UNSIGNED);
                details.cChannels = 1;
                details.item = 0;
                details.cbDetails = sizeofMIXERCONTROLDETAILS_UNSIGNED;

                retval = mixerGetControlDetails(mixer, ref details, MIXER_GETCONTROLDETAILSF_VALUE);
                if (retval == MMSYSERR_NOERROR)
                {
                    MIXERCONTROLDETAILS_UNSIGNED du = (MIXERCONTROLDETAILS_UNSIGNED)Marshal.PtrToStructure(details.paDetails, typeof(MIXERCONTROLDETAILS_UNSIGNED));
                    val = du.dwValue;
                }
                else val = -1;
                Marshal.FreeCoTaskMem(details.paDetails);
            }
            else val = -1;
            mixerClose(mixer);
            return val;
        }
开发者ID:Dfinitski,项目名称:genesisradio,代码行数:41,代码来源:mixer.cs

示例14: InitRealtekHDaudioPlay

        public static bool InitRealtekHDaudioPlay(int mixerID)      // yt7pwr
        {
            try
            {
                int mixer;
                int retval = -1;
                retval = mixerOpen(out mixer, mixerID, 0, 0, 0);
                if (retval != MMSYSERR_NOERROR)
                    return false;

                MIXERCONTROL ctrl = new MIXERCONTROL();
                // set Playback Wave Volume to max
                bool success = GetControlByType(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,
                    4104, MIXERCONTROL_CONTROLTYPE_MUX, out ctrl);
                if (!success)
                    goto failed;
                if (!SetUnsigned(mixer, ctrl, ctrl.lMaximum))
                    goto failed;

                mixerClose(mixer);
                return true;

            failed:
                mixerClose(mixer);
                return false;
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
                return false;
            }
        }
开发者ID:Dfinitski,项目名称:genesisradio,代码行数:32,代码来源:mixer.cs

示例15: GetUnsigned

		private static bool GetUnsigned(int mixer, MIXERCONTROL ctrl, out int num)
		{
			MIXERCONTROLDETAILS mxcd = new MIXERCONTROLDETAILS();
			num = 0;

			int sizeofMIXERCONTROLDETAILS = Marshal.SizeOf(mxcd);
			int sizeofMIXERCONTROLDETAILS_UNSIGNED = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_UNSIGNED)); 
			mxcd.cbStruct = sizeofMIXERCONTROLDETAILS; 
			mxcd.dwControlID = ctrl.dwControlID; 
			mxcd.paDetails = Marshal.AllocCoTaskMem(sizeofMIXERCONTROLDETAILS_UNSIGNED); 
			mxcd.cChannels = 1; 
			mxcd.item = 0; 
			mxcd.cbDetails = sizeofMIXERCONTROLDETAILS_UNSIGNED; 

			int retval = mixerGetControlDetails(mixer, ref mxcd, MIXER_GETCONTROLDETAILSF_VALUE);
			if(retval != MMSYSERR_NOERROR)
			{
				Marshal.FreeCoTaskMem(mxcd.paDetails);
				return false;
			}

			MIXERCONTROLDETAILS_UNSIGNED du = 
				(MIXERCONTROLDETAILS_UNSIGNED)Marshal.PtrToStructure(mxcd.paDetails, typeof(MIXERCONTROLDETAILS_UNSIGNED));
			num = du.dwValue;

			Marshal.FreeCoTaskMem(mxcd.paDetails);
			return true;
		}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:28,代码来源:wmm.cs


注:本文中的MIXERCONTROL类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。