Exemple #1
0
        public void Remove(MixerLine mixerLine)
        {
            if (this.InnerList.Contains(mixerLine))
            {
                this.InnerList.Remove(mixerLine);
                return;
            }

            MixerLine mixerLineToRemove = null;

            foreach (MixerLine mixerLineLoop in this.InnerList)
            {
                if (mixerLineLoop.ComponentType == mixerLine.ComponentType &&
                    mixerLineLoop.Destination == mixerLine.Destination &&
                    mixerLineLoop.Id == mixerLine.Id &&
                    mixerLineLoop.Source == mixerLine.Source &&
                    mixerLineLoop.Name == mixerLine.Name)
                {
                    mixerLineToRemove = mixerLineLoop;
                    break;
                }
            }

            if (mixerLineToRemove != null)
            {
                this.InnerList.Remove(mixerLineToRemove);
            }
        }
Exemple #2
0
 private void PtrMixerLineChange(IntPtr hMixer, uint lineId)
 {
     if (hMixer != IntPtr.Zero && MixerLineChanged != null)
     {
         MixerLine line = mUserLines.GetMixerLineByLineId(lineId);
         if (line != null)
         {
             MixerLineChanged(this, line);
         }
     }
 }
Exemple #3
0
        public bool Contains(MixerLine line)
        {
            foreach (MixerLine mixerLine in this.InnerList)
            {
                if (mixerLine == line)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #4
0
 private void PtrMixerControlChange(IntPtr hMixer, uint controlId)
 {
     if (hMixer != IntPtr.Zero && MixerLineChanged != null)
     {
         MixerLine line = mUserLines.GetMixerLineByControlId(controlId);
         if (line != null)
         {
             MixerLineChanged(this, line);
         }
         else
         {
             MixerLine lineOS = mLines.GetMixerLineByControlId(controlId);
             if (lineOS != null)
             {
                 foreach (MixerLine broadcastLine in mUserLines)
                 {
                     MixerLineChanged(this, broadcastLine);
                 }
             }
         }
     }
 }
Exemple #5
0
 public void Add(MixerLine line)
 {
     this.InnerList.Add(line);
 }
Exemple #6
0
        private void ReloadLines()
        {
            MMErrors errorCode = 0;

            mLines.Clear();
            mUserLines.Clear();

            MIXERLINE         mxl = new MIXERLINE();
            MIXERLINECONTROLS mlc = new MIXERLINECONTROLS();
            MIXERCONTROL      mc  = new MIXERCONTROL();
            uint dwDestination;

            unchecked
            {
                dwDestination = (uint)-1;
            }

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

            if (mMixerType == MixerType.Recording)
            {
                mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_WAVEIN;
                errorCode           = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE);
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode));
                }
            }
            else if (mMixerType == MixerType.Playback)
            {
                mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_SPEAKERS;
                errorCode           = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE);
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    mxl.dwComponentType = MIXERLINE_COMPONENTTYPE.DST_UNDEFINED;
                    errorCode           = (MMErrors)MixerNative.mixerGetLineInfo(mHMixer, ref mxl, MIXER_GETLINEINFOF.COMPONENTTYPE);
                    if (errorCode != MMErrors.MMSYSERR_NOERROR)
                    {
                        throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode));
                    }
                }
            }

            dwDestination = mxl.dwDestination;

            MixerLine mixLine = new MixerLine();

            if (mMixerType == MixerType.Recording)
            {
                mixLine.Direction = MixerType.Recording;
            }
            else if (mMixerType == MixerType.Playback)
            {
                mixLine.Direction = MixerType.Playback;
            }

            mixLine.Mixer         = this;
            mixLine.Channels      = mxl.cChannels;
            mixLine.CControls     = mxl.cControls;
            mixLine.Connections   = mxl.cConnections;
            mixLine.Flag          = mxl.fdwLine;
            mixLine.Destination   = dwDestination;
            mixLine.Name          = mxl.szName;
            mixLine.Id            = mxl.dwLineID;
            mixLine.ComponentType = mxl.dwComponentType;
            mixLine.Source        = mxl.dwSource;
            mixLine.HMixer        = mHMixer;

            if (mixLine.CControls != 0 && !(mixLine.CControls == 1 && mixLine.Controls[0].Type == MIXERCONTROL_CONTROLTYPE.MUX))
            {
                mUserLines.Add(mixLine);
            }
            mLines.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(mHMixer, ref mxl, MIXER_GETLINEINFOF.SOURCE);
                if (errorCode != MMErrors.MMSYSERR_NOERROR)
                {
                    throw new MixerException(errorCode, Mixers.GetErrorDescription(FuncName.fnMixerGetLineInfo, errorCode));
                }

                MixerLine mixLineNew = new MixerLine();

                if (mMixerType == MixerType.Recording)
                {
                    mixLineNew.Direction = MixerType.Recording;
                }
                else if (mMixerType == MixerType.Playback)
                {
                    mixLineNew.Direction = MixerType.Playback;
                }

                mixLineNew.Mixer         = this;
                mixLineNew.Channels      = mxl.cChannels;
                mixLineNew.CControls     = mxl.cControls;
                mixLineNew.Connections   = mxl.cConnections;
                mixLineNew.Flag          = mxl.fdwLine;
                mixLineNew.Destination   = dwDestination;
                mixLineNew.Name          = mxl.szName;
                mixLineNew.Id            = mxl.dwLineID;
                mixLineNew.ComponentType = mxl.dwComponentType;
                mixLineNew.Source        = mxl.dwSource;
                mixLineNew.HMixer        = mHMixer;

                if (mixLineNew.CControls != 0)
                {
                    mUserLines.Add(mixLineNew);
                }
                mLines.Add(mixLineNew);
            }
        }