OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include <iostream> | |
12 | |
13 #include "gflags/gflags.h" | |
14 #include "webrtc/base/logging.h" | |
15 #include "webrtc/modules/audio_processing/test/conversational_speech/settings.h" | |
16 #include "webrtc/test/testsupport/fileutils.h" | |
17 | |
18 namespace webrtc { | |
19 namespace test { | |
20 namespace { | |
21 | |
22 // Adapting DirExists/FileExists interfaces to DEFINE_validator. | |
23 auto dir_exists = [](const char* c, const std::string& dirpath) { | |
24 return DirExists(dirpath); | |
25 }; | |
26 auto file_exists = [](const char* c, const std::string& filepath) { | |
27 return FileExists(filepath); | |
28 }; | |
29 | |
30 const char kUsageDescription[] = | |
31 "Usage: convspeech_gen\n" | |
32 " -i <path/to/source/audiotracks>\n" | |
33 " -t <path/to/timing_file.txt>\n" | |
34 " -o <output/path>\n" | |
35 "\n\n" | |
36 "Command-line tool to generate multiple-end audio tracks to simulate " | |
37 "conversational speech with two or more participants."; | |
38 | |
39 DEFINE_string(i, "", "Directory containing the speech turn wav files"); | |
40 DEFINE_validator(i, dir_exists); | |
41 DEFINE_string(t, "", "Path to the timing text file"); | |
42 DEFINE_validator(t, file_exists); | |
43 DEFINE_string(o, "", "Output wav files destination path"); | |
44 DEFINE_validator(o, dir_exists); | |
45 | |
46 } // namespace | |
47 | |
48 int main(int argc, char* argv[]) { | |
49 google::SetUsageMessage(kUsageDescription); | |
50 google::ParseCommandLineFlags(&argc, &argv, true); | |
51 | |
52 ConvSpeechGeneratorSettings settings(FLAGS_i, FLAGS_t, FLAGS_o); | |
53 | |
54 // TODO(alessiob): remove line below once debugged. | |
55 rtc::LogMessage::LogToDebug(rtc::LS_VERBOSE); | |
56 LOG(LS_VERBOSE) << "i = " << settings.audiotracks_path(); | |
57 LOG(LS_VERBOSE) << "t = " << settings.timing_filepath(); | |
58 LOG(LS_VERBOSE) << "o = " << settings.output_path(); | |
59 | |
60 return 0; | |
61 } | |
62 | |
63 } // namespace test | |
64 } // namespace webrtc | |
65 | |
66 int main(int argc, char* argv[]) { | |
67 return webrtc::test::main(argc, argv); | |
68 } | |
OLD | NEW |