Chromium Code Reviews| 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <string> | |
| 16 #include <vector> | |
| 17 | |
| 18 namespace webrtc { | |
| 19 namespace test { | |
| 20 namespace conversational_speech { | |
| 21 | |
| 22 class Timing { | |
| 23 public: | |
| 24 struct Turn{ | |
| 25 Turn(std::string speaker_name_, std::string audiotrack_file_name_, | |
| 26 int offset_) | |
|
kwiberg-webrtc
2017/03/16 14:10:09
No trailing underscore on non-member variables, pl
AleBzk
2017/03/20 14:25:28
Done.
| |
| 27 : speaker_name(speaker_name_), | |
| 28 audiotrack_file_name(audiotrack_file_name_), | |
| 29 offset(offset_) {} | |
| 30 bool operator ==(const Turn &b) const; | |
| 31 std::string speaker_name; | |
| 32 std::string audiotrack_file_name; | |
| 33 int offset; | |
| 34 }; | |
| 35 | |
| 36 Timing(); | |
| 37 ~Timing(); | |
| 38 | |
| 39 // Removes all the existing turn entries. | |
| 40 void Clear(); | |
| 41 | |
| 42 // Appends the next turn. | |
| 43 void AppendTurn(std::unique_ptr<Timing::Turn> turn); | |
| 44 | |
| 45 // Loads the turns from a file. | |
| 46 void Load(const std::string& timing_filepath); | |
| 47 | |
| 48 // Writes the turns into a file. | |
| 49 void Save(const std::string& timing_filepath) const; | |
| 50 | |
| 51 const std::vector<std::unique_ptr<Timing::Turn>>& turns() const; | |
| 52 std::size_t Size() const; | |
| 53 | |
| 54 private: | |
| 55 std::vector<std::unique_ptr<Turn>> turns_; | |
|
kwiberg-webrtc
2017/03/16 14:10:09
Turn is a simple value type. Why not just have a s
AleBzk
2017/03/20 14:25:28
True. At this moment copying is not an issue. I ex
kwiberg-webrtc
2017/03/21 22:35:15
OK, definitely just use a std::vector<Turn> then.
| |
| 56 }; | |
| 57 | |
| 58 } // namespace conversational_speech | |
| 59 } // namespace test | |
| 60 } // namespace webrtc | |
| 61 | |
| 62 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_ | |
| OLD | NEW |