add code to disable AppNap on OS X/MacOS
Should build on versions before 10.9 and run everywhere due to respondsToSelector check.
This commit is contained in:
parent
adf290446f
commit
25ec63968c
@ -50,6 +50,7 @@ using namespace ARDOUR;
|
||||
using namespace std;
|
||||
|
||||
extern void set_language_preference (); // cocoacarbon.mm
|
||||
extern void no_app_nap (); // cocoacarbon.mm
|
||||
|
||||
static void
|
||||
setup_logging(void)
|
||||
@ -81,6 +82,10 @@ setup_logging(void)
|
||||
void
|
||||
fixup_bundle_environment (int argc, char* argv[], string & localedir)
|
||||
{
|
||||
/* do this even for non-bundle runtimes */
|
||||
|
||||
no_app_nap ();
|
||||
|
||||
if (!g_getenv ("ARDOUR_BUNDLED")) {
|
||||
return;
|
||||
}
|
||||
|
@ -106,3 +106,14 @@ set_language_preference ()
|
||||
setenv ("LANG", [nslocale UTF8String], 0);
|
||||
CFRelease (cflocale);
|
||||
}
|
||||
|
||||
/* Prevent "App Nap" */
|
||||
|
||||
void
|
||||
no_app_nap ()
|
||||
{
|
||||
if ( [ [ NSProcessInfo processInfo ] respondsToSelector:@selector(beginActivityWithOptions:reason:) ] ) {
|
||||
cout << "Disabling MacOS AppNap\n";
|
||||
[ [ NSProcessInfo processInfo] beginActivityWithOptions:NSActivityLatencyCritical reason:@"realtime audio" ];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user