コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 /// <summary>
 /// Starts the device.
 /// </summary>
 public bool Start()
 {
     Ensure();
     return(BassWasapi.Start());
 }
コード例 #4
0
 /// <summary>
 /// Frees the Device.
 /// </summary>
 public void Dispose()
 {
     Ensure();
     Callback = null;
     BassWasapi.Free();
 }
コード例 #5
0
 /// <summary>
 /// Stops the device.
 /// </summary>
 public bool Stop(bool Reset = true)
 {
     Ensure();
     return(BassWasapi.Stop(Reset));
 }