Page 2 of 2

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 10:17 am
by k brown
The issue is with bitmap knobs, your example is a Vector knob, which I already said I know can do it. All the bitmap knobs I've encountered don't have those start angle/sweep angle floats inside, with the Rotate prim. But as I've said, I can get the bitmap knob limited to about a 90 degree angle of rotation, the issue is then the Steps don't work.

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 1:07 pm
by tektoog
hey,
Maybe it would be a solution to just browse the never-ending knob gallery there, and find the knob you're looking for?
https://www.g200kg.com/en/webknobman/gallery.php
Just another way of looking at the issue ;)

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 2:34 pm
by Spogg
The schematic contains 2 knobs, neither of which you will like, because one of them doesn’t notch visually and the other one I just made in JKnobman (but it does notch and needs no modification to the knob framework). They do both go through a 180 degree arc though, so that’s something anyway.

So have a look anyway and see if they spark ideas.

Cheers

Spogg

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 6:23 pm
by k brown
Thanks Spogg - yeah, the first example, the grey knob is a different spin on what I already tried - giving the Drag Y different values. But just as when I tried it, now the knob has no steps (and when Steps are turned on, the knob basically doesn't work).

Judging by your Knobman example, it appears the only way to get what I'm after is with a custom Knobman file that specifies the arc the knob will move through (or edit an existing file to do that).

I just find it hard to believe that there isn't a way to juggle the greens in the first (grey knob) example so that the Steps function will work.

I really want to do this with some beautiful knobs I found, and there's no chance of getting the Knobman files (if they were even made that way), in order to edit them.

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 7:24 pm
by k brown
OK - I figured it out. The hang-up was that after setting a narrower range than 0-1 for the Drag Y, the number of Steps has to be greater than the desired number, because it's now being divided.

In my case I set the Drag Y to 0.33 min / 0.8 max. I wanted 4 steps so I entered 8 Steps into the Properties box. Voila - 100 degree centered rotation, with 4 steps. All that was needed to make a selector was subtracting the new min value (0.857143) from the output, so it starts at zero, setting the knob's regular Min/Max range to 0-3 (as one would normally do in making a knob a 4-input selector) and multiplying the final out value by 3 so it gets to the end of a four-input selector.

I'm sure the maths could be refined, etc., but it works for my current need. I just stumbled on this by (barely) educated guesses - would be great if someone could actually work out the formula for predictably setting angle of rotation vs number of desired steps, because they each affect the other.

Now I just need to get the blood-stains out of the carpet! :cry: :)

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 11:10 pm
by tulamide
k brown wrote:OK - I figured it out. The hang-up was that after setting a narrower range than 0-1 for the Drag Y, the number of Steps has to be greater than the desired number, because it's now being divided.

In my case I set the Drag Y to 0.33 min / 0.8 max. I wanted 4 steps so I entered 8 Steps into the Properties box. Voila - 100 degree centered rotation, with 4 steps. All that was needed to make a selector was subtracting the new min value (0.857143) from the output, so it starts at zero, setting the knob's regular Min/Max range to 0-3 (as one would normally do in making a knob a 4-input selector) and multiplying the final out value by 3 so it gets to the end of a four-input selector.

I'm sure the maths could be refined, etc., but it works for my current need. I just stumbled on this by (barely) educated guesses - would be great if someone could actually work out the formula for predictably setting angle of rotation vs number of desired steps, because they each affect the other.

Now I just need to get the blood-stains out of the carpet! :cry: :)

While I still wonder, whx this was posted in "DSP", I want to congratulate you! I hope you discovered that math is actually not your enemy, but there to help you realise your dreams 8-)

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 11:16 pm
by k brown
Only code stuff here - I wasn't aware. Should have been General?

Re: Bitmap knob arc

PostPosted: Sun Jun 21, 2020 10:01 am
by tulamide
I can't help anyone with the drag prims, they always acted un-intuitive to me. But I can help with the math part, in case others struggle as well. It's not very difficult, but sometimes we don't see the forest for the trees, so here we go.

The secret to it is normalising and the number of frames in the bitmap strip. If you have a drag value ranging from 0 to 1, it represents the frames(single images of the strip) 1 to N, so that you would switch to a new frame every 1/N, until N/N. Since normalised ranges are zero-based, the range of frames is 1 + (0 to N-1)

Also note that there is no such thing as half an image, or a quarter of an image. There is only a whole image. In math this is the equivalent of an integer. No decimals. Only frame 2, not frame 2.315

Now while dragging, each time the distance 1/N is covered, a new frame is reached. So all you have to do is multiplying the drag prim's output by N-1, add 1 and round the value down.

Example:
N = 30, drag value = 0.435, floor(1 + 0.435 * 29) ^= floor(1 + 12.615) ^= floor(13.615) = 13
N = 30, drag value = 1, floor(1 + 1 * 29) ^= floor(1 + 29) ^= floor(30) = 30

Re: Bitmap knob arc

PostPosted: Sun Jun 21, 2020 2:02 pm
by k brown
Thanks for that - I hope it's helpful to others, but it's utterly opaque to me. :oops: