• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2015 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 WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
13 
14 #include "webrtc/common_audio/channel_buffer.h"
15 #include "webrtc/modules/audio_processing/beamformer/array_util.h"
16 
17 namespace webrtc {
18 
19 template<typename T>
20 class Beamformer {
21  public:
~Beamformer()22   virtual ~Beamformer() {}
23 
24   // Process one time-domain chunk of audio. The audio is expected to be split
25   // into frequency bands inside the ChannelBuffer. The number of frames and
26   // channels must correspond to the constructor parameters. The same
27   // ChannelBuffer can be passed in as |input| and |output|.
28   virtual void ProcessChunk(const ChannelBuffer<T>& input,
29                             ChannelBuffer<T>* output) = 0;
30 
31   // Sample rate corresponds to the lower band.
32   // Needs to be called before the the Beamformer can be used.
33   virtual void Initialize(int chunk_size_ms, int sample_rate_hz) = 0;
34 
35   // Aim the beamformer at a point in space.
36   virtual void AimAt(const SphericalPointf& spherical_point) = 0;
37 
38   // Indicates whether a given point is inside of the beam.
IsInBeam(const SphericalPointf & spherical_point)39   virtual bool IsInBeam(const SphericalPointf& spherical_point) { return true; }
40 
41   // Returns true if the current data contains the target signal.
42   // Which signals are considered "targets" is implementation dependent.
43   virtual bool is_target_present() = 0;
44 };
45 
46 }  // namespace webrtc
47 
48 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_BEAMFORMER_BEAMFORMER_H_
49