diff options
author | Damien Zammit <damien@zamaudio.com> | 2016-11-01 17:34:00 +1100 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2016-11-01 17:34:00 +1100 |
commit | 5be177ea10b84d8cfdc7e11780d28e111267d1ce (patch) | |
tree | 547241c8b6501e7c2ba71fd87849046d4739afb4 /plugins/ZamPhono/ZamPhonoPlugin.hpp | |
parent | 5d9e7c69a16c7d64da6bb30b8cac7c082edbecc8 (diff) |
Added ZamPhono plugin and UI
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Diffstat (limited to 'plugins/ZamPhono/ZamPhonoPlugin.hpp')
-rw-r--r-- | plugins/ZamPhono/ZamPhonoPlugin.hpp | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/plugins/ZamPhono/ZamPhonoPlugin.hpp b/plugins/ZamPhono/ZamPhonoPlugin.hpp new file mode 100644 index 0000000..e062530 --- /dev/null +++ b/plugins/ZamPhono/ZamPhonoPlugin.hpp @@ -0,0 +1,119 @@ +/* + * ZamPhono + * Copyright (C) 2016 Damien Zammit <damien@zamaudio.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef ZAMPHONOPLUGIN_HPP_INCLUDED +#define ZAMPHONOPLUGIN_HPP_INCLUDED + +#include "DistrhoPlugin.hpp" +#include <complex> + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +class ZamPhonoPlugin : public Plugin +{ +public: + enum Parameters + { + paramToggle = 0, + paramType, + paramCount + }; + + ZamPhonoPlugin(); + +protected: + // ------------------------------------------------------------------- + // Information + + const char* getLabel() const noexcept override + { + return "ZamPhono"; + } + + const char* getMaker() const noexcept override + { + return "Damien Zammit"; + } + + const char* getLicense() const noexcept override + { + return "GPL v2+"; + } + + uint32_t getVersion() const noexcept override + { + return d_version(3, 7, 0); + } + + int64_t getUniqueId() const noexcept override + { + return d_cconst('Z', 'M', 'P', 'H'); + } + + // ------------------------------------------------------------------- + // Init + + void initParameter(uint32_t index, Parameter& parameter) ; + void initProgramName(uint32_t index, String& programName) ; + + // ------------------------------------------------------------------- + // Internal data + + float getParameterValue(uint32_t index) const override; + void setParameterValue(uint32_t index, float value) override; + void loadProgram(uint32_t index) override; + + // ------------------------------------------------------------------- + // Process + void aweight(float); + + static inline double + sanitize_denormal(double v) { + if(!std::isnormal(v)) + return 0.f; + return v; + } + + static inline double + from_dB(double gdb) { + return (exp(gdb/20.f*log(10.f))); + } + + static inline double + to_dB(double g) { + return (20.f*log10(g)); + } + + void activate() override; + void run(const float** inputs, float** outputs, uint32_t frames) override; + void emphasis(float srate); + double run_filter(double in); + + double zn1, zn2, zd1, zd2; + double b0, b1, b2; + double a1, a2; + // ------------------------------------------------------------------- + +private: + float type, inv; +}; + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO + +#endif // ZAMPHONO_HPP_INCLUDED |