/// ------------------------------------------------------------------------------------
        private void CreateAnnotationFile(AudioRecordingType fileType, float start, float end)
        {
            if (!Directory.Exists(_model.OralAnnotationsFolder))
            {
                Directory.CreateDirectory(_model.OralAnnotationsFolder);
            }

            if (fileType == AudioRecordingType.Careful)
            {
                File.OpenWrite(Path.Combine(_model.OralAnnotationsFolder,
                                            TimeTier.ComputeFileNameForCarefulSpeechSegment(start, end))).Close();
            }
            else
            {
                File.OpenWrite(Path.Combine(_model.OralAnnotationsFolder,
                                            TimeTier.ComputeFileNameForOralTranslationSegment(start, end))).Close();
            }
        }
        /// ------------------------------------------------------------------------------------
        private void CreateModelAndAnnotationFileForType(AudioRecordingType modelType,
                                                         AudioRecordingType fileType, float start, float end)
        {
            if (Directory.Exists(_model.OralAnnotationsFolder))
            {
                Directory.Delete(_model.OralAnnotationsFolder, true);
            }

            _model.Dispose();
            _model = OralAnnotationRecorderDlgViewModel.Create(_componentFile.Object, modelType);

            Directory.CreateDirectory(_model.OralAnnotationsFolder);

            if (fileType == AudioRecordingType.Careful)
            {
                WriteWavFile(Path.Combine(_model.OralAnnotationsFolder,
                                          TimeTier.ComputeFileNameForCarefulSpeechSegment(start, end)));
            }
            else
            {
                WriteWavFile(Path.Combine(_model.OralAnnotationsFolder,
                                          TimeTier.ComputeFileNameForOralTranslationSegment(start, end)));
            }
        }
Exemplo n.º 3
0
 public void ComputeFileNameForCarefulSpeechSegment_PassGoodStartAndEnd_ReturnsCorrectFileName()
 {
     Assert.AreEqual("3.456_to_10.321_Careful.wav",
                     TimeTier.ComputeFileNameForCarefulSpeechSegment(3.456f, 10.321f));
 }
Exemplo n.º 4
0
 public void ComputeFileNameForCarefulSpeechSegment_PassGoodSegment_ReturnsCorrectFileName()
 {
     Assert.AreEqual("0_to_4.75_Careful.wav",
                     TimeTier.ComputeFileNameForCarefulSpeechSegment(new AnnotationSegment(null, 0f, 4.75f)));
 }
Exemplo n.º 5
0
 public void GetFileNameForCarefulSpeechSegment_PassNullSegment_ThrowsException()
 {
     Assert.Throws <NullReferenceException>(() => TimeTier.ComputeFileNameForCarefulSpeechSegment(null as AnnotationSegment));
 }