本文整理汇总了C#中NAudio.Wave.WaveIn.GetMixerLine方法的典型用法代码示例。如果您正苦于以下问题:C# WaveIn.GetMixerLine方法的具体用法?C# WaveIn.GetMixerLine怎么用?C# WaveIn.GetMixerLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAudio.Wave.WaveIn
的用法示例。
在下文中一共展示了WaveIn.GetMixerLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VolumeControl
public VolumeControl(int deviceNumber)
{
waveIn = new WaveIn();
waveIn.DeviceNumber = deviceNumber;
// waveIn.DataAvailable += waveIn_DataAvailable;
// waveIn.StartRecording();
int waveInDeviceNumber = waveIn.DeviceNumber;
if (Environment.OSVersion.Version.Major >= 6) // Vista and over
{
var mixerLine = waveIn.GetMixerLine();
//new MixerLine((IntPtr)waveInDeviceNumber, 0, MixerFlags.WaveIn);
foreach (var control in mixerLine.Controls.Where(control => control.ControlType == MixerControlType.Volume))
{
this.volumeControl = control as UnsignedMixerControl;
//Level = desiredVolume;
break;
}
}
else
{
var mixer = new Mixer(waveInDeviceNumber);
foreach (var source in from destination in mixer.Destinations
where destination.ComponentType == MixerLineComponentType.DestinationWaveIn
from source in destination.Sources
where source.ComponentType == MixerLineComponentType.SourceMicrophone
select source)
{
foreach (var control in source.Controls.Where(control => control.ControlType == MixerControlType.Volume))
{
volumeControl = control as UnsignedMixerControl;
//Level = desiredVolume;
break;
}
}
}
}
示例2: CanGetWaveInMixerLine
public void CanGetWaveInMixerLine()
{
using (WaveIn waveIn = new WaveIn())
{
MixerLine line = waveIn.GetMixerLine();
//Debug.WriteLine(String.Format("Mic Level {0}", level));
}
}
示例3: Record
public void Record(string fileName, int volume = 100)
{
_waveIn = new WaveIn { WaveFormat = new WaveFormat() };
_writer = new WaveFileWriter(fileName, _waveIn.WaveFormat);
TrySetVolumeControl(_waveIn.GetMixerLine(), volume);
_waveIn.DataAvailable += new_dataAvailable;
_waveIn.StartRecording();
}
示例4: AudioLevelManager
protected AudioLevelManager(WaveIn waveDevice)
: this(GetVolumeMixerControlForInputLine(waveDevice.GetMixerLine()))
{
}