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.

152 lines
5.7KB

  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. namespace water {
  26. //==============================================================================
  27. /** Represents the current executable's process.
  28. This contains methods for controlling the current application at the
  29. process-level.
  30. @see Thread, JUCEApplicationBase
  31. */
  32. class Process
  33. {
  34. public:
  35. //==============================================================================
  36. enum ProcessPriority
  37. {
  38. LowPriority = 0,
  39. NormalPriority = 1,
  40. HighPriority = 2,
  41. RealtimePriority = 3
  42. };
  43. /** Changes the current process's priority.
  44. @param priority the process priority, where
  45. 0=low, 1=normal, 2=high, 3=realtime
  46. */
  47. static void setPriority (const ProcessPriority priority);
  48. /** Kills the current process immediately.
  49. This is an emergency process terminator that kills the application
  50. immediately - it's intended only for use only when something goes
  51. horribly wrong.
  52. @see JUCEApplicationBase::quit
  53. */
  54. static void terminate();
  55. //==============================================================================
  56. /** Returns true if this application process is the one that the user is
  57. currently using.
  58. */
  59. static bool isForegroundProcess();
  60. /** Attempts to make the current process the active one.
  61. (This is not possible on some platforms).
  62. */
  63. static void makeForegroundProcess();
  64. /** Hides the application (on an OS that supports this, e.g. OSX) */
  65. static void hide();
  66. //==============================================================================
  67. /** Raises the current process's privilege level.
  68. Does nothing if this isn't supported by the current OS, or if process
  69. privilege level is fixed.
  70. */
  71. static void raisePrivilege();
  72. /** Lowers the current process's privilege level.
  73. Does nothing if this isn't supported by the current OS, or if process
  74. privilege level is fixed.
  75. */
  76. static void lowerPrivilege();
  77. //==============================================================================
  78. /** Returns true if this process is being hosted by a debugger. */
  79. static bool isRunningUnderDebugger() noexcept;
  80. //==============================================================================
  81. /** Tries to launch the OS's default reader application for a given file or URL. */
  82. static bool openDocument (const String& documentURL, const String& parameters);
  83. /** Tries to launch the OS's default email application to let the user create a message. */
  84. static bool openEmailWithAttachments (const String& targetEmailAddress,
  85. const String& emailSubject,
  86. const String& bodyText,
  87. const StringArray& filesToAttach);
  88. #ifdef CARLA_OS_WIN
  89. //==============================================================================
  90. /** WINDOWS ONLY - This returns the HINSTANCE of the current module.
  91. The return type is a void* to avoid being dependent on windows.h - just cast
  92. it to a HINSTANCE to use it.
  93. In a normal JUCE application, this will be automatically set to the module
  94. handle of the executable.
  95. If you've built a DLL and plan to use any JUCE messaging or windowing classes,
  96. you'll need to make sure you call the setCurrentModuleInstanceHandle()
  97. to provide the correct module handle in your DllMain() function, because
  98. the system relies on the correct instance handle when opening windows.
  99. */
  100. static void* getCurrentModuleInstanceHandle() noexcept;
  101. /** WINDOWS ONLY - Sets a new module handle to be used by the library.
  102. The parameter type is a void* to avoid being dependent on windows.h, but it actually
  103. expects a HINSTANCE value.
  104. @see getCurrentModuleInstanceHandle()
  105. */
  106. static void setCurrentModuleInstanceHandle (void* newHandle) noexcept;
  107. #endif
  108. private:
  109. Process();
  110. JUCE_DECLARE_NON_COPYABLE (Process)
  111. };
  112. }
  113. #endif // JUCE_PROCESS_H_INCLUDED