本文整理匯總了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()))
{
}