Hello everybody!
This is my first post, hope it complies with the standards.
I'm working on locating the origin of the sound using libfreenect which is a library that enables communication between the Kinect and the computer. Have set it and its working perfectly, it streams the data on the following code:
Code:
if(num_samples < c->max_samples - c->current_idx) { memcpy(&(c->buffers[0][c->current_idx]), mic1, num_samples*sizeof(int32_t));
memcpy(&(c->buffers[1][c->current_idx]), mic2, num_samples*sizeof(int32_t));
memcpy(&(c->buffers[2][c->current_idx]), mic3, num_samples*sizeof(int32_t));
memcpy(&(c->buffers[3][c->current_idx]), mic4, num_samples*sizeof(int32_t));
} else {
int first = c->max_samples - c->current_idx;
int left = num_samples - first;
memcpy(&(c->buffers[0][c->current_idx]), mic1, first*sizeof(int32_t));
memcpy(&(c->buffers[1][c->current_idx]), mic2, first*sizeof(int32_t));
memcpy(&(c->buffers[2][c->current_idx]), mic3, first*sizeof(int32_t));
memcpy(&(c->buffers[3][c->current_idx]), mic4, first*sizeof(int32_t));
memcpy(c->buffers[0], &mic1[first], left*sizeof(int32_t));
memcpy(c->buffers[1], &mic2[first], left*sizeof(int32_t));
memcpy(c->buffers[2], &mic3[first], left*sizeof(int32_t));
memcpy(c->buffers[3], &mic4[first], left*sizeof(int32_t));
}
and I added the following to try to copy the data to two int arrays called xn and yn:
Code:
memcpy(&xn, mic1, first*sizeof(int32_t)); //Here I'll copy the samples from the two mics.
memcpy(&yn, mic4, first*sizeof(int32_t));
I attach the modified code below. What I'm trying to do after that is applying a crosscorrelation algorithm to calculate the Azimuth, I tried it with fake samples and it seemed to work fine but I'm stuck trying to apply it to the Kinect.
It compiles and shows no errors but once I execute it I get core dumped and sometimes even Kernel Panic (I'm working on Ubuntu 12.10 OS).
Thanks everybody for their attention!