Audaspace  1.4.0
A high level audio library.
Equalizer.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2022 Marcos Perez Gonzalez
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #pragma once
18 
25 #include <memory>
26 #include <vector>
27 
28 #include "ISound.h"
29 #include "ImpulseResponse.h"
30 
32 
33 class Buffer;
34 class ImpulseResponse;
38 class AUD_API Equalizer : public ISound
39 {
40 private:
44  std::shared_ptr<ISound> m_sound;
45 
49  std::shared_ptr<Buffer> m_bufEQ;
50 
54  std::shared_ptr<ImpulseResponse> m_impulseResponse;
55 
59  Equalizer(const Equalizer&) = delete;
60  Equalizer& operator=(const Equalizer&) = delete;
61 
66  std::shared_ptr<ImpulseResponse> createImpulseResponse();
67 
72  std::shared_ptr<Buffer> minimumPhaseFilterHomomorphic(std::shared_ptr<Buffer> original, int lOriginal, int lWork);
73 
78  std::shared_ptr<Buffer> minimumPhaseFilterHilbert(std::shared_ptr<Buffer> original, int lOriginal, int lWork);
79 
80 public:
85  Equalizer(std::shared_ptr<ISound> sound, std::shared_ptr<Buffer> bufEQ, int externalSizeEq, float maxFreqEq, int sizeConversion);
86 
87  virtual ~Equalizer();
88  virtual std::shared_ptr<IReader> createReader();
89 
90  /*
91  * Length of the external equalizer definition. It must be the number of "float" positions of the Buffer
92  */
93  int external_size_eq;
94 
95  /*
96  * Length of the internal equalizer definition
97  */
98  int filter_length;
99 
100  /*
101  * Maximum frequency used in the equalizer definition
102  */
103  float maxFreqEq;
104 };
105 
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
This class represents an impulse response that can be used in convolution.
Definition: ImpulseResponse.h:40
The ISound interface.
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
This class is a simple buffer in RAM which is 32 Byte aligned and provides resize functionality...
Definition: Buffer.h:33
This class represents a type of sound source and saves the necessary values for it.
Definition: ISound.h:39
The ImpulseResponse class.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
virtual std::shared_ptr< IReader > createReader()=0
Creates a reader for playback of the sound source.
This class represents a sound that can be modified depending on a given impulse response.
Definition: Equalizer.h:38