2016-05-24 20:54:40 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_
|
2016-05-24 20:54:40 -07:00
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2022-08-16 14:44:38 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_processing/test/audio_processing_simulator.h"
|
2016-05-24 20:54:40 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
// Used to perform an audio processing simulation from wav files.
|
|
|
|
|
class WavBasedSimulator final : public AudioProcessingSimulator {
|
|
|
|
|
public:
|
2018-03-09 17:33:04 +01:00
|
|
|
WavBasedSimulator(const SimulationSettings& settings,
|
2020-05-19 12:52:08 +02:00
|
|
|
rtc::scoped_refptr<AudioProcessing> audio_processing,
|
2018-03-09 17:33:04 +01:00
|
|
|
std::unique_ptr<AudioProcessingBuilder> ap_builder);
|
2020-09-29 09:46:21 +02:00
|
|
|
|
|
|
|
|
WavBasedSimulator() = delete;
|
|
|
|
|
WavBasedSimulator(const WavBasedSimulator&) = delete;
|
|
|
|
|
WavBasedSimulator& operator=(const WavBasedSimulator&) = delete;
|
|
|
|
|
|
2016-08-29 15:10:34 -07:00
|
|
|
~WavBasedSimulator() override;
|
2016-05-24 20:54:40 -07:00
|
|
|
|
|
|
|
|
// Processes the WAV input.
|
|
|
|
|
void Process() override;
|
|
|
|
|
|
2021-01-21 10:08:15 +01:00
|
|
|
// Only analyzes the data for the simulation, instead of perform any
|
|
|
|
|
// processing.
|
|
|
|
|
void Analyze() override;
|
|
|
|
|
|
2016-05-24 20:54:40 -07:00
|
|
|
private:
|
|
|
|
|
enum SimulationEventType {
|
|
|
|
|
kProcessStream,
|
|
|
|
|
kProcessReverseStream,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void Initialize();
|
|
|
|
|
bool HandleProcessStreamCall();
|
|
|
|
|
bool HandleProcessReverseStreamCall();
|
|
|
|
|
void PrepareProcessStreamCall();
|
|
|
|
|
void PrepareReverseProcessStreamCall();
|
2016-12-09 03:18:22 -08:00
|
|
|
static std::vector<SimulationEventType> GetDefaultEventChain();
|
|
|
|
|
static std::vector<SimulationEventType> GetCustomEventChain(
|
2022-08-16 14:44:38 +02:00
|
|
|
absl::string_view filename);
|
2016-05-24 20:54:40 -07:00
|
|
|
|
|
|
|
|
std::vector<SimulationEventType> call_chain_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_TEST_WAV_BASED_SIMULATOR_H_
|