blob: 7ac538dc865fada1b14fdf70573e306874d29dc1 [file] [log] [blame]
peah60a189f2016-05-25 03:54:401/*
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 Bonadei92ea95e2017-09-15 04:47:3111#ifndef MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_
12#define MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_
peah60a189f2016-05-25 03:54:4013
14#include <vector>
15
Danil Chapovalov2b36b372024-10-24 12:46:1516#include "absl/base/nullability.h"
Ali Tofighf3592cb2022-08-16 12:44:3817#include "absl/strings/string_view.h"
Danil Chapovalov2b36b372024-10-24 12:46:1518#include "api/audio/audio_processing.h"
19#include "api/scoped_refptr.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3120#include "modules/audio_processing/test/audio_processing_simulator.h"
peah60a189f2016-05-25 03:54:4021
22namespace webrtc {
23namespace test {
24
25// Used to perform an audio processing simulation from wav files.
26class WavBasedSimulator final : public AudioProcessingSimulator {
27 public:
Danil Chapovalov2b36b372024-10-24 12:46:1528 WavBasedSimulator(
29 const SimulationSettings& settings,
30 absl::Nonnull<scoped_refptr<AudioProcessing>> audio_processing);
Niels Möllerde953292020-09-29 07:46:2131
32 WavBasedSimulator() = delete;
33 WavBasedSimulator(const WavBasedSimulator&) = delete;
34 WavBasedSimulator& operator=(const WavBasedSimulator&) = delete;
35
kwiberg3cc87742016-08-29 22:10:3436 ~WavBasedSimulator() override;
peah60a189f2016-05-25 03:54:4037
38 // Processes the WAV input.
39 void Process() override;
40
Per Åhgren879d33b2021-01-21 09:08:1541 // Only analyzes the data for the simulation, instead of perform any
42 // processing.
43 void Analyze() override;
44
peah60a189f2016-05-25 03:54:4045 private:
46 enum SimulationEventType {
47 kProcessStream,
48 kProcessReverseStream,
49 };
50
51 void Initialize();
52 bool HandleProcessStreamCall();
53 bool HandleProcessReverseStreamCall();
54 void PrepareProcessStreamCall();
55 void PrepareReverseProcessStreamCall();
peah5ad5de32016-12-09 11:18:2256 static std::vector<SimulationEventType> GetDefaultEventChain();
57 static std::vector<SimulationEventType> GetCustomEventChain(
Ali Tofighf3592cb2022-08-16 12:44:3858 absl::string_view filename);
peah60a189f2016-05-25 03:54:4059
60 std::vector<SimulationEventType> call_chain_;
peah60a189f2016-05-25 03:54:4061};
62
63} // namespace test
64} // namespace webrtc
65
Mirko Bonadei92ea95e2017-09-15 04:47:3166#endif // MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_