Mouse polling rate?

Is there an easy way to speed up the mouse polling rate for a JUCE app? More precisely, since polling rate it the hardware term I guess, is there a way to get updates from the system more often?

I noticed that mouseDrag will only occur something like 10 times each second (on an iphone app … somewhat faster on the Desktop).

It looks like the MouseInputSource class just handles async updates from the system? Is there a way to query to system instead, or to ask the system to send updates more often?

Start a timer and use the getCursorPos function ?

On OSX there’s no way of reading the mouse pos - all it can give you is the position when the last mouse event arrived, so polling would actually give you much worse performance than doing it normally. It’s just not how OSes are designed these days - you get mouse events when the OS decides you should have them, but in my experience that’s pretty good.

The only thing I can think of that might slow down the rate at which the events arrive would be if you’re doing a lot of work in the event callbacks - that could make the OS think the app is busy, and throttle back the rate at which it sends the events?

Yeah, that is what I gathered after trying the getCurrentPos function 100 times a second and seeing the same event multiple times.

And your right Jules, on the callback slowing the system down (I have a rather hefty audio callback, which is higher priority than mouse movements of course … bah!). Works fast enough on the mac, but looks like it will need some serious optimizing for the iphone.

onward then …

s

I don’t really think the audio callback would make any difference to mouse events - I meant the event callbacks, which would obviously block the event thread, and could cause the OS to coalesce pending mouse events rather than posting them.

I wouldn’t be too surprised if the iphone just has a low mouse frequency, as it must have to do a hell of a lot of filtering to get a smooth position from the touch screen.

Hmmmm … There’s nothing done currently in the EventCallback.
But trimming the UI and audio callback’s definitely affects system MouseDrag event frequency (on iphone that is).

Got it up to more like 50/second.