Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: webrtc/modules/audio_processing/test/conversational_speech/settings.cc

Issue 2740063004: C++ porting of the initial python script for conversational speech generation. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/conversational_speech/settings.cc
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/settings.cc b/webrtc/modules/audio_processing/test/conversational_speech/settings.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9c11502573a9b2ef1da2aaf021e8e93167fa5f66
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/conversational_speech/settings.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/audio_processing/test/conversational_speech/settings.h"
+
+namespace webrtc {
+namespace test {
+namespace convspeechgen {
+
+const std::string Settings::AudiotracksPath(void) {
+ return audiotracks_path_;
+}
+
+const std::string Settings::TimingFilePath(void) {
+ return timing_filepath_;
+}
+
+const std::string Settings::OutputPath(void) {
+ return output_path_;
+}
+
+bool Settings::ValidateAndReport(void) {
+ bool bln_valid_audiotracks_path = ValidateDirectoryPath(&audiotracks_path_);
hlundin-webrtc 2017/03/13 12:28:19 We typically don't add bln_ to qualify the variabl
AleBzk 2017/03/13 14:14:41 Acknowledged.
+ ReportConditionalError(
+ !bln_valid_audiotracks_path, "invalid audio tracks path");
+
+ bool bln_valid_timing_filepath = ValidateDirectoryPath(&timing_filepath_);
+ ReportConditionalError(
+ !bln_valid_timing_filepath, "invalid timing file path");
+
+ bool bln_valid_output_path = ValidateDirectoryPath(&output_path_);
+ ReportConditionalError(!bln_valid_output_path, "invalid output path");
+
+ return bln_valid_audiotracks_path && bln_valid_timing_filepath &&
+ (bln_valid_output_path);
+}
+
+bool Settings::ValidateFilePath(std::string* path) {
+ // TODO(alessiob): check that the file exists.
+ return true;
+}
+
+bool Settings::ValidateDirectoryPath(std::string* path) {
+ // TODO(alessiob): check that the directory exists.
+ return true;
+}
+
+void Settings::ReportConditionalError(bool condition, std::string message) {
+ if (condition)
+ std::cerr << message << std::endl;
+}
+
+} // namespace convspeechgen
+} // namespace test
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698