25bd5d8adb
subrepo: subdir: "deps/juce" merged: "b13f9084e" upstream: origin: "https://github.com/essej/JUCE.git" branch: "sono6good" commit: "b13f9084e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
//
|
|
// MacSpecific.m
|
|
// AudioPluginHost - App
|
|
//
|
|
// Created by Jesse Chappell on 1/6/22.
|
|
// Copyright © 2022 Raw Material Software Limited. All rights reserved.
|
|
//
|
|
|
|
#include <juce_core/system/juce_TargetPlatform.h>
|
|
|
|
#if JUCE_MAC
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
void disableAppNap() {
|
|
// Does the App Nap API even exist on this Mac?
|
|
if ([[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions:reason:)]) {
|
|
// If the API exists, then disable App Nap...
|
|
|
|
// From NSProcessInfo.h:
|
|
// NSActivityIdleSystemSleepDisabled = (1ULL << 20),
|
|
// NSActivityUserInitiated = (0x00FFFFFFULL | NSActivityIdleSystemSleepDisabled),
|
|
// NSActivityLatencyCritical = 0xFF00000000ULL
|
|
|
|
uint64_t options = (0x00FFFFFFULL | (1ULL << 20)) | 0xFF00000000ULL;
|
|
|
|
// NSActivityLatencyCritical | NSActivityUserInitiated
|
|
[[NSProcessInfo processInfo] beginActivityWithOptions:options
|
|
reason:@"avoiding audio hiccups and reducing latency"];
|
|
}
|
|
}
|
|
|
|
#endif
|