示例#1
0
        // Token: 0x060005D7 RID: 1495 RVA: 0x000132A8 File Offset: 0x000114A8
        private static bool IsControlUnsigned(MixerControlType controlType)
        {
            if (controlType <= MixerControlType.Percent)
            {
                if (controlType != MixerControlType.UnsignedMeter && controlType != MixerControlType.Unsigned && controlType != MixerControlType.Percent)
                {
                    return(false);
                }
            }
            else
            {
                switch (controlType)
                {
                case MixerControlType.Fader:
                case MixerControlType.Volume:
                case MixerControlType.Bass:
                case MixerControlType.Treble:
                case MixerControlType.Equalizer:
                    break;

                default:
                    if (controlType != MixerControlType.MicroTime && controlType != MixerControlType.MilliTime)
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(true);
        }
示例#2
0
        /// <summary>
        /// Determines whether a specified mixer control type is a list text control
        /// </summary>
        // Token: 0x060005D3 RID: 1491 RVA: 0x000131E4 File Offset: 0x000113E4
        private static bool IsControlListText(MixerControlType controlType)
        {
            if (controlType != MixerControlType.Equalizer)
            {
                switch (controlType)
                {
                case MixerControlType.SingleSelect:
                case MixerControlType.Mux:
                    break;

                default:
                    switch (controlType)
                    {
                    case MixerControlType.MultipleSelect:
                    case MixerControlType.Mixer:
                        break;

                    default:
                        return(false);
                    }
                    break;
                }
            }
            return(true);
        }
示例#3
0
        // Token: 0x060005D5 RID: 1493 RVA: 0x0001323C File Offset: 0x0001143C
        private static bool IsControlSigned(MixerControlType controlType)
        {
            if (controlType <= MixerControlType.Signed)
            {
                switch (controlType)
                {
                case MixerControlType.SignedMeter:
                case MixerControlType.PeakMeter:
                    break;

                default:
                    if (controlType != MixerControlType.Signed)
                    {
                        return(false);
                    }
                    break;
                }
            }
            else if (controlType != MixerControlType.Decibels)
            {
                switch (controlType)
                {
                case MixerControlType.Slider:
                case MixerControlType.Pan:
                case MixerControlType.QSoundPan:
                    break;

                default:
                    return(false);
                }
            }
            return(true);
        }
示例#4
0
        private void SetValue(MixerComponentType componentType, MixerControlType controlType, int controlValue)
        {
            MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

            if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) != MixerError.None)
            {
                throw new InvalidOperationException("Mixer.SetValue.1");
            }

            using (
                MixerNativeMethods.MixerLineControls mixerLineControls =
                    new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
            {
                if (MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType) !=
                    MixerError.None)
                {
                    throw new InvalidOperationException("Mixer.SetValue.2");
                }

                MixerNativeMethods.MixerControl mixerControl =
                    (MixerNativeMethods.MixerControl)
                    Marshal.PtrToStructure(mixerLineControls.Data, typeof(MixerNativeMethods.MixerControl));

                using (
                    MixerNativeMethods.MixerControlDetails mixerControlDetails =
                        new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId))
                {
                    Marshal.WriteInt32(mixerControlDetails.Data, controlValue);
                    MixerNativeMethods.mixerSetControlDetails(_handle, mixerControlDetails, 0);
                }
            }
        }
示例#5
0
        private MixerNativeMethods.MixerControlDetails GetControl(MixerComponentType componentType,
                                                                  MixerControlType controlType)
        {
            MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

            if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) != MixerError.None)
            {
                throw new InvalidOperationException("Mixer.GetControl.1");
            }

            using (
                MixerNativeMethods.MixerLineControls mixerLineControls =
                    new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
            {
                if (MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType) !=
                    MixerError.None)
                {
                    throw new InvalidOperationException("Mixer.GetControl.2");
                }

                MixerNativeMethods.MixerControl mixerControl =
                    (MixerNativeMethods.MixerControl)
                    Marshal.PtrToStructure(mixerLineControls.Data, typeof(MixerNativeMethods.MixerControl));

                return(new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId));
            }
        }
 public MixerLineControls(int lineId, MixerControlType controlType)
 {
     this.Size        = Marshal.SizeOf(typeof(MixerControlDetails));
     this.LineId      = lineId;
     this.ControlType = Convert.ToUInt32(controlType);
     this.Controls    = 1;
     this.Data        = Marshal.AllocCoTaskMem(152);
     this.DataSize    = 152;
 }
示例#7
0
 private static bool IsControlListText(MixerControlType controlType)
 {
     if (controlType <= MixerControlType.SingleSelect)
     {
         if (controlType != MixerControlType.Equalizer && controlType != MixerControlType.SingleSelect)
         {
             return(false);
         }
     }
     else if (controlType != MixerControlType.Mux && controlType != MixerControlType.MultipleSelect && controlType != MixerControlType.Mixer)
     {
         return(false);
     }
     return(true);
 }
示例#8
0
        private static bool IsControlSigned(MixerControlType controlType)
        {
            switch (controlType)
            {
            case MixerControlType.PeakMeter:
            case MixerControlType.SignedMeter:
            case MixerControlType.Signed:
            case MixerControlType.Decibels:
            case MixerControlType.Pan:
            case MixerControlType.QSoundPan:
            case MixerControlType.Slider:
                return(true);

            default:
                return(false);
            }
        }
示例#9
0
        /// <summary>
        /// Returns true if this is a boolean control
        /// </summary>
        /// <param name="controlType">Control type</param>
        // Token: 0x060005D1 RID: 1489 RVA: 0x00013158 File Offset: 0x00011358
        private static bool IsControlBoolean(MixerControlType controlType)
        {
            if (controlType <= MixerControlType.StereoEnhance)
            {
                if (controlType != MixerControlType.BooleanMeter)
                {
                    switch (controlType)
                    {
                    case MixerControlType.Boolean:
                    case MixerControlType.OnOff:
                    case MixerControlType.Mute:
                    case MixerControlType.Mono:
                    case MixerControlType.Loudness:
                    case MixerControlType.StereoEnhance:
                        break;

                    default:
                        return(false);
                    }
                }
            }
            else if (controlType != MixerControlType.Button)
            {
                switch (controlType)
                {
                case MixerControlType.SingleSelect:
                case MixerControlType.Mux:
                    break;

                default:
                    switch (controlType)
                    {
                    case MixerControlType.MultipleSelect:
                    case MixerControlType.Mixer:
                        break;

                    default:
                        return(false);
                    }
                    break;
                }
            }
            return(true);
        }
示例#10
0
        private static bool IsControlUnsigned(MixerControlType controlType)
        {
            switch (controlType)
            {
            case MixerControlType.UnsignedMeter:
            case MixerControlType.Unsigned:
            case MixerControlType.Bass:
            case MixerControlType.Equalizer:
            case MixerControlType.Fader:
            case MixerControlType.Treble:
            case MixerControlType.Volume:
            case MixerControlType.MicroTime:
            case MixerControlType.MilliTime:
            case MixerControlType.Percent:
                return(true);

            default:
                return(false);
            }
        }
示例#11
0
        private object GetValue(MixerComponentType componentType, MixerControlType controlType)
        {
            try
            {
                MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

                if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) !=
                    MixerError.None)
                {
                    throw new InvalidOperationException("Mixer.OpenControl.1");
                }

                using (
                    MixerNativeMethods.MixerLineControls mixerLineControls =
                        new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
                {
                    MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType);
                    MixerNativeMethods.MixerControl mixerControl =
                        (MixerNativeMethods.MixerControl)
                        Marshal.PtrToStructure(mixerLineControls.Data, typeof(MixerNativeMethods.MixerControl));

                    using (
                        MixerNativeMethods.MixerControlDetails mixerControlDetails =
                            new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId))
                    {
                        MixerNativeMethods.mixerGetControlDetailsA(_handle, mixerControlDetails, 0);

                        return(Marshal.ReadInt32(mixerControlDetails.Data));
                    }
                }
            }
            catch (Exception ex)
            {
                // Catch exception when audio device is disconnected
                Log.Error("Mixer: GetValue {0}", ex.Message);
            }
            // Set Volume to 30000 when audio recover
            return(30000);
        }
示例#12
0
        private MixerNativeMethods.MixerControlDetails GetControl(MixerComponentType componentType,
                                                                  MixerControlType controlType)
        {
            try
            {
                MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

                if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) !=
                    MixerError.None)
                {
                    throw new InvalidOperationException("Mixer.GetControl.1");
                }

                using (
                    MixerNativeMethods.MixerLineControls mixerLineControls =
                        new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
                {
                    if (MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType) !=
                        MixerError.None)
                    {
                        throw new InvalidOperationException("Mixer.GetControl.2");
                    }

                    MixerNativeMethods.MixerControl mixerControl =
                        (MixerNativeMethods.MixerControl)
                        Marshal.PtrToStructure(mixerLineControls.Data, typeof(MixerNativeMethods.MixerControl));

                    return(new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId));
                }
            }
            catch (Exception ex)
            {
                // Catch exception when audio device is disconnected
                Log.Error("Mixer: GetControl {0}", ex.Message);
            }
            return(null);
        }
示例#13
0
    private void SetValue(MixerComponentType componentType, MixerControlType controlType, int controlValue)
    {
      MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

      if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) != MixerError.None)
      {
        throw new InvalidOperationException("Mixer.SetValue.1");
      }

      using (
        MixerNativeMethods.MixerLineControls mixerLineControls =
          new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
      {
        if (MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType) !=
            MixerError.None)
        {
          throw new InvalidOperationException("Mixer.SetValue.2");
        }

        MixerNativeMethods.MixerControl mixerControl =
          (MixerNativeMethods.MixerControl)
          Marshal.PtrToStructure(mixerLineControls.Data, typeof (MixerNativeMethods.MixerControl));

        using (
          MixerNativeMethods.MixerControlDetails mixerControlDetails =
            new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId))
        {
          Marshal.WriteInt32(mixerControlDetails.Data, controlValue);
          MixerNativeMethods.mixerSetControlDetails(_handle, mixerControlDetails, 0);
        }
      }
    }
示例#14
0
    private MixerNativeMethods.MixerControlDetails GetControl(MixerComponentType componentType,
                                                              MixerControlType controlType)
    {
      MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

      if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) != MixerError.None)
      {
        throw new InvalidOperationException("Mixer.GetControl.1");
      }

      using (
        MixerNativeMethods.MixerLineControls mixerLineControls =
          new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
      {
        if (MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType) !=
            MixerError.None)
        {
          throw new InvalidOperationException("Mixer.GetControl.2");
        }

        MixerNativeMethods.MixerControl mixerControl =
          (MixerNativeMethods.MixerControl)
          Marshal.PtrToStructure(mixerLineControls.Data, typeof (MixerNativeMethods.MixerControl));

        return new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId);
      }
    }
示例#15
0
		private static bool IsControlCustom(MixerControlType controlType)
		{
			return (controlType == MixerControlType.Custom);
		}
示例#16
0
		private static bool IsControlUnsigned(MixerControlType controlType)
		{
			switch (controlType)
			{
				case MixerControlType.UnsignedMeter:
				case MixerControlType.Unsigned:
				case MixerControlType.Bass:
				case MixerControlType.Equalizer:
				case MixerControlType.Fader:
				case MixerControlType.Treble:
				case MixerControlType.Volume:
				case MixerControlType.MicroTime:
				case MixerControlType.MilliTime:
				case MixerControlType.Percent:
					return true;
				default:
					return false;
			}
		}
示例#17
0
		private static bool IsControlSigned(MixerControlType controlType)
		{
			switch (controlType)
			{
				case MixerControlType.PeakMeter:
				case MixerControlType.SignedMeter:
				case MixerControlType.Signed:
				case MixerControlType.Decibels:
				case MixerControlType.Pan:
				case MixerControlType.QSoundPan:
				case MixerControlType.Slider:
					return true;
				default:
					return false;
			}
		}
示例#18
0
		/// <summary>
		/// Determines whether a specified mixer control type is a list text control
		/// </summary>
		private static bool IsControlListText(MixerControlType controlType)
		{
			switch (controlType)
			{
				case MixerControlType.Equalizer:
				case MixerControlType.Mixer:
				case MixerControlType.MultipleSelect:
				case MixerControlType.Mux:
				case MixerControlType.SingleSelect:
					return true;
				default:
					return false;
			}
		}
示例#19
0
		/// <summary>
		/// Returns true if this is a boolean control
		/// </summary>
		/// <param name="controlType">Control type</param>
		private static bool IsControlBoolean(MixerControlType controlType)
		{
			switch (controlType)
			{
				case MixerControlType.BooleanMeter:
				case MixerControlType.Boolean:
				case MixerControlType.Button:
				case MixerControlType.Loudness:
				case MixerControlType.Mono:
				case MixerControlType.Mute:
				case MixerControlType.OnOff:
				case MixerControlType.StereoEnhance:
				case MixerControlType.Mixer:
				case MixerControlType.MultipleSelect:
				case MixerControlType.Mux:
				case MixerControlType.SingleSelect:
					return true;
				default:
					return false;
			}
		}
示例#20
0
 private static bool IsControlCustom(MixerControlType controlType)
 {
     return(controlType == MixerControlType.Custom);
 }
示例#21
0
    private object GetValue(MixerComponentType componentType, MixerControlType controlType)
    {
      try
      {
        MixerNativeMethods.MixerLine mixerLine = new MixerNativeMethods.MixerLine(componentType);

        if (MixerNativeMethods.mixerGetLineInfoA(_handle, ref mixerLine, MixerLineFlags.ComponentType) !=
            MixerError.None)
        {
          throw new InvalidOperationException("Mixer.OpenControl.1");
        }

        using (
          MixerNativeMethods.MixerLineControls mixerLineControls =
            new MixerNativeMethods.MixerLineControls(mixerLine.LineId, controlType))
        {
          MixerNativeMethods.mixerGetLineControlsA(_handle, mixerLineControls, MixerLineControlFlags.OneByType);
          MixerNativeMethods.MixerControl mixerControl =
            (MixerNativeMethods.MixerControl)
              Marshal.PtrToStructure(mixerLineControls.Data, typeof(MixerNativeMethods.MixerControl));

          using (
            MixerNativeMethods.MixerControlDetails mixerControlDetails =
              new MixerNativeMethods.MixerControlDetails(mixerControl.ControlId))
          {
            MixerNativeMethods.mixerGetControlDetailsA(_handle, mixerControlDetails, 0);

            return Marshal.ReadInt32(mixerControlDetails.Data);
          }
        }
      }
      catch (Exception)
      {
        // Catch exception when audio device is disconnected
      }
      // Set Volume to 30000 when audio recover
      return 30000;
    }
示例#22
0
 public MixerLineControls(int lineId, MixerControlType controlType)
 {
   this.Size = Marshal.SizeOf(typeof (MixerControlDetails));
   this.LineId = lineId;
   this.ControlType = Convert.ToUInt32(controlType);
   this.Controls = 1;
   this.Data = Marshal.AllocCoTaskMem(152);
   this.DataSize = 152;
 }