pantherb / setBfree

DSP tonewheel organ
http://setbfree.org
GNU General Public License v2.0
194 stars 35 forks source link

Midi-Mapping for whirl.drum.filter #81

Closed kokomorgan closed 3 years ago

kokomorgan commented 3 years ago

Hello all, I'm working on a project for assigning all available setBfree-midi-controllers to a knob on my keyboard. I'm on an Arm7 SOC (Odroid-XU4) with raspbian.

So far, it works, but I'm having trouble with the filter for the whirl.drum. I assigned filter-controller via config-file:

midi.controller.upper.40=whirl.horn.filter.a.type midi.controller.upper.41=whirl.horn.filter.a.hz midi.controller.upper.42=whirl.horn.filter.a.q midi.controller.upper.43=whirl.horn.filter.a.gain

midi.controller.upper.44=whirl.horn.filter.b.type midi.controller.upper.45=whirl.horn.filter.b.hz midi.controller.upper.46=whirl.horn.filter.b.q midi.controller.upper.47=whirl.horn.filter.b.gain

midi.controller.upper.52=whirl.drum.filter.type midi.controller.upper.53=whirl.drum.filter.hz midi.controller.upper.54=whirl.drum.filter.q midi.controller.upper.55=whirl.drum.filter.gain

The horn-filters work, but the drum-filter doesn't show any effect. I digged through the source-code and found in whirl.c -> initWhirl that there is no function associated to the drum filter, also, there is only a 'fsetDrumFilterFrequency' and so on, but no 'setDrumFilterFrequency' like for the horn filters. Am I missing something? Or is the code? ;)

Thanks for any tip in advance! Best regards, Kolja

kokomorgan commented 3 years ago

Nevermind, I solved it myself by adding Functions:

`static void setDrumFilterType (void d, unsigned char uc) { struct b_whirl w = (struct b_whirl*)d; w->lpT = (int)(uc / 15); UPDATE_D_FILTER; }

static void setDrumFilterFrequency (void d, unsigned char uc) { struct b_whirl w = (struct b_whirl)d; double u = (double)uc; double minv = 20.0; double maxv = 8000.0; w->lpF = minv + ((maxv - minv) ((u * u) / 16129.0)); UPDATE_D_FILTER; }

static void setDrumFilterQ (void d, unsigned char uc) { struct b_whirl w = (struct b_whirl)d; double u = (double)uc; double minv = 0.01; double maxv = 6.00; w->lpQ = minv + ((maxv - minv) (u / 127.0)); UPDATE_D_FILTER; }

static void setDrumFilterGain (void d, unsigned char uc) { struct b_whirl w = (struct b_whirl)d; double u = (double)uc; double minv = -48.0; double maxv = 48.0; w->lpG = minv + ((maxv - minv) (u / 127.0)); UPDATE_D_FILTER; }`

and adding

useMIDIControlFunction (m, "whirl.drum.filter.type", setDrumFilterType, (void*)w); useMIDIControlFunction (m, "whirl.drum.filter.hz", setDrumFilterFrequency, (void*)w); useMIDIControlFunction (m, "whirl.drum.filter.q", setDrumFilterQ, (void*)w); useMIDIControlFunction (m, "whirl.drum.filter.gain", setDrumFilterGain, (void*)w);

to initWhirl all in whirl.c.

That worked. Cheers, Kolja