Glitches in certain frequencies
I resolved my issue. The problem was with timing. My samples were rendered correctly, but the problem was with waiting for the buffer. I switched to event driven approach instead of manually calculating the buffer length and waiting, and the problem was resolved.

I don't know whether this question might be useful for someone. If not or if the source of the problem is not related to DSP, I will delete it. But for now I'm keeping it here with my answer.