add filter file
This commit is contained in:
parent
d15b80a46b
commit
fd7634671f
38
plugin/filter.cpp
Normal file
38
plugin/filter.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
Peacock-8 VA polysynth
|
||||||
|
|
||||||
|
Copyright 2024 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 "ic29.hpp"
|
||||||
|
|
||||||
|
void Voice::filter(float *buffer, uint32_t pos, uint32_t frames) {
|
||||||
|
for (uint32_t i = 0; i < frames; i++) {
|
||||||
|
for (uint8_t ovs = 0; ovs < 4; ovs++) {
|
||||||
|
fb = b4;
|
||||||
|
// hard clip
|
||||||
|
if (fb > 1) fb = 1;
|
||||||
|
if (fb < -1) fb = -1;
|
||||||
|
|
||||||
|
fb = buffer[i+pos] - (fb * reso);
|
||||||
|
b1 = ((fb - b1) * cut) + b1;
|
||||||
|
b2 = ((b1 - b2) * cut) + b2;
|
||||||
|
b3 = ((b2 - b3) * cut) + b3;
|
||||||
|
b4 = ((b3 - b4) * cut) + b4;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[i+pos] = b4;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user