/// <summary>
        /// Cancels recording.
        /// </summary>
        /// <exception cref="InvalidOperationException">If it is called before start()</exception>
        public void Cancel()
        {
            if (_recorder == null)
            {
                throw new InvalidOperationException("The recorder has not been prepared.");
            }

            _recorder.Cancel();
        }
        /// <summary>
        /// Cancels recording.
        /// Invokes "VoiceRecorderStopped" to other application's modules.
        /// </summary>
        public void CancelVoiceRecording()
        {
            try
            {
                _recorder.Cancel();

                // prepare-unpreapare required to make the Recorder work after cancel.
                _recorder.Unprepare();
                _recorder.Prepare();
            }
            catch (Exception exception)
            {
                ErrorHandler(exception.Message);
                return;
            }

            VoiceRecorderStopped?.Invoke(this, new EventArgs());
        }
        /// <summary>
        /// Cancel recording voice
        /// </summary>
        public void Cancel()
        {
            if (_recorder.State == RecorderState.Idle || _recorder.State == RecorderState.Ready)
            {
                Console.WriteLine("AudioRecordService.Cancel : No need to cancel in State (" + _recorder.State + ") ");
                return;
            }

            try
            {
                _recorder.Cancel();
                if (_recorder.State != RecorderState.Ready)
                {
                    Console.WriteLine("    AudioRecordService.Cancel state error");
                }
            }
            catch (Exception e)
            {
                HandleError("Cancel", e);
            }
        }