notes
This commit is contained in:
parent
ff3cb82c85
commit
284ce7193c
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "chassis.hpp"
|
#include "chassis.hpp"
|
||||||
|
|
||||||
|
|
||||||
SVF::SVF(float cutoff = 0, float q = 0, float samplerate = 0) {
|
SVF::SVF(float cutoff = 0, float q = 0, float samplerate = 0) {
|
||||||
z1 = z2 = 0;
|
z1 = z2 = 0;
|
||||||
setFreq(cutoff, q, samplerate);
|
setFreq(cutoff, q, samplerate);
|
||||||
@ -96,12 +95,9 @@ void Chassis::initParameter(uint32_t index, Parameter ¶meter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::setParameterValue(uint32_t index, float value) {
|
void Chassis::setParameterValue(uint32_t index, float value) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Chassis::getParameterValue(uint32_t index) const {
|
float Chassis::getParameterValue(uint32_t index) const {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,17 +123,68 @@ void Chassis::loadProgram(uint32_t index) {
|
|||||||
void Chassis::activate() {
|
void Chassis::activate() {
|
||||||
// calculate filter coefficients
|
// calculate filter coefficients
|
||||||
printf("called activate()\n");
|
printf("called activate()\n");
|
||||||
|
for (uint32_t i = 0; i< NUM_VOICES; i++ ) {
|
||||||
|
assign[i] = 0x80 | i;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::deactivate() {
|
void Chassis::deactivate() {
|
||||||
// zero out the outputs, maybe
|
// zero out the outputs, maybe
|
||||||
printf("called deactivate()\n");
|
printf("called deactivate()\n");
|
||||||
|
printf("%02x", assign[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Chassis::noteOn(uint8_t note) {
|
||||||
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
|
printf("note on, finding free voice in %02x for %d\n", assign[i], note);
|
||||||
|
if (assign[i] & 0x80) { // top bit is voice free flag
|
||||||
|
assign[i] &= 0x7f; // enable
|
||||||
|
printf("voice %d would be set to note %d\n", assign[i], note);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == NUM_VOICES) { // didn't find a free voice
|
||||||
|
uint32_t v = assign[0];
|
||||||
|
memmove(assign, assign + 1, NUM_VOICES - 1); // shunt all voices down by one
|
||||||
|
assign[NUM_VOICES - 1] = v; // oldest voice goes at the top of the queue
|
||||||
|
printf("no free voices, reused %d for note %d\n", v, note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("note table is now ");
|
||||||
|
for (uint32_t i=0; i < NUM_VOICES; i++ ) {
|
||||||
|
printf("%02x = ", assign[i]);
|
||||||
|
}
|
||||||
|
printf("----------------------------\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void Chassis::noteOff(uint8_t note) {
|
||||||
|
|
||||||
|
uint32_t v;
|
||||||
|
printf("note off called for %3d\n", note);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
|
v = assign[i];
|
||||||
|
printf("trying voice %02x\n", v);
|
||||||
|
if (v < 0x80) {
|
||||||
|
printf("note %02x is playing\n", v);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) {
|
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) {
|
||||||
// actual effects here
|
if (midiEventCount > 0) printf("\n--------------------\n");
|
||||||
|
for (uint32_t i = 0; i < midiEventCount; i++) {
|
||||||
|
printf("%4d %02x %02x\n", MidiEvents[i].frame, MidiEvents[i].data[0], MidiEvents[i].data[1]);
|
||||||
|
if (MidiEvents[i].data[0] == 0x90) {
|
||||||
|
noteOn(MidiEvents[i].data[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the plugin
|
// create the plugin
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef BARRVERB_HPP
|
#ifndef BARRVERB_HPP
|
||||||
#define BARRVERB_HPP
|
#define BARRVERB_HPP
|
||||||
|
|
||||||
|
#define NUM_VOICES 8
|
||||||
|
|
||||||
#include "DistrhoPlugin.hpp"
|
#include "DistrhoPlugin.hpp"
|
||||||
|
|
||||||
class SVF {
|
class SVF {
|
||||||
@ -70,7 +72,13 @@ class Chassis : public Plugin {
|
|||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) override;
|
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) override;
|
||||||
|
|
||||||
|
|
||||||
|
void noteOn(uint8_t note);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint8_t assign[NUM_VOICES]; // assigner table
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Chassis);
|
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Chassis);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user