xref: /aosp_15_r20/external/webrtc/api/test/audioproc_float.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #ifndef API_TEST_AUDIOPROC_FLOAT_H_
12*d9f75844SAndroid Build Coastguard Worker #define API_TEST_AUDIOPROC_FLOAT_H_
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #include <memory>
15*d9f75844SAndroid Build Coastguard Worker #include <vector>
16*d9f75844SAndroid Build Coastguard Worker 
17*d9f75844SAndroid Build Coastguard Worker #include "modules/audio_processing/include/audio_processing.h"
18*d9f75844SAndroid Build Coastguard Worker 
19*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
20*d9f75844SAndroid Build Coastguard Worker namespace test {
21*d9f75844SAndroid Build Coastguard Worker 
22*d9f75844SAndroid Build Coastguard Worker // This is an interface for the audio processing simulation utility. This
23*d9f75844SAndroid Build Coastguard Worker // utility can be used to simulate the audioprocessing module using a recording
24*d9f75844SAndroid Build Coastguard Worker // (either an AEC dump or wav files), and generate the output as a wav file.
25*d9f75844SAndroid Build Coastguard Worker // Any audio_processing object specified in the input is used for the
26*d9f75844SAndroid Build Coastguard Worker // simulation. The optional `audio_processing` object provides the
27*d9f75844SAndroid Build Coastguard Worker // AudioProcessing instance that is used during the simulation. Note that when
28*d9f75844SAndroid Build Coastguard Worker // the audio_processing object is specified all functionality that relies on
29*d9f75844SAndroid Build Coastguard Worker // using the AudioProcessingBuilder is deactivated, since the AudioProcessing
30*d9f75844SAndroid Build Coastguard Worker // object is already created and the builder is not used in the simulation. It
31*d9f75844SAndroid Build Coastguard Worker // is needed to pass the command line flags as `argc` and `argv`, so these can
32*d9f75844SAndroid Build Coastguard Worker // be interpreted properly by the utility. To see a list of all supported
33*d9f75844SAndroid Build Coastguard Worker // command line flags, run the executable with the '--help' flag.
34*d9f75844SAndroid Build Coastguard Worker int AudioprocFloat(rtc::scoped_refptr<AudioProcessing> audio_processing,
35*d9f75844SAndroid Build Coastguard Worker                    int argc,
36*d9f75844SAndroid Build Coastguard Worker                    char* argv[]);
37*d9f75844SAndroid Build Coastguard Worker 
38*d9f75844SAndroid Build Coastguard Worker // This is an interface for the audio processing simulation utility. This
39*d9f75844SAndroid Build Coastguard Worker // utility can be used to simulate the audioprocessing module using a recording
40*d9f75844SAndroid Build Coastguard Worker // (either an AEC dump or wav files), and generate the output as a wav file.
41*d9f75844SAndroid Build Coastguard Worker // The `ap_builder` object will be used to create the AudioProcessing instance
42*d9f75844SAndroid Build Coastguard Worker // that is used during the simulation. The `ap_builder` supports setting of
43*d9f75844SAndroid Build Coastguard Worker // injectable components, which will be passed on to the created AudioProcessing
44*d9f75844SAndroid Build Coastguard Worker // instance. It is needed to pass the command line flags as `argc` and `argv`,
45*d9f75844SAndroid Build Coastguard Worker // so these can be interpreted properly by the utility.
46*d9f75844SAndroid Build Coastguard Worker // To get a fully-working audioproc_f utility, all that is needed is to write a
47*d9f75844SAndroid Build Coastguard Worker // main function, create an AudioProcessingBuilder, optionally set custom
48*d9f75844SAndroid Build Coastguard Worker // processing components on it, and pass the builder together with the command
49*d9f75844SAndroid Build Coastguard Worker // line arguments into this function.
50*d9f75844SAndroid Build Coastguard Worker // To see a list of all supported command line flags, run the executable with
51*d9f75844SAndroid Build Coastguard Worker // the '--help' flag.
52*d9f75844SAndroid Build Coastguard Worker int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder,
53*d9f75844SAndroid Build Coastguard Worker                    int argc,
54*d9f75844SAndroid Build Coastguard Worker                    char* argv[]);
55*d9f75844SAndroid Build Coastguard Worker 
56*d9f75844SAndroid Build Coastguard Worker // Interface for the audio processing simulation utility, which is similar to
57*d9f75844SAndroid Build Coastguard Worker // the one above, but which adds the option of receiving the input as a string
58*d9f75844SAndroid Build Coastguard Worker // and returning the output as an array. The first three arguments fulfill the
59*d9f75844SAndroid Build Coastguard Worker // same purpose as above. Pass the `input_aecdump` to provide the content of an
60*d9f75844SAndroid Build Coastguard Worker // AEC dump file as a string. After the simulation is completed,
61*d9f75844SAndroid Build Coastguard Worker // `processed_capture_samples` will contain the the samples processed on the
62*d9f75844SAndroid Build Coastguard Worker // capture side.
63*d9f75844SAndroid Build Coastguard Worker int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder,
64*d9f75844SAndroid Build Coastguard Worker                    int argc,
65*d9f75844SAndroid Build Coastguard Worker                    char* argv[],
66*d9f75844SAndroid Build Coastguard Worker                    absl::string_view input_aecdump,
67*d9f75844SAndroid Build Coastguard Worker                    std::vector<float>* processed_capture_samples);
68*d9f75844SAndroid Build Coastguard Worker }  // namespace test
69*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
70*d9f75844SAndroid Build Coastguard Worker 
71*d9f75844SAndroid Build Coastguard Worker #endif  // API_TEST_AUDIOPROC_FLOAT_H_
72