RavEngine
Loading...
Searching...
No Matches
mono_pole_filter.h
1/*
2Copyright 2018 Google Inc. All Rights Reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS-IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef RESONANCE_AUDIO_DSP_MONO_POLE_FILTER_H_
18#define RESONANCE_AUDIO_DSP_MONO_POLE_FILTER_H_
19
20#include "base/audio_buffer.h"
21
22namespace vraudio {
23
24// Class representing a mono pole filter. This class also performs filtering.
26 public:
27 // Constructs a |MonoPoleFilter| given a single coefficient.
28 //
29 // @param coefficient A single coefficient between 0.0f and 1.0f.
30 explicit MonoPoleFilter(float coefficient);
31
32 // Filter method for use with AudioBuffer::Channel.
33 //
34 // @param input |AudioBuffer::Channel| of input to be processed.
35 // @param output Pointer to output |AudioBuffer::Channel|.
36 // @return Returns false if the filter has an allpass configuration. This
37 // helps to avoid copies whenever the output is expected to be identical
38 // to the input.
39 bool Filter(const AudioBuffer::Channel& input, AudioBuffer::Channel* output);
40
41 // Sets the filter's coefficent.
42 //
43 // @param coefficient A mono pole filter coefficient.
44 void SetCoefficient(float coefficient);
45
46 private:
47 // The previous frame computed by the filter.
48 float previous_output_;
49
50 // Represents and maintains the state of the filter in terms of its
51 // transfer function coefficient.
52 float coefficient_;
53};
54
55} // namespace vraudio
56
57#endif // RESONANCE_AUDIO_DSP_MONO_POLE_FILTER_H_
Definition channel_view.h:30
Definition mono_pole_filter.h:25