[PD] convolution code error
barknech at ph-cip.uni-koeln.de
Wed Aug 21 09:14:45 CEST 2002
J. Scott Hildebrand hat gesagt: // J. Scott Hildebrand wrote:
> here is the code for my convolution project that i'm working on. i
> sent an earlier email to the pdlist, but i don't think it'll go through
> because it's over 2MB which includes a bin file.
I hope it didn't...
> anyway i found out where
> i'm getting the seg fault:
> for(set=0; set<=255; set++)
> aleftout[set]=(*in1++); /*brings in 256 samples from input*/
If *in1 and *in2 are smaller than 256 - they are "n" and thus usually
64 samples long - you're reading past the end of the list into
unchartered territory and that results in undefined behaviour ==
> what i think is happening is that aleftout and arightout are float
> arrays, and what i'm trying to pass into them are pointers to floats.
Pointers to floats and float arrays are practically the same. Instead
of your code snippet you could also write:
int set = n;
while (set--) // "while set not NULL and count it downwards"
(*aleftout++) = (*in1++);
arightout[set] = in2[set];
> everything in my code is happening in the while(n--) part of it,
If you just want to copy all elements of *in1 to *aleftout you maybe
don't need to do this in the (while n--) loop, because then you would
do the copying n-times. But maybe you want excactly this? I'm not
quite sure, if your algorithm needs this updating on each sample,
because I didn't understand it fully. Maybe you could just copy the
Frank Barknecht _ ______footils.org__
More information about the Pd-list