public Loopback(WasapiLoopbackDevice Device, bool IncludeSilence) { this.Device = Device; if (IncludeSilence) { PlaybackDevice playbackDevice = PlaybackDevice.DefaultDevice; foreach (var dev in PlaybackDevice.Devices) { if (dev.DeviceInfo.Driver == Device.DeviceInfo.ID) { playbackDevice = dev; } } SilencePlayer = new Silence(playbackDevice); } Device.Init(); Device.Callback += (b) => { if (DataAvailable != null) { DataAvailable(b); } }; }
static WasapiLoopbackDevice Get(int Device) { if (Singleton.ContainsKey(Device)) { return(Singleton[Device]); } else { var Dev = new WasapiLoopbackDevice() { DeviceIndex = Device }; Singleton.Add(Device, Dev); return(Dev); } }