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.

196 lines
5.9KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2022 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. #include "DistrhoPluginInfo.h"
  19. // -----------------------------------------------------------------------
  20. // Check if all required macros are defined
  21. #ifndef DISTRHO_PLUGIN_NAME
  22. # error DISTRHO_PLUGIN_NAME undefined!
  23. #endif
  24. #ifndef DISTRHO_PLUGIN_NUM_INPUTS
  25. # error DISTRHO_PLUGIN_NUM_INPUTS undefined!
  26. #endif
  27. #ifndef DISTRHO_PLUGIN_NUM_OUTPUTS
  28. # error DISTRHO_PLUGIN_NUM_OUTPUTS undefined!
  29. #endif
  30. #ifndef DISTRHO_PLUGIN_URI
  31. # error DISTRHO_PLUGIN_URI undefined!
  32. #endif
  33. // -----------------------------------------------------------------------
  34. // Define optional macros if not done yet
  35. #ifndef DISTRHO_PLUGIN_HAS_UI
  36. # define DISTRHO_PLUGIN_HAS_UI 0
  37. #endif
  38. #ifndef DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  39. # define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0
  40. #endif
  41. #ifndef DISTRHO_PLUGIN_IS_RT_SAFE
  42. # define DISTRHO_PLUGIN_IS_RT_SAFE 0
  43. #endif
  44. #ifndef DISTRHO_PLUGIN_IS_SYNTH
  45. # define DISTRHO_PLUGIN_IS_SYNTH 0
  46. #endif
  47. #ifndef DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
  48. # define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
  49. #endif
  50. #ifndef DISTRHO_PLUGIN_WANT_LATENCY
  51. # define DISTRHO_PLUGIN_WANT_LATENCY 0
  52. #endif
  53. #ifndef DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
  54. # define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
  55. #endif
  56. #ifndef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
  57. # define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
  58. #endif
  59. #ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
  60. # define DISTRHO_PLUGIN_WANT_PROGRAMS 0
  61. #endif
  62. #ifndef DISTRHO_PLUGIN_WANT_STATE
  63. # define DISTRHO_PLUGIN_WANT_STATE 0
  64. #endif
  65. #ifndef DISTRHO_PLUGIN_WANT_FULL_STATE
  66. # define DISTRHO_PLUGIN_WANT_FULL_STATE 0
  67. # define DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET
  68. #endif
  69. #ifndef DISTRHO_PLUGIN_WANT_TIMEPOS
  70. # define DISTRHO_PLUGIN_WANT_TIMEPOS 0
  71. #endif
  72. #ifndef DISTRHO_UI_FILE_BROWSER
  73. # if defined(DGL_FILE_BROWSER_DISABLED) || DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  74. # define DISTRHO_UI_FILE_BROWSER 0
  75. # else
  76. # define DISTRHO_UI_FILE_BROWSER 1
  77. # endif
  78. #endif
  79. #ifndef DISTRHO_UI_USER_RESIZABLE
  80. # define DISTRHO_UI_USER_RESIZABLE 0
  81. #endif
  82. #ifndef DISTRHO_UI_USE_NANOVG
  83. # define DISTRHO_UI_USE_NANOVG 0
  84. #endif
  85. // -----------------------------------------------------------------------
  86. // Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed
  87. #ifndef DISTRHO_PLUGIN_HAS_EMBED_UI
  88. # if (defined(DGL_CAIRO) && defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && defined(HAVE_OPENGL))
  89. # define DISTRHO_PLUGIN_HAS_EMBED_UI 1
  90. # else
  91. # define DISTRHO_PLUGIN_HAS_EMBED_UI 0
  92. # endif
  93. #endif
  94. // -----------------------------------------------------------------------
  95. // Define DISTRHO_UI_URI if needed
  96. #ifndef DISTRHO_UI_URI
  97. # define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#DPF_UI"
  98. #endif
  99. // -----------------------------------------------------------------------
  100. // Test if synth has audio outputs
  101. #if DISTRHO_PLUGIN_IS_SYNTH && DISTRHO_PLUGIN_NUM_OUTPUTS == 0
  102. # error Synths need audio output to work!
  103. #endif
  104. // -----------------------------------------------------------------------
  105. // Enable MIDI input if synth, test if midi-input disabled when synth
  106. #ifndef DISTRHO_PLUGIN_WANT_MIDI_INPUT
  107. # define DISTRHO_PLUGIN_WANT_MIDI_INPUT DISTRHO_PLUGIN_IS_SYNTH
  108. #elif DISTRHO_PLUGIN_IS_SYNTH && ! DISTRHO_PLUGIN_WANT_MIDI_INPUT
  109. # error Synths need MIDI input to work!
  110. #endif
  111. // -----------------------------------------------------------------------
  112. // Enable state if plugin wants state files (deprecated)
  113. #ifdef DISTRHO_PLUGIN_WANT_STATEFILES
  114. # warning DISTRHO_PLUGIN_WANT_STATEFILES is deprecated
  115. # undef DISTRHO_PLUGIN_WANT_STATEFILES
  116. # if ! DISTRHO_PLUGIN_WANT_STATE
  117. # undef DISTRHO_PLUGIN_WANT_STATE
  118. # define DISTRHO_PLUGIN_WANT_STATE 1
  119. # endif
  120. #endif
  121. // -----------------------------------------------------------------------
  122. // Enable full state if plugin exports presets
  123. #if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE && defined(DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET)
  124. # warning Plugins with programs and state should implement full state API too
  125. # undef DISTRHO_PLUGIN_WANT_FULL_STATE
  126. # define DISTRHO_PLUGIN_WANT_FULL_STATE 1
  127. #endif
  128. // -----------------------------------------------------------------------
  129. // Disable file browser if using external UI
  130. #if DISTRHO_UI_FILE_BROWSER && DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  131. # warning file browser APIs do not work for external UIs
  132. # undef DISTRHO_UI_FILE_BROWSER 0
  133. # define DISTRHO_UI_FILE_BROWSER 0
  134. #endif
  135. // -----------------------------------------------------------------------
  136. // Disable UI if DGL or external UI is not available
  137. #if (defined(DGL_CAIRO) && ! defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && ! defined(HAVE_OPENGL))
  138. # undef DISTRHO_PLUGIN_HAS_EMBED_UI
  139. # define DISTRHO_PLUGIN_HAS_EMBED_UI 0
  140. #endif
  141. #if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI
  142. # undef DISTRHO_PLUGIN_HAS_UI
  143. # define DISTRHO_PLUGIN_HAS_UI 0
  144. #endif
  145. // -----------------------------------------------------------------------
  146. // Prevent users from messing about with DPF internals
  147. #ifdef DISTRHO_UI_IS_STANDALONE
  148. # error DISTRHO_UI_IS_STANDALONE must not be defined
  149. #endif
  150. // -----------------------------------------------------------------------
  151. #endif // DISTRHO_PLUGIN_CHECKS_H_INCLUDED