<div dir="ltr">so you say this is actually the section of the code I&#39;m looking for to make the conversion I want, right?<br><br>======<br>







<p class=""><span class="">static</span> <span class="">void</span> hslider_set(t_hslider *x, t_floatarg f)    <span class="">/* bugfix */</span></p>
<p class="">{</p>
<p class="">    <span class="">double</span> g;</p>
<p class=""><br></p>
<p class="">    <span class="">if</span>(x-&gt;x_gui.x_isa.x_reverse)    <span class="">/* bugfix */</span></p>
<p class="">    {</p>
<p class="">        <span class="">if</span>(f &gt; x-&gt;x_min)</p>
<p class="">            f = x-&gt;x_min;</p>
<p class="">        <span class="">if</span>(f &lt; x-&gt;x_max)</p>
<p class="">            f = x-&gt;x_max;</p>
<p class="">    }</p>
<p class="">    <span class="">else</span></p>
<p class="">    {</p>
<p class="">        <span class="">if</span>(f &gt; x-&gt;x_max)</p>
<p class="">            f = x-&gt;x_max;</p>
<p class="">        <span class="">if</span>(f &lt; x-&gt;x_min)</p>
<p class="">            f = x-&gt;x_min;</p>
<p class="">    }</p>
<p class="">    <span class="">if</span>(x-&gt;x_lin0_log1)</p>
<p class="">        g = log(f/x-&gt;x_min)/x-&gt;x_k;</p>
<p class="">    <span class="">else</span></p>
<p class="">        g = (f - x-&gt;x_min) / x-&gt;x_k;</p>
<p class="">    x-&gt;x_val = (<span class="">int</span>)(<span class="">100.0</span>*g + <span class="">0.49999</span>);</p>
<p class="">    x-&gt;x_pos = x-&gt;x_val;</p>
<p class="">    (*x-&gt;x_gui.x_draw)(x, x-&gt;x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);</p>
<p class="">}</p></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-17 4:07 GMT-03:00 Jonathan Wilkes <span dir="ltr">&lt;<a href="mailto:jancsika@yahoo.com" target="_blank">jancsika@yahoo.com</a>&gt;</span>:<br>
<blockquote class="gmail_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">AFAICT vslider is saving something like a slider position, and your expression above (along with the code I posted) is for getting back the original value from it.  If you send it something between 0.01 and 1 you&#39;ll get a curve that&#39;s inverted from the one you&#39;re after.  If you send it a slider position-- something like another [expr] based on the code inside vslider_set-- you&#39;ll get back (roughly) the same value you input.<br>
<br>But I&#39;m still stuck on why vslider_bang is doing any math at all.  Why should it be more complex than &quot;if bang then output stored value&quot;?  (Setting aside sending to receive symbols for the moment.)<span class="HOEnZb"><font color="#888888"><br>
<br>-Jonathan</font></span><div><div class="h5"><br><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 dir="ltr"> <font face="Arial"> On Monday, March 17, 2014 1:21 AM, Alexandre Torres Porres &lt;<a href="mailto:porres@gmail.com" target="_blank">porres@gmail.com</a>&gt; wrote:<br> </font> </div>  <div><div><div dir="ltr">
<div>Hi Roman. This is turning out trickier than I thought. A friend explained the code to me and got to the following equation, with min/max values as 0.01 and 1 respectively.</div><div><br></div><div>[expr 0.01 * exp((log(1 / 0.01) / 0.01) * $f1 * 0.01)]<br>

</div><div><br></div><div>For what I&#39;ve checked, it seems to behave like your patch. But it doesn&#39;t do the trick I&#39;m looking for yet. I sent a patch earlier, and I&#39;m sending it back again.</div><div><br></div>

<div>The goal is to connect a linear slider to an [expr] (with this so called &quot;log&quot; function) and then to another linear slider. The idea then is that this second slider behaves as one that was set as being &quot;log&quot;.</div>

<div><br></div><div>In the patch attached I was able to emulate it poorly with [pow 0.25], but that was before reaching the list. See that if I use this expr function from the code or your patch it presents quite a different behavior.</div>

<div><br></div><div>maybe it is some sort of inversion of this equation, not sure. Apparently this code converts the &quot;log&quot; function values to linear and I&#39;m hoping to get the exact opposite. Got it?</div><div>

<br></div><div>Thanks for looking into this</div></div><div><br><br><div>2014-03-12 4:38 GMT-03:00 Roman Haefeli <span dir="ltr">&lt;<a rel="nofollow">reduzent@gmail.com</a>&gt;</span>:<br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Don, 2014-03-06 at 21:37 -0300, Alexandre Torres Porres wrote:<br>
&gt; hi folks, out of curiosity, what&#39;s the exact log function used in the<br>
&gt; slider? I&#39;d like to emulate it.<br>
<br>
</div>I am not sure, if this is what you want. It converts the incoming linear<br>
range between 0 and 1 to a logarithmic range specified by $1 and $2,<br>
respectively by the second and third inlet. They behave like the lower<br>
and upper bound specified in the [vslider]/[hslider] classes.<br>
<br>
<a rel="nofollow">https://raw.github.com/reduzent/netpd2-patches/master/abs/rh_scalelog.pd</a><br>
<span><font color="#888888"><br>
<br>
Roman<br>
</font></span><div><div><br>
<br>
<br>
<br>
_______________________________________________<br>
<a rel="nofollow">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -&gt; <a rel="nofollow">http://lists.puredata.info/listinfo/pd-list</a><br>
</div></div></blockquote></div><br></div></div><br>_______________________________________________<br><a>Pd-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a>http://lists.puredata.info/listinfo/pd-list</a><br>
<br><br></div>  </div> </div>  </div> </div></div></div></div></blockquote></div><br></div>