no antialiasing, plays midi notes

This commit is contained in:
Gordon JC Pearce 2024-08-20 23:02:36 +01:00
parent 70b588f7f5
commit 8661286e79

View File

@ -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;