Const/i for fractional?


#1

If I have settings that I don't need to change I usually use const/i instead of ctrl/dial because it saves me sram.

But what If I have real fractional value like 0,1234 whatever. Is there any object that let's me set these kind of values fixed? problem with ctrl/dial is that it also involve ui feedback, because the value of the dial needs to be sent back to the computer wich uses up more ram.


#2

you can do it in code like this. This is a math/*, where i modified inlet_b to be a fixed fractional value instead:

the fixed value here is 34.95

And how to se the fixed value, this is what I have added instead of inlet_b:
(int32_t)(34.95f * (1 << 21))


#3

Thanks but with my poor programming skills I could not really get this to work and it seems a bit inconvenient to have to enter this in code all the time.

Would it be possible to get it like this?

Attributes are fixed right? So they don't eat up extra ram.


#4

I havent used them like that but I dont see why not :slight_smile:

Anyway, I just put together a quick example where I implemented 4 fixed parameters into one object where you can set the delay times in the Krate code.

All you have to do is edit the 34.95 and change it to any fractional value you like.

BLIND2.axp (1.7 KB)


#5

Ok cool thanks again, I'll try this later!


#6

no, but they do eat up code memory ... but thats less than a parameter, and also allows the optimiser to 'do its things'