Slider Parameters


#1

Hi,

 

This is a compund question.. I was trying to mess around a bit with the controllers to get the kind I was using on my Synthmaker patches. And wanted to change the velocity. I found a parameter "velocityModeSensitivity" and derived it was the control down velocity. But I can't find the default velocity for the slider is this 1:1?

Also is there- or shouldn't we start building an indepth tutorial on the GUI/slider? Where all the handles are located. Since I for one am itching to get some traction for my DSP stuff.

 


#2

Hi Bokito,

I don't think I understand what you are asking, but it seems like you are looking for a tutorial on the slider object(?).

There is one, which  can be found here - https://www.juce.com/doc/tutorial_slider_values


#3

Thanks,

I was looking for a way to change the default speed of the slider. The thing is the speed remains constant regardless of the number of steps. So the slider skips steps that are not due to the mouse skipping them.

I want to lower the speed a bit.  What I wanted to do, since I cant find the variable controlling the default slider speed. Is use the flag thats sets the "function/control" down velocity, and replace it with a boolean to manipulate the speed from the top. But I can't find the area of code responsible for this.

In the long run I want to remove a lot of stuff I dont need,  Maybe ill look for those in the 1500 lines I sent to the printer :) The rotary controlls I used to have used two vectors, a dot and a circle. And the circle is only to see the area when prototyping. (and the control last visited) The GUI just slides under the rotating dot.  So it cuts back the amount of vectors a bit. It would look and feel like this.. http://www.soundsystembrabant.com/

 


#4

Im not the right person for this. So.. Ill update my findings to make things easyer for others. Correct me if im wrong ;) The files im changing are (Juce/modules/juce_gui_basics/widgets/juce_slider.cpp)  and  (juce_slider.h).

 

I hacked into the speed by altering line: 1050 to 1053: isVelocityBased = 1; // Tho this only works for the slider, and is probably the wronw wat to do it.

Close to that I found some optimizing opportunities in lines: 1179, 1173, 1089, 1088, 1079, 1078, 1077, The divides by 2.0f can be multiplied by 0.5f to save some CPU.

The mouse and key variable names are listed (and documented) in the header. Lines 857 - 880. Also here: http://www.juce.com/juce/api/classMouseListener.html And here: https://www.juce.com/doc/classKeyListener

So are the colors and parameters visible from the header.. But, why go other than ui for this.

A lot of usefull info here, no doubt: https://www.juce.com/doc/structSlider_1_1LookAndFeelMethods

 

 


#5

The divides by 2.0f can be multiplied by 0.5f to save some CPU

Any half decent compiler will optimise this anyway. They'll almost certainly be the same CPU instructions.


#6

That's bad practice, period.


#7

Well whether writing "* 0.5f" or "/ 2.0f" is better is semantically is one discussion.

Stating "The divides by 2.0f can be multiplied by 0.5f to save some CPU" is just wrong, period.

 

The reason I bought this up is because many new programmers read these forums and may get the wrong impression about how optimsers work from this. They could then end up writing code that is difficult to read because they believe it to be more efficient.

If you have micro optimisations like this, a profile is usually required to prove it's actually faster.


#8

I like discussions like this, but maybe on another instance? Doing away with the multiplier is quite apparent as well. Don't defend this codependant relationship with the obvious sadist putting the PP's behind the C. :D