Forum

Why are floats always in [0..1]?

Hi,
when I connect a VVVV IOBox (Value Advanced) to my freeframe node, its value is always truncated to the range [0…1. Is that by design? It’s an annoying constraint…

citing from http://freeframe.sourceforge.net/spec.html
“FreeFrame parameter values are always 32-bit floats, and the range of values permitted is STRICTLY 0-1”

the plugins internally have to convert 0-1 to the range they need.

i know its annoying and maybe it could even be worked around…if there wasn’t this overall time constraint.

I’m sorry for wasting your time with my dumb questions… I didn’t see that “detail” in the spec :)
However, I need to pass a matrix which can have arbitrary values. Is it possible to pass these values as text so I could convert them internally? Passing text values is possible according to freeframe spec, but in SetParameterStruct of the FreeFrame.h file I found on the VVVV website there is only a float value in it (not a pointer). Is there anywhere an example project, which passes text, too?

hm…but doesn’t that just work if you use value-spreads (FF_TYPE_VALUESPREAD) of the extended freeframe spec as in/out parameters?

do you need to get the matrix in or out? or both? an iobox connected may first take the pins subtype which is 0/1 but still actually output the correct values?

concerning the string: that value is the address of a pointer to the actual 0-terminated string.

If I use FF_TYPE_VALUESPREAD, then the setInput method is called with a parameter of type InputStruct.

typedef struct InputStructTag {
DWORD Index;
DWORD SliceCount;
double* Spread;
} InputStruct;

I suppose the “Spread” values have to be in 0…1, too…? But my input matrix should have values in the range “-infinity … +infinity”. Maybe I understood something very basic wrong, but I thought, that passing these values is not possible because of the limited FreeFrame spec - and that’s why I wanted to pass them as text values. BTW: I just need the matrix as input and not as output.

concerning the string: that value is the address of a pointer to the actual 0-terminated string
What happens, if the value is of type FF_TYPE_STRINGESPREAD? setInput is called instead of setParameter, isn’t it? And its parameter is of type InputStruct which contains only a double array. I would have expected either a second setInput method with a different parameter type for text spreads, or at least a parameter for the one and only setInput method of type void* which I could cast into a char* OR double*…

  • I suppose the “Spread” values have to be in 0…1
    nono, i am quite certain those can be anything, don’t be confused by the subtype a connected iobox gets from the pin.

  • What happens, if the value is of type FF_TYPE_STRINGESPREAD? setInput is called instead of setParameter, isn’t it? And its parameter is of type InputStruct which contains only a double array
    it’s been a while since i did this. maybe you’re right it should have been of type void, i just modeled it after the original freeframe SetParameterStruct which only takes a float, which is in case of a string being transmitted the pointer to a 0-terminated string.

i am not sure if i’ve really ever tested this to work though…

You’re right - I AM confused by the subtype thing… So the parameter can have theoretically any value (not necessarily in 0…1), but because of the subtype of the freeframe pin it IS in the range 0…1 though…???

Can you give a concrete code example, how the spreaded string input could work for me? Let’s say setInput(InputStruct* pParam) is being called for my spreaded string input pin. Can you tell me how to retrieve the passed text out of the InputStruct parameter (see above for definition of InputStruct)?

  • So the parameter can have theoretically any value (not necessarily in 0…1), but because of the subtype of the freeframe pin it IS in the range 0…1 though
    isn’t it only that if you connect an iobox that it takes the subtype and therefore it seems as if values are constrained to 0-1, but actually you can still feed it any falue? if you want to get rid of the subtype place a dummy + node in between the iobox and the freeframe-pin.

please try this. i am quite positive it will work. and then you won’t need the string-pin, right? because i don’t have a codesample at hand…

Thanks, that helped a lot! I think I’ll connect the input matrix of my IOBox to a + node and this one to my freeframe input pin.