From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- .../openmpt-trunk/sounddsp/EQ.h | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Src/external_dependencies/openmpt-trunk/sounddsp/EQ.h (limited to 'Src/external_dependencies/openmpt-trunk/sounddsp/EQ.h') diff --git a/Src/external_dependencies/openmpt-trunk/sounddsp/EQ.h b/Src/external_dependencies/openmpt-trunk/sounddsp/EQ.h new file mode 100644 index 00000000..77d451f7 --- /dev/null +++ b/Src/external_dependencies/openmpt-trunk/sounddsp/EQ.h @@ -0,0 +1,66 @@ +/* + * EQ.h + * ---- + * Purpose: Mixing code for equalizer. + * Notes : Ugh... This should really be removed at some point. + * Authors: Olivier Lapicque + * OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +#include "openmpt/all/BuildSettings.hpp" + +#include "openmpt/base/Types.hpp" +#include "openmpt/soundbase/MixSample.hpp" + +#include + +#include + +OPENMPT_NAMESPACE_BEGIN + +#ifndef NO_EQ + +inline constexpr std::size_t MAX_EQ_CHANNELS = 4; +inline constexpr std::size_t MAX_EQ_BANDS = 6; + +struct EQBANDSTATE +{ + float x1 = 0.0f; + float x2 = 0.0f; + float y1 = 0.0f; + float y2 = 0.0f; +}; + +struct EQBANDSETTINGS +{ + float a0; + float a1; + float a2; + float b1; + float b2; + float Gain; + float CenterFrequency; +}; + +class CEQ +{ +private: + std::array, MAX_EQ_CHANNELS> m_ChannelState; + std::array m_Bands; + template + void ProcessTemplate(TMixSample *frontBuffer, TMixSample *rearBuffer, std::size_t countFrames, std::size_t numChannels); +public: + CEQ(); + void Initialize(bool bReset, uint32 MixingFreq); + void Process(MixSampleInt *frontBuffer, MixSampleInt *rearBuffer, std::size_t countFrames, std::size_t numChannels); + void Process(MixSampleFloat *frontBuffer, MixSampleFloat *rearBuffer, std::size_t countFrames, std::size_t numChannels); + void SetEQGains(const uint32 *pGains, const uint32 *pFreqs, bool bReset, uint32 MixingFreq); +}; + +#endif // !NO_EQ + +OPENMPT_NAMESPACE_END -- cgit