These are chat archives for highfidelity/hifi

17th
Feb 2017
Ryan Huffman
@huffman
Feb 17 2017 16:37
@TopRamenGod Still need help? I can help if needed
Michael Varner
@TopRamenGod
Feb 17 2017 19:13
@huffman well, my issue now is a fundamental JS issue. The problem is that I need a reliable beat interval, and the built-in timers are obviously no good for that.
Ryan Huffman
@huffman
Feb 17 2017 19:14
What interval are you using?
how many ms?
Michael Varner
@TopRamenGod
Feb 17 2017 19:14
I've seen some self-correcting algorithms that use two dates, measure the difference, and then use it to self-correct. I was going to attempt a solution in that vein today.
120 bpm or 500 ms
And then a window on that of 250 for hit detection
Ryan Huffman
@huffman
Feb 17 2017 19:16
how far off are the callbacks?
Michael Varner
@TopRamenGod
Feb 17 2017 19:17
The inconsistency is...highly inconsistent
Ryan Huffman
@huffman
Feb 17 2017 19:17
This is an implementation detail that shouldn't be relied on, but the script engine will use a precise timer for timeouts < 200ms. I would suggest trying that just to see if it makes a difference.
If it does, it's something that we will probably want to revisit
Michael Varner
@TopRamenGod
Feb 17 2017 19:18
So set my interval to < 200 ms to see if that helps?
Ryan Huffman
@huffman
Feb 17 2017 19:18
You can also change that threshold inside ScriptEngine.cpp
That would be easier if you already have a build ready
Line ~1140
Michael Varner
@TopRamenGod
Feb 17 2017 19:19
I have he project set up in vs
And ready to build if need be
Ryan Huffman
@huffman
Feb 17 2017 19:20
Cool, you could try bumping that number up
Michael Varner
@TopRamenGod
Feb 17 2017 19:21
I'm guessing this is a binding to a lower level timer that fires underneath this threshold?
Ryan Huffman
@huffman
Feb 17 2017 19:23
I'm not sure what Qt's actual implementation looks like, but you are probably right
Michael Varner
@TopRamenGod
Feb 17 2017 19:23
(I'm AFK ATM. About to get back to a machine)
Ryan Huffman
@huffman
Feb 17 2017 19:25

Ah, gotcha. Yeah, this is a QTimer setting. This is from the documentation, which answers your question:

On UNIX (including Linux, macOS, and iOS), Qt will keep millisecond accuracy for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up to 5% to align the timer with other timers that are expected to fire at or around the same time. The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups and power consumption.

On Windows, Qt will use Windows's Multimedia timer facility (if available) for Qt::PreciseTimer and normal Windows timers for Qt::CoarseTimer and Qt::VeryCoarseTimer.

On all platforms, the interval for Qt::VeryCoarseTimer is rounded to the nearest full second (e.g. an interval of 23500ms will be rounded to 24000ms, and 20300ms to 20000ms).

Michael Varner
@TopRamenGod
Feb 17 2017 19:26
Interesting how it recycles Windows' Multimedia timer...
Ryan Huffman
@huffman
Feb 17 2017 19:28
I'm not sure I follow
Michael Varner
@TopRamenGod
Feb 17 2017 19:28
"On Windows, Qt will use Windows's Multimedia timer facility (if available) for Qt::PreciseTimer and normal Windows timers for Qt::CoarseTimer and Qt::VeryCoarseTimer."
I guess 'utilizes' would be a better term than 'recycles'
Ryan Huffman
@huffman
Feb 17 2017 19:29
Oh, gotcha
Michael Varner
@TopRamenGod
Feb 17 2017 19:30
It just made me curious about another large multicomponent C++ framework I've worked on, Juce, and what it uses to base it's acccurate timers on
most likely the same thing
Michael Varner
@TopRamenGod
Feb 17 2017 19:56
Ah, the nice long runway that is building the HiFi project
Michael Varner
@TopRamenGod
Feb 17 2017 20:28
Is there some special consideration for building Sandbox? 'domain-server.exe' keeps wanting to be 'a bit' crashy
Ryan Huffman
@huffman
Feb 17 2017 21:15
I saw the same with my Debug domain-server build last night but I haven't looked into it. Release was fine.
is that what you are seeing?
Michael Varner
@TopRamenGod
Feb 17 2017 21:43
about to hop into the stress test, I'll be back after that