Yeah, but the library floor is slow (or used to be) and I usually replace it with a faster version inside tight loops. I should retest this to see if it's still the case.antto wrote:floor ;]
...
omega = freq / sampling_rate; // erm, this is always done via reciprocal, no division here
phase = phase + omega;
phase -= floor(phase); // keeps it in the range 0..1.0
You can be sure you're not making a call to a function if you do this instead:
Code: Select all
phase += omega;
phase -= phase >= 1.0f;