reverb_frequency_response.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
  11. #define MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
  12. #include <array>
  13. #include <vector>
  14. #include "absl/types/optional.h"
  15. #include "api/array_view.h"
  16. #include "modules/audio_processing/aec3/aec3_common.h"
  17. namespace webrtc {
  18. // Class for updating the frequency response for the reverb.
  19. class ReverbFrequencyResponse {
  20. public:
  21. ReverbFrequencyResponse();
  22. ~ReverbFrequencyResponse();
  23. // Updates the frequency response estimate of the reverb.
  24. void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
  25. frequency_response,
  26. int filter_delay_blocks,
  27. const absl::optional<float>& linear_filter_quality,
  28. bool stationary_block);
  29. // Returns the estimated frequency response for the reverb.
  30. rtc::ArrayView<const float> FrequencyResponse() const {
  31. return tail_response_;
  32. }
  33. private:
  34. void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
  35. frequency_response,
  36. int filter_delay_blocks,
  37. float linear_filter_quality);
  38. float average_decay_ = 0.f;
  39. std::array<float, kFftLengthBy2Plus1> tail_response_;
  40. };
  41. } // namespace webrtc
  42. #endif // MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_