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