64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
/*
|
|
tonewheel organ plugin
|
|
|
|
Copyright 2025 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 "tonewheel.hpp"
|
|
|
|
double sampleRate;
|
|
uint32_t bufferSize;
|
|
|
|
START_NAMESPACE_DISTRHO
|
|
|
|
Tonewheel::Tonewheel() : Plugin(kParameterCount, 0, 0) {
|
|
assigner = new Assigner;
|
|
}
|
|
|
|
Tonewheel::~Tonewheel() {
|
|
delete assigner;
|
|
}
|
|
|
|
void Tonewheel::initAudioPort(bool input, uint32_t index, AudioPort& port) {
|
|
port.groupId = kPortGroupStereo;
|
|
Plugin::initAudioPort(input, index, port);
|
|
|
|
if (!input && index == 0) port.symbol = "Left";
|
|
if (!input && index == 1) port.symbol = "Right";
|
|
}
|
|
|
|
void Tonewheel::activate() {
|
|
sampleRate = getSampleRate();
|
|
bufferSize = getBufferSize();
|
|
printf("In activate, bufSz=%d smpRt=%f\n", bufferSize, sampleRate);
|
|
}
|
|
|
|
void Tonewheel::deactivate() {
|
|
}
|
|
|
|
void Tonewheel::run(const float**, float** outputs, uint32_t frames,
|
|
const MidiEvent* ev, uint32_t evCount) {
|
|
|
|
(void) frames;
|
|
(void) outputs;
|
|
for (uint32_t i = 0; i < evCount; i++) {
|
|
assigner->handleMidi((MidiEvent*)&ev[i]);
|
|
}
|
|
}
|
|
|
|
Plugin* createPlugin() { return new Tonewheel(); }
|
|
|
|
END_NAMESPACE_DISTRHO
|