Init() public method

Initialises the device.
public Init ( ) : bool
return bool
コード例 #1
0
        /// <summary>
        /// Creates a new instance of <see cref="Loopback"/> capture.
        /// </summary>
        /// <param name="Device">The <see cref="WasapiLoopbackDevice"/> to use.</param>
        /// <param name="IncludeSilence">Whether to include Silence in the Capture.</param>
        public Loopback(WasapiLoopbackDevice Device, bool IncludeSilence = true)
        {
            _device = Device;

            if (IncludeSilence)
            {
                var playbackDevice = PlaybackDevice.Devices.First(Dev => Dev.Info.Driver == Device.Info.ID);

                _silencePlayer = new Silence(playbackDevice);
            }

            Device.Init();
            Device.Callback += Processing;

            var info = Device.Info;

            AudioFormat = WaveFormat.FromParams(info.MixFrequency, info.MixChannels, Resolution.Float);
        }
コード例 #2
0
ファイル: Loopback.cs プロジェクト: ManagedBass/ManagedBass
        /// <summary>
        /// Creates a new instance of <see cref="Loopback"/> capture.
        /// </summary>
        /// <param name="Device">The <see cref="WasapiLoopbackDevice"/> to use.</param>
        /// <param name="IncludeSilence">Whether to include Silence in the Capture.</param>
        public Loopback(WasapiLoopbackDevice Device, bool IncludeSilence = true)
        {
            _device = Device;

            if (IncludeSilence)
            {
                var playbackDevice = PlaybackDevice.Devices.First(Dev => Dev.Info.Driver == Device.Info.ID);

                _silencePlayer = new Silence(playbackDevice);
            }

            Device.Init();
            Device.Callback += Processing;

            var info = Device.Info;

            AudioFormat = WaveFormat.FromParams(info.MixFrequency, info.MixChannels, Resolution.Float);
        }