Most efficient way to toggle parameters with integer for changing radio buttons?


#1

Having a lot of trouble finding anything relating to this on this forum, but I'm sure that it's been brought up several times with different wording.

I want to be able to toggle a parameter specifically for certain objects that have embedded radio buttons with no inlet, but can be controlled via Midi CC. If I wanted to control it with a knob, I just use a math/div object to divide a dial into the number of parameters desired into a midi/intern/cc. Cake. However knobs are a precious resource for me at the moment, so I would like to be able to toggle radio buttons embedded into a patch with a button. Pictured is the way that I'm currently doing it. Can anybody provide me with a more elegant solution than this? Thanks!


#2

If you don't want to modify the oscillator object, a simple change would be to replace the 4 dials and 4 math/div objects with a single custom object which supplies the 4 constants.

This is the K-rate code:
outlet_o1 = 0 << 16;
outlet_o2 = 17 << 16;
outlet_o3 = 39 << 16;
outlet_o4 = 63 << 16;

And, of course, you'd need to create 4 output objects: o1,o2,o3,o4, of type frac32.positive .


#3

Or you could take the output from the counter and multiply by a constant.

Are you looking for something that just uses existing objects so you don't need to write your own? Otherwise you could take the code for all the objects and roll it into a single object.


#4

I would go into adding inlets to the objects, then you can save aalllll that patching with the values and the midi etc and just hook up the counter to the object directly.
Here is a pretty good description on how that works: https://sebiik.github.io/community.axoloti.com.backup/t/hacking-objects-101-adding-modulation-inlets/2969