/// ------------------------------------------------------------------------------------ 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))); } }
public void GetFileNameForOralTranslationSegment_PassGoodStartAndEnd_ReturnsCorrectFileName() { Assert.AreEqual("3.456_to_10.321_Translation.wav", TimeTier.ComputeFileNameForOralTranslationSegment(3.456f, 10.321f)); }
public void ComputeFileNameForOralTranslationSegment_PassGoodSegment_ReturnsCorrectFileName() { Assert.AreEqual("0_to_4.75_Translation.wav", TimeTier.ComputeFileNameForOralTranslationSegment(new AnnotationSegment(null, 0f, 4.75f))); }
public void ComputeFileNameForOralTranslationSegment_PassNullSegment_ThrowsException() { Assert.Throws <NullReferenceException>(() => TimeTier.ComputeFileNameForOralTranslationSegment(null as AnnotationSegment)); }