using System;
using NAudio.CoreAudioApi;
// ReSharper disable once CheckNamespace
namespace NAudio.Wave
{
///
/// WASAPI Loopback Capture
/// based on a contribution from "Pygmy" - http://naudio.codeplex.com/discussions/203605
///
public class WasapiLoopbackCapture : WasapiCapture
{
///
/// Initialises a new instance of the WASAPI capture class
///
public WasapiLoopbackCapture() :
this(GetDefaultLoopbackCaptureDevice())
{
}
///
/// Initialises a new instance of the WASAPI capture class
///
/// Capture device to use
public WasapiLoopbackCapture(MMDevice captureDevice) :
base(captureDevice)
{
}
///
/// Gets the default audio loopback capture device
///
/// The default audio loopback capture device
public static MMDevice GetDefaultLoopbackCaptureDevice()
{
MMDeviceEnumerator devices = new MMDeviceEnumerator();
return devices.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
}
///
/// Specify loopback
///
protected override AudioClientStreamFlags GetAudioClientStreamFlags()
{
return AudioClientStreamFlags.Loopback | base.GetAudioClientStreamFlags();
}
}
}