Pitch fluctuates unexpectedly in simple sine function
You are using 32-bit floats, and not resetting the phase by subtracting 2 pi.  That means the phase will eventually climb up to where the sin() function's phase unwrapping algorithm doesn't have enough bits of quantization, or valid mantissa, left over afterward unwrapping.  

Add this:

if (phase &gt; M_PI) { phase -= 2.0 * M_PI; }


inside your loop somewhere.