Наследование: System.EventArgs
 protected void OnFrameAvailable(object sender, AudioDataEventArgs e)
 {
     if (FrameAvailable != null)
     {
         FrameAvailable(sender, e);
     }
 }
        int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
        {
            if (_lastSampleTime < 0.0)
            {
                _lastSampleTime = SampleTime;
                return(0);
            }
            double frame_duration = SampleTime - _lastSampleTime;

            _lastSampleTime = SampleTime;


            var args = new AudioDataEventArgs();

            if (UseAbsoluteTime)
            {
                args.CaptureTime = (DateTime.Now - _startDay).TotalSeconds - m_TimecodeBase - frame_duration;
            }
            else
            {
                args.CaptureTime = SampleTime - m_TimecodeBase;
                if (args.CaptureTime < 0.0)
                {
                    return(0);
                }
            }

            args.Samples = new short[BufferLen / 2];
            Marshal.Copy(pBuffer, args.Samples, 0, BufferLen / 2);
            OnFrameAvailable(this, args);
            return(0);
        }
Пример #3
0
 protected void OnFrameAvailable(object sender, AudioDataEventArgs e)
 {
     if (FrameAvailable != null) {
         FrameAvailable(sender, e);
     }
 }
Пример #4
0
        int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
        {
            if (_lastSampleTime < 0.0) {
                _lastSampleTime = SampleTime;
                return 0;
            }
            double frame_duration = SampleTime - _lastSampleTime;
            _lastSampleTime = SampleTime;

            var args = new AudioDataEventArgs();

            if (UseAbsoluteTime) {
                args.CaptureTime = (DateTime.Now - _startDay).TotalSeconds - m_TimecodeBase - frame_duration;
            } else {
                args.CaptureTime = SampleTime - m_TimecodeBase;
                if (args.CaptureTime < 0.0) return 0;
            }

            args.Samples = new short[BufferLen / 2];
            Marshal.Copy(pBuffer, args.Samples, 0, BufferLen / 2);
            OnFrameAvailable(this, args);
            return 0;
        }