Mixer component.
For a list of all members of this type, see Mixer Members.
System.Object
MarshalByRefObject
Component
Mixer
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
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;
}
}
}
}
Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll)
Mixer Members | Alvas.Audio Namespace