This is probably a really stupid question, but I have a question about the code in the ‘User Created Sound’ example.
How do I read the condition part of the FOR loop in the pcmreadcallback().
for (count=0; count<datalen>>2; count++) // >>2 = 16bit stereo (4 bytes per sample)
*stereo16bitbuffer++ = (signed short)(sin(t1) * 32767.0f); // left channel
*stereo16bitbuffer++ = (signed short)(sin(t2) * 32767.0f); // right channel
t1 += 0.01f + v1; t2 += 0.0142f + v2; v1 += (float)(sin(t1) * 0.002f); v2 += (float)(sin(t2) * 0.002f); }
Is it count need to be less then the datalen bit-shifted right 2? I guess, I am trying to figure out where datalen comes from, and how shifting 2 equates to 2 channels [other then the obvious reasons].
Just a little confused.
Thanks in advance.
- ForeverTangent asked 4 years ago
- You must login to post comments