File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 21
21
import queue
22
22
import requests
23
23
import threading
24
+ from ctypes import windll , c_int
24
25
from babble_model_loader import *
25
26
from camera_widget import CameraWidget
26
27
from config import BabbleConfig
34
35
from winotify import Notification
35
36
os .system ('color' ) # init ANSI color
36
37
38
+ winmm = None
39
+ try :
40
+ winmm = windll .winmm
41
+ except OSError :
42
+ #print("[DEBUG] Failed to load winmm.dll")
43
+ pass
44
+
37
45
# Random environment variable to speed up webcam opening on the MSMF backend.
38
46
# https://github.com/opencv/opencv/issues/17687
39
47
os .environ ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS" ] = "0"
51
59
page_url = "https://github.com/SummerSigh/ProjectBabble/releases/latest"
52
60
appversion = "Babble v2.0.6 Alpha"
53
61
62
+ def timerResolution (toggle ):
63
+ if winmm != None :
64
+ if toggle :
65
+ rc = c_int (winmm .timeBeginPeriod (1 ))
66
+ if rc .value != 0 :
67
+ # TIMEERR_NOCANDO = 97
68
+ print (f"[WARN] Failed to set timer resolution: { rc .value } " )
69
+ else :
70
+ winmm .timeEndPeriod (1 )
54
71
55
72
def main ():
56
73
# Get Configuration
@@ -95,6 +112,8 @@ def main():
95
112
print ("[INFO] Toast notifications not supported" )
96
113
except :
97
114
print ("[INFO] Internet connection failed, no update check occured." )
115
+
116
+ timerResolution (True )
98
117
# Check to see if we have an ROI. If not, bring up ROI finder GUI.
99
118
100
119
# Spawn worker threads
@@ -219,6 +238,7 @@ def main():
219
238
if ROSC :
220
239
osc_receiver .shutdown ()
221
240
osc_receiver_thread .join ()
241
+ timerResolution (False )
222
242
print ("\033 [94m[INFO] Exiting BabbleApp\033 [0m" )
223
243
return
224
244
You can’t perform that action at this time.
0 commit comments