2022-04-02 16:45:02 +00:00
|
|
|
// SPDX-License-Identifier: GPLv3-or-later WITH Appstore-exception
|
|
|
|
// Copyright (C) 2020 Jesse Chappell
|
|
|
|
|
|
|
|
|
|
|
|
#include "CrossPlatformUtils.h"
|
|
|
|
|
|
|
|
//#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
|
|
|
|
#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 1
|
|
|
|
|
|
|
|
#include <juce_core/system/juce_TargetPlatform.h>
|
|
|
|
|
|
|
|
|
|
|
|
#if JUCE_MAC
|
|
|
|
|
|
|
|
|
|
|
|
//#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
|
2022-04-11 17:23:10 +00:00
|
|
|
void getSafeAreaInsets(void * component, float & top, float & bottom, float & left, float & right, int & notchPos)
|
2022-04-02 16:45:02 +00:00
|
|
|
{
|
|
|
|
top = bottom = left = right = 0;
|
2022-04-11 17:23:10 +00:00
|
|
|
notchPos = 0;
|
2022-04-02 16:45:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|