//// ReSharper disable RedundantDefaultFieldInitializer //private bool m_IsAutoRecordNext = false; //// ReSharper restore RedundantDefaultFieldInitializer //public bool IsAutoRecordNext //{ // get // { // return m_IsAutoRecordNext; // } // set // { // if (m_IsAutoRecordNext == value) return; // m_IsAutoRecordNext = value; // RaisePropertyChanged(() => IsAutoRecordNext); // } //} private void OnAudioRecordingFinished(object sender, AudioRecorder.AudioRecordingFinishEventArgs e) { if (!TheDispatcher.CheckAccess()) { #if DEBUG Debugger.Break(); #endif TheDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action <object, AudioRecorder.AudioRecordingFinishEventArgs>)OnAudioRecordingFinished_, sender, e); return; } OnAudioRecordingFinished_(sender, e); }
public event FinishingPageHandler FinishingPage; // finishing a page private void OnAudioRecordingFinished(object sender, AudioRecorder.AudioRecordingFinishEventArgs e) { mRecorder.AudioRecordingFinished -= OnAudioRecordingFinished; bool deleteAfterInsert = true; if (deleteAfterInsert) { FileDataProvider dataProv = (FileDataProvider)mSessionMedia.Presentation.DataProviderFactory.Create(DataProviderFactory.AUDIO_WAV_MIME_TYPE); dataProv.InitByMovingExistingFile(e.RecordedFilePath); mSessionMedia.AudioMediaData.AppendPcmData(dataProv); } else { // TODO: progress ! (time consuming file copy) mSessionMedia.AudioMediaData.AppendPcmData_RiffHeader(e.RecordedFilePath); } if (deleteAfterInsert && File.Exists(e.RecordedFilePath)) //check exist just in case file adopted by DataProviderManager { File.Delete(e.RecordedFilePath); } m_PhDetectorEstimatedBytesRecorded = 0; }
private void OnAudioRecordingFinished_(object sender, AudioRecorder.AudioRecordingFinishEventArgs e) { if (!Settings.Default.Audio_DisableSingleWavFileRecord) { if (m_RecordAndContinue_StopSingleFileRecord) { m_RecordAndContinue_StopSingleFileRecord = false; return; } } if (m_InterruptRecording) { m_RecordAndContinue = false; m_InterruptRecording = false; checkAndAddDeferredRecordingDataItems(); if (IsMonitoringAlways) { CommandStartMonitor.Execute(); } return; } if (!String.IsNullOrEmpty(e.RecordedFilePath)) { registerRecordedAudioFileForDeferredAddition(e.RecordedFilePath); ////m_RecordAndContinue && ////!Settings.Default.Audio_EnableSkippability //if (m_RecordAndContinue) //{ //} //else //{ // openFile(e.RecordedFilePath, true, true, State.Audio.PcmFormatRecordingMonitoring); //} } if (m_RecordAndContinue) { if (!Settings.Default.Audio_DisableSingleWavFileRecord) { #if DEBUG DebugFix.Assert(IsRecording); #endif } IsAutoPlay = false; Tuple <TreeNode, TreeNode> treeNodeSelection = m_UrakawaSession.GetTreeNodeSelection(); TreeNode treeNode = treeNodeSelection.Item2 ?? treeNodeSelection.Item1; if (treeNode != null) { //TreeNode next = electNextRecordableNode(treeNode); tryNext: //TreeNode nested; //TreeNode next = TreeNode.GetNextTreeNodeWithNoSignificantTextOnlySiblings(false, treeNode, out nested); TreeNode next = TreeNode.NavigatePreviousNextSignificantText(false, treeNode); if (next != null) { TreeNode math = next.GetFirstAncestorWithXmlElement("math"); if (math != null) { next = math; } else { TreeNode svg = next.GetFirstAncestorWithXmlElement("svg"); if (svg != null) { next = svg; } else { TreeNode candidate = m_UrakawaSession.AdjustTextSyncGranularity(next, treeNode); if (candidate != null) { next = candidate; } } } if (Settings.Default.Audio_EnableSkippability && m_UrakawaSession.isTreeNodeSkippable(next)) { treeNode = next; goto tryNext; } m_StateToRestore = null; m_UrakawaSession.PerformTreeNodeSelection(next, false, null); //nested); State.Selection.ClearSelection(); //must appear after tree node selection!!! m_RecordAndContinue = false; if (!Settings.Default.Audio_DisableSingleWavFileRecord) { //RaisePropertyChanged(() => State.Audio.PcmFormatRecordingMonitoring); //if (EventAggregator != null) //{ // EventAggregator.GetEvent<StatusBarMessageUpdateEvent>().Publish(Tobi_Plugin_AudioPane_Lang.Recording); //} //PCMFormatInfo pcmFormatInfo = State.Audio.GetCurrentPcmFormat(); OnStateChanged_Recorder(null, new AudioRecorder.StateChangedEventArgs(AudioRecorder.State.Stopped)); } else { State.Audio.PcmFormatRecordingMonitoring = null; } Tuple <TreeNode, TreeNode> treeNodeSelectionNew = m_UrakawaSession.GetTreeNodeSelection(); TreeNode treeNodeNew = treeNodeSelectionNew.Item2 ?? treeNodeSelectionNew.Item1; if (treeNodeNew != null) { //#if DEBUG // DebugFix.Assert(treeNodeNew == next); //#endif //DEBUG if (treeNodeNew.GetManagedAudioMedia() == null && treeNodeNew.GetFirstDescendantWithManagedAudio() == null) { if (IsWaveFormLoading && View != null) { View.CancelWaveFormLoad(true); } if (!Settings.Default.Audio_DisableSingleWavFileRecord) { // NOOP } else { CommandStartRecord.Execute(); } return; } else { if (!Settings.Default.Audio_DisableSingleWavFileRecord) { m_RecordAndContinue_StopSingleFileRecord = true; CommandStopRecord.Execute(); } if (m_DeferredRecordingDataItems != null) { checkAndAddDeferredRecordingDataItems(); if (IsWaveFormLoading && View != null) { View.CancelWaveFormLoad(true); } m_UrakawaSession.PerformTreeNodeSelection(treeNodeSelectionNew.Item1, false, treeNodeSelectionNew.Item2); } //CommandPlay.Execute(); if (Settings.Default.Audio_Record_OverwriteFollowingAudio) { CommandSelectAll.Execute(); CommandStartRecord.Execute(); } } } else { #if DEBUG Debugger.Break(); #endif } if (IsMonitoringAlways && !IsMonitoring) { CommandStartMonitor.Execute(); } return; } } if (!Settings.Default.Audio_DisableSingleWavFileRecord) { m_RecordAndContinue_StopSingleFileRecord = true; CommandStopRecord.Execute(); } } m_RecordAndContinue = false; checkAndAddDeferredRecordingDataItems(); State.Audio.PcmFormatRecordingMonitoring = null; if (IsMonitoringAlways && !IsMonitoring) { CommandStartMonitor.Execute(); } }