Assuming oSignal
is filled with complex numbers in such a way, that real and imaginary parts alternate, it might help to change
for(int y=0;y< 8191;y++)
to
for(int y=0;y< 8191;y+=2)
Edit: I didn't even notice that you're passing only 1024 samples. You must pass as many time-domain samples as there will be frequency-domain samples, in your case 4096.
Edit: One more thing: you're obviously trying to find the base frequency of something. Unless that something is a computer generated tone or a human whistle (both of which are very pure tones), you might be disappointed by the result. The simple method you posted barely works for flute.
Edit: For voice and guitar you're out of luck. I wrote a program some time ago that displays the frequency domain, try it out, you'll see the problem. There are also sources available, if you're interested.
Final edit: You might want to read the Wikipedia article on pitch detection. Concentrate on time-domain approaches.