Click or drag to resize
Mixer Class
Mixer component.
Inheritance Hierarchy

Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax
public class Mixer : Component

The Mixer type exposes the following members.

Constructors
  NameDescription
Public methodMixer
Initializes a new instance of the Mixer class
Top
Methods
  NameDescription
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Releases all resources used by the Component.
(Inherited from Component.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetDestination
Gets the destination line.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodStatic memberCode exampleGetMixerName
Gets the name of the mixer by index.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodToString
Returns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component.)
Top
Fields
  NameDescription
Public fieldStatic memberPlayback
Playback line
Public fieldStatic memberRecording
Recording line
Top
Properties
  NameDescription
Public propertyContainer
Gets the IContainer that contains the Component.
(Inherited from Component.)
Public propertyStatic memberMixerCount
Gets mixer quantity.
Public propertyMixerID
Gets the mixer ID.
Public propertyMixerName
Gets the name of the mixer.
Public propertyMixerNo
Gets or sets the current mixer number.
Public propertySite
Gets or sets the ISite of the Component.
(Inherited from Component.)
Top
Events
  NameDescription
Public eventControlChange
ControlChange event
Public eventDisposed
Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component.)
Top
Examples
This example shows simple using of Mixer class.
public static void TestMixer()
{
    PlayerEx plex = new PlayerEx();
    int playerMixerNo = plex.GetMixerNo();
    bool isMute = GetPlayerMute(playerMixerNo);
    SetPlayerMute(playerMixerNo, !isMute);

    RecorderEx rex = new RecorderEx();
    SetRecorderVolumeMax(rex.GetMixerNo());
}

private static void SetRecorderVolumeMax(int recorderMixerNo)
{
    Mixer mx = new Mixer();
    mx.MixerNo = recorderMixerNo;
    DestinationLine dl = mx.GetDestination(Mixer.Recording);
    if (dl != null)
    {
        foreach (MixerControl mc in dl.Controls)
        {
            if (mc is MixerIntControl)
            {
                MixerIntControl mic = mc as MixerIntControl;
                mic.Value = mic.Maximum;
                break;
            }
            else if (mc is MixerListControl)
            {
                MixerListControl mlc = dl.Controls[0] as MixerListControl;
                MixerLine ml = mlc.Lines[mlc.Value];
                foreach (MixerControl ctrl in ml.Controls)
                {
                    if (ctrl is MixerIntControl)
                    {
                        MixerIntControl mic = ctrl as MixerIntControl;
                        mic.Value = mic.Maximum;
                        break;
                    }
                }
            }
        }
    }
}

private static bool GetPlayerMute(int playerMixerNo)
{
    Mixer mx = new Mixer();
    mx.MixerNo = playerMixerNo;
    DestinationLine dl = mx.GetDestination(Mixer.Playback);
    if (dl != null)
    {
        foreach (MixerControl ctrl in dl.Controls)
        {
            if (ctrl is MixerMuteControl)
            {
                return ((MixerMuteControl)ctrl).Value != 0;
            }
        }
    }
    return false;
}

private static void SetPlayerMute(int playerMixerNo, bool value)
{
    Mixer mx = new Mixer();
    mx.MixerNo = playerMixerNo;
    DestinationLine dl = mx.GetDestination(Mixer.Playback);
    if (dl != null)
    {
        foreach (MixerControl ctrl in dl.Controls)
        {
            if (ctrl is MixerMuteControl)
            {
                ((MixerMuteControl)ctrl).Value = (value) ? 1 : 0;
                break;
            }
        }
    }
}
See Also