• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2016 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_SIMULATOR_BUFFERS_H_
12 #define MODULES_AUDIO_PROCESSING_TEST_SIMULATOR_BUFFERS_H_
13 
14 #include <memory>
15 #include <vector>
16 
17 #include "modules/audio_processing/audio_buffer.h"
18 #include "modules/audio_processing/include/audio_processing.h"
19 #include "rtc_base/random.h"
20 
21 namespace webrtc {
22 namespace test {
23 
24 struct SimulatorBuffers {
25   SimulatorBuffers(int render_input_sample_rate_hz,
26                    int capture_input_sample_rate_hz,
27                    int render_output_sample_rate_hz,
28                    int capture_output_sample_rate_hz,
29                    size_t num_render_input_channels,
30                    size_t num_capture_input_channels,
31                    size_t num_render_output_channels,
32                    size_t num_capture_output_channels);
33   ~SimulatorBuffers();
34 
35   void CreateConfigAndBuffer(int sample_rate_hz,
36                              size_t num_channels,
37                              Random* rand_gen,
38                              std::unique_ptr<AudioBuffer>* buffer,
39                              StreamConfig* config,
40                              std::vector<float*>* buffer_data,
41                              std::vector<float>* buffer_data_samples);
42 
43   void UpdateInputBuffers();
44 
45   std::unique_ptr<AudioBuffer> render_input_buffer;
46   std::unique_ptr<AudioBuffer> capture_input_buffer;
47   std::unique_ptr<AudioBuffer> render_output_buffer;
48   std::unique_ptr<AudioBuffer> capture_output_buffer;
49   StreamConfig render_input_config;
50   StreamConfig capture_input_config;
51   StreamConfig render_output_config;
52   StreamConfig capture_output_config;
53   std::vector<float*> render_input;
54   std::vector<float> render_input_samples;
55   std::vector<float*> capture_input;
56   std::vector<float> capture_input_samples;
57   std::vector<float*> render_output;
58   std::vector<float> render_output_samples;
59   std::vector<float*> capture_output;
60   std::vector<float> capture_output_samples;
61 };
62 
63 }  // namespace test
64 }  // namespace webrtc
65 
66 #endif  // MODULES_AUDIO_PROCESSING_TEST_SIMULATOR_BUFFERS_H_
67