Page 1 of 1

Buffers

PostPosted: Tue Jan 12, 2016 1:33 pm
by Rocko
Hi all,

I'm trying to run a simple buffer, using arrays ('DSP code module'), without success.
It seems like a simple syntax issue... Could you help?
What am I doing wrong?

Code: Select all
monoin in;
monoout out;

float buffer[2];


out = buffer[0];

buffer[0] = buffer[1];

buffer[1] = in ;


Thanks

Re: Buffers

PostPosted: Tue Jan 12, 2016 11:15 pm
by martinvicanek
That's a limitation of FS's array implementation: you can't use different array elements in one equation. :-(
Your example would work with a termporary - uhm - buffer (temp variable):
Code: Select all
monoin in;
monoout out;

float buffer[2];
float temp;

out = buffer[0];
temp = buffer[1];
buffer[0] = temp;

buffer[1] = in ;

But that's of course kinda pointless. When using arrays, you do not want to move the data like in a fire brigade. Look inside the stock delay, there is a ring buffer.

Re: Buffers

PostPosted: Wed Jan 13, 2016 9:54 am
by Rocko
Thanks Martin - appreciated !!