On 16/03/16 13:37, Claude Heiland-Allen wrote:
On 16/03/16 13:25, i go bananas wrote:
pd using the same address for inlets and outlets as an
optimisation?
Yes, Pd recycles signal vectors so your output vector could be the same
as the input vector, which means this code is unsafe because it could
trash the inputs:
// loop through the 4 oscillators, adding the left to right:
for (int osc = 0; osc < 4; osc++)
{
int n = (int)(w[14]);
while (n--) *output[osc]++ = *left[osc]++ + *right[osc]++;
}
The easiest fix would be to reverse the order of the loops:
int n = (int)(w[14]);
while (n--)
{
for (int osc = 0; osc < 4; osc++)
*output[osc] = *left[osc] + *right[osc];
output++;
left++;
right++;
}
oops, this is wrong, I think
maybe *output[osc]++ = *left[osc]++ + *right[osc]++; would work in the
inner loop in fact, I'm just not sure of the order of the C operations
here...
Your alternative method of changing the iolet creation orders is not a
fix, it might "work" for one particular patch but another patch could
break it again.
Claude
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list