peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame^] | 11 | #ifndef MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_ |
peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame^] | 16 | #include "modules/audio_processing/test/audio_processing_simulator.h" |
peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame^] | 18 | #include "rtc_base/constructormagic.h" |
peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | namespace test { |
| 22 | |
| 23 | // Used to perform an audio processing simulation from wav files. |
| 24 | class WavBasedSimulator final : public AudioProcessingSimulator { |
| 25 | public: |
kwiberg | 3cc8774 | 2016-08-29 22:10:34 | [diff] [blame] | 26 | explicit WavBasedSimulator(const SimulationSettings& settings); |
| 27 | ~WavBasedSimulator() override; |
peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 28 | |
| 29 | // Processes the WAV input. |
| 30 | void Process() override; |
| 31 | |
| 32 | private: |
| 33 | enum SimulationEventType { |
| 34 | kProcessStream, |
| 35 | kProcessReverseStream, |
| 36 | }; |
| 37 | |
| 38 | void Initialize(); |
| 39 | bool HandleProcessStreamCall(); |
| 40 | bool HandleProcessReverseStreamCall(); |
| 41 | void PrepareProcessStreamCall(); |
| 42 | void PrepareReverseProcessStreamCall(); |
peah | 5ad5de3 | 2016-12-09 11:18:22 | [diff] [blame] | 43 | static std::vector<SimulationEventType> GetDefaultEventChain(); |
| 44 | static std::vector<SimulationEventType> GetCustomEventChain( |
| 45 | const std::string& filename); |
peah | 60a189f | 2016-05-25 03:54:40 | [diff] [blame] | 46 | |
| 47 | std::vector<SimulationEventType> call_chain_; |
| 48 | int last_specified_microphone_level_ = 100; |
| 49 | |
| 50 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WavBasedSimulator); |
| 51 | }; |
| 52 | |
| 53 | } // namespace test |
| 54 | } // namespace webrtc |
| 55 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame^] | 56 | #endif // MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_ |