zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 93f34a57774eee9c5b9725a1a2be14b22cf01b33
parent 7ab641b32a7b755b91fd3f4cb89a46f62d2ea59b
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Fri,  1 Jul 2016 11:32:01 -0400

FilterParams: Export Formant Positions To 3.0.0 UI

Diffstat:
Msrc/Params/FilterParams.cpp | 44++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/Params/FilterParams.cpp b/src/Params/FilterParams.cpp @@ -122,6 +122,12 @@ const rtosc::Ports FilterParams::ports = { FilterParams *obj = (FilterParams *) d.obj; d.reply(d.loc, "f", obj->getoctavesfreq()); }}, + {"q_value:", + rDoc("Q value for UI Response Graphs"), + NULL, [](const char *, RtData &d) { + FilterParams *obj = (FilterParams *) d.obj; + d.reply(d.loc, "f", obj->getq()); + }}, {"response:", rDoc("Get a frequency response"), NULL, [](const char *, RtData &d) { @@ -151,6 +157,44 @@ const rtosc::Ports FilterParams::ports = { // "", NULL, [](){}}, //{"Pvowels#" FF_MAX_VOWELS "/formants#" FF_MAX_FORMANTS "/q", // "", NULL, [](){}}, + // + //struct Pvowels_t { + // struct formants_t { + // unsigned char freq, amp, q; //frequency,amplitude,Q + // } formants[FF_MAX_FORMANTS]; + //} Pvowels[FF_MAX_VOWELS]; + {"vowels:", + rDoc("Get info for formant graph"), + NULL, [](const char *, RtData &d) { + FilterParams *obj = (FilterParams *) d.obj; + + rtosc_arg_t args[2+3*FF_MAX_FORMANTS*FF_MAX_VOWELS]; + char type[2+3*FF_MAX_FORMANTS*FF_MAX_VOWELS + 1] = {0}; + + type[0] = 'i'; + type[1] = 'i'; + + args[0].i = FF_MAX_VOWELS; + args[1].i = FF_MAX_FORMANTS; + + + for(int i=0; i<FF_MAX_VOWELS; ++i) { + auto &val = obj->Pvowels[i]; + for(int j=0; j<FF_MAX_FORMANTS; ++j) { + auto &f = val.formants[j]; + //each formant is 3 arguments + //each vowel is FF_MAX_FORMANTS * length of formants long + auto *a = args + i*FF_MAX_FORMANTS*3 + j*3 + 2; + auto *t = type + i*FF_MAX_FORMANTS*3 + j*3 + 2; + a[0].f = obj->getformantfreq(f.freq); + a[1].f = obj->getformantamp(f.amp); + a[2].f = obj->getformantq(f.q); + //printf("<%d,%d,%d,%d,%d,%f,%f,%f>\n", i, j, f.freq, f.amp, f.q, a[0].f, a[1].f, a[2].f); + t[0] = t[1] = t[2] = 'f'; + } + } + d.replyArray(d.loc, type, args); + }}, }; #undef rChangeCb #define rChangeCb