/// <summary> /// Get Device By Index. /// </summary> public static WasapiLoopbackDevice Get(int Device) { if (Singleton.ContainsKey(Device)) { return(Singleton[Device] as WasapiLoopbackDevice); } WasapiDeviceInfo info; if (!(BassWasapi.GetDeviceInfo(Device, out info) && info.IsLoopback)) { throw new ArgumentException("Invalid WasapiLoopbackDevice Index"); } var dev = new WasapiLoopbackDevice(Device); Singleton.Add(Device, dev); return(dev); }
internal bool _Init(int Frequency, int Channels, bool Shared, bool UseEventSync, int Buffer, int Period) { if (Info.IsInitialized) { return(true); } var flags = Shared ? WasapiInitFlags.Shared : WasapiInitFlags.Exclusive; if (UseEventSync) { flags |= WasapiInitFlags.EventDriven; } var result = BassWasapi.Init(DeviceIndex, Frequency, Channels, flags, Buffer, Period, _proc); return(result); }
/// <summary> /// Starts the device. /// </summary> public bool Start() { Ensure(); return(BassWasapi.Start()); }
/// <summary> /// Frees the Device. /// </summary> public void Dispose() { Ensure(); Callback = null; BassWasapi.Free(); }
/// <summary> /// Stops the device. /// </summary> public bool Stop(bool Reset = true) { Ensure(); return(BassWasapi.Stop(Reset)); }