1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Tweak for mac initialisation in plugins.

This commit is contained in:
Julian Storer 2011-06-28 20:37:07 +01:00
parent 640ad3ac7b
commit 7c1bfffe0b
7 changed files with 69 additions and 39 deletions

View file

@ -103,39 +103,43 @@ private:
//==============================================================================
// this little function just demonstrates a few system info calls
static const String collectSomeSystemInfo()
static String collectSomeSystemInfo()
{
String systemInfo;
systemInfo
<< "Time and date: " << Time::getCurrentTime().toString (true, true)
<< "\nUser logon name: " << SystemStats::getLogonName()
<< "\nFull user name: " << SystemStats::getFullUserName()
<< "\nHost name: " << SystemStats::getComputerName()
<< "\nOperating system: " << SystemStats::getOperatingSystemName()
<< "\nCPU vendor: " << SystemStats::getCpuVendor()
<< "\nCPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz"
<< "\nNumber of CPUs: " << SystemStats::getNumCpus()
<< "\nCPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no")
<< "\nCPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no")
<< "\nCPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no")
<< "\nCPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no")
<< "\nMemory size: " << SystemStats::getMemorySizeInMegabytes() << "MB"
<< "\nFound network card MAC addresses: " << getMacAddressList()
<< "\nCurrent executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName()
<< "\nCurrent application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName()
<< "\nCurrent working directory: " << File::getCurrentWorkingDirectory().getFullPathName()
<< "\nUser home directory: " << File::getSpecialLocation (File::userHomeDirectory).getFullPathName()
<< "\nUser documents directory: " << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName()
<< "\nUser application data directory: " << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName()
<< "\nCommon application data directory: " << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName()
<< "\nTemp directory: " << File::getSpecialLocation (File::tempDirectory).getFullPathName()
<< "\n\n";
<< "Time and date: " << Time::getCurrentTime().toString (true, true) << newLine
<< "User logon name: " << SystemStats::getLogonName() << newLine
<< "Full user name: " << SystemStats::getFullUserName() << newLine
<< "Host name: " << SystemStats::getComputerName() << newLine
<< "Operating system: " << SystemStats::getOperatingSystemName() << newLine
<< "Memory size: " << SystemStats::getMemorySizeInMegabytes() << "MB" << newLine
<< "Number of CPUs: " << SystemStats::getNumCpus() << newLine
<< "CPU vendor: " << SystemStats::getCpuVendor() << newLine
<< "CPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz" << newLine
<< "CPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no") << newLine
<< "CPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no") << newLine
<< "CPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") << newLine
<< "CPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") << newLine
<< "Found network card MAC addresses: " << getMacAddressList() << newLine
<< "Current working directory: " << File::getCurrentWorkingDirectory().getFullPathName() << newLine
<< "Current executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName() << newLine
<< "Current application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() << newLine
<< "User home directory: " << File::getSpecialLocation (File::userHomeDirectory).getFullPathName() << newLine
<< "User documents directory: " << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() << newLine
<< "User application data directory: " << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() << newLine
<< "Common application data directory: " << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() << newLine
<< "Temp directory: " << File::getSpecialLocation (File::tempDirectory).getFullPathName() << newLine
<< newLine;
return systemInfo;
}
static const String getMacAddressList()
static String getMacAddressList()
{
Array <MACAddress> macAddresses;
MACAddress::findAllAddresses (macAddresses);

View file

@ -19362,10 +19362,18 @@ int JUCEApplication::main (const String& commandLine)
extern const char* juce_Argv0;
#endif
#if JUCE_MAC
extern void initialiseNSApplication();
#endif
int JUCEApplication::main (int argc, const char* argv[])
{
JUCE_AUTORELEASEPOOL
#if JUCE_MAC
initialiseNSApplication();
#endif
#if ! JUCE_WINDOWS
jassert (createInstance != nullptr);
juce_Argv0 = argv[0];
@ -271164,13 +271172,10 @@ SystemStats::CPUFlags::CPUFlags()
}
#if JUCE_MAC
struct SharedAppInitialiser
struct RLimitInitialiser
{
SharedAppInitialiser()
RLimitInitialiser()
{
JUCE_AUTORELEASEPOOL
[NSApplication sharedApplication];
rlimit lim;
getrlimit (RLIMIT_NOFILE, &lim);
lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;
@ -271178,7 +271183,7 @@ struct SharedAppInitialiser
}
};
static SharedAppInitialiser sharedAppInitialiser;
static RLimitInitialiser rLimitInitialiser;
#endif
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
@ -285616,6 +285621,14 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
}
#endif
void initialiseNSApplication()
{
#if JUCE_MAC
JUCE_AUTORELEASEPOOL
[NSApplication sharedApplication];
#endif
}
void MessageManager::doPlatformSpecificInitialisation()
{
if (juceAppDelegate == nil)

View file

@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 5
#define JUCE_BUILDNUMBER 6
/** Current Juce version number.

View file

@ -256,10 +256,18 @@ int JUCEApplication::main (const String& commandLine)
extern const char* juce_Argv0;
#endif
#if JUCE_MAC
extern void initialiseNSApplication();
#endif
int JUCEApplication::main (int argc, const char* argv[])
{
JUCE_AUTORELEASEPOOL
#if JUCE_MAC
initialiseNSApplication();
#endif
#if ! JUCE_WINDOWS
jassert (createInstance != nullptr);
juce_Argv0 = argv[0];

View file

@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 5
#define JUCE_BUILDNUMBER 6
/** Current Juce version number.

View file

@ -445,6 +445,14 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
#endif
//==============================================================================
void initialiseNSApplication()
{
#if JUCE_MAC
JUCE_AUTORELEASEPOOL
[NSApplication sharedApplication];
#endif
}
void MessageManager::doPlatformSpecificInitialisation()
{
if (juceAppDelegate == nil)

View file

@ -74,13 +74,10 @@ SystemStats::CPUFlags::CPUFlags()
}
#if JUCE_MAC
struct SharedAppInitialiser
struct RLimitInitialiser
{
SharedAppInitialiser()
RLimitInitialiser()
{
JUCE_AUTORELEASEPOOL
[NSApplication sharedApplication];
rlimit lim;
getrlimit (RLIMIT_NOFILE, &lim);
lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;
@ -88,7 +85,7 @@ struct SharedAppInitialiser
}
};
static SharedAppInitialiser sharedAppInitialiser;
static RLimitInitialiser rLimitInitialiser;
#endif
//==============================================================================