<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt">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.&nbsp; There's even more math to draw the tick and I can't figure out how it works at the moment.<br><br>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.&nbsp; 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.<br><br>-Jonathan<br><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size:
 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Tuesday, March 11, 2014 8:08 PM, Alexandre Torres Porres &lt;porres@gmail.com&gt; wrote:<br> </font> </div>  <div class="y_msg_container"><div id="yiv7524290602"><div dir="ltr">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.<div>
<br></div><div>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)].</div><div><br></div><div>Cheers</div></div><div class="yiv7524290602gmail_extra">
<br><br><div class="yiv7524290602gmail_quote">2014-03-06 21:56 GMT-03:00 Jonathan Wilkes <span dir="ltr">&lt;<a href="" rel="nofollow" ymailto="mailto:jancsika@yahoo.com" target="_blank">jancsika@yahoo.com</a>&gt;</span>:<br><blockquote class="yiv7524290602gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-size:12pt;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;">From g_vslider.c:<br><br>&nbsp;&nbsp;&nbsp; if(x-&gt;x_lin0_log1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out = x-&gt;x_min*exp(x-&gt;x_k*(double)(x-&gt;x_val)*0.01);<br>
<br><br>Where x-&gt;x_k is:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(x-&gt;x_max/x-&gt;x_min)/(double)(x-&gt;x_gui.x_h - 1);<br><br><div><span>And x-&gt;x_gui.x_h is the height of the slider</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;">
<br><span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;"><span>-Jonathan<br></span></div><div style="display:block;">
 <br> <br> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;">
<div class="yiv7524290602"> <div dir="ltr"> <font face="Arial"> On Thursday, March 6, 2014 7:37 PM, Alexandre Torres Porres &lt;<a href="" rel="nofollow" ymailto="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>&gt; wrote:<br> </font> </div>  </div>
<div><div class="yiv7524290602"><div><div dir="ltr">hi folks, out of curiosity, what's the exact log function used in the slider? I'd like to emulate it.<div><br></div><div>cheers</div></div>
</div><br></div>_______________________________________________<br><a href="" rel="nofollow" ymailto="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a href="" rel="nofollow" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br><br></div>  </div> </div>  </div> </div></div></blockquote></div><br></div></div><br><br></div>  </div> </div>  </div> </div></body></html>