-
Notifications
You must be signed in to change notification settings - Fork 32
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
Question about ticks calculation #552
Comments
@garydan42 as I'm not sure if this is net new code, or was lifted from the original WinMM port implementation. |
Good catch, should do the calculation without truncation. |
Can I submit a PR for this? If yes do you want a new function, a new macro, or just inplace fixes? (the truncation occurs in several lines) |
Happy to have a PR if you want to submit one. Create a macro and submit a PR. :) Thanks! |
Thanks PR ready! |
MIDI/src/api/Client/WinMM/MidiSrvPort.cpp
Line 357 in 7ca0062
this does an integer division (with truncation) and converts to double after that:
DWORD ticks = (DWORD) (((position - m_StartTime) / m_qpcFrequency) * 1000.0);
was this the intent (no truncation):
DWORD ticks = (DWORD) ((position - m_StartTime) * 1000.0 / m_qpcFrequency);
if not then why not skip converting to double (might be faster)
DWORD ticks = (DWORD) (((position - m_StartTime) / m_qpcFrequency) * 1000);
The text was updated successfully, but these errors were encountered: