DISTRHO Plugin Framework
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.

211 lines
6.4KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DISTRHO_PLUGIN_CHECKS_H_INCLUDED
  17. #define DISTRHO_PLUGIN_CHECKS_H_INCLUDED
  18. #ifndef DISTRHO_DETAILS_HPP_INCLUDED
  19. # error wrong include order
  20. #endif
  21. #include "DistrhoPluginInfo.h"
  22. // -----------------------------------------------------------------------
  23. // Check if all required macros are defined
  24. #ifndef DISTRHO_PLUGIN_NAME
  25. # error DISTRHO_PLUGIN_NAME undefined!
  26. #endif
  27. #ifndef DISTRHO_PLUGIN_NUM_INPUTS
  28. # error DISTRHO_PLUGIN_NUM_INPUTS undefined!
  29. #endif
  30. #ifndef DISTRHO_PLUGIN_NUM_OUTPUTS
  31. # error DISTRHO_PLUGIN_NUM_OUTPUTS undefined!
  32. #endif
  33. #ifndef DISTRHO_PLUGIN_URI
  34. # error DISTRHO_PLUGIN_URI undefined!
  35. #endif
  36. // -----------------------------------------------------------------------
  37. // Define optional macros if not done yet
  38. #ifndef DISTRHO_PLUGIN_HAS_UI
  39. # define DISTRHO_PLUGIN_HAS_UI 0
  40. #endif
  41. #ifndef DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  42. # define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0
  43. #endif
  44. #ifndef DISTRHO_PLUGIN_IS_RT_SAFE
  45. # define DISTRHO_PLUGIN_IS_RT_SAFE 0
  46. #endif
  47. #ifndef DISTRHO_PLUGIN_IS_SYNTH
  48. # define DISTRHO_PLUGIN_IS_SYNTH 0
  49. #endif
  50. #ifndef DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
  51. # define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
  52. #endif
  53. #ifndef DISTRHO_PLUGIN_WANT_LATENCY
  54. # define DISTRHO_PLUGIN_WANT_LATENCY 0
  55. #endif
  56. #ifndef DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
  57. # define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
  58. #endif
  59. #ifndef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
  60. # define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
  61. #endif
  62. #ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
  63. # define DISTRHO_PLUGIN_WANT_PROGRAMS 0
  64. #endif
  65. #ifndef DISTRHO_PLUGIN_WANT_STATE
  66. # define DISTRHO_PLUGIN_WANT_STATE 0
  67. #endif
  68. #ifndef DISTRHO_PLUGIN_WANT_FULL_STATE
  69. # define DISTRHO_PLUGIN_WANT_FULL_STATE 0
  70. # define DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET
  71. #endif
  72. #ifndef DISTRHO_PLUGIN_WANT_TIMEPOS
  73. # define DISTRHO_PLUGIN_WANT_TIMEPOS 0
  74. #endif
  75. #ifndef DISTRHO_UI_FILE_BROWSER
  76. # if defined(DGL_FILE_BROWSER_DISABLED) || DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  77. # define DISTRHO_UI_FILE_BROWSER 0
  78. # else
  79. # define DISTRHO_UI_FILE_BROWSER 1
  80. # endif
  81. #endif
  82. #ifndef DISTRHO_UI_USER_RESIZABLE
  83. # define DISTRHO_UI_USER_RESIZABLE 0
  84. #endif
  85. #ifndef DISTRHO_UI_USE_NANOVG
  86. # define DISTRHO_UI_USE_NANOVG 0
  87. #endif
  88. // -----------------------------------------------------------------------
  89. // Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed
  90. #ifndef DISTRHO_PLUGIN_HAS_EMBED_UI
  91. # if (defined(DGL_CAIRO) && defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && defined(HAVE_OPENGL))
  92. # define DISTRHO_PLUGIN_HAS_EMBED_UI 1
  93. # else
  94. # define DISTRHO_PLUGIN_HAS_EMBED_UI 0
  95. # endif
  96. #endif
  97. // -----------------------------------------------------------------------
  98. // Define DISTRHO_UI_URI if needed
  99. #ifndef DISTRHO_UI_URI
  100. # define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#DPF_UI"
  101. #endif
  102. // -----------------------------------------------------------------------
  103. // Test if synth has audio outputs
  104. #if DISTRHO_PLUGIN_IS_SYNTH && DISTRHO_PLUGIN_NUM_OUTPUTS == 0
  105. # error Synths need audio output to work!
  106. #endif
  107. // -----------------------------------------------------------------------
  108. // Enable MIDI input if synth, test if midi-input disabled when synth
  109. #ifndef DISTRHO_PLUGIN_WANT_MIDI_INPUT
  110. # define DISTRHO_PLUGIN_WANT_MIDI_INPUT DISTRHO_PLUGIN_IS_SYNTH
  111. #elif DISTRHO_PLUGIN_IS_SYNTH && ! DISTRHO_PLUGIN_WANT_MIDI_INPUT
  112. # error Synths need MIDI input to work!
  113. #endif
  114. // -----------------------------------------------------------------------
  115. // Enable state if plugin wants state files (deprecated)
  116. #ifdef DISTRHO_PLUGIN_WANT_STATEFILES
  117. # warning DISTRHO_PLUGIN_WANT_STATEFILES is deprecated
  118. # undef DISTRHO_PLUGIN_WANT_STATEFILES
  119. # if ! DISTRHO_PLUGIN_WANT_STATE
  120. # undef DISTRHO_PLUGIN_WANT_STATE
  121. # define DISTRHO_PLUGIN_WANT_STATE 1
  122. # endif
  123. #endif
  124. // -----------------------------------------------------------------------
  125. // Enable full state if plugin exports presets
  126. #if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE && defined(DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET)
  127. # warning Plugins with programs and state should implement full state API too
  128. # undef DISTRHO_PLUGIN_WANT_FULL_STATE
  129. # define DISTRHO_PLUGIN_WANT_FULL_STATE 1
  130. #endif
  131. // -----------------------------------------------------------------------
  132. // Disable file browser if using external UI
  133. #if DISTRHO_UI_FILE_BROWSER && DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  134. # warning file browser APIs do not work for external UIs
  135. # undef DISTRHO_UI_FILE_BROWSER 0
  136. # define DISTRHO_UI_FILE_BROWSER 0
  137. #endif
  138. // -----------------------------------------------------------------------
  139. // Disable UI if DGL or external UI is not available
  140. #if (defined(DGL_CAIRO) && ! defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && ! defined(HAVE_OPENGL))
  141. # undef DISTRHO_PLUGIN_HAS_EMBED_UI
  142. # define DISTRHO_PLUGIN_HAS_EMBED_UI 0
  143. #endif
  144. #if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  145. # undef DISTRHO_PLUGIN_HAS_UI
  146. # define DISTRHO_PLUGIN_HAS_UI 0
  147. #endif
  148. // -----------------------------------------------------------------------
  149. // Make sure both default width and height are provided
  150. #if defined(DISTRHO_UI_DEFAULT_WIDTH) && !defined(DISTRHO_UI_DEFAULT_HEIGHT)
  151. # error DISTRHO_UI_DEFAULT_WIDTH is defined but DISTRHO_UI_DEFAULT_HEIGHT is not
  152. #endif
  153. #if defined(DISTRHO_UI_DEFAULT_HEIGHT) && !defined(DISTRHO_UI_DEFAULT_WIDTH)
  154. # error DISTRHO_UI_DEFAULT_HEIGHT is defined but DISTRHO_UI_DEFAULT_WIDTH is not
  155. #endif
  156. // -----------------------------------------------------------------------
  157. // Prevent users from messing about with DPF internals
  158. #ifdef DISTRHO_UI_IS_STANDALONE
  159. # error DISTRHO_UI_IS_STANDALONE must not be defined
  160. #endif
  161. // -----------------------------------------------------------------------
  162. #endif // DISTRHO_PLUGIN_CHECKS_H_INCLUDED