jdxi_editor.utils.macos_activity

macOS: tell the system that the app is doing latency-critical work.

macOS throttles the timers of an app it thinks is idle (App Nap, timer coalescing): a timed wait ends late, by tens of milliseconds — notes of a MIDI file or a pattern off their beat, a reading’s timeouts reached early. While playing, the editor holds an NSProcessInfo activity “user initiated, latency critical”, as audio and MIDI applications do; Windows has timeBeginPeriod for the same purpose. Elsewhere, and if anything goes wrong, nothing happens.

Done through the Objective-C runtime with ctypes (no PyObjC needed). objc_msgSend is called with the exact prototype of each method: on Apple silicon it must not be called as a variadic function.

Attributes

USER_INITIATED

LATENCY_CRITICAL

OPTIONS

_runtime

Functions

_objc()

_send(restype, *argtypes)

objc_msgSend with this prototype: (receiver, selector, *argtypes) -> restype.

_sel(name)

begin(reason) → Optional[int]

Start the activity; its token (to give to end()), or None if not on macOS or not possible.

end(token) → None

End the activity begun with begin().

Module Contents

jdxi_editor.utils.macos_activity.USER_INITIATED = 16777215[source]
jdxi_editor.utils.macos_activity.LATENCY_CRITICAL = 1095216660480[source]
jdxi_editor.utils.macos_activity.OPTIONS = 1095233437695[source]
jdxi_editor.utils.macos_activity._runtime = None[source]
jdxi_editor.utils.macos_activity._objc()[source]
jdxi_editor.utils.macos_activity._send(restype, *argtypes)[source]

objc_msgSend with this prototype: (receiver, selector, *argtypes) -> restype.

jdxi_editor.utils.macos_activity._sel(name: str)[source]
jdxi_editor.utils.macos_activity.begin(reason: str) → int | None[source]

Start the activity; its token (to give to end()), or None if not on macOS or not possible.

jdxi_editor.utils.macos_activity.end(token: int | None) → None[source]

End the activity begun with begin().