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