Esempio n. 1
0
        public WaveInProvider(WaveInDevice Device, int FrameRate, WaveFormat Wf)
        {
            _waveInEvent = new WaveInEvent
            {
                DeviceNumber       = Device.DeviceNumber,
                BufferMilliseconds = (int)Math.Ceiling(1000 / (decimal)FrameRate),
                NumberOfBuffers    = 3,
                WaveFormat         = new NWaveFormat(Wf.SampleRate, Wf.BitsPerSample, Wf.Channels)
            };

            IsSynchronizable = true;
            WaveFormat       = Wf;

            Setup();
        }
Esempio n. 2
0
        public WaveInProvider(WaveInDevice Device, WaveFormat Wf)
        {
            _waveInEvent = new WaveInEvent
            {
                DeviceNumber       = Device.DeviceNumber,
                BufferMilliseconds = 100,
                NumberOfBuffers    = 3,
                WaveFormat         = new NWaveFormat(Wf.SampleRate, Wf.BitsPerSample, Wf.Channels)
            };

            IsSynchronizable = false;
            WaveFormat       = Wf;

            Setup();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new synchronizable instance of <see cref="WaveInProvider"/> to be used with an <see cref="IRecorder"/>.
        /// </summary>
        /// <param name="Device">The Recording Device.</param>
        /// <param name="Wf"><see cref="WaveFormat"/> to use.</param>
        /// <param name="FrameRate">The <see cref="IRecorder"/>'s FrameRate.</param>
        public WaveInProvider(WaveInDevice Device, WaveFormat Wf, int FrameRate)
        {
            IsSynchronizable = FrameRate != -1;

            _waveInEvent = new WaveInEvent
            {
                DeviceNumber       = Device.DeviceNumber,
                BufferMilliseconds = IsSynchronizable ? (int)Math.Ceiling(1000 / (decimal)FrameRate) : 100,
                NumberOfBuffers    = 3,
                WaveFormat         = new NWaveFormat(Wf.SampleRate, Wf.BitsPerSample, Wf.Channels)
            };

            WaveFormat = Wf;

            _waveInEvent.RecordingStopped += (Sender, Args) => RecordingStopped?.Invoke(this, new EndEventArgs(Args.Exception));

            _waveInEvent.DataAvailable += (Sender, Args) => DataAvailable?.Invoke(this, new DataAvailableEventArgs(Args.Buffer, Args.BytesRecorded));
        }
Esempio n. 4
0
 /// <summary>
 /// Creates a new instance of <see cref="WaveInProvider"/>.
 /// </summary>
 /// <param name="Device">The Recording Device.</param>
 /// <param name="Wf"><see cref="WaveFormat"/> to use.</param>
 public WaveInProvider(WaveInDevice Device, WaveFormat Wf)
     : this(Device, Wf, -1)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new instance of <see cref="WaveInProvider"/> using Default <see cref="WaveFormat"/>.
 /// </summary>
 /// <param name="Device">The Recording Device.</param>
 public WaveInProvider(WaveInDevice Device)
     : this(Device, new WaveFormat())
 {
 }