xref: /aosp_15_r20/external/webrtc/modules/audio_processing/test/conversational_speech/timing.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_
12 #define MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "absl/strings/string_view.h"
18 #include "api/array_view.h"
19 
20 namespace webrtc {
21 namespace test {
22 namespace conversational_speech {
23 
24 struct Turn {
TurnTurn25   Turn(absl::string_view new_speaker_name,
26        absl::string_view new_audiotrack_file_name,
27        int new_offset,
28        int gain)
29       : speaker_name(new_speaker_name),
30         audiotrack_file_name(new_audiotrack_file_name),
31         offset(new_offset),
32         gain(gain) {}
33   bool operator==(const Turn& b) const;
34   std::string speaker_name;
35   std::string audiotrack_file_name;
36   int offset;
37   int gain;
38 };
39 
40 // Loads a list of turns from a file.
41 std::vector<Turn> LoadTiming(absl::string_view timing_filepath);
42 
43 // Writes a list of turns into a file.
44 void SaveTiming(absl::string_view timing_filepath,
45                 rtc::ArrayView<const Turn> timing);
46 
47 }  // namespace conversational_speech
48 }  // namespace test
49 }  // namespace webrtc
50 
51 #endif  // MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_TIMING_H_
52