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.

149 lines
5.5KB

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