Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
6.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. #ifndef JUCE_PROCESS_H_INCLUDED
  24. #define JUCE_PROCESS_H_INCLUDED
  25. //==============================================================================
  26. /** Represents the current executable's process.
  27. This contains methods for controlling the current application at the
  28. process-level.
  29. @see Thread, JUCEApplicationBase
  30. */
  31. class JUCE_API Process
  32. {
  33. public:
  34. //==============================================================================
  35. enum ProcessPriority
  36. {
  37. LowPriority = 0,
  38. NormalPriority = 1,
  39. HighPriority = 2,
  40. RealtimePriority = 3
  41. };
  42. /** Changes the current process's priority.
  43. @param priority the process priority, where
  44. 0=low, 1=normal, 2=high, 3=realtime
  45. */
  46. static void JUCE_CALLTYPE setPriority (const ProcessPriority priority);
  47. /** Kills the current process immediately.
  48. This is an emergency process terminator that kills the application
  49. immediately - it's intended only for use only when something goes
  50. horribly wrong.
  51. @see JUCEApplicationBase::quit
  52. */
  53. static void JUCE_CALLTYPE terminate();
  54. //==============================================================================
  55. /** Returns true if this application process is the one that the user is
  56. currently using.
  57. */
  58. static bool JUCE_CALLTYPE isForegroundProcess();
  59. /** Attempts to make the current process the active one.
  60. (This is not possible on some platforms).
  61. */
  62. static void JUCE_CALLTYPE makeForegroundProcess();
  63. /** Hides the application (on an OS that supports this, e.g. OSX) */
  64. static void JUCE_CALLTYPE hide();
  65. //==============================================================================
  66. /** Raises the current process's privilege level.
  67. Does nothing if this isn't supported by the current OS, or if process
  68. privilege level is fixed.
  69. */
  70. static void JUCE_CALLTYPE raisePrivilege();
  71. /** Lowers the current process's privilege level.
  72. Does nothing if this isn't supported by the current OS, or if process
  73. privilege level is fixed.
  74. */
  75. static void JUCE_CALLTYPE lowerPrivilege();
  76. //==============================================================================
  77. /** Returns true if this process is being hosted by a debugger. */
  78. static bool JUCE_CALLTYPE isRunningUnderDebugger() noexcept;
  79. //==============================================================================
  80. /** Tries to launch the OS's default reader application for a given file or URL. */
  81. static bool JUCE_CALLTYPE openDocument (const String& documentURL, const String& parameters);
  82. /** Tries to launch the OS's default email application to let the user create a message. */
  83. static bool JUCE_CALLTYPE openEmailWithAttachments (const String& targetEmailAddress,
  84. const String& emailSubject,
  85. const String& bodyText,
  86. const StringArray& filesToAttach);
  87. #ifdef CARLA_OS_WIN
  88. //==============================================================================
  89. /** WINDOWS ONLY - This returns the HINSTANCE of the current module.
  90. The return type is a void* to avoid being dependent on windows.h - just cast
  91. it to a HINSTANCE to use it.
  92. In a normal JUCE application, this will be automatically set to the module
  93. handle of the executable.
  94. If you've built a DLL and plan to use any JUCE messaging or windowing classes,
  95. you'll need to make sure you call the setCurrentModuleInstanceHandle()
  96. to provide the correct module handle in your DllMain() function, because
  97. the system relies on the correct instance handle when opening windows.
  98. */
  99. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() noexcept;
  100. /** WINDOWS ONLY - Sets a new module handle to be used by the library.
  101. The parameter type is a void* to avoid being dependent on windows.h, but it actually
  102. expects a HINSTANCE value.
  103. @see getCurrentModuleInstanceHandle()
  104. */
  105. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) noexcept;
  106. #endif
  107. #if JUCE_MAC || DOXYGEN
  108. //==============================================================================
  109. /** OSX ONLY - Shows or hides the OSX dock icon for this app. */
  110. static void setDockIconVisible (bool isVisible);
  111. #endif
  112. #if JUCE_MAC || JUCE_LINUX || DOXYGEN
  113. //==============================================================================
  114. /** UNIX ONLY - Attempts to use setrlimit to change the maximum number of file
  115. handles that the app can open. Pass 0 or less as the parameter to mean
  116. 'infinite'. Returns true if it succeeds.
  117. */
  118. static bool setMaxNumberOfFileHandles (int maxNumberOfFiles) noexcept;
  119. #endif
  120. private:
  121. Process();
  122. JUCE_DECLARE_NON_COPYABLE (Process)
  123. };
  124. #endif // JUCE_PROCESS_H_INCLUDED