[L2Ork-dev] 40 hours

Ivica Ico Bukvic ico at vt.edu
Fri Sep 25 14:51:33 EDT 2020


That feeling when you spend 40 work hours trying to resuscitate and old, 
broken, and horribly coded Pd-L2Ork GUI knob external, spend a majority 
of that time on producing the following snippet, and then finally get it 
done right...

On a side-note, if you ever have any questions about logarithms, I now 
likely know the answers by heart... And yes, the new flatgui/knob is 
going to kick some serious butt...

if (x->x_lin0_log1)
{
     t_float norm_val = (x->x_pos - x->x_min) / (x->x_max - x->x_min);
     if (x->x_gui.x_reverse)
     {
         x->x_val = x->x_max - (exp((1 - norm_val) * 
log(100))/exp(log(100)) - 0.01) / 0.99 * (x->x_max-x->x_min);
     }
     else
     {
         x->x_val = (exp(norm_val * log(100))/exp(log(100)) - 0.01) / 
0.99 * (abs(x->x_max-x->x_min)) + x->x_min;
     }
}
...
t_float norm_val = (x->x_val - x->x_min) / (x->x_max - x->x_min);
if (x->x_gui.x_reverse)
{
     t_float log_norm_val = log(100 - (norm_val * 99))/(log(100));
     x->x_pos = log_norm_val * (abs(x->x_max-x->x_min)) + x->x_max;
}
else
{
     t_float log_norm_val = log(1 + (norm_val * 99))/(log(100));
     x->x_pos = log_norm_val * (abs(x->x_max-x->x_min)) + x->x_min;
}

-- 
Ivica Ico Bukvic, D.M.A.
Director, Creativity + Innovation
Co-Director, Human Centered Design iPhD
Institute for Creativity, Arts, and Technology

Virginia Tech
Creative Technologies in Music
School of Performing Arts – 0141
Blacksburg, VA 24061
(540) 231-6139
ico at vt.edu

www.icat.vt.edu
www.performingarts.vt.edu
l2ork.icat.vt.edu
ico.bukvic.net



More information about the L2Ork-dev mailing list