Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onUserSoundSample bug at 127 seconds after start #69

Open
djm1176 opened this issue May 13, 2022 · 2 comments
Open

onUserSoundSample bug at 127 seconds after start #69

djm1176 opened this issue May 13, 2022 · 2 comments

Comments

@djm1176
Copy link

djm1176 commented May 13, 2022

On Windows 10 x64, I've been getting a bug where the frequency passed from onUserSoundSample is a lower frequency I expect.
In order to reproduce this, the following should create a constant, 440hz sine wave for the first 127 seconds from the start. Afterwards, the pitch should lower:

virtual float onUserSoundSample(int nChannel, float fGlobalTime, float fTimeStep) {
    return sinf(440.0f * 2.0f * 3.14159f * fGlobalTime);
}
@djm1176
Copy link
Author

djm1176 commented May 13, 2022

I've noticed that m_fGlobalTime updates slower after 128 seconds as well. The issue is somewhere within the audio thread.

@OneLoneCoder
Copy link
Owner

Yes! This is a good one! It's a floating point number limitation. Either quick fix by moving to doubles, or you'll need to move to an integer/float hybrid for long term time accumulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants