Ivo Creusen | 2cb4105 | 2018-03-15 12:22:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 API_TEST_AUDIOPROC_FLOAT_H_ |
| 12 | #define API_TEST_AUDIOPROC_FLOAT_H_ |
| 13 | |
| 14 | #include <memory> |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 09:57:01 +0200 | [diff] [blame] | 15 | #include <vector> |
Ivo Creusen | 2cb4105 | 2018-03-15 12:22:52 +0100 | [diff] [blame] | 16 | |
| 17 | #include "modules/audio_processing/include/audio_processing.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | namespace test { |
| 21 | |
| 22 | // This is an interface for the audio processing simulation utility. This |
| 23 | // utility can be used to simulate the audioprocessing module using a recording |
| 24 | // (either an AEC dump or wav files), and generate the output as a wav file. |
Per Åhgren | e9cd617 | 2020-05-19 12:52:08 +0200 | [diff] [blame] | 25 | // Any audio_processing object specified in the input is used for the |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 26 | // simulation. The optional `audio_processing` object provides the |
Per Åhgren | e9cd617 | 2020-05-19 12:52:08 +0200 | [diff] [blame] | 27 | // AudioProcessing instance that is used during the simulation. Note that when |
| 28 | // the audio_processing object is specified all functionality that relies on |
| 29 | // using the AudioProcessingBuilder is deactivated, since the AudioProcessing |
| 30 | // object is already created and the builder is not used in the simulation. It |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 31 | // is needed to pass the command line flags as `argc` and `argv`, so these can |
Per Åhgren | e9cd617 | 2020-05-19 12:52:08 +0200 | [diff] [blame] | 32 | // be interpreted properly by the utility. To see a list of all supported |
| 33 | // command line flags, run the executable with the '--help' flag. |
| 34 | int AudioprocFloat(rtc::scoped_refptr<AudioProcessing> audio_processing, |
| 35 | int argc, |
| 36 | char* argv[]); |
| 37 | |
| 38 | // This is an interface for the audio processing simulation utility. This |
| 39 | // utility can be used to simulate the audioprocessing module using a recording |
| 40 | // (either an AEC dump or wav files), and generate the output as a wav file. |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 41 | // The `ap_builder` object will be used to create the AudioProcessing instance |
| 42 | // that is used during the simulation. The `ap_builder` supports setting of |
Ivo Creusen | 2cb4105 | 2018-03-15 12:22:52 +0100 | [diff] [blame] | 43 | // injectable components, which will be passed on to the created AudioProcessing |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 44 | // instance. It is needed to pass the command line flags as `argc` and `argv`, |
Ivo Creusen | 2cb4105 | 2018-03-15 12:22:52 +0100 | [diff] [blame] | 45 | // so these can be interpreted properly by the utility. |
| 46 | // To get a fully-working audioproc_f utility, all that is needed is to write a |
| 47 | // main function, create an AudioProcessingBuilder, optionally set custom |
| 48 | // processing components on it, and pass the builder together with the command |
| 49 | // line arguments into this function. |
| 50 | // To see a list of all supported command line flags, run the executable with |
| 51 | // the '--help' flag. |
| 52 | int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder, |
| 53 | int argc, |
| 54 | char* argv[]); |
| 55 | |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 09:57:01 +0200 | [diff] [blame] | 56 | // Interface for the audio processing simulation utility, which is similar to |
| 57 | // the one above, but which adds the option of receiving the input as a string |
| 58 | // and returning the output as an array. The first three arguments fulfill the |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 59 | // same purpose as above. Pass the `input_aecdump` to provide the content of an |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 09:57:01 +0200 | [diff] [blame] | 60 | // AEC dump file as a string. After the simulation is completed, |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 61 | // `processed_capture_samples` will contain the the samples processed on the |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 09:57:01 +0200 | [diff] [blame] | 62 | // capture side. |
| 63 | int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder, |
| 64 | int argc, |
| 65 | char* argv[], |
| 66 | absl::string_view input_aecdump, |
| 67 | std::vector<float>* processed_capture_samples); |
Ivo Creusen | 2cb4105 | 2018-03-15 12:22:52 +0100 | [diff] [blame] | 68 | } // namespace test |
| 69 | } // namespace webrtc |
| 70 | |
| 71 | #endif // API_TEST_AUDIOPROC_FLOAT_H_ |