hey there everyone, I am trying to make a pitch slider that take integer values between -24 +24 for a pitch control of an sound oscillator I use ofxGui ofParameter, my question is there a slider that show the middle as a 0 point so it will be look more accurate?
I modified a tiny bit in the examples -> gui -> guiExample code to set the min and max range of the slider.
gui.add(circleResolution.setup("circle res", 0, -24, 24));
Is this what you’re looking for?
my question is more a cosmetic one - I meant that when my slider at 0 value it shows as if it half full… - this is how the slider is look like when it on the 0 point.
- this is how I want my slider to look like on a 0 point
Aha, now I get it
While checking out the ofxSlider files I discovered that I already messed with it a while back.
I modified the
generateDraw() function in ofxSlider.cpp from
bar.rectangle(b.x+1, b.y+1, valAsPct, b.height-2);
bar.rectangle(b.x+valAsPct, b.y+1, 2, b.height-2);
Besides this I also made a bool indicating the filled state, or the non-filled state, what you’re looking for.
this type of sliders looks more appropriate for a bipolar stuff, thanks for reply…
now all I got to do is figure out how to make a slider for a pitch that increment by semitones
, I tried to do some thing like this
vco1Out = vco1.saw(440 + (pitch * 2) * log2 (8.1757989156f * 12)); // using maxim addon, and the pitch is a intSlider that go's from -24 to 24
but that is way out of tune, it starts A = 220 and not 440 for some reason, and it also not stay in tune after moving up or down an half octave or so, can someone please show my how to accomplish this?
I tried this, and got some familiar looking frequencies / ratios.
int base = 440; for(char i=0; i<12; i++) cout << base * pow(2, i/12.f) << endl;
thanks that is one step further for me
Weird… corrected it to <
vco1Out = vco1.saw(a * pow(2, pitch / 24.f)) * amplitude;
a = 440
pitch is intSlider that go’s -24/+24
and the tuner is happy than I am happy.
now it works and make sense as well…thanks again Jildert!!