update to support juce 6.1. added mute audio while processing capture option. added a mac specific priority fix. use async popup menus and browsers where needed.
This commit is contained in:
46
Source/CrossPlatformUtilsMac.mm
Normal file
46
Source/CrossPlatformUtilsMac.mm
Normal file
@ -0,0 +1,46 @@
|
||||
// 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>
|
||||
|
||||
|
||||
void getSafeAreaInsets(void * component, float & top, float & bottom, float & left, float & right)
|
||||
{
|
||||
top = bottom = left = right = 0;
|
||||
}
|
||||
|
||||
|
||||
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
|
Reference in New Issue
Block a user