From 8661286e79d25a14871a1b7e2cc63e5d1448bc55 Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Tue, 20 Aug 2024 23:02:36 +0100 Subject: [PATCH] no antialiasing, plays midi notes --- plugin/sonnenlicht.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/sonnenlicht.cpp b/plugin/sonnenlicht.cpp index 145aad3..7a9c477 100644 --- a/plugin/sonnenlicht.cpp +++ b/plugin/sonnenlicht.cpp @@ -28,6 +28,19 @@ Sonnenlicht::Sonnenlicht() : Plugin(kParameterCount, 0, 0), fSampleRate(getSampl void Sonnenlicht::run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) { + + if (midiEventCount > 0) { + for (uint32_t i=0; i < midiEventCount; i++ ) { + const uint8_t *data = midiEvents[i].data; + const uint8_t status = data[0] & 0xf0; + + + if (status == 0x90) { + w = (261.6 * (powf(2, (data[1]-60)/12.0f)))/fSampleRate; + printf("set w to %f\n", w); + } + } + } for (uint32_t i = 0; i < frames; i++) { phase += w; if (phase > 1) phase -= 1;