bad values from xwax timecoder
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mixxx |
Fix Released
|
Low
|
Owen Williams |
Bug Description
What I thought would be a simple one-liner is causing problems. In xwax's timecoder.c, I want to normalize the timecode to represent milliseconds instead of "timecoder steps." Technically we lose precision with vinyl like traktor (since it's supposedly accurate to 1/2 millisecond) but it's much cleaner to problem for.
So I wrote this line (at the end of the file):
if (r >= 0) {
//normalize position to milliseconds, not timecode steps -- Owen
r = r * 1000 / (tc->def-
...
However I seem to suck at math, because every so often this will spit out a gigantic value -- originally because I did the math before I tested for r>=0, which (maybe?) caused unsigned integer math barf. But it's still capable of spitting out gigantic values, so there's still something wrong.
What's the right way to write this line so all the numbers behave? I'm thinking:
r = (float)r * (1000.0 / (tc->def-
(r is a signed int, resolution is an int, and speed is a double)
Changed in mixxx: | |
milestone: | none → 1.11.0 |
importance: | Undecided → Low |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
When the value goes gigantic -- what are the values of all the other variables? Can you log it or something?