Exemplo n.º 1
0
        private void OnRecordingStopped(object sender, StoppedEventArgs err)
        {
            if (err.Exception != null)
            {
                InfoMessage?.Invoke(this, $"Ошибка: {err.Exception.Message}");
            }

            ffmpegProcess?.StandardOutput.Close();
            ffmpegProcess?.StandardInput.Close();
            ffmpegProcess?.Kill();

            _audioCapture.RecordingStopped -= OnRecordingStopped;
            _audioCapture.DataAvailable    -= OnDataAvailable;


            _audioCapture.Dispose();
            _audioCapture            = null;
            _threadSafeBoolBackValue = 0;

            Task.Run(() => { _transportService.SendFinalData(); }).Wait();
            Task.Run(() => { _transportService.CloseConnection(); }).Wait();
            InfoMessage?.Invoke(this, "Запись остановлена");
            RecordLevel?.Invoke(this, 0.0F);
            RecordStopped?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public virtual bool BDeserialize(BiuSerializer ser)
        {
            bool bRet = true;

            try
            {
                short nVal = 0;

                ser
                .Deserialize(ref nVal)
                .Deserialize(ref Date)
                .Deserialize(ref SiteName)
                .Deserialize(ref OperationName)
                .Deserialize(ref SuspiciousCause)
                .Deserialize(ref Remark)
                .Deserialize(ref ErrorCode)
                .Deserialize(ref LogString);

                Level = (RecordLevel)nVal;
            }
            catch
            {
                bRet = false;
            }

            return(bRet);
        }
Exemplo n.º 3
0
        private void OnDataAvailable(object sender, WaveInEventArgs waveInEventArgs)
        {
            var ffmpegIn = ffmpegProcess.StandardInput.BaseStream;

            RecordLevel?.Invoke(this, CalculateRecordLevel(waveInEventArgs));
            ffmpegIn.Write(waveInEventArgs.Buffer, 0, waveInEventArgs.BytesRecorded);

            Task.Run(async() => await ProcessData());
        }