Beispiel #1
0
 void RaiseBalanceChangedEvent(AudioLine audioLine)
 {
     if (this.BalanceChanged != null)
     {
         this.BalanceChanged(audioLine);
     }
 }
Beispiel #2
0
 void RaiseMuteChangedEvent(AudioLine audioLine)
 {
     if (this.MuteChanged != null)
     {
         this.MuteChanged(audioLine);
     }
 }
Beispiel #3
0
 void DefaultLineMuteChanged(AudioLine obj)
 {
     if (MuteChanged != null)
     {
         MuteChanged(this);
     }
 }
Beispiel #4
0
 void RaiseVolumeChangedEvent(AudioLine audioLine)
 {
     if (this.VolumeChanged != null)
     {
         this.VolumeChanged(audioLine);
     }
 }
Beispiel #5
0
 void DefaultLineVolumeChanged(AudioLine obj)
 {
     if (VolumeChanged != null)
     {
         VolumeChanged(this);
     }
 }
Beispiel #6
0
        private void ReloadLines()
        {
            MMErrors errorCode = 0;

            _audioLines.Clear();

            MIXERLINE mxl = new MIXERLINE();
            uint      dwDestination;

            unchecked
            {
                dwDestination = (uint)-1;
            }

            mxl.cbStruct        = (uint)Marshal.SizeOf(mxl);
            mxl.dwComponentType = _componentType;

            errorCode = (MMErrors)MixerNative.mixerGetLineInfo(_hMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE);
            if (errorCode != MMErrors.MMSYSERR_NOERROR)
            {
                throw new MixerException(errorCode, WMME.Audio.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode));
            }

            dwDestination = mxl.dwDestination;

            var mixLine = new AudioLine(this, mxl);

            if (mixLine.CControls != 0 && !(mixLine.CControls == 1 && mixLine.Controls[0].ControlType == MIXERCONTROL_CONTROLTYPE.MUX))
            {
                _audioLines.Add(mixLine);
            }

            int cConnections = (int)mxl.cConnections;

            for (int i = 0; i < cConnections; i++)
            {
                mxl.cbStruct      = (uint)Marshal.SizeOf(mxl);
                mxl.dwDestination = dwDestination;
                mxl.dwSource      = (uint)i;

                errorCode = (MMErrors)MixerNative.mixerGetLineInfo(Handle, ref mxl, MIXER_GETLINEINFOF.SOURCE);
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    throw new MixerException(errorCode, WMME.Audio.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode));
                }

                var mixLineNew = new AudioLine(this, mxl);

                if (mixLineNew.CControls != 0)
                {
                    _audioLines.Add(mixLineNew);
                }
            }
        }
Beispiel #7
0
        public AudioLineControl(AudioLine audioLine, MIXERCONTROL mc, Action <AudioLine> raiseEventDelegate)
        {
            AudioLine           = audioLine;
            _raiseEventDelegate = raiseEventDelegate;

            Id            = mc.dwControlID;
            ControlType   = (MIXERCONTROL_CONTROLTYPE)mc.dwControlType;
            ControlFlag   = (MIXERCONTROL_CONTROLFLAG)mc.fdwControl;
            MultipleItems = mc.cMultipleItems;
            Name          = mc.szName;
            Minimum       = mc.Bounds.dwMinimum;
            Maximum       = mc.Bounds.dwMaximum;
            Steps         = mc.Metrics.cSteps;
        }
Beispiel #8
0
        public static string DumpAudioLine(AudioLine audioLine)
        {
            AudioLine line = audioLine as AudioLine;

            if (line == null)
            {
                return("Line is not supported or null\r\n");
            }

            return(String.Format(@"
  Line:                {0}
  LineId:              {1}
  Active:              {2}
  Balance:             {3}
  CControls:           {4}
  Channel:             {5}
  Channels:            {6}
  ComponentType:       {7}
  Connected:           {8}
  Connections:         {9}
  Controls:
  +++
{10}
  +++
  Destination:         {11}
  Direction:           {12}
  HasBalance:          {13}
  HasVolume:           {14}
  Mute:                {15}
  Source:              {16}
  Volume:              {17}
", line.Name, line.Id, line.Active, line.Balance, line.CControls, Enum.GetName(typeof(Native.Channel), line.Channel),
                                 line.Channels, Enum.GetName(typeof(Native.MIXERLINE_COMPONENTTYPE), line.ComponentType), line.Connected, line.Connections,
                                 DumpCollection(line.Controls, new DumpDelegate <AudioLineControl>(DumpLineControl)), line.Destination, line.Direction, line.HasBalance, line.HasVolume,
                                 line.Mute, line.Source, line.Volume));
        }
Beispiel #9
0
 public MuteAudioLineControl(AudioLine audioLine, MIXERCONTROL mc, Action <AudioLine> raiseEventDelegate)
     : base(audioLine, mc, raiseEventDelegate)
 {
 }