rearrange output stuff
This commit is contained in:
parent
fcadaf3980
commit
24fd4718f5
|
@ -24,7 +24,13 @@
|
||||||
|
|
||||||
#include "DistrhoPluginInfo.h"
|
#include "DistrhoPluginInfo.h"
|
||||||
|
|
||||||
Generator::Generator() {
|
Generator::Generator(uint32_t bufferSize) {
|
||||||
|
output = new float[bufferSize];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Generator::~Generator() {
|
||||||
|
delete output;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Generator::setupGenerator(double sampleRate) {
|
void Generator::setupGenerator(double sampleRate) {
|
||||||
|
@ -37,7 +43,7 @@ void Generator::setupGenerator(double sampleRate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Generator::runBlock(float *output, uint8_t *noteTable, uint32_t frames) {
|
void Generator::runBlock(uint8_t *noteTable, uint32_t frames) {
|
||||||
Voice *v;
|
Voice *v;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint8_t k, p, key, n1, n2, d;
|
uint8_t k, p, key, n1, n2, d;
|
||||||
|
|
|
@ -45,10 +45,12 @@ class Voice {
|
||||||
|
|
||||||
class Generator {
|
class Generator {
|
||||||
public:
|
public:
|
||||||
Generator();
|
Generator(uint32_t bufferSize);
|
||||||
|
~Generator();
|
||||||
void setupGenerator(double sampleRate);
|
void setupGenerator(double sampleRate);
|
||||||
void runBlock(float *output, uint8_t *noteTable, uint32_t frames);
|
void runBlock(uint8_t *noteTable, uint32_t frames);
|
||||||
Voice voices[NUM_VOICES];
|
Voice voices[NUM_VOICES];
|
||||||
|
float *output;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t phase[12];
|
uint32_t phase[12];
|
||||||
|
|
|
@ -24,12 +24,15 @@ START_NAMESPACE_DISTRHO
|
||||||
|
|
||||||
Sonnenlicht::Sonnenlicht() : Plugin(kParameterCount, 0, 0), fSampleRate(getSampleRate()) {
|
Sonnenlicht::Sonnenlicht() : Plugin(kParameterCount, 0, 0), fSampleRate(getSampleRate()) {
|
||||||
printf("initialiser called\n");
|
printf("initialiser called\n");
|
||||||
genny.setupGenerator(fSampleRate);
|
genny = new Generator(getBufferSize());
|
||||||
assigner = new Assigner(genny.voices);
|
genny->setupGenerator(fSampleRate);
|
||||||
|
|
||||||
|
assigner = new Assigner(genny->voices);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sonnenlicht::~Sonnenlicht() {
|
Sonnenlicht::~Sonnenlicht() {
|
||||||
delete assigner;
|
delete assigner;
|
||||||
|
delete genny;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sonnenlicht::setParameterValue(uint32_t index, float value) {
|
void Sonnenlicht::setParameterValue(uint32_t index, float value) {
|
||||||
|
@ -51,7 +54,8 @@ void Sonnenlicht::deactivate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
||||||
(void) index; (void) ¶meter; // pretend these aren't here
|
(void)index;
|
||||||
|
(void)¶meter; // pretend these aren't here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +65,9 @@ void Sonnenlicht::run(const float**, float** outputs, uint32_t frames,
|
||||||
assigner->handleMidi((MidiEvent*)&ev[i]);
|
assigner->handleMidi((MidiEvent*)&ev[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
genny.runBlock(outputs[0], assigner->noteTbl, frames);
|
genny->runBlock(assigner->noteTbl, frames);
|
||||||
|
memcpy(outputs[0], genny->output, frames * sizeof(float));
|
||||||
|
memcpy(outputs[1], genny->output, frames * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin* createPlugin() { return new Sonnenlicht(); }
|
Plugin* createPlugin() { return new Sonnenlicht(); }
|
||||||
|
|
|
@ -58,9 +58,9 @@ class Sonnenlicht : public Plugin {
|
||||||
const MidiEvent *midiEvents, uint32_t midiEventCount) override;
|
const MidiEvent *midiEvents, uint32_t midiEventCount) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Assigner *assigner;
|
|
||||||
double fSampleRate;
|
double fSampleRate;
|
||||||
Generator genny;
|
Assigner *assigner;
|
||||||
|
Generator *genny;
|
||||||
|
|
||||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Sonnenlicht);
|
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Sonnenlicht);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue