Wow, never mind-- it's a veritable Rube Goldberg machine of code to get from an 
incoming float to an outgoing one in g_vslider.c.  There's even more math to 
draw the tick and I can't figure out how it works at the moment.

I also love how tempting "log" is for a volume control, but then it silently 
changes a minimum of "0" to max / 100, so you get a runtime error where you 
can't turn the volume down all the way.  Then when you figure out what it did 
you have to add an object to subtract that last little bit, at which point you 
might as well have used [rms] or coded your own algorithm.

-Jonathan




On Tuesday, March 11, 2014 8:08 PM, Alexandre Torres Porres <por...@gmail.com> 
wrote:
 
Thanks Jonathan. Unfortunately, my C expertise is kinda poor and I'm still 
lost. I see it's got something to do with [exp] but haven't got my head around 
the function needed to emulate it. I'm making extensive documentation about Pd, 
so I'd like to write about it. I find it worth noting.

In the patch I'm sending, which was my attempt to get this right before 
reaching the list, I was able to emulate a bit reasonably with [expr pow($f1, 
0.25)].

Cheers



2014-03-06 21:56 GMT-03:00 Jonathan Wilkes <jancs...@yahoo.com>:

From g_vslider.c:
>
>    if(x->x_lin0_log1)
>        out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01);
>
>
>Where x->x_k is:
>        log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1);
>
>
>And x->x_gui.x_h is the height of the slider
>
>
>-Jonathan
>
>
>
>
>On Thursday, March 6, 2014 7:37 PM, Alexandre Torres Porres <por...@gmail.com> 
>wrote:
> 
>hi folks, out of curiosity, what's the exact log function used in the slider? 
>I'd like to emulate it.
>
>
>cheers
>_______________________________________________
>Pd-list@iem.at mailing list
>UNSUBSCRIBE and account-management -> 
>http://lists.puredata.info/listinfo/pd-list
>
>
>
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to