Change scaling of knob during runtime?

Hey :slight_smile:

Hope you are having a great day!

I would like to build a module, with knobs, that has more than one function. I can do that, no problem, but I’d like to be able to change the actual scaling of the knobs. So for one setting it has a scaling 0-10 and for other setting it has scaling 0-45, for example, so the knob display value shows correct scaling for this specific setting.

I know it has something to do with ParamQuantize, which I have looked at, but not sure where to start.

Can i actually change this at “runtime”?

Can anyone refer to an example in the library that does this?

Thanks in advance, Jakob

paramquantities[YOUR_PARAM]->setMax, setMin and the like, maybe?

Check “Quantity.hpp”.

Thanks, I will try that :slight_smile:

I think I probably overcomplicated it a bit. I did not think I could configure the parameters in process struct, but I could. It just needs ot be set only once, when changing from one range to another, or else Rack will crash.

Anyway this worked:

if(TestButton == 0 && TestButtonNtrig){
				configParam(TEST_PARAM, 0.f, 10000.f, 0.f, "1") ->snapEnabled = true;
				TestButtonNtrig = 0;
				}
				else if(TestButton == 1 && TestButtonNtrig == 0){
				configParam(TEST_PARAM, 0.f, 1000.f, 0.f, "2") ->snapEnabled = true;
				TestButtonNtrig = 1;
				}

Thanks for the tip, you got me in the right direction :wink:

1 Like

well, since you can interpret the knob any way that you like, what does it matter? Make them both go from 0…1 and interpret them how you please.

One parameter setting is probability that goes from 0-100. Very basic.

Another one is conditional triggers, which looks like this:

configSwitch(ROW1_PARAM + i, 0.f, 70.f , 0.f  , "Conditional", {
						"1. 1/1", "2. 1/2", "3. 2/2", "4. 1/3", "5. 2/3", "6. 3/3", "7. 1/4", "8. 2/4", "9. 3/4", "10. 4/4", "11. 1/5", "12. 2/5", "13. 3/5", "14. 4/5", "15. 5/5", "16. 1/6", "17. 2/6", "18. 3/6", "19. 4/6", "20. 5/6", "21. 6/6", "22 1/7", "23. 2/7", "24. 3/7", "25. 4/7", "26. 5/7", "27. 6/7", "28. 7/7", "29. 1/8", "30. 2/8", "31. 3/8", "32. 4/8", "33. 5/8", "34. 6/8", "35. 7/8", "36. 8/8",
						"37. NOT 1/2", "38. NOT 2/2", "39. NOT 1/3", "40. NOT 2/3", "41. NOT 3/3", "42. NOT 1/4", "43. NOT 2/4", "44. NOT 3/4", "45. NOT 4/4", "46. NOT 1/5", "47. NOT 2/5", "48. NOT 3/5", "49. NOT 4/5", "50. NOT 5/5", "51. NOT 1/6", "52. NOT 2/6", "53. NOT 3/6", "54. NOT 4/6", "55. NOT 5/6", "56. NOT 6/6", "57 NOT 1/7", "58. NOT 2/7", "59. NOT 3/7", "60. NOT 4/7", "61. NOT 5/7", "62. NOT 6/7", "63. NOT 7/7", "64. NOT 1/8", "65. NOT 2/8", "66. NOT 3/8", "67. NOT 4/8", "68. NOT 5/8", "69. NOT 6/8", "70. NOT 7/8", "71. NOT 8/8" }) ->snapEnabled = true;

Another one is retrigger, which looks like this:

	configSwitch(ROW1_PARAM + i, 0.f, 73.f , 0.f  , " Retrigger Speed Step %d ", {"0. Off" , "1. 1/4th", "2. 1/8th", "3. 1/16" , "4. 32th", "5. 64th", "6. 128th", "7. 256th", "8. 512th", "9. 1/4th + Random 2", "10. 1/4th + Random 3", "11. 1/4th + Random 4", "12. 1/4th + Random 5", "13. 1/4th + Random 6", "14. 1/4th + Random 7", "15. 1/4th + Random 8", "16. 1/8th + Random 2", "17. 1/8th + Random 3", "18. 1/8th + Random 4", "19. 1/8th + Random 5", "20. 1/8th + Random 6", "21. 1/8th + Random 7", "22. 1/16th + Random 2", "23. 1/16th + Random 3", "24. 1/16th + Random 4", "25. 1/16th + Random 5", "26. 1/16th + Random 6", "27. 1/32th + Random 2", "28. 1/32th + Random 3", "29. 1/32th + Random 4", "30. 1/32th + Random 5", "31. 1/64th + Random 2", "32. 1/64th + Random 3", "33. 1/64th + Random 4", "34. 1/128th + Random 2", "35. 1/128th + Random 3", "36. 1/256th + Random 2",
						"37. Off","38. 1/4th", "39. 1/8th", "40. 1/16" , "41. 32th", "42. 64th", "43. 128th", "44. 256th", "45. 512th", "46. 1/4th + Random 2", "47. 1/4th + Random 3", "48. 1/4th + Random 4", "49. 1/4th + Random 5", "50. 1/4th + Random 6", "51. 1/4th + Random 7", "52. 1/4th + Random 8", "53. 1/8th + Random 2", "54. 1/8th + Random 3", "55. 1/8th + Random 4", "56. 1/8th + Random 5", "57. 1/8th + Random 6", "58. 1/8th + Random 7", "59. 1/16th + Random 2", "60. 1/16th + Random 3", "61. 1/16th + Random 4", "62. 1/16th + Random 5", "63. 1/16th + Random 6", "64. 1/32th + Random 2", "65. 1/32th + Random 3", "66. 1/32th + Random 4", "67. 1/32th + Random 5", "68. 1/64th + Random 2", "69. 1/64th + Random 3", "70. 1/64th + Random 4", "71. 1/128th + Random 2", "72. 1/128th + Random 3", "73. 1/256th + Random 2"});				

In this case, being able to see and set exact numbers are really important, cause they are very different.

That wont work super well with a parameter going form 0-1.

But yeah, in some cases it will probably be fine :slight_smile:

that param can go from x to y, no one but you will know. You can add a custom param quantity, it’s completely documented. Then you provide the float → string conversion yourself. Don’t get hung up on “helpers” like configSwitch. Unless it help you, of course.

VCV isn’t magic. You can do anything that it does. You just have to write a line or two of code, just like VCV does…

I am not 100% sure how to do that. We are not all programmers by trade, so something that for you seems like a tiny thing to do, can be a huge thing for others.

All the structural stuff, like this, is what I find hard, cause I never really had to deal with that stuff before. Doing the algos, I am completely fine with, but stuff like this takes a while to understand.

Anyway I got it working and I don’t see any issues, so I don’t think I’ll change it. I like it :wink:

1 Like

You could also provide 2 knobs at the same position (x/y coordinates) and make only one visible at a time. I’ve never tried that but I think it’s worth thinking about it.

I am also doing something similar to that already. No the exact same, but similar

I have a button on top of my knob, to create a kind multi task parameter, so there is both a knob and a button in the same place, like this:

Screenshot 2024-06-08 at 11.19.30

… Yes, I am going to change the colour of that button later… :wink:

The first sequencer I’ve been working on, is almost done, just need to do a bit of “cleaning”:

And then the second one, which I am working on now, which is using the several different ranges pr knob. This is still work in progress, on the UI side:

1 Like

yes, some of my modules also have buttons on top of knobs :+1:

1 Like

It’s a nice solution, with “push/pull” pots in situations where you have many params and trying to limiting space.

The hot area of a button is always the bounding rectangle. This is also true for round buttons. So if you put a round button on top of a knob, don’t forget to overwrite onHover() and onButton() to change the hot area to a circle.

Yeah I must admit, it can be a bit hard sometimes to get the right param, then button or the knob, especially when using the trimpot.

Definitely not perfect what I have here and definitely not the final solution, but it does the job. I just needed to have something working, so I can go on with the rest of the module, which still needs a bit of work.

I will look into that and try to understand what’s going on in that code, thanks :slight_smile:

It’s the same code as in the code for the knob (and the comment says it all)