Codebox, can't copy values from a buffer to an array
Hi all,
I'm trying to copy some values retrieved from a buffer~ via function peek to a fixed size array in codebox. No matter the type of array (FixedSampleArray, FixedNumberArray, etc.), I get this message when compiling:
error:8050:50:assigning to 'RNBO::SampleValue' (aka 'double') from incompatible type 'array<RNBO::SampleValue, 2>' (aka 'array<double, 2>')
This also happen with FixedNumberArray, whose value , according to the RNBO reference guide, may change depending on the circumstances in which code is generated and used.
I thought FixedNumberArray would have been a good choice to work with audio sample values regardless of their format, though I can't make it work. Help?
Thanks in advance.
Hey Alessandro,
If you look at the documentation for peek: https://rnbo.cycling74.com/codebox/ref/peek
You'll notice that it returns 2 values. I believe there is some work to automatically select the first value if you do a simple assignment in this case, but that clearly isn't working right now you can solve your problem by adding a [0] after your peek() call to select the first item in the return.
Thanks Alex!
I hope they do some work on the codebox documentation...
so many of the functions don't have any reasonable description, of parameters or outputs.
generally the rnbo docs needs some work, alot of it is cut n' paste from max, without being updated to changes ... e.g. fft~ phase output talks about using index~ which does not exist in RNBO.
similarly the online help/reference, links to max/msp objects rather than rnbo versions. (if they even exist , see above !)