AndersMalmgren / FreePIE

Programmable Input Emulator
650 stars 144 forks source link

Timers - Subsecond resolution? #128

Open PWBENNETT opened 7 years ago

PWBENNETT commented 7 years ago

I have a situation where I want to briefly "tap" a button. In other words, setPressed(... True) when some event happens, record the T = time when it was pushed, let the event loop run a few milliseconds or so, and as soon as time > T + some_value, then I know it's safe to setPressed(... False). What's the best hi-res timer to access within IronPython?

zelmon64 commented 7 years ago

@PWBENNETT how quick a tap do you want? Here's some information on the timing. Here's an example. If you use setPressed(key) without a boolean it sends a brief tap.

PWBENNETT commented 7 years ago

I'm using vJoy.setPressed() at the moment, around line 33 of this:

https://gist.github.com/PWBENNETT/8f2c44f8b17d24fee7094459b5ec89b8

However, I found out this evening when I went to resume debugging it that none of my vJoy devices work at all. No errors, and reading the MIDI devices goes fine, but none of the vJoy axes or buttons are being changed when I slide sliders and twist knobs.

PWBENNETT commented 7 years ago

For now, I'm reinstalling vJoy itself, but the installer isn't finishing (yet), even though it's been several minutes at 99% or 100% (it's hard to tell from the bar graph).

PWBENNETT commented 7 years ago

Yeah, it seems that midi[n].update() on this type of control (like a jog wheel) leaves the buffer data with a control value of either 63 (turn -ve) or 65 (turn +ve), never returning it to "no update" / "not moving". This seems to be inherent in MIDI itself, since I've seen it with other software on other OSes. I'm guessing (on the fly) that my devices are maybe waiting for some kind of ACK in response before de-signalling its state. I will continue to research.