Finally got the labels in the Response tab sorted
x-axis : frequencies, y-axis; time in seconds.
We were struggling with the correct math stuff to position the labels.
I was looking at other plugins and how they looked. I noticed fil4.lv2 had the labelling how we wanted it to be.
So I cloned the repo (
https://github.com/x42/fil4.lv2.git) and imported it in Kdevelop.
Then the hunt was on, where is the code that draws the labels.
I noticed
tools/gen_image.c
Lot's of frequency printing stuff in there (dial_to_freq (const FilterFreq *m, float f) for example), but couldn't find the 20 - 20k labels.
Then I saw
gui/fil4.c .
Wait,gui,these labels must be in the gui .
Kdevelop has the feauture when you hover over a statement, a little pop-up shows up where you can 'trace' the use of a function/variable.
Following "Show Uses" it turned out this was indeed the function I needed.
I 'copied' the function in Libreoffice Calc and found it gave the desired output.
One small problem , it only looked good when starting with 20 ..
Later on irc (#lad, freenode) rgareus (aka x42) told me the general function is
Code: Select all
x = log ( f / minimum ) / log ( maximum / minimum )
if f = minimum -> x = 0
if f = maximum -> x = 1
Now it made sense, fil4.lv2 has a range of 20 - 20K
Code: Select all
return rintf(m0_width * logf (f / 20.0) / logf (1000.0));
20 is the minimum, 20000 is maximum -> 1000 = 20000/20 .. duh ..
So I needed :
Code: Select all
int x = ( int ) ( pixel_width * logf ( freq[i] / 50.0f ) / logf ( 20000.0f / 50.0f )
The result (layout tweaking needed ofc):
(I'm very proud and feel very smart :p )