This commit is contained in:
Gordon JC Pearce 2024-09-02 22:11:57 +01:00
parent d31a372b46
commit ff3cb82c85
7 changed files with 330 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
build/
bin/
.vscode
*~

7
LICENCE Normal file
View File

@ -0,0 +1,7 @@
ISC License
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
###############################
#
# Makefile for chassis
# based on the work of falkTX
#
# for full licence, see LICENCE in the root of the project
#
###############################
include dpf/Makefile.base.mk
all: plugins gen
plugins:
$(MAKE) all -C plugin
ifneq ($(CROSS_COMPILING),true)
gen: plugins dpf/utils/lv2_ttl_generator
@$(CURDIR)/dpf/utils/generate-ttl.sh
ifeq ($(MACOS),true)
@$(CURDIR)/dpf/utils/generate-vst-bundles.sh
endif
dpf/utils/lv2_ttl_generator:
$(MAKE) -C dpf/utils/lv2-ttl-generator
else
gen:
endif
clean:
$(MAKE) clean -C dpf/utils/lv2-ttl-generator
$(MAKE) clean -C plugin
rm -rf bin build
.PHONY: plugins

View File

@ -0,0 +1,39 @@
/*
BarrVerb reverb plugin
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef DISTRHO_PLUGIN_INFO_H
#define DISTRHO_PLUGIN_INFO_H
#define DISTRHO_PLUGIN_NAME "chassis"
#define DISTRHO_PLUGIN_URI "https://gjcp.net/plugins/chassis"
#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
#define DISTRHO_PLUGIN_IS_SYNTH 1
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
enum Parameters {
paramProg,
kParameterCount
};
#endif

19
plugin/Makefile Normal file
View File

@ -0,0 +1,19 @@
###############################
#
# Makefile for BarrVerb
# based on the work of falkTX
#
# for full licence, see LICENCE in the root of the project
#
###############################
NAME = chassis
FILES_DSP = chassis.cpp
include ../dpf/Makefile.plugins.mk
TARGETS += vst2 vst3 jack lv2_dsp
all: $(TARGETS)

146
plugin/chassis.cpp Normal file
View File

@ -0,0 +1,146 @@
/*
Chassis reverb plugin
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "chassis.hpp"
SVF::SVF(float cutoff = 0, float q = 0, float samplerate = 0) {
z1 = z2 = 0;
setFreq(cutoff, q, samplerate);
}
void SVF::setFreq(float cutoff, float q, float samplerate) {
z1 = z2 = 0;
printf("called with %f %f %f\n", cutoff, q, samplerate);
w = 2 * tan(3.14159 * (cutoff / samplerate));
a = w / q;
b = w * w;
// corrected SVF params, per Fons Adriaensen
c1 = (a + b) / (1 + a / 2 + b / 4);
c2 = b / (a + b);
d0 = c1 * c2 / 4;
printf("c1 %f c2 %f d0 %f\n", c1, c2, d0);
}
inline float SVF::lpStep(float in) {
x = in - z1 - z2;
z2 += c2 * z1;
z1 += c1 * x;
return d0 * x + z2;
}
START_NAMESPACE_DISTRHO
Chassis::Chassis() : Plugin(kParameterCount, 0, 0) { // one parameter, no programs, no states
//lowpass = new float[getBufferSize()];
//ram = new int16_t[16384];
//bzero(lowpass, sizeof(float) * getBufferSize());
//bzero(ram, sizeof(int16_t) * 16384);
//f1.setFreq(5916, .6572, getSampleRate());
// f2.setFreq(9458, 2.536, getSampleRate());
}
// Initialisation functions
void Chassis::initParameter(uint32_t index, Parameter &parameter) {
if (index == p_saw) {
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
parameter.name = "Saw";
parameter.symbol = "saw";
parameter.ranges.max = 1.0f;
}
if (index == p_sqr) {
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
parameter.name = "Square";
parameter.symbol = "sqr";
parameter.ranges.max = 4.0f;
}
if (index == p_sublev) {
parameter.hints = kParameterIsAutomatable;
parameter.name = "Sub";
parameter.symbol = "sub";
parameter.ranges.def = 20.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 64.0f;
}
if (index == paramProgram) {
parameter.hints = kParameterIsAutomatable;
parameter.name = "prog";
parameter.symbol = "prog";
parameter.ranges.def = 1.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
}
}
void Chassis::setParameterValue(uint32_t index, float value) {
}
float Chassis::getParameterValue(uint32_t index) const {
return 0;
}
void Chassis::initAudioPort(bool input, uint32_t index, AudioPort &port) {
port.groupId = kPortGroupStereo;
Plugin::initAudioPort(input, index, port);
if (!input && index == 0) port.name = "Left Out";
if (!input && index == 1) port.name = "Right Out";
}
/*
void Chassis::initProgramName(uint32_t index, String &programName) {
programName = "init";
}
void Chassis::loadProgram(uint32_t index) {
prog_offset = (index & 0x3f) << 7;
program = index + 1;
}
*/
// Processing functions
void Chassis::activate() {
// calculate filter coefficients
printf("called activate()\n");
}
void Chassis::deactivate() {
// zero out the outputs, maybe
printf("called deactivate()\n");
}
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) {
// actual effects here
}
// create the plugin
Plugin *createPlugin() { return new Chassis(); }
END_NAMESPACE_DISTRHO

80
plugin/chassis.hpp Normal file
View File

@ -0,0 +1,80 @@
/*
Chassis reverb plugin
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef BARRVERB_HPP
#define BARRVERB_HPP
#include "DistrhoPlugin.hpp"
class SVF {
public:
SVF(float cutoff, float q, float samplerate);
void setFreq(float cutoff, float q, float samplerate);
float lpStep(float in);
private:
float w, a, b;
float c1, c2, d0;
float z1, z2, x;
};
START_NAMESPACE_DISTRHO
class Chassis : public Plugin {
public:
enum Parameters {
p_saw, p_sqr, p_sublev,
paramProgram,
kParameterCount
};
Chassis();
protected:
const char *getLabel() const override { return "chassis"; }
const char *getDescription() const override {
return "MIDIVerb emulation, a tribute to Keith Barr";
}
const char *getMaker() const override { return "Gordonjcp"; }
const char *getLicense() const override { return "ISC"; }
uint32_t getVersion() const override { return d_version(1, 0, 0); }
int64_t getUniqueId() const override { return d_cconst('P', 'f', 'a', 'u'); }
// Initialisation
void initAudioPort(bool input, uint32_t index, AudioPort &port) override;
void initParameter(uint32_t index, Parameter &parameter) override;
void setParameterValue(uint32_t index, float value) override;
float getParameterValue(uint32_t index) const override;
// void initProgramName(uint32_t index, String &programName) override;
// void loadProgram(uint32_t index) override;
// Processing
void activate() override;
void deactivate() override;
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) override;
private:
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Chassis);
};
END_NAMESPACE_DISTRHO
#endif // BARRVERB_HPP