commit 07c93d8a4eef911b7bb4c19a5484fc6d6091e395
parent 8a5a4181561775e4beb7a2c73200a8ee347bf775
Author: Friedolino <[email protected]>
Date: Sun, 19 Apr 2020 01:31:36 +0200
make /distorsion/waveform reflect the Pvolume par
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Effects/Distorsion.cpp b/src/Effects/Distorsion.cpp
@@ -69,19 +69,20 @@ rtosc::Ports Distorsion::ports = {
{"waveform:", 0, 0, [](const char *, rtosc::RtData &d)
{
Distorsion &dd = *(Distorsion*)d.obj;
- float buffer[128];
+ float buffer[128], orig[128];
rtosc_arg_t args[128];
char arg_str[128+1] = {};
for(int i=0; i<128; ++i)
buffer[i] = 2*(i/128.0)-1;
+ memcpy(orig, buffer, sizeof(float_t)*128);
waveShapeSmps(sizeof(buffer)/sizeof(buffer[0]), buffer,
dd.Ptype + 1, dd.Pdrive, dd.Poffset, dd.Pfuncpar);
for(int i=0; i<128; ++i) {
arg_str[i] = 'f';
- args[i].f = buffer[i];
+ args[i].f = (dd.Pvolume * buffer[i] + (127 - dd.Pvolume) * orig[i]) / 127.0f;
}
d.replyArray(d.loc, arg_str, args);